Skip to content

Commit

Permalink
Merge pull request #7516 from stangri/master-luci-app-https-dns-proxy
Browse files Browse the repository at this point in the history
luci-app-https-dns-proxy: bugfixes and resolvers update
  • Loading branch information
stangri authored Dec 31, 2024
2 parents d9ce4fb + e1887f2 commit 37db0aa
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ var pkg = {
);
},
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("") +
"$"
);
if (template)
return new RegExp(
"^" +
template
.split(/(\{\w+\})/g)
.map((part) => {
let placeholder = part.match(/^\{(\w+)\}$/);
if (placeholder) return `(?<${placeholder[1]}>.*?)`;
else return part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
})
.join("") +
"$"
);
return new RegExp("");
},
templateToResolver: function (template, args) {
return template.replace(/{(\w+)}/g, (_, v) => args[v]);
if (template) return template.replace(/{(\w+)}/g, (_, v) => args[v]);
return null;
},
};

Expand Down Expand Up @@ -157,8 +160,11 @@ var status = baseclass.extend({
force_dns_active: null,
version: null,
},
providers: (data[1] && data[1][pkg.Name]) || { providers: [] },
runtime: (data[2] && data[2][pkg.Name]) || { instances: [] },
providers: (data[1] && data[1][pkg.Name]) || [{ title: "empty" }],
runtime: (data[2] && data[2][pkg.Name]) || {
instances: null,
triggers: [],
},
};
reply.providers.sort(function (a, b) {
return _(a.title).localeCompare(_(b.title));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ return view.extend({
http2_support: null,
http3_support: null,
},
providers: (data[1] && data[1][pkg.Name]) || { providers: [] },
providers: (data[1] && data[1][pkg.Name]) || [{ title: "empty" }],
};
reply.providers.sort(function (a, b) {
return _(a.title).localeCompare(_(b.title));
Expand Down Expand Up @@ -331,7 +331,7 @@ return view.extend({
o.optional = true;

o = s.option(form.Value, "listen_addr", _("Listen Address"));
o.datatype = "ipaddr";
o.datatype = "ipaddr('nomask')";
o.default = "";
o.optional = true;
o.placeholder = "127.0.0.1";
Expand All @@ -353,13 +353,13 @@ return view.extend({
o.optional = true;

o = s.option(form.Value, "dscp_codepoint", _("DSCP Codepoint"));
o.datatype = "and(uinteger, range(0,63))";
o.datatype = "range(0,63)";
o.default = "";
o.modalonly = true;
o.optional = true;

o = s.option(form.Value, "verbosity", _("Logging Verbosity"));
o.datatype = "and(uinteger, range(0,4))";
o.datatype = "range(0,4)";
o.default = "";
o.modalonly = true;
o.optional = true;
Expand All @@ -370,7 +370,7 @@ return view.extend({
o.optional = true;

o = s.option(form.Value, "polling_interval", _("Polling Interval"));
o.datatype = "and(uinteger, range(5,3600))";
o.datatype = "range(5,3600)";
o.default = "";
o.modalonly = true;
o.optional = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ return baseclass.extend({
force_dns_active: null,
version: null,
},
providers: (data[1] && data[1][pkg.Name]) || { providers: [] },
runtime: (data[2] && data[2][pkg.Name]) || { instances: [] },
providers: (data[1] && data[1][pkg.Name]) || [{ title: "empty" }],
runtime: (data[2] && data[2][pkg.Name]) || { instances: null, triggers: [] },
};
reply.providers.sort(function (a, b) {
return _(a.title).localeCompare(_(b.title));
Expand Down
Loading

0 comments on commit 37db0aa

Please sign in to comment.