From 570e37cd3cee98d272d700f44c3ad6c1d1af5ede Mon Sep 17 00:00:00 2001 From: gitea-action Date: Tue, 29 Oct 2024 23:30:18 +0800 Subject: [PATCH] luci-app-homeproxy: sync upstream last commit: https://github.com/immortalwrt/homeproxy/commit/8d79f403a142d5b46b6513e72c648655cf581cb4 --- .../htdocs/luci-static/resources/homeproxy.js | 10 ++++++++++ .../luci-static/resources/view/homeproxy/node.js | 2 +- .../luci-static/resources/view/homeproxy/server.js | 2 +- luci-app-homeproxy/root/etc/init.d/homeproxy | 9 ++++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/luci-app-homeproxy/htdocs/luci-static/resources/homeproxy.js b/luci-app-homeproxy/htdocs/luci-static/resources/homeproxy.js index f80fb6430..8403b24ed 100644 --- a/luci-app-homeproxy/htdocs/luci-static/resources/homeproxy.js +++ b/luci-app-homeproxy/htdocs/luci-static/resources/homeproxy.js @@ -63,6 +63,16 @@ return baseclass.extend({ '1.3' ], + CBIStaticList: form.DynamicList.extend({ + __name__: 'CBI.StaticList', + + renderWidget: function(/* ... */) { + var dl = form.DynamicList.prototype.renderWidget.apply(this, arguments); + dl.querySelector('.add-item ul > li[data-value="-"]').remove(); + return dl; + } + }), + calcStringMD5: function(e) { /* Thanks to https://stackoverflow.com/a/41602636 */ function h(a, b) { diff --git a/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js b/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js index 88ceb30a7..fcc110aa2 100644 --- a/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js +++ b/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/node.js @@ -1004,7 +1004,7 @@ function renderNodeSettings(section, data, features, main_node, routing_mode) { o.depends('tls', '1'); o.modalonly = true; - o = s.option(form.MultiValue, 'tls_cipher_suites', _('Cipher suites'), + o = s.option(hp.CBIStaticList, 'tls_cipher_suites', _('Cipher suites'), _('The elliptic curves that will be used in an ECDHE handshake, in preference order. If empty, the default will be used.')); for (var i of hp.tls_cipher_suites) o.value(i); diff --git a/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js b/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js index bd5120568..ede05ebd4 100644 --- a/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js +++ b/luci-app-homeproxy/htdocs/luci-static/resources/view/homeproxy/server.js @@ -568,7 +568,7 @@ return view.extend({ o.depends('tls', '1'); o.modalonly = true; - o = s.option(form.MultiValue, 'tls_cipher_suites', _('Cipher suites'), + o = s.option(hp.CBIStaticList, 'tls_cipher_suites', _('Cipher suites'), _('The elliptic curves that will be used in an ECDHE handshake, in preference order. If empty, the default will be used.')); for (var i of hp.tls_cipher_suites) o.value(i); diff --git a/luci-app-homeproxy/root/etc/init.d/homeproxy b/luci-app-homeproxy/root/etc/init.d/homeproxy index 0bd90b7fd..c38dec1a5 100755 --- a/luci-app-homeproxy/root/etc/init.d/homeproxy +++ b/luci-app-homeproxy/root/etc/init.d/homeproxy @@ -14,7 +14,14 @@ PROG="/usr/bin/sing-box" HP_DIR="/etc/homeproxy" RUN_DIR="/var/run/homeproxy" LOG_PATH="$RUN_DIR/homeproxy.log" -DNSMASQ_DIR="/tmp/dnsmasq.d/dnsmasq-homeproxy.d" + +# we don't know which is the default server, just take the first one +DNSMASQ_UCI_CONFIG="$(uci -q show "dhcp.@dnsmasq[0]" | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')" +if [ -f "/tmp/etc/dnsmasq.conf.$DNSMASQ_UCI_CONFIG" ]; then + DNSMASQ_DIR="$(awk -F '=' '/^conf-dir=/ {print $2}' "/tmp/etc/dnsmasq.conf.$DNSMASQ_UCI_CONFIG")/dnsmasq-homeproxy.d" +else + DNSMASQ_DIR="/tmp/dnsmasq.d/dnsmasq-homeproxy.d" +fi log() { echo -e "$(date "+%Y-%m-%d %H:%M:%S") [DAEMON] $*" >> "$LOG_PATH"