radicale2.lua 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 = entry({"admin", "services", "radicale2", "server"}, cbi("radicale2/server"), _("Server Settings"))
  12. page.leaf = true
  13. page.order = 10
  14. page = entry({"admin", "services", "radicale2", "auth"}, cbi("radicale2/auth"), _("Authentication / Users"))
  15. page.leaf = true
  16. page.order = 20
  17. page = entry({"admin", "services", "radicale2", "storage"}, cbi("radicale2/storage"), _("Storage"))
  18. page.leaf = true
  19. page.order = 30
  20. page = entry({"admin", "services", "radicale2", "logging"}, cbi("radicale2/logging"), _("Logging"))
  21. page.leaf = true
  22. page.order = 40
  23. end
  24. function pymodexists(module)
  25. 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")\'')
  26. retval = retfun() == "True"
  27. while retfun() do end
  28. return retval
  29. end