radicale2.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. -- Licensed to the public under the Apache License 2.0.
  2. module("luci.controller.radicale2", package.seeall)
  3. function index()
  4. local page
  5. -- no config create an empty one
  6. if not nixio.fs.access("/etc/config/radicale2") then
  7. nxfs.writefile("/etc/config/radicale2", "")
  8. end
  9. page = entry({"admin", "services", "radicale2"}, alias("admin", "services", "radicale2", "server"), _("Radicale 2.x"))
  10. page.leaf = false
  11. page.acl_depends = { "luci-app-radicale2" }
  12. page = entry({"admin", "services", "radicale2", "server"}, cbi("radicale2/server"), _("Server Settings"))
  13. page.leaf = true
  14. page.order = 10
  15. page = entry({"admin", "services", "radicale2", "auth"}, cbi("radicale2/auth"), _("Authentication / Users"))
  16. page.leaf = true
  17. page.order = 20
  18. page = entry({"admin", "services", "radicale2", "storage"}, cbi("radicale2/storage"), _("Storage"))
  19. page.leaf = true
  20. page.order = 30
  21. page = entry({"admin", "services", "radicale2", "logging"}, cbi("radicale2/logging"), _("Logging"))
  22. page.leaf = true
  23. page.order = 40
  24. end
  25. function pymodexists(module)
  26. retfun = luci.util.execi('python3 -c \'import importlib.util as util;found_module = util.find_spec("' .. module .. '");print(found_module is not None);print("\\n")\'')
  27. retval = retfun() == "True"
  28. while retfun() do end
  29. return retval
  30. end