Skip to content

Commit 4db502d

Browse files
committed
rework ubus data pull
1 parent 32750f4 commit 4db502d

File tree

5 files changed

+43
-63
lines changed

5 files changed

+43
-63
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PKG_NAME:=luci-app-https-dns-proxy
77
PKG_LICENSE:=AGPL-3.0-or-later
88
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
99
PKG_VERSION:=2025.12.29
10-
PKG_RELEASE:=1
10+
PKG_RELEASE:=2
1111

1212
LUCI_TITLE:=DNS Over HTTPS Proxy Web UI
1313
LUCI_URL:=https://github.com/stangri/luci-app-https-dns-proxy/

htdocs/luci-static/resources/https-dns-proxy/status.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ const getProviders = rpc.declare({
7979
params: ["name"],
8080
});
8181

82-
const getRuntime = rpc.declare({
83-
object: "luci." + pkg.Name,
84-
method: "getRuntime",
85-
params: ["name"],
82+
const getServiceInfo = rpc.declare({
83+
object: "service",
84+
method: "list",
85+
params: ["name", "verbose"],
8686
});
8787

8888
const _setInitAction = rpc.declare({
@@ -138,10 +138,10 @@ var RPC = {
138138
}.bind(this)
139139
);
140140
},
141-
getRuntime: function (name) {
142-
getRuntime(name).then(
141+
getServiceInfo: function (name, verbose) {
142+
getServiceInfo(name, verbose).then(
143143
function (result) {
144-
this.emit("getRuntime", result);
144+
this.emit("getServiceInfo", result);
145145
}.bind(this)
146146
);
147147
},
@@ -159,7 +159,7 @@ var status = baseclass.extend({
159159
return Promise.all([
160160
L.resolveDefault(getInitStatus(pkg.Name), {}),
161161
L.resolveDefault(getProviders(pkg.Name), {}),
162-
L.resolveDefault(getRuntime(pkg.Name), {}),
162+
L.resolveDefault(getServiceInfo(pkg.Name, true), {}),
163163
]).then(function (data) {
164164
var text;
165165
var reply = {
@@ -170,9 +170,8 @@ var status = baseclass.extend({
170170
version: null,
171171
},
172172
providers: (data[1] && data[1][pkg.Name]) || [{ title: "empty" }],
173-
runtime: (data[2] && data[2][pkg.Name]) || {
174-
instances: null,
175-
triggers: [],
173+
ubus: (data[2] && data[2][pkg.Name]) || {
174+
instances: {},
176175
},
177176
};
178177
reply.providers.sort(function (a, b) {
@@ -220,7 +219,7 @@ var status = baseclass.extend({
220219
]);
221220

222221
var instancesDiv = [];
223-
if (reply.runtime.instances) {
222+
if (reply.ubus.instances && Object.keys(reply.ubus.instances).length > 0) {
224223
var instancesTitle = E(
225224
"label",
226225
{ class: "cbi-value-title" },
@@ -235,7 +234,7 @@ var status = baseclass.extend({
235234
var instancesDescr = E("div", { class: "cbi-value-description" }, "");
236235

237236
text = "";
238-
Object.values(reply.runtime.instances).forEach((element) => {
237+
Object.values(reply.ubus.instances).forEach((element) => {
239238
var resolver;
240239
var address;
241240
var port;
@@ -464,5 +463,5 @@ return L.Class.extend({
464463
getInitStatus: getInitStatus,
465464
getPlatformSupport: getPlatformSupport,
466465
getProviders: getProviders,
467-
getRuntime: getRuntime,
466+
getServiceInfo: getServiceInfo,
468467
});

po/templates/https-dns-proxy.pot

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
msgid ""
22
msgstr "Content-Type: text/plain; charset=UTF-8"
33

4-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:284
4+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:283
55
msgid "%s%s%s proxy at %s on port %s.%s"
66
msgstr ""
77

8-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:276
8+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:275
99
msgid "%s%s%s proxy on port %s.%s"
1010
msgstr ""
1111

@@ -205,11 +205,11 @@ msgstr ""
205205
msgid "Direct"
206206
msgstr ""
207207

208-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:408
208+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:407
209209
msgid "Disable"
210210
msgstr ""
211211

212-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:402
212+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:401
213213
msgid "Disabling %s service"
214214
msgstr ""
215215

@@ -225,11 +225,11 @@ msgstr ""
225225
msgid "DoH DNS (SB)"
226226
msgstr ""
227227

228-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:389
228+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:388
229229
msgid "Enable"
230230
msgstr ""
231231

232-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:383
232+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:382
233233
msgid "Enabling %s service"
234234
msgstr ""
235235

@@ -263,7 +263,7 @@ msgstr ""
263263
msgid "Force DNS Ports"
264264
msgstr ""
265265

266-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:197
266+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:196
267267
msgid "Force DNS ports:"
268268
msgstr ""
269269

@@ -326,7 +326,7 @@ msgstr ""
326326
msgid "HTTPS DNS Proxy - Instances"
327327
msgstr ""
328328

329-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:187
329+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:186
330330
msgid "HTTPS DNS Proxy - Status"
331331
msgstr ""
332332

@@ -461,7 +461,7 @@ msgstr ""
461461
msgid "Norway"
462462
msgstr ""
463463

464-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:213
464+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:212
465465
msgid "Not installed or not found"
466466
msgstr ""
467467

@@ -486,7 +486,7 @@ msgstr ""
486486
msgid "Parameter"
487487
msgstr ""
488488

489-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:295
489+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:294
490490
msgid "Please %sdonate%s to support development of this project."
491491
msgstr ""
492492

@@ -546,11 +546,11 @@ msgstr ""
546546
msgid "Quad 9"
547547
msgstr ""
548548

549-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:351
549+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:350
550550
msgid "Restart"
551551
msgstr ""
552552

553-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:345
553+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:344
554554
msgid "Restarting %s service"
555555
msgstr ""
556556

@@ -593,27 +593,27 @@ msgstr ""
593593
msgid "Security Filter"
594594
msgstr ""
595595

596-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:229
596+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:228
597597
msgid "See the %sREADME%s for details."
598598
msgstr ""
599599

600600
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js:103
601601
msgid "Select the DNSMASQ Configs to update"
602602
msgstr ""
603603

604-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:434
604+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:433
605605
msgid "Service Control"
606606
msgstr ""
607607

608-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:227
608+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:226
609609
msgid "Service Instances"
610610
msgstr ""
611611

612612
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/view/https-dns-proxy/overview.js:51
613613
msgid "Service Options"
614614
msgstr ""
615615

616-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:191
616+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:190
617617
msgid "Service Status"
618618
msgstr ""
619619

@@ -647,11 +647,11 @@ msgstr ""
647647
msgid "Standard"
648648
msgstr ""
649649

650-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:332
650+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:331
651651
msgid "Start"
652652
msgstr ""
653653

654-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:326
654+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:325
655655
msgid "Starting %s service"
656656
msgstr ""
657657

@@ -660,11 +660,11 @@ msgstr ""
660660
msgid "Statistic Interval"
661661
msgstr ""
662662

663-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:370
663+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:369
664664
msgid "Stop"
665665
msgstr ""
666666

667-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:364
667+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:363
668668
msgid "Stopping %s service"
669669
msgstr ""
670670

@@ -783,15 +783,15 @@ msgstr ""
783783
msgid "Variant"
784784
msgstr ""
785785

786-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:195
786+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:194
787787
msgid "Version %s - Running."
788788
msgstr ""
789789

790-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:207
790+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:206
791791
msgid "Version %s - Stopped (Disabled)."
792792
msgstr ""
793793

794-
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:205
794+
#: applications/luci-app-https-dns-proxy/htdocs/luci-static/resources/https-dns-proxy/status.js:204
795795
msgid "Version %s - Stopped."
796796
msgstr ""
797797

root/usr/libexec/rpcd/luci.https-dns-proxy

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ get_providers() {
112112
echo ']}'
113113
}
114114

115-
get_runtime() { ubus call service list "{ 'verbose': true, 'name': '$1' }"; }
116-
117115
set_init_action() {
118116
local name="$1" action="$2" cmd
119117
case $action in
@@ -143,9 +141,6 @@ case "$1" in
143141
json_add_object "getProviders"
144142
json_add_string 'name' "name"
145143
json_close_object
146-
json_add_object "getRuntime"
147-
json_add_string 'name' "name"
148-
json_close_object
149144
json_add_object "setInitAction"
150145
json_add_string 'name' "name"
151146
json_add_string 'action' "action"
@@ -183,13 +178,6 @@ case "$1" in
183178
json_cleanup
184179
get_providers "$name"
185180
;;
186-
getRuntime)
187-
read -r input
188-
json_load "$input"
189-
json_get_var name "name"
190-
json_cleanup
191-
get_runtime "$name"
192-
;;
193181
setInitAction)
194182
read -r input
195183
json_load "$input"

root/usr/share/rpcd/acl.d/luci-app-https-dns-proxy.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,16 @@
77
"getInitList",
88
"getInitStatus",
99
"getPlatformSupport",
10-
"getProviders",
11-
"getRuntime"
12-
]
10+
"getProviders"
11+
],
12+
"service": ["list"]
1313
},
14-
"uci": [
15-
"dhcp",
16-
"https-dns-proxy"
17-
]
14+
"uci": ["dhcp", "https-dns-proxy"]
1815
},
1916
"write": {
20-
"uci": [
21-
"https-dns-proxy"
22-
],
17+
"uci": ["https-dns-proxy"],
2318
"ubus": {
24-
"luci.https-dns-proxy": [
25-
"setInitAction"
26-
]
19+
"luci.https-dns-proxy": ["setInitAction"]
2720
}
2821
}
2922
}

0 commit comments

Comments
 (0)