From 442f9b3b63101f45e1eab1cb718da0e32ffca972 Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Sat, 18 Jan 2025 00:23:28 +0800 Subject: [PATCH] update 2025-01-18 00:23:28 --- luci-app-dnsproxy/Makefile | 2 +- .../luci-static/resources/view/dnsproxy.js | 38 +++++++++---------- luci-app-fchomo/Makefile | 2 +- .../resources/view/fchomo/client.js | 2 +- .../resources/view/fchomo/hosts.js | 4 +- .../luci-static/resources/view/fchomo/log.js | 4 +- .../resources/view/fchomo/ruleset.js | 2 +- .../resources/view/fchomo/server.js | 2 +- luci-app-tinyfilemanager/Makefile | 2 +- .../resources/view/tinyfilemanager/config.js | 22 +++++------ .../resources/view/tinyfilemanager/main.js | 4 +- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/luci-app-dnsproxy/Makefile b/luci-app-dnsproxy/Makefile index 0e10ad11a..97f72cdea 100644 --- a/luci-app-dnsproxy/Makefile +++ b/luci-app-dnsproxy/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # -# Copyright (C) 2023-2024 muink +# Copyright (C) 2023-2025 muink include $(TOPDIR)/rules.mk diff --git a/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js b/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js index abf24af68..5f4f5a3e7 100644 --- a/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js +++ b/luci-app-dnsproxy/htdocs/luci-static/resources/view/dnsproxy.js @@ -7,8 +7,8 @@ 'require view'; 'require tools.widgets as widgets'; -var conf = 'dnsproxy'; -var instance = 'dnsproxy'; +const conf = 'dnsproxy'; +const instance = 'dnsproxy'; const callServiceList = rpc.declare({ object: 'service', @@ -25,8 +25,8 @@ const callHostHints = rpc.declare({ function getServiceStatus() { return L.resolveDefault(callServiceList(conf), {}) - .then(function (res) { - var isrunning = false; + .then((res) => { + let isrunning = false; try { isrunning = res[conf]['instances'][instance]['running']; } catch (e) { } @@ -36,7 +36,7 @@ function getServiceStatus() { return view.extend({ - load: function() { + load() { return Promise.all([ getServiceStatus(), callHostHints(), @@ -44,9 +44,9 @@ return view.extend({ ]); }, - poll_status: function(nodes, stat) { - var isRunning = stat[0], - view = nodes.querySelector('#service_status'); + poll_status(nodes, stat) { + const isRunning = stat[0]; + let view = nodes.querySelector('#service_status'); if (isRunning) { view.innerHTML = "" + instance + " - " + _("SERVER RUNNING") + ""; @@ -56,9 +56,9 @@ return view.extend({ return; }, - render: function(res) { - var isRunning = res[0], - hosts = res[1]; + render(res) { + const isRunning = res[0]; + const hosts = res[1]; let m, s, o, ss, so; @@ -88,20 +88,20 @@ return view.extend({ o.value('127.0.0.1'); o.value('::1'); - var ipaddrs = {}, ip6addrs = {}; - Object.keys(hosts).forEach(function(mac) { - var addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4), - addrs6 = L.toArray(hosts[mac].ip6addrs || hosts[mac].ipv6); + let ipaddrs = {}, ip6addrs = {}; + Object.keys(hosts).forEach((mac) => { + let addrs = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4); + let addrs6 = L.toArray(hosts[mac].ip6addrs || hosts[mac].ipv6); - for (var i = 0; i < addrs.length; i++) + for (let i = 0; i < addrs.length; i++) ipaddrs[addrs[i]] = hosts[mac].name || mac; - for (var i = 0; i < addrs6.length; i++) + for (let i = 0; i < addrs6.length; i++) ip6addrs[addrs6[i]] = hosts[mac].name || mac; }); - L.sortedKeys(ipaddrs, null, 'addr').forEach(function(ipv4) { + L.sortedKeys(ipaddrs, null, 'addr').forEach((ipv4) => { o.value(ipv4, ipaddrs[ipv4] ? '%s (%s)'.format(ipv4, ipaddrs[ipv4]) : ipv4); }); - L.sortedKeys(ip6addrs, null, 'addr').forEach(function(ipv6) { + L.sortedKeys(ip6addrs, null, 'addr').forEach((ipv6) => { o.value(ipv6, ip6addrs[ipv6] ? '%s (%s)'.format(ipv6, ip6addrs[ipv6]) : ipv6); }); diff --git a/luci-app-fchomo/Makefile b/luci-app-fchomo/Makefile index e2e6d847d..ce00c01a9 100644 --- a/luci-app-fchomo/Makefile +++ b/luci-app-fchomo/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 # -# Copyright (C) 2024 Anya Lin +# Copyright (C) 2024-2025 Anya Lin include $(TOPDIR)/rules.mk diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js index 639921659..5086644dc 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js @@ -577,7 +577,7 @@ return view.extend({ s = m.section(form.TypedSection); s.render = function () { - poll.add(function () { + poll.add(function() { return hm.getServiceStatus('mihomo-c').then((isRunning) => { hm.updateStatus(document.getElementById('_client_bar'), isRunning ? { dashboard_repo: dashboard_repo } : false, 'mihomo-c', true); }); diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/hosts.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/hosts.js index 5a5f322d9..9bbd6eb98 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/hosts.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/hosts.js @@ -14,10 +14,10 @@ return view.extend({ handleSave(ev) { let value = (document.querySelector('textarea').value || '').trim().replace(/\r\n/g, '\n') + '\n'; - return hm.writeFile('templates', 'hosts.yaml', value).then(function(rc) { + return hm.writeFile('templates', 'hosts.yaml', value).then((rc) => { document.querySelector('textarea').value = value; ui.addNotification(null, E('p', _('Contents have been saved.')), 'info'); - }).catch(function(e) { + }).catch((e) => { ui.addNotification(null, E('p', _('Unable to save contents: %s').format(e))); }); }, diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js index bceb08e87..b6a31cf69 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/log.js @@ -42,13 +42,13 @@ function getRuntimeLog(name, filename) { let log; poll.add(L.bind(function() { return fs.read_direct(String.format('%s/%s.log', hm_dir, filename), 'text') - .then(function(res) { + .then((res) => { log = E('pre', { 'wrap': 'pre' }, [ res.trim() || _('Log is empty.') ]); dom.content(log_textarea, log); - }).catch(function(err) { + }).catch((err) => { if (err.toString().includes('NotFoundError')) log = E('pre', { 'wrap': 'pre' }, [ _('Log file does not exist.') diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js index 7bf4a1c9c..6c89cdca4 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/ruleset.js @@ -162,7 +162,7 @@ return view.extend({ .then(L.bind(this.map.load, this.map)) .then(L.bind(this.map.reset, this.map)) .then(L.ui.hideModal) - .catch(function() {}); + .catch(() => {}); } else { return ui.hideModal(); } diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js index 46c485215..a3da3ede0 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js @@ -26,7 +26,7 @@ return view.extend({ s = m.section(form.TypedSection); s.render = function () { - poll.add(function () { + poll.add(function() { return hm.getServiceStatus('mihomo-s').then((isRunning) => { hm.updateStatus(document.getElementById('_server_bar'), isRunning ? { dashboard_repo: dashboard_repo } : false, 'mihomo-s', true); }); diff --git a/luci-app-tinyfilemanager/Makefile b/luci-app-tinyfilemanager/Makefile index cb604e948..d93786bed 100644 --- a/luci-app-tinyfilemanager/Makefile +++ b/luci-app-tinyfilemanager/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-3.0 # -# Copyright (C) 2022-2024 muink +# Copyright (C) 2022-2025 muink include $(TOPDIR)/rules.mk diff --git a/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/config.js b/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/config.js index 41366fbe1..eb04d8cf9 100644 --- a/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/config.js +++ b/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/config.js @@ -10,7 +10,7 @@ return view.extend({ // handleSave: null, // handleReset: null, - load: function() { + load() { return Promise.all([ L.resolveDefault(fs.read('/var/tinyfilemanager/releaseslist'), null), L.resolveDefault(fs.stat('/usr/libexec/tinyfilemanager-update'), {}), @@ -19,10 +19,10 @@ return view.extend({ ]); }, - render: function(res) { - var releaseslist = res[0] ? res[0].trim().split("\n") : [], - has_location = res[2].path, - pkgversion = '2.6'; + render(res) { + const releaseslist = res[0] ? res[0].trim().split("\n") : []; + const has_location = res[2].path; + const pkgversion = '2.6'; let m, s, o; @@ -36,7 +36,7 @@ return view.extend({ o.inputstyle = 'apply'; o.onclick = function() { return fs.exec('/etc/init.d/tinyfilemanager', ['reload']) - .catch(function(e) { ui.addNotification(null, E('p', e.message), 'error') }); + .catch((e) => { ui.addNotification(null, E('p', e.message), 'error') }); }; if (! has_location) o.description = _('To enable SSL support, you may need to install %s
').format(['php-nginx']); @@ -154,15 +154,15 @@ return view.extend({ o.inputstyle = 'apply'; o.onclick = function() { return fs.exec('/etc/init.d/tinyfilemanager', ['check']) - .then(function(res) { return window.location.reload() }) - .catch(function(e) { ui.addNotification(null, E('p', e.message), 'error') }); + .then((res) => { return window.location.reload() }) + .catch((e) => { ui.addNotification(null, E('p', e.message), 'error') }); }; if (releaseslist.length) { o = s.option(form.ListValue, '_releaseslist', _('Releases list')); //o.value(pkgversion); o.default = pkgversion; - for (var i = 0; i < releaseslist.length; i++) + for (let i = 0; i < releaseslist.length; i++) o.value(releaseslist[i]); o.write = function() {}; @@ -170,10 +170,10 @@ return view.extend({ o.inputtitle = _('Uprgade'); o.inputstyle = 'apply'; o.onclick = function(ev, section_id) { - var releasestag=this.section.getOption('_releaseslist').formvalue(section_id); + const releasestag=this.section.getOption('_releaseslist').formvalue(section_id); //alert(releasestag); return fs.exec_direct('/usr/libexec/tinyfilemanager-update', [releasestag]) - .catch(function(e) { ui.addNotification(null, E('p', e.message), 'error') }); + .catch((e) => { ui.addNotification(null, E('p', e.message), 'error') }); } }; diff --git a/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/main.js b/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/main.js index fdc9ba28a..44eb58af0 100644 --- a/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/main.js +++ b/luci-app-tinyfilemanager/htdocs/luci-static/resources/view/tinyfilemanager/main.js @@ -6,10 +6,10 @@ return view.extend({ handleSave: null, handleReset: null, - load: function() { + load() { }, - render: function() { + render() { return E('iframe', { src: window.location.protocol + '//' + window.location.hostname + '/tinyfilemanager/', style: 'width: 100%; min-height: 100vh; border: none; border-radius: 3px;'