diff options
Diffstat (limited to 'applications/luci-app-https-dns-proxy/htdocs')
3 files changed, 20 insertions, 78 deletions
diff --git a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js index 0ae128b923..37675c5b83 100644 --- a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js +++ b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js @@ -13,8 +13,16 @@ var pkg = { get Name() { return "https-dns-proxy"; }, + get ReadmeCompat() { + return ""; + }, get URL() { - return "https://docs.openwrt.melmac.net/" + pkg.Name + "/"; + return ( + "https://docs.openwrt.melmac.net/" + + pkg.Name + + "/" + + (pkg.ReadmeCompat ? pkg.ReadmeCompat + "/" : "") + ); }, templateToRegexp: function (template) { return RegExp( @@ -30,6 +38,9 @@ var pkg = { "$" ); }, + templateToResolver: function (template, args) { + return template.replace(/{(\w+)}/g, (_, v) => args[v]); + }, }; var getInitList = rpc.declare({ @@ -428,6 +439,8 @@ RPC.on("setInitAction", function (reply) { return L.Class.extend({ status: status, + pkg: pkg, + getInitStatus: getInitStatus, getPlatformSupport: getPlatformSupport, getProviders: getProviders, getRuntime: getRuntime, diff --git a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js index 86cafd1030..5922a35279 100644 --- a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js +++ b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js @@ -11,34 +11,7 @@ "require view"; "require https-dns-proxy.status as hdp"; -var pkg = { - get Name() { - return "https-dns-proxy"; - }, - - get URL() { - return "https://docs.openwrt.melmac.net/" + pkg.Name + "/"; - }, - - templateToRegexp: function (template) { - return RegExp( - "^" + - template - .split(/(\{\w+\})/g) - .map((part) => { - let placeholder = part.match(/^\{(\w+)\}$/); - if (placeholder) return `(?<${placeholder[1]}>.*?)`; - else return part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); - }) - .join("") + - "$" - ); - }, - - templateToResolver: function (template, args) { - return template.replace(/{(\w+)}/g, (_, v) => args[v]); - }, -}; +var pkg = hdp.pkg; return view.extend({ load: function () { diff --git a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/status/include/71_https-dns-proxy.js b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/status/include/71_https-dns-proxy.js index 8723b6e653..401e1546d1 100644 --- a/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/status/include/71_https-dns-proxy.js +++ b/applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/status/include/71_https-dns-proxy.js @@ -3,62 +3,18 @@ "require uci"; "require form"; "require baseclass"; +"require https-dns-proxy.status as hdp"; -var pkg = { - get Name() { - return "https-dns-proxy"; - }, - get URL() { - return "https://docs.openwrt.melmac.net/" + pkg.Name + "/"; - }, - templateToRegexp: function (template) { - return RegExp( - "^" + - template - .split(/(\{\w+\})/g) - .map((part) => { - let placeholder = part.match(/^\{(\w+)\}$/); - if (placeholder) return `(?<${placeholder[1]}>.*?)`; - else return part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); - }) - .join("") + - "$" - ); - }, -}; - -var getInitStatus = rpc.declare({ - object: "luci." + pkg.Name, - method: "getInitStatus", - params: ["name"], -}); - -var getPlatformSupport = rpc.declare({ - object: "luci." + pkg.Name, - method: "getPlatformSupport", - params: ["name"], -}); - -var getProviders = rpc.declare({ - object: "luci." + pkg.Name, - method: "getProviders", - params: ["name"], -}); - -var getRuntime = rpc.declare({ - object: "luci." + pkg.Name, - method: "getRuntime", - params: ["name"], -}); +var pkg = hdp.pkg; return baseclass.extend({ title: _("HTTPS DNS Proxy Instances"), load: function () { return Promise.all([ - getInitStatus(pkg.Name), - getProviders(pkg.Name), - getRuntime(pkg.Name), + hdp.getInitStatus(pkg.Name), + hdp.getProviders(pkg.Name), + hdp.getRuntime(pkg.Name), ]); }, |