libs: move http.protocol.{date,mime,conditionals} to luci-lib-httpprotoutils
[project/luci.git] / applications / luci-app-dnscrypt-proxy / luasrc / model / cbi / dnscrypt-proxy / overview_tab.lua
index 999c81d..8f0e322 100644 (file)
@@ -4,7 +4,6 @@
 local fs        = require("nixio.fs")
 local uci       = require("luci.model.uci").cursor()
 local util      = require("luci.util")
-local date      = require("luci.http.protocol.date")
 local res_input = "/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv"
 local res_dir   = fs.dirname(res_input)
 local dump      = util.ubus("network.interface", "dump", {})
@@ -12,6 +11,11 @@ local plug_cnt  = tonumber(luci.sys.exec("env -i /usr/sbin/dnscrypt-proxy --vers
 local res_list  = {}
 local url       = "https://raw.githubusercontent.com/dyne/dnscrypt-proxy/master/dnscrypt-resolvers.csv"
 
+local _, date = pcall(require, "luci.http.date")
+if not date then
+       _, date = pcall(require, "luci.http.protocol.date")
+end
+
 if not fs.access(res_input) then
        if not fs.access("/lib/libustream-ssl.so") then
                m = SimpleForm("error", nil, translate("No default resolver list and no SSL support available.<br />")