From 0c67fa5e72bd8cf75c1b415f029ea61a1c230770 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 May 2026 20:54:52 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=BD=20Sync=202026-05-20=2020:54:52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ddnsto/Makefile | 49 ++++++++--- ddnsto/files/ddnsto-monitor.sh | 49 ----------- ddnsto/files/ddnsto.config | 10 ++- ddnsto/files/ddnsto.init | 56 ++++++------ ddnsto/files/ddnsto.uci-default | 2 +- ipv6-neigh/Makefile | 2 +- ipv6-neigh/src/main.rs | 85 +++++++++++-------- ipv6-neigh/src/reconcile.rs | 20 ++--- luci-app-ddnsto/Makefile | 4 +- luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua | 43 +++++++++- .../root/www/luci-static/ddnsto/index.js | 2 +- luci-app-passwall/Makefile | 4 +- .../model/cbi/passwall/client/type/ray.lua | 8 +- .../cbi/passwall/client/type/sing-box.lua | 8 +- .../model/cbi/passwall/server/type/ray.lua | 5 +- .../cbi/passwall/server/type/sing-box.lua | 5 +- teleproxy/Makefile | 4 +- 17 files changed, 202 insertions(+), 154 deletions(-) delete mode 100644 ddnsto/files/ddnsto-monitor.sh mode change 100755 => 100644 ddnsto/files/ddnsto.init diff --git a/ddnsto/Makefile b/ddnsto/Makefile index 955f9c415..df2b0dce9 100644 --- a/ddnsto/Makefile +++ b/ddnsto/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2015-2016 OpenWrt.org +# Copyright (C) 2015-2024 OpenWrt.org # Copyright (C) 2020 jjm2473@gmail.com # # This is free software, licensed under the GNU General Public License v3. @@ -10,9 +10,17 @@ include $(TOPDIR)/rules.mk PKG_ARCH_DDNSTO:=$(ARCH) PKG_NAME:=ddnsto -# use PKG_SOURCE_DATE instead of PKG_VERSION for compitable -PKG_SOURCE_DATE:=3.0.4 -PKG_RELEASE:=1 +# use PKG_SOURCE_DATE instead of PKG_VERSION for compatible +PKG_SOURCE_DATE:=4.2.0 +PKG_RELEASE:=2 + +# 构建类型:standard 或 lite +DDNSTO_TYPE?=standard + +# 调试信息 +$(info DDNSTO_TYPE is set to: $(DDNSTO_TYPE)) + +# 架构名称映射 ARCH_HEXCODE:= ifeq ($(ARCH),x86_64) ARCH_HEXCODE=8664 @@ -24,29 +32,49 @@ else ifeq ($(ARCH),mipsel) ARCH_HEXCODE=1b0c endif PKG_SOURCE_VERSION:=$(ARCH_HEXCODE) -PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_SOURCE_DATE).tar.gz -PKG_SOURCE_URL:=https://dl.istoreos.com/binary/ddnsto/ -PKG_HASH:=skip -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_SOURCE_DATE) + +# 根据类型选择下载地址和文件名 +ifeq ($(DDNSTO_TYPE),lite) + PKG_SOURCE:=$(PKG_NAME)-binary-lite-$(PKG_SOURCE_DATE).tar.gz + PKG_SOURCE_URL:=https://github.com/linkease/ddnsto-openwrt-package/raw/refs/heads/main/ + PKG_HASH:=skip + PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-lite-$(PKG_SOURCE_DATE) +else + PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_SOURCE_DATE).tar.gz + PKG_SOURCE_URL:=https://github.com/linkease/ddnsto-openwrt-package/raw/refs/heads/main/ + PKG_HASH:=skip + PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_SOURCE_DATE) +endif PKG_BUILD_PARALLEL:=1 PKG_USE_MIPS16:=0 +# 禁用 strip,保持二进制文件原样 +STRIP:=true +RSTRIP:=: + include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME) SECTION:=net CATEGORY:=Network SUBMENU:=Web Servers/Proxies - TITLE:=DDNS.to - the reverse proxy + TITLE:=DDNS.to - the reverse proxy ($(DDNSTO_TYPE)) DEPENDS:= PKGARCH:=all URL:=https://www.ddnsto.com/ endef define Package/$(PKG_NAME)/description - DDNS.to is a reverse proxy + DDNS.to is a reverse proxy service that allows you to access + your devices from anywhere without public IP or port forwarding. + + Build type: $(DDNSTO_TYPE) + Features: + - Multi-device index support + - WebDAV file sharing + - Intranet penetration endef define Package/$(PKG_NAME)/conffiles @@ -70,7 +98,6 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d $(1)/etc/uci-defaults $(INSTALL_BIN) $(PKG_BUILD_DIR)/ddnsto.$(PKG_ARCH_DDNSTO) $(1)/usr/sbin/ddnstod - $(INSTALL_BIN) $(PKG_BUILD_DIR)/ddwebdav.$(PKG_ARCH_DDNSTO) $(1)/usr/sbin/ddwebdav $(INSTALL_CONF) ./files/ddnsto.config $(1)/etc/config/ddnsto $(INSTALL_BIN) ./files/ddnsto.init $(1)/etc/init.d/ddnsto $(INSTALL_BIN) ./files/ddnsto.uci-default $(1)/etc/uci-defaults/ddnsto diff --git a/ddnsto/files/ddnsto-monitor.sh b/ddnsto/files/ddnsto-monitor.sh deleted file mode 100644 index 206138046..000000000 --- a/ddnsto/files/ddnsto-monitor.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -DEVICE_IDX=0 -LOG_LEVEL=2 -while getopts u:x:l: flag -do - case "${flag}" in - u) TOKEN=${OPTARG};; - x) DEVICE_IDX=${OPTARG};; - l) LOG_LEVEL=${OPTARG};; - esac -done - -if [ -z "${TOKEN}" ]; then - logger "ddnsto: the token is empty, get token from https://www.ddnsto.com/ " - exit 2 -fi - -echo "ddnsto version device_id is is:" -/usr/sbin/ddnsto -u ${TOKEN} -w - -_term() { - logger "ddnsto: SIGTERM" - killall ddnsto 2>/dev/null - killall ddwebdav 2>/dev/null - - rm -f /tmp/.ddnsto.pid - rm -f /tmp/.ddnsto.status - rm -f /tmp/.ddnsto.up - exit -} - -trap "_term;" SIGTERM - -while true ; do - if ! pidof "ddnsto" > /dev/null ; then - logger "ddnsto try running" - /usr/sbin/ddnsto -u ${TOKEN} -x ${DEVICE_IDX} & - PID=$! - wait $PID - RET=$? - logger "ddnsto EXIT CODE: ${RET}" - if [ "${RET}" == "100" ]; then - logger "ddnsto token error, please set a correct token from https://www.ddnsto.com/ " - exit 100 - fi - fi - sleep 20 -done diff --git a/ddnsto/files/ddnsto.config b/ddnsto/files/ddnsto.config index 5bfecf33a..603c38e38 100644 --- a/ddnsto/files/ddnsto.config +++ b/ddnsto/files/ddnsto.config @@ -1,5 +1,11 @@ config ddnsto option enabled '0' - option feat_port '3033' - option feat_enabled '0' + # option token '' option index '0' + option logger '0' + option feat_enabled '0' + option feat_port '3033' + # option feat_username '' + # option feat_password '' + # option feat_disk_path_selected '' + # option address '' diff --git a/ddnsto/files/ddnsto.init b/ddnsto/files/ddnsto.init old mode 100755 new mode 100644 index 85d46de34..e47d88285 --- a/ddnsto/files/ddnsto.init +++ b/ddnsto/files/ddnsto.init @@ -4,45 +4,49 @@ START=99 USE_PROCD=1 get_config() { - config_get_bool enabled $1 enabled 1 - config_get_bool logger $1 logger 0 - config_get token $1 token - config_get index $1 index 0 - config_get_bool feat_enabled $1 feat_enabled 1 + config_get_bool enabled $1 enabled 0 + config_get_bool logger $1 logger 0 + config_get token $1 token + config_get index $1 index 0 + config_get_bool feat_enabled $1 feat_enabled 0 } ddnsto_prepare() { - killall ddnstod 2>/dev/null - killall ddwebdav 2>/dev/null + killall ddnstod 2>/dev/null } stop_service() { - ddnsto_prepare + ddnsto_prepare } start_service() { - ddnsto_prepare - config_load ddnsto - config_foreach get_config ddnsto - if [ $enabled != 1 ]; then - return 1 - fi + ddnsto_prepare + config_load ddnsto + config_foreach get_config ddnsto + + if [ "$enabled" != "1" ]; then + logger -t ddnsto -p daemon.info "ddnsto service disabled" + return 1 + fi - if [ -z "$token" ]; then - logger -t ddnsto -p warn "token not set" - return 1 - fi - - procd_open_instance - procd_set_param command /usr/sbin/ddnstod -u "$token" -x $index -F - [ "$logger" == 1 ] && procd_set_param stderr 1 - procd_set_param respawn - procd_close_instance + if [ -z "$token" ]; then + logger -t ddnsto -p daemon.warn "token not set" + return 1 + fi + + procd_open_instance + procd_set_param command /usr/sbin/ddnstod -u "$token" -x "$index" -F + [ "$logger" == "1" ] && procd_set_param stderr 1 + procd_set_param respawn + procd_close_instance } service_triggers() { - procd_add_reload_trigger "ddnsto" + procd_add_reload_trigger "ddnsto" } + reload_service() { - restart + stop + sleep 1 + start } diff --git a/ddnsto/files/ddnsto.uci-default b/ddnsto/files/ddnsto.uci-default index 7714691fa..e62e6a8d5 100644 --- a/ddnsto/files/ddnsto.uci-default +++ b/ddnsto/files/ddnsto.uci-default @@ -17,4 +17,4 @@ EOF /etc/init.d/ddnsto enable -exit 0 \ No newline at end of file +exit 0 diff --git a/ipv6-neigh/Makefile b/ipv6-neigh/Makefile index 61ee8aa21..4ffda96e3 100644 --- a/ipv6-neigh/Makefile +++ b/ipv6-neigh/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ipv6-neigh PKG_VERSION:=0.1.0 -PKG_RELEASE:=11 +PKG_RELEASE:=12 PKG_BUILD_DEPENDS:=rust/host PKG_BUILD_PARALLEL:=1 diff --git a/ipv6-neigh/src/main.rs b/ipv6-neigh/src/main.rs index 89e0bbc76..a67ab4d7c 100644 --- a/ipv6-neigh/src/main.rs +++ b/ipv6-neigh/src/main.rs @@ -30,7 +30,7 @@ mod types; use filter::{if_ipv4_in_private_subnet, if_ipv6_in_private_subnet, ipv6_in_prefix, ipv6_passes_active_prefix, is_gua_ipv6}; use iface::{get_active_lan_prefixes, register_router_addresses, wait_for_dns_server}; use probe::{probe_gua_keepalive, probe_registered_neighbours, prune_gua_keepalive, send_icmpv4_echo, send_icmpv6_echo}; -use reconcile::{do_delete_dns, process_new_neigh, prune_ula_for_mac, reconcile_dns}; +use reconcile::{do_delete_dns, process_new_neigh, prune_ula_for_host, reconcile_dns}; use types::{ DEFAULT_TTL, RTNLGRP_NEIGH, GuaKeepaliveEntry, Neigh, RegisteredEntry, nl_mgrp, }; @@ -253,16 +253,17 @@ async fn main() -> Result<(), ()> { } } - let key = (neigh.mac.clone(), inet_to_string(&neigh.inet)); + let ip_str = inet_to_string(&neigh.inet); match neigh.state { NeighbourState::Reachable => { // Confirmed online — register in DNS immediately. - if !registered.contains_key(&key) { - if let Some(hostname) = leases.get(&neigh.mac) { + if let Some(hostname) = leases.get(&neigh.mac) { + let key = (hostname.clone(), ip_str.clone()); + if !registered.contains_key(&key) { // Enforce per-host ULA limit before adding a new one. if let NeighbourAddress::Inet6(addr) = &neigh.inet { if if_ipv6_in_private_subnet(addr) { - prune_ula_for_mac(&neigh.mac, max_ula_per_host, &mut registered, &updater).await; + prune_ula_for_host(hostname, max_ula_per_host, &mut registered, &updater).await; } } let result = match &neigh.inet { @@ -281,9 +282,9 @@ async fn main() -> Result<(), ()> { } Err(e) => error!("DNS update failed for {}: {}", hostname, e), } - } else { - debug!("no lease for mac {}, skipping DNS update", neigh.mac); } + } else { + debug!("no lease for mac {}, skipping DNS update", neigh.mac); } } NeighbourState::Stale | NeighbourState::Delay | NeighbourState::Probe => { @@ -409,29 +410,39 @@ async fn main() -> Result<(), ()> { } } - let key = (neigh.mac.clone(), inet_to_string(&neigh.inet)); + let ip_str = inet_to_string(&neigh.inet); if is_failed_state(neigh.state) { - // Neighbour confirmed unreachable — remove DNS record - if let Some(entry) = registered.remove(&key) { - debug!("Neighbour failed: {:?}", neigh); - if !do_delete_dns(&entry.hostname, &neigh.inet, &updater).await { - // DNS delete failed, put back so we retry - registered.insert(key, entry); + // Neighbour confirmed unreachable — remove DNS record. + // Resolve key by hostname (handles MAC changes: new MAC in leases + // can now evict entries registered under an old MAC). + // Fall back to scanning registered by IP if MAC is no longer in leases. + let key_opt: Option<(String, String)> = leases + .get(&neigh.mac) + .map(|h| (h.clone(), ip_str.clone())) + .or_else(|| registered.keys().find(|(_, ip)| ip == &ip_str).cloned()); + if let Some(key) = key_opt { + if let Some(entry) = registered.remove(&key) { + debug!("Neighbour failed: {:?}", neigh); + if !do_delete_dns(&entry.hostname, &neigh.inet, &updater).await { + // DNS delete failed, put back so we retry + registered.insert(key, entry); + } } } } else if neigh.state == NeighbourState::Reachable { - if let Some(entry) = registered.get_mut(&key) { - // Already registered, just update timestamp and ifindex - entry.last_confirmed = Instant::now(); - entry.ifindex = neigh.ifindex; - } else { - // New reachable neighbour — register in DNS - debug!("New neighbour: {:?}", neigh); - if let Some(hostname) = leases.get(&neigh.mac) { + if let Some(hostname) = leases.get(&neigh.mac) { + let key = (hostname.clone(), ip_str.clone()); + if let Some(entry) = registered.get_mut(&key) { + // Already registered, just update timestamp and ifindex + entry.last_confirmed = Instant::now(); + entry.ifindex = neigh.ifindex; + } else { + // New reachable neighbour — register in DNS + debug!("New neighbour: {:?}", neigh); // Enforce per-host ULA limit before adding. if let NeighbourAddress::Inet6(addr) = &neigh.inet { if if_ipv6_in_private_subnet(addr) { - prune_ula_for_mac(&neigh.mac, max_ula_per_host, &mut registered, &updater).await; + prune_ula_for_host(hostname, max_ula_per_host, &mut registered, &updater).await; } } if process_new_neigh(&neigh, &updater, &leases, private_subnet_v6).await { @@ -441,17 +452,20 @@ async fn main() -> Result<(), ()> { ifindex: neigh.ifindex, }); } - } else { - debug!("no lease for mac {}, skipping DNS update", neigh.mac); } + } else { + debug!("no lease for mac {}, skipping DNS update", neigh.mac); } } else if matches!(neigh.state, NeighbourState::Stale | NeighbourState::Delay | NeighbourState::Probe) { // Uncertain state: update ifindex only so the next probe uses // the right interface, but do NOT refresh last_confirmed — // STALE/DELAY/PROBE is not confirmed reachable and refreshing // the timestamp would suppress the periodic probe. - if let Some(entry) = registered.get_mut(&key) { - entry.ifindex = neigh.ifindex; + if let Some(hostname) = leases.get(&neigh.mac) { + let key = (hostname.clone(), ip_str.clone()); + if let Some(entry) = registered.get_mut(&key) { + entry.ifindex = neigh.ifindex; + } } } } @@ -474,15 +488,16 @@ async fn main() -> Result<(), ()> { } } } - let key = (neigh.mac.clone(), inet_to_string(&neigh.inet)); - let stored_hostname = registered.remove(&key).map(|e| e.hostname); + let ip_str = inet_to_string(&neigh.inet); + // Resolve key by hostname; fall back to scanning by IP if MAC gone from leases. + let key_opt: Option<(String, String)> = leases + .get(&neigh.mac) + .map(|h| (h.clone(), ip_str.clone())) + .or_else(|| registered.keys().find(|(_, ip)| ip == &ip_str).cloned()); debug!("Del neighbour: {:?}", neigh); - // Use stored hostname if available, fall back to leases for records - // that survived a program restart (not in registered). - let hostname_opt = stored_hostname - .or_else(|| leases.get(&neigh.mac).cloned()); - if let Some(ref hostname) = hostname_opt { - do_delete_dns(hostname, &neigh.inet, &updater).await; + if let Some(key) = key_opt { + registered.remove(&key); + do_delete_dns(&key.0, &neigh.inet, &updater).await; } } _ => {} diff --git a/ipv6-neigh/src/reconcile.rs b/ipv6-neigh/src/reconcile.rs index 1080cd5b0..51575075c 100644 --- a/ipv6-neigh/src/reconcile.rs +++ b/ipv6-neigh/src/reconcile.rs @@ -67,20 +67,20 @@ pub(crate) async fn do_delete_dns( } } -/// Enforce the per-host ULA AAAA limit. If `mac` already has `max` or more ULA AAAA +/// Enforce the per-host ULA AAAA limit. If `host` already has `max` or more ULA AAAA /// records in `registered`, remove the oldest (by `last_confirmed`) and delete from DNS. -/// Returns the number of existing ULA AAAA records for this MAC (after pruning). -pub(crate) async fn prune_ula_for_mac( - mac: &str, +/// Returns the number of existing ULA AAAA records for this host (after pruning). +pub(crate) async fn prune_ula_for_host( + host: &str, max: usize, registered: &mut HashMap<(String, String), RegisteredEntry>, updater: &DnsUpdater, ) -> usize { - // Collect existing ULA AAAA keys for this MAC. + // Collect existing ULA AAAA keys for this host. let mut ula_keys: Vec<((String, String), Instant)> = registered .iter() - .filter(|((m, ip_str), _)| { - m == mac && ip_str.parse::().map_or(false, |a| if_ipv6_in_private_subnet(&a)) + .filter(|((h, ip_str), _)| { + h == host && ip_str.parse::().map_or(false, |a| if_ipv6_in_private_subnet(&a)) }) .map(|(k, e)| (k.clone(), e.last_confirmed)) .collect(); @@ -99,15 +99,15 @@ pub(crate) async fn prune_ula_for_mac( let addr: Ipv6Addr = key.1.parse().unwrap(); let inet = NeighbourAddress::Inet6(addr); do_delete_dns(&entry.hostname, &inet, updater).await; - info!("ULA pruning: removed oldest {} -> {} for mac {}", entry.hostname, key.1, mac); + info!("ULA pruning: removed oldest {} -> {} for host {}", entry.hostname, key.1, host); } } // Return count after pruning. registered .iter() - .filter(|((m, ip_str), _)| { - m == mac && ip_str.parse::().map_or(false, |a| if_ipv6_in_private_subnet(&a)) + .filter(|((h, ip_str), _)| { + h == host && ip_str.parse::().map_or(false, |a| if_ipv6_in_private_subnet(&a)) }) .count() } diff --git a/luci-app-ddnsto/Makefile b/luci-app-ddnsto/Makefile index 016f71b95..cdeff9b02 100644 --- a/luci-app-ddnsto/Makefile +++ b/luci-app-ddnsto/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI support for ddnsto LUCI_DEPENDS:=+ddnsto +block-mount LUCI_PKGARCH:=all -PKG_VERSION:=3.2.0-r5 -PKG_RELEASE:=1 +PKG_VERSION:=4.0.3-r1 +PKG_RELEASE:=2 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua b/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua index 60b427c41..7679785dc 100644 --- a/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua +++ b/luci-app-ddnsto/luasrc/model/cbi/ddnsto.lua @@ -1,9 +1,9 @@ --wulishui ,20200911 --jjm2473 ,20210127 -local m, s +local m, s, o -m = Map("ddnsto", translate("DDNS.to"), translate("DDNS.to is a reverse proxy.") +m = Map("ddnsto", translate("DDNS.to"), translate("DDNS.to is a reverse proxy service.") .. " " .. translate("Official Website") .. "") @@ -18,6 +18,41 @@ s:option(Flag, "enabled", translate("Enable")).rmempty=false s:option(Value, "token", translate("Token")).rmempty=false +o = s:option(Value, "index", translate("Device Index")) +o.default = "0" +o.datatype = "uinteger" +o.rmempty = false + +o = s:option(Flag, "logger", translate("Enable Logging")) +o.default = "0" +o.rmempty = false + +-- WebDAV/File Sharing settings +s2=m:section(TypedSection, "ddnsto", translate("WebDAV File Sharing")) +s2.addremove=false +s2.anonymous=true + +o = s2:option(Flag, "feat_enabled", translate("Enable WebDAV")) +o.default = "0" +o.rmempty = false + +o = s2:option(Value, "feat_port", translate("WebDAV Port")) +o.default = "3033" +o.datatype = "port" +o.rmempty = false +o:depends("feat_enabled", "1") + +o = s2:option(Value, "feat_username", translate("Username")) +o.rmempty = false +o:depends("feat_enabled", "1") + +o = s2:option(Value, "feat_password", translate("Password")) +o.password = true +o.rmempty = false +o:depends("feat_enabled", "1") + +o = s2:option(Value, "feat_disk_path_selected", translate("Shared Path")) +o.rmempty = false +o:depends("feat_enabled", "1") + return m - - diff --git a/luci-app-ddnsto/root/www/luci-static/ddnsto/index.js b/luci-app-ddnsto/root/www/luci-static/ddnsto/index.js index 3f0ff7c54..c80a5f663 100644 --- a/luci-app-ddnsto/root/www/luci-static/ddnsto/index.js +++ b/luci-app-ddnsto/root/www/luci-static/ddnsto/index.js @@ -97,6 +97,6 @@ Error generating stack: `+o.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vf=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Vu=Gt("smartphone",vf);function yf(){return m.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:m.jsx("div",{className:"flex items-start",children:m.jsxs("div",{className:"flex-1",children:[m.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[m.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center",children:m.jsx(Bu,{className:"w-6 h-6 text-blue-600"})}),m.jsx("h2",{className:"text-slate-800",children:"DDNSTO 远程访问"})]}),m.jsx("p",{className:"text-slate-600 text-sm mb-2",children:"DDNSTO 远程访问,不需要公网 IP、不需要开放端口。只需一个链接,即可从任何地方安全访问您的 NAS、路由器和桌面。"}),m.jsxs("a",{href:"https://www.ddnsto.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-blue-600 hover:underline",children:["了解更多",m.jsx(Al,{className:"w-3 h-3"})]})]})})})}function wf({isRunning:y,isConfigured:E,hostname:d,address:U,deviceId:T,version:L,featEnabled:B,tunnelOk:G,onRefreshStatus:A}){const[Q,Z]=C.useState(!1),W={label:y?"运行中":"已停止",bgColor:y?"bg-green-100":"bg-slate-200",textColor:y?"text-green-700":"text-slate-600"},H=U&&U.trim().length>0?U:"未配置",q=Q,ae=G===!0,V=q?"检查中...":G===!0?"正常":G===!1?"无法连接服务器":"未知",Y=B==="1"||B===!0?"已开启":"未开启",we=T||"-",ze=async()=>{if(A){Z(!0);try{await A()}finally{Z(!1)}}};return m.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[m.jsx("h3",{className:"text-slate-800 mb-4",children:"运行状态"}),m.jsxs("div",{className:"flex items-center justify-between pb-6 border-b border-slate-100",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("span",{className:`px-3 py-1 rounded-full text-sm ${W.bgColor} ${W.textColor}`,children:W.label}),E&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-sm text-slate-500",children:"远程访问域名:"}),U&&U.trim().length>0?m.jsxs("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline flex items-center gap-1",children:[H,m.jsx(Al,{className:"w-3 h-3"})]}):m.jsx("span",{className:"text-sm text-slate-500",children:H})]})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs("button",{onClick:ze,className:"px-3 py-2 rounded-md text-blue-600 text-sm hover:bg-blue-50 transition-colors flex items-center gap-1",children:[m.jsx(hf,{className:"w-4 h-4"}),"刷新状态"]})})]}),m.jsx("div",{className:"mt-6",children:m.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-700",children:[m.jsx(Bu,{className:"w-4 h-4 text-slate-400"}),q&&m.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-slate-300 border-t-blue-600 animate-spin"}),m.jsxs("h4",{className:"text-sm text-slate-700",children:["服务器连接:",ae?m.jsx("span",{className:"text-green-600",children:V}):m.jsx("span",{children:V}),"| 设备 ID:",we," | 拓展功能:",Y,L?` | 版本:${L}`:""]})]})})]})}function Qu({checked:y,onChange:E,label:d,id:U,disabled:T,containerClassName:L,...B}){return m.jsxs("div",{className:`ddnsto-toggle-container ${L||""}`,children:[d&&m.jsx("label",{htmlFor:U,className:"text-sm text-slate-700 mr-3 whitespace-nowrap",children:d}),m.jsxs("label",{className:"ddnsto-toggle-switch","aria-label":d||"toggle",children:[m.jsx("input",{id:U,type:"checkbox",checked:y,disabled:T,onChange:G=>E(G.target.checked),...B}),m.jsx("span",{className:"ddnsto-toggle-slider","aria-hidden":!0})]})]})}function kf({onSave:y,isInTab:E,token:d,enabled:U,advancedConfig:T,onRegisterSave:L,onTokenChange:B,onEnabledChange:G}){const[A,Q]=C.useState(d||""),[Z,W]=C.useState(U);C.useEffect(()=>{Q(d||"")},[d]),C.useEffect(()=>{W(U)},[T,U]);const H=()=>{A.trim()&&y(A,Z?"1":"0",T)};return C.useEffect(()=>{L&&L(()=>H())},[L,A,Z,T]),m.jsxs("div",{className:E?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!E&&m.jsxs(m.Fragment,{children:[m.jsx("h3",{className:"text-slate-800 mb-2",children:"手动配置"}),m.jsx("p",{className:"text-xs text-slate-400 mb-6",children:"如果您已经在 DDNSTO 控制台获取了令牌,可以直接在此填写并启动插件。"})]}),m.jsxs("div",{className:"space-y-5",children:[m.jsx("div",{className:"pb-4",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h4",{className:"text-sm text-slate-700",children:"启用 DDNSTO"}),m.jsx(Qu,{checked:Z,onChange:q=>{W(q),G?.(q)},"aria-label":"启用 DDNSTO",containerClassName:"ml-6"})]})}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.jsxs("label",{className:"text-sm text-slate-700",children:["用户令牌(Token) ",m.jsx("span",{className:"text-red-500",children:"*"})]}),m.jsxs("a",{href:"https://www.ddnsto.com/docs/guide/token.html",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline flex items-center gap-1",children:["如何查看用户令牌",m.jsx(Al,{className:"w-3 h-3"})]})]}),m.jsx("div",{className:"relative",children:m.jsx("input",{type:"text",value:A,onChange:q=>{Q(q.target.value),B?.(q.target.value)},placeholder:"请输入您的 DDNSTO 令牌",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})}),m.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"令牌将保存在路由器本地,请勿泄露。"})]})]})]})}function xf({token:y,enabled:E,advancedConfig:d,onSave:U,isInTab:T,onRegisterSave:L}){const[B,G]=C.useState(d.feat_enabled==="1"),A=K=>K.feat_disk_path_selected?K.feat_disk_path_selected:K.mounts&&K.mounts.length>0?K.mounts[0]:"",[Q,Z]=C.useState(A(d)),[W,H]=C.useState(d.feat_port||"3033"),[q,ae]=C.useState(d.feat_username||"ddnsto"),[V,Y]=C.useState(d.feat_password||""),[we,ze]=C.useState(!1),[ke,fe]=C.useState(d.index||"");C.useEffect(()=>{G(d.feat_enabled==="1"),Z(A(d)),d.feat_port&&H(d.feat_port),d.feat_username&&ae(d.feat_username),d.feat_password&&Y(d.feat_password),d.index!==void 0&&fe(d.index)},[d]);const Ce=()=>{U(y,E?"1":"0",{feat_enabled:B?"1":"0",feat_port:W,feat_username:q,feat_password:V,feat_disk_path_selected:Q,mounts:d.mounts,index:ke})};return C.useEffect(()=>{L&&L(()=>Ce())},[L,y,E,B,Q,W,q,V,ke,d.mounts]),m.jsxs("div",{className:T?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!T&&m.jsx("h3",{className:"text-slate-800 mb-4",children:"高级功能"}),m.jsxs("div",{className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-700 mb-2",children:"设备编号(可选)"}),m.jsx("input",{type:"text",value:ke,onChange:K=>fe(K.target.value),placeholder:"",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"}),m.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"如有多台设备id重复,请修改此编号(0~100),正常情况不需要修改"})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h4",{className:"text-sm text-slate-700",children:"启用拓展功能"}),m.jsx(Qu,{checked:B,onChange:K=>G(K),"aria-label":"启用拓展功能",containerClassName:"ml-6"})]}),m.jsxs("div",{className:"flex items-center gap-2 -mt-2",children:[m.jsx("p",{className:"text-xs text-slate-400",children:"启用后可支持控制台的「文件管理」及「远程开机」功能"}),m.jsxs("a",{href:"https://www.ddnsto.com/docs/guide/advanced.html",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline flex items-center gap-1 whitespace-nowrap",children:["查看教程",m.jsx(Al,{className:"w-3 h-3"})]})]}),B&&m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(ff,{className:"w-4 h-4 text-slate-600"}),m.jsx("h5",{className:"text-sm text-slate-700",children:"WebDAV 服务配置"})]}),m.jsxs("div",{className:"space-y-4 pl-6",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"可访问的文件目录"}),m.jsx("select",{value:Q,onChange:K=>Z(K.target.value),className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white",children:d.mounts&&d.mounts.length>0?d.mounts.map(K=>m.jsx("option",{value:K,children:K},K)):m.jsx("option",{value:"",disabled:!0,children:"未检测到挂载点"})}),m.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"控制台上的文件管理将只能看到此目录及其子目录。"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"服务端口"}),m.jsx("input",{type:"text",value:W,onChange:K=>H(K.target.value),placeholder:"3033",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"授权用户名"}),m.jsx("input",{type:"text",value:q,onChange:K=>ae(K.target.value),placeholder:"ddnsto",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"授权用户密码"}),m.jsxs("div",{className:"relative",children:[m.jsx("input",{type:we?"text":"password",value:V,onChange:K=>Y(K.target.value),placeholder:"设置访问密码",className:"w-full px-3 py-2 pr-10 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"}),m.jsx("button",{type:"button",onClick:()=>ze(!we),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:we?m.jsx(sf,{className:"w-4 h-4"}):m.jsx(cf,{className:"w-4 h-4"})})]})]})]})]})]})]})}function Sf({ddnstoToken:y,ddnstoEnabled:E,advancedConfig:d,onSave:U,saveBanner:T}){const[L,B]=C.useState("basic"),G=C.useRef(null),A=C.useRef(),Q=C.useRef(),[Z,W]=C.useState(y||""),[H,q]=C.useState(E==="1");C.useEffect(()=>{W(y||"")},[y]),C.useEffect(()=>{q(E==="1")},[E]);const ae=()=>{L==="basic"?A.current?.():Q.current?.()};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 mb-4",children:[m.jsx("div",{className:"border-b border-slate-200 px-6",children:m.jsx("div",{className:"flex items-center justify-between",children:m.jsxs("div",{className:"flex items-center -mb-px",children:[m.jsx("button",{onClick:()=>B("basic"),className:`px-4 py-4 text-sm border-b-2 transition-colors ${L==="basic"?"border-blue-600 text-blue-600":"border-transparent text-slate-600 hover:text-slate-800"}`,children:"基础配置"}),m.jsx("button",{onClick:()=>B("advanced"),className:`px-4 py-4 text-sm border-b-2 transition-colors ${L==="advanced"?"border-blue-600 text-blue-600":"border-transparent text-slate-600 hover:text-slate-800"}`,children:"高级功能"})]})})}),m.jsxs("div",{ref:G,className:"p-6",children:[L==="basic"&&m.jsx(kf,{token:Z,enabled:H,advancedConfig:d,onSave:U,isInTab:!0,onRegisterSave:V=>{A.current=V},onTokenChange:W,onEnabledChange:q}),L==="advanced"&&m.jsx(xf,{token:Z,enabled:H,advancedConfig:d,onSave:U,isInTab:!0,onRegisterSave:V=>{Q.current=V}})]})]}),m.jsx("div",{className:"flex justify-end gap-3 mt-4",children:m.jsxs("button",{onClick:ae,disabled:!Z.trim(),className:"ddnsto-btn ddnsto-btn-primary",children:[m.jsx(gf,{className:"ddnsto-btn-icon"}),"保存配置并应用"]})}),T.state!=="idle"&&m.jsxs("div",{className:["mt-2 rounded-md border px-3 py-2 text-sm",T.state==="loading"?"bg-blue-50 border-blue-200 text-blue-800":"",T.state==="success"?"bg-emerald-50 border-emerald-200 text-emerald-800":"",T.state==="error"?"bg-red-50 border-red-200 text-red-800":""].join(" "),children:[m.jsx("div",{className:"font-medium",children:T.message}),T.description&&m.jsx("div",{className:"text-xs mt-1 opacity-80 break-words",children:T.description})]})]})}const bn={auth:0,starting:1,binding:2,domain:3,checking:4};function _f({apiBase:y,csrfToken:E,deviceId:d,onboardingBase:U,onComplete:T,onRefreshStatus:L,isInTab:B}){const[G,A]=C.useState(!1),[Q,Z]=C.useState(U||"https://www.kooldns.cn/bind"),[W,H]=C.useState(`${U||"https://www.kooldns.cn/bind"}/#/auth?send=1&source=openwrt&callback=*`),[q,ae]=C.useState("auth"),[V,Y]=C.useState(d||""),[we,ze]=C.useState(""),[ke,fe]=C.useState(""),[Ce,K]=C.useState(!1),[Re,he]=C.useState(null),xe=C.useRef("auth"),ue=E||(typeof window<"u"?window.ddnstoCsrfToken:""),Qe=C.useCallback(g=>{ae(u=>bn[g]>bn[u]?g:u)},[]);C.useEffect(()=>{xe.current=q},[q]),C.useEffect(()=>{console.log("Onboarding iframe url:",W)},[W]);const Le=C.useCallback(()=>{ae("auth"),ze(""),fe(""),he(null),Y(d||""),H(`${Q}/#/auth?send=1&source=openwrt&callback=*`)},[Qe,d,Q]);C.useEffect(()=>{const g="/#/auth?send=1&source=openwrt&callback=*",u=U||"https://www.kooldns.cn/bind";Z(u),H(`${u}${g}`)},[U]),C.useEffect(()=>{Y(d||"")},[d]);const me=C.useCallback(async()=>{for(let v=0;v<20;v+=1){const M=await fetch(`${y}/admin/services/ddnsto/api/status`,{credentials:"same-origin"});if(M.ok){const X=(await M.json())?.data||{},O=X.deviceId||X.device_id||"";if(O&&Y(O),X.running)return{running:!0,deviceId:O}}await new Promise(b=>setTimeout(b,2e3))}throw new Error("ddnsto not running")},[y]),ge=C.useCallback(async g=>{const u={url:g};ue&&(u.token=ue);const v=await fetch(`${y}/admin/services/ddnsto/api/onboarding/address`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",...ue?{"X-LuCI-Token":ue}:{}},body:JSON.stringify(u)});if(!v.ok)throw new Error(`HTTP ${v.status}`);const M=await v.json();if(!M?.ok)throw new Error(M?.error||"save address failed")},[y,ue]),Ie=C.useCallback(async(g,u)=>{K(!0),he(null);const v=V||d||"",M=`${Q}/#/bind?status=starting&token=${encodeURIComponent(g)}&sign=${encodeURIComponent(u)}${v?`&routerId=${encodeURIComponent(v)}`:""}`;H(M),Qe("starting");try{const b=await fetch(`${y}/admin/services/ddnsto/api/onboarding/start`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",...ue?{"X-LuCI-Token":ue}:{}},body:JSON.stringify({token:g})});if(!b.ok)throw new Error(`HTTP ${b.status}`);const X=await b.json();if(!X?.ok)throw new Error(X?.error||"start failed");L&&await L();const re=(await me())?.deviceId||V||d||"";if(bn[xe.current]>=bn.domain)return;const ee=`${Q}/#/bind?status=starting&routerId=${encodeURIComponent(re)}&token=${encodeURIComponent(g)}&sign=${encodeURIComponent(u)}`;H(ee),Qe("binding"),Y(re)}catch{he("启动失败,请稍后重试")}finally{K(!1)}},[Qe,y,d,ue,Q,L,me,Le,V]),Ne=C.useCallback(g=>{const u=g||V;if(!we||!ke||!u)return;const v=`${Q}/#/domain?sign=${encodeURIComponent(ke)}&token=${encodeURIComponent(we)}&routerId=${encodeURIComponent(u)}&netaddr=127.0.0.1&source=openwrt`;H(v),ae("domain")},[ke,we,Q,V]),ie=C.useCallback(async g=>{H(`${Q}/#/check?url=${encodeURIComponent(g)}`),ae("checking"),T();try{await ge(g),L&&await L()}catch{he("保存域名失败,请重试")}},[Q,T,L,ge]),x=C.useCallback(()=>{A(!0),Le()},[Le]);C.useEffect(()=>{const g=u=>{if(!G)return;console.log("Onboarding message:",u.data);const v=u.data;let M=v;if(typeof v=="string")try{M=JSON.parse(v)}catch{return}if(!M||typeof M!="object")return;const b=M.data,O=b&&typeof b=="object"?b:M;if((typeof O.auth=="string"?O.auth:"")!=="ddnsto")return;const ee=typeof O.sign=="string"?O.sign:"",oe=typeof O.token=="string"?O.token:"",Ue=typeof O.step=="string"?O.step:"",fn=typeof O.status=="string"?O.status:"",Un=typeof O.url=="string"?O.url:"",Tt=O.success,An=typeof Tt=="number"?Tt:Number(Tt);if(ee&&oe&&q==="auth"&&!Ce){ze(oe),fe(ee),Ie(oe,ee);return}if(Ue==="bind"&&fn==="success"){const Zt=typeof O.router_uid=="string"?O.router_uid:V;Zt&&Y(Zt),Ne(Zt);return}Ue==="domain"&&Un&&An===0&&bn[xe.current]window.removeEventListener("message",g)},[Ne,ie,Ce,Ie,G,q]);const I=()=>m.jsx("div",{className:"flex items-center justify-between mb-6",children:m.jsx("h3",{className:"text-slate-800",children:"快速向导"})});return G?m.jsxs("div",{className:B?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!B&&I(),m.jsx("div",{className:"rounded-lg border border-slate-200 overflow-hidden",children:m.jsx("iframe",{src:W,title:"快速向导",className:"w-full",style:{width:"100%",height:"70vh",maxHeight:"400px",border:0},loading:"lazy"})})]}):m.jsxs("div",{className:B?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!B&&I(),m.jsxs("div",{className:"text-center py-8",children:[m.jsx("div",{className:"mb-4 flex justify-center",children:m.jsx("div",{className:"w-16 h-16 rounded-full bg-blue-50 flex items-center justify-center",children:m.jsx(Vu,{className:"w-8 h-8 text-blue-600"})})}),m.jsx("h4",{className:"text-slate-800 mb-2",children:"欢迎使用 DDNSTO!"}),m.jsx("p",{className:"text-sm text-slate-600 mb-6 max-w-md mx-auto",children:"通过微信扫码登录,我们将引导您完成插件配置"}),m.jsxs("button",{onClick:x,className:"ddnsto-btn ddnsto-btn-primary",children:[m.jsx(Vu,{className:"ddnsto-btn-icon"}),"开始配置"]})]})]})}function Ef({config:y}){const[E,d]=C.useState(!1),[U,T]=C.useState(!1),[L,B]=C.useState("OpenWrt"),[G,A]=C.useState(""),[Q,Z]=C.useState(""),[W,H]=C.useState(""),[q,ae]=C.useState(""),[V,Y]=C.useState("1"),[we,ze]=C.useState({feat_enabled:"0",feat_port:"",feat_username:"",feat_password:"",feat_disk_path_selected:"",mounts:[],index:""}),[,ke]=C.useState(null),[fe,Ce]=C.useState(null),[K,Re]=C.useState({state:"idle",message:""}),he=C.useRef(),xe=(y?.api_base||"/cgi-bin/luci").replace(/\/$/,""),ue=y?.token||"",Qe=(y?.onboarding_base||"https://www.kooldns.cn/bind").replace(/\/$/,""),Le=C.useCallback((x,I,g,u)=>{he.current&&window.clearTimeout(he.current),Re({state:x,message:I,description:g}),u&&(he.current=window.setTimeout(()=>{Re({state:"idle",message:""})},u))},[]);C.useEffect(()=>()=>{he.current&&window.clearTimeout(he.current)},[]);const me=C.useCallback(async()=>{try{const x=await fetch(`${xe}/admin/services/ddnsto/api/config`,{credentials:"same-origin"});if(!x.ok)throw new Error(`HTTP ${x.status}`);const g=(await x.json())?.data||{};g.address&&A(g.address),g.device_id!==void 0?Z(g.device_id):g.deviceId!==void 0&&Z(g.deviceId),g.version!==void 0&&H(g.version),g.token&&ae(g.token),g.enabled!==void 0&&Y(g.enabled),ze({feat_enabled:g.feat_enabled||"0",feat_port:g.feat_port||"",feat_username:g.feat_username||"",feat_password:g.feat_password||"",feat_disk_path_selected:g.feat_disk_path_selected||"",mounts:g.mounts||[],index:g.index||""})}catch(x){console.error("Failed to fetch ddnsto config",x)}},[xe]),ge=C.useCallback(async()=>{try{const x=await fetch(`${xe}/admin/services/ddnsto/api/status`,{credentials:"same-origin"});if(!x.ok)throw new Error(`HTTP ${x.status}`);const g=(await x.json())?.data||{};d(!!g.running),g.token_set&&T(!0),g.hostname&&B(g.hostname),g.device_id!==void 0?Z(g.device_id):g.deviceId!==void 0&&Z(g.deviceId),g.address&&A(g.address),g.version!==void 0&&H(g.version),ke(null)}catch(x){console.error("Failed to fetch ddnsto status",x),ke("无法获取运行状态")}},[xe]),Ie=C.useCallback(async()=>{try{const x=await fetch(`${xe}/admin/services/ddnsto/api/connectivity`,{credentials:"same-origin"});if(!x.ok)throw new Error(`HTTP ${x.status}`);const g=(await x.json())?.data||{};g.tunnel_ok!==void 0&&g.tunnel_ok!==null?Ce(g.tunnel_ok===!0):Ce(null)}catch(x){console.error("Failed to fetch ddnsto connectivity",x),Ce(null)}},[xe]),Ne=C.useCallback(async()=>{await me(),await ge(),await Ie()},[me,ge,Ie]),ie=C.useCallback(async(x,I,g)=>{Le("loading","正在保存配置...","正在将配置写入路由器,请稍候");try{const u=new URLSearchParams;ue&&u.append("token",ue),u.append("ddnsto_token",x),u.append("enabled",I),u.append("feat_enabled",g.feat_enabled),u.append("feat_port",g.feat_port),u.append("feat_username",g.feat_username),u.append("feat_password",g.feat_password),u.append("feat_disk_path_selected",g.feat_disk_path_selected),u.append("index",g.index||"");const v=await fetch(`${xe}/admin/services/ddnsto/api/config`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",...ue?{"X-LuCI-Token":ue}:{}},body:u});if(!v.ok)throw new Error(`HTTP ${v.status}`);const M=await v.json();if(!M?.ok)throw new Error(M?.error||"Save failed");Le("success","配置已保存并生效",void 0,3e3),T(!0),await me(),await ge()}catch(u){console.error("Failed to save config",u);const v=u instanceof Error?u.message:String(u);Le("error","保存失败,请重试",v,4e3)}},[xe,ue,me,ge]);return C.useEffect(()=>{me(),ge(),Ie()},[me,ge,Ie]),C.useEffect(()=>{const x=window.setInterval(ge,5e3);return()=>{window.clearInterval(x)}},[ge]),m.jsx("div",{className:"min-h-screen bg-slate-50",children:m.jsx("main",{children:m.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[m.jsx(yf,{}),m.jsx(wf,{isRunning:E,isConfigured:U,hostname:L,address:G,deviceId:Q,version:W,featEnabled:we.feat_enabled,tunnelOk:fe,onRefreshStatus:Ne}),m.jsx(_f,{apiBase:xe,csrfToken:ue,deviceId:Q,onboardingBase:Qe,onRefreshStatus:Ne,onComplete:()=>T(!0)}),m.jsx(Sf,{ddnstoToken:q,ddnstoEnabled:V,advancedConfig:we,onSave:ie,saveBanner:K})]})})})}const Cf='/*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */*,:before,:after,::backdrop{--tw-border-style: solid}@layer properties{@supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x: 0;--tw-translate-y: 0;--tw-translate-z: 0;--tw-rotate-x: rotateX(0);--tw-rotate-y: rotateY(0);--tw-rotate-z: rotateZ(0);--tw-skew-x: skewX(0);--tw-skew-y: skewY(0);--tw-space-y-reverse: 0;--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}@layer theme{:root,:host{--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500: oklch(.637 .237 25.331);--color-amber-50: oklch(.987 .022 95.277);--color-amber-200: oklch(.924 .12 95.746);--color-amber-600: oklch(.666 .179 58.318);--color-green-50: oklch(.982 .018 155.826);--color-green-100: oklch(.962 .044 156.743);--color-green-200: oklch(.925 .084 155.995);--color-green-600: oklch(.627 .194 149.214);--color-green-700: oklch(.527 .154 150.069);--color-green-800: oklch(.448 .119 151.328);--color-blue-50: oklch(.97 .014 254.604);--color-blue-200: oklch(.882 .059 254.128);--color-blue-500: oklch(.623 .214 259.815);--color-blue-600: oklch(.546 .245 262.881);--color-blue-700: oklch(.488 .243 264.376);--color-slate-50: oklch(.984 .003 247.858);--color-slate-100: oklch(.968 .007 247.896);--color-slate-200: oklch(.929 .013 255.508);--color-slate-300: oklch(.869 .022 252.894);--color-slate-400: oklch(.704 .04 256.788);--color-slate-500: oklch(.554 .046 257.417);--color-slate-600: oklch(.446 .043 257.281);--color-slate-700: oklch(.372 .044 257.287);--color-slate-800: oklch(.279 .041 260.031);--color-white: #fff;--spacing: .25rem;--container-md: 28rem;--container-5xl: 64rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-base: 1rem;--text-lg: 1.125rem;--text-xl: 1.25rem;--text-2xl: 1.5rem;--font-weight-normal: 400;--font-weight-medium: 500;--default-transition-duration: .15s;--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);--default-font-family: var(--font-sans);--default-font-feature-settings: var(--font-sans--font-feature-settings);--default-font-variation-settings: var(--font-sans--font-variation-settings);--default-mono-font-family: var(--font-mono);--default-mono-font-feature-settings: var(--font-mono--font-feature-settings);--default-mono-font-variation-settings: var(--font-mono--font-variation-settings)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1;color:currentColor}@supports (color: color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentColor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}body{background-color:var(--background);color:var(--foreground)}*{border-color:var(--border);outline-color:var(--ring)}@supports (color: color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h1{font-size:var(--text-2xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h2{font-size:var(--text-xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h3{font-size:var(--text-lg);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h4,:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) label,:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) button{font-size:var(--text-base);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) input{font-size:var(--text-base);font-weight:var(--font-weight-normal);line-height:1.5}}@layer utilities{.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.right-2{right:calc(var(--spacing) * 2)}.z-10{z-index:10}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-auto{margin-inline:auto}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.block{display:block}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-40{height:calc(var(--spacing) * 40)}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-40{width:calc(var(--spacing) * 40)}.w-full{width:100%}.max-w-5xl{max-width:var(--container-5xl)}.max-w-md{max-width:var(--container-md)}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.translate-x-1{--tw-translate-x: calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-6{--tw-translate-x: calc(var(--spacing) * 6);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-rows-8{grid-template-rows:repeat(8,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-600{border-color:var(--color-blue-600)}.border-green-200{border-color:var(--color-green-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-transparent{border-color:#0000}.bg-amber-50{background-color:var(--color-amber-50)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-600{background-color:var(--color-green-600)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-white{background-color:var(--color-white)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-7{padding-left:calc(var(--spacing) * 7)}.text-center{text-align:center}.text-right{text-align:right}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-red-500{color:var(--color-red-500)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-white{color:var(--color-white)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}@media(hover:hover){.hover\\:bg-blue-50:hover{background-color:var(--color-blue-50)}}@media(hover:hover){.hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}}@media(hover:hover){.hover\\:bg-green-700:hover{background-color:var(--color-green-700)}}@media(hover:hover){.hover\\:bg-slate-50:hover{background-color:var(--color-slate-50)}}@media(hover:hover){.hover\\:text-slate-600:hover{color:var(--color-slate-600)}}@media(hover:hover){.hover\\:text-slate-800:hover{color:var(--color-slate-800)}}@media(hover:hover){.hover\\:underline:hover{text-decoration-line:underline}}.focus\\:ring-2:focus{--tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-blue-500:focus{--tw-ring-color: var(--color-blue-500)}.focus\\:outline-none:focus{--tw-outline-style: none;outline-style:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-slate-300:disabled{background-color:var(--color-slate-300)}}:root,:host{--font-size: 16px;--background: #fff;--foreground: oklch(.145 0 0);--card: #fff;--card-foreground: oklch(.145 0 0);--popover: oklch(1 0 0);--popover-foreground: oklch(.145 0 0);--primary: #030213;--primary-foreground: oklch(1 0 0);--secondary: oklch(.95 .0058 264.53);--secondary-foreground: #030213;--muted: #ececf0;--muted-foreground: #717182;--accent: #e9ebef;--accent-foreground: #030213;--destructive: #d4183d;--destructive-foreground: #fff;--border: #0000001a;--input: transparent;--input-background: #f3f3f5;--switch-background: #cbced4;--font-weight-medium: 500;--font-weight-normal: 400;--ring: oklch(.708 0 0);--chart-1: oklch(.646 .222 41.116);--chart-2: oklch(.6 .118 184.704);--chart-3: oklch(.398 .07 227.392);--chart-4: oklch(.828 .189 84.429);--chart-5: oklch(.769 .188 70.08);--radius: .625rem;--sidebar: oklch(.985 0 0);--sidebar-foreground: oklch(.145 0 0);--sidebar-primary: #030213;--sidebar-primary-foreground: oklch(.985 0 0);--sidebar-accent: oklch(.97 0 0);--sidebar-accent-foreground: oklch(.205 0 0);--sidebar-border: oklch(.922 0 0);--sidebar-ring: oklch(.708 0 0)}.dark{--background: oklch(.145 0 0);--foreground: oklch(.985 0 0);--card: oklch(.145 0 0);--card-foreground: oklch(.985 0 0);--popover: oklch(.145 0 0);--popover-foreground: oklch(.985 0 0);--primary: oklch(.985 0 0);--primary-foreground: oklch(.205 0 0);--secondary: oklch(.269 0 0);--secondary-foreground: oklch(.985 0 0);--muted: oklch(.269 0 0);--muted-foreground: oklch(.708 0 0);--accent: oklch(.269 0 0);--accent-foreground: oklch(.985 0 0);--destructive: oklch(.396 .141 25.723);--destructive-foreground: oklch(.637 .237 25.331);--border: oklch(.269 0 0);--input: oklch(.269 0 0);--ring: oklch(.439 0 0);--font-weight-medium: 500;--font-weight-normal: 400;--chart-1: oklch(.488 .243 264.376);--chart-2: oklch(.696 .17 162.48);--chart-3: oklch(.769 .188 70.08);--chart-4: oklch(.627 .265 303.9);--chart-5: oklch(.645 .246 16.439);--sidebar: oklch(.205 0 0);--sidebar-foreground: oklch(.985 0 0);--sidebar-primary: oklch(.488 .243 264.376);--sidebar-primary-foreground: oklch(.985 0 0);--sidebar-accent: oklch(.269 0 0);--sidebar-accent-foreground: oklch(.985 0 0);--sidebar-border: oklch(.269 0 0);--sidebar-ring: oklch(.439 0 0)}html{font-size:var(--font-size);font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}@property --tw-translate-x{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-y{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-z{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-rotate-x{syntax: "*"; inherits: false; initial-value: rotateX(0);}@property --tw-rotate-y{syntax: "*"; inherits: false; initial-value: rotateY(0);}@property --tw-rotate-z{syntax: "*"; inherits: false; initial-value: rotateZ(0);}@property --tw-skew-x{syntax: "*"; inherits: false; initial-value: skewX(0);}@property --tw-skew-y{syntax: "*"; inherits: false; initial-value: skewY(0);}@property --tw-space-y-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false}@property --tw-shadow-alpha{syntax: ""; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false}@property --tw-inset-shadow-alpha{syntax: ""; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false}@property --tw-ring-offset-width{syntax: ""; inherits: false; initial-value: 0;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}:root,:host{--ddn-bg: #f8fafc;--ddn-surface: #ffffff;--ddn-surface-muted: #f1f5f9;--ddn-border: #e2e8f0;--ddn-border-strong: #cbd5e1;--ddn-text-primary: #0f172a;--ddn-text-secondary: #475569;--ddn-text-muted: #64748b;--ddn-primary: #2563eb;--ddn-primary-strong: #1d4ed8;--ddn-input-bg: #ffffff;--ddn-disabled-bg: #e2e8f0;--ddn-disabled-text: #94a3b8;--ddn-divider: #e2e8f0;--ddn-spinner: #94a3b8}[data-darkmode=true],:host([data-darkmode="true"]){--ddn-bg: #0f172a;--ddn-surface: #111827;--ddn-surface-muted: #1f2937;--ddn-border: #334155;--ddn-border-strong: #475569;--ddn-text-primary: #e5e7eb;--ddn-text-secondary: #cbd5e1;--ddn-text-muted: #94a3b8;--ddn-primary: #3b82f6;--ddn-primary-strong: #2563eb;--ddn-input-bg: #0b1220;--ddn-disabled-bg: #1f2937;--ddn-disabled-text: #64748b;--ddn-divider: #1f2937;--ddn-spinner: #cbd5e1}[data-darkmode=true],:host([data-darkmode="true"]){color:var(--ddn-text-primary)}[data-darkmode=true] .bg-slate-50,:host([data-darkmode="true"]) .bg-slate-50{background-color:var(--ddn-bg)!important}[data-darkmode=true] .bg-white,:host([data-darkmode="true"]) .bg-white{background-color:var(--ddn-surface)!important;color:var(--ddn-text-primary)}[data-darkmode=true] .border-slate-200,:host([data-darkmode="true"]) .border-slate-200,[data-darkmode=true] .border-slate-100,:host([data-darkmode="true"]) .border-slate-100{border-color:var(--ddn-border)!important}[data-darkmode=true] .border-slate-300,:host([data-darkmode="true"]) .border-slate-300{border-color:var(--ddn-border-strong)!important}[data-darkmode=true] .text-slate-800,:host([data-darkmode="true"]) .text-slate-800,[data-darkmode=true] .text-slate-700,:host([data-darkmode="true"]) .text-slate-700{color:var(--ddn-text-primary)!important}[data-darkmode=true] .text-slate-600,:host([data-darkmode="true"]) .text-slate-600,[data-darkmode=true] .text-slate-500,:host([data-darkmode="true"]) .text-slate-500{color:var(--ddn-text-secondary)!important}[data-darkmode=true] .text-slate-400,:host([data-darkmode="true"]) .text-slate-400{color:var(--ddn-text-muted)!important}[data-darkmode=true] .bg-blue-50,:host([data-darkmode="true"]) .bg-blue-50{background-color:#2563eb1f!important;color:var(--ddn-text-primary)}[data-darkmode=true] .bg-emerald-50,:host([data-darkmode="true"]) .bg-emerald-50{background-color:#10b98124!important;color:var(--ddn-text-primary)}[data-darkmode=true] .bg-red-50,:host([data-darkmode="true"]) .bg-red-50{background-color:#f871711f!important;color:var(--ddn-text-primary)}[data-darkmode=true] .border-b,:host([data-darkmode="true"]) .border-b{border-color:var(--ddn-divider)!important}[data-darkmode=true] input,:host([data-darkmode="true"]) input,[data-darkmode=true] select,:host([data-darkmode="true"]) select,[data-darkmode=true] textarea,:host([data-darkmode="true"]) textarea{background-color:var(--ddn-input-bg);color:var(--ddn-text-primary)}[data-darkmode=true] .animate-spin,:host([data-darkmode="true"]) .animate-spin{border-color:var(--ddn-spinner)!important}',Nf=".ddnsto-host{padding:16px 20px;background-color:#f8fafc;border-radius:16px;overflow:hidden}.ddnsto-host[data-darkmode=true]{background-color:#0b1220}.ddnsto-host #app{display:block}",jf='.ddnsto-toggle-container{display:inline-flex;align-items:center}.ddnsto-toggle-switch{position:relative;display:inline-block;width:44px;height:22px;cursor:pointer}.ddnsto-toggle-switch input{opacity:0;width:0;height:0;position:absolute;inset:0;margin:0}.ddnsto-toggle-slider{position:absolute;cursor:pointer;inset:0;background-color:#e5e7eb;transition:.2s ease;border-radius:22px;border:1px solid #cbd5e1;box-shadow:0 1px 2px #0000000a inset}.ddnsto-toggle-slider:before{position:absolute;content:"";height:16px;width:16px;left:2px;top:2px;background-color:#fff;transition:.2s ease;border-radius:50%;box-shadow:0 1px 2px #0003}.ddnsto-toggle-switch input:checked+.ddnsto-toggle-slider{background-color:#3b82f6;border-color:#3b82f6}.ddnsto-toggle-switch input:checked+.ddnsto-toggle-slider:before{transform:translate(22px)}.ddnsto-toggle-switch input:focus-visible+.ddnsto-toggle-slider{box-shadow:0 0 0 3px #3b82f640}.ddnsto-toggle-switch input:disabled+.ddnsto-toggle-slider{opacity:.6;cursor:not-allowed}',zf=".ddnsto-btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding:.625rem 1.25rem;border-radius:.5rem;border:1px solid transparent;font-size:.875rem;font-weight:600;line-height:1.2;text-decoration:none;cursor:pointer;transition:background-color .15s ease,color .15s ease,box-shadow .15s ease,border-color .15s ease;user-select:none}.ddnsto-btn:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.ddnsto-btn-primary{background-color:var(--ddn-primary);color:#fff;border-color:var(--ddn-primary-strong);box-shadow:0 1px 2px #00000014}.ddnsto-btn-primary:hover:not(:disabled){background-color:var(--ddn-primary-strong)}.ddnsto-btn-primary:active:not(:disabled){background-color:#1e3a8a}.ddnsto-btn:disabled,.ddnsto-btn[aria-disabled=true]{background-color:var(--ddn-disabled-bg);border-color:var(--ddn-border);color:var(--ddn-disabled-text);cursor:not-allowed;box-shadow:none}.ddnsto-btn-icon{width:1rem;height:1rem}",Pf="ddnsto-theme",Tf=y=>{const E=y.match(/\d+/g);if(E&&E.length>=3)return{r:parseInt(E[0],10),g:parseInt(E[1],10),b:parseInt(E[2],10)};if(y.startsWith("#")){const d=y.replace("#","");if(d.length===3)return{r:parseInt(d[0]+d[0],16),g:parseInt(d[1]+d[1],16),b:parseInt(d[2]+d[2],16)};if(d.length===6)return{r:parseInt(d.slice(0,2),16),g:parseInt(d.slice(2,4),16),b:parseInt(d.slice(4,6),16)}}return null},Rf=()=>{try{const y=localStorage.getItem(Pf);if(y==="dark"||y==="light")return y}catch{}if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";try{const y=getComputedStyle(document.body).backgroundColor,E=Tf(y);if(E)return .2126*E.r+.7152*E.g+.0722*E.b<128?"dark":"light"}catch{}return"light"},bl=(y,E)=>{y&&(E==="dark"?y.setAttribute("data-darkmode","true"):y.removeAttribute("data-darkmode"))},jr={token:"",prefix:"",api_base:"/cgi-bin/luci",lang:"zh-cn",onboarding_base:"https://web.ddnsto.com/openwrt-bind"},zr=typeof window<"u"&&window.ddnstoConfig||{},Lf={token:zr.token??jr.token,prefix:zr.prefix??jr.prefix,api_base:zr.api_base??jr.api_base,lang:zr.lang??jr.lang,onboarding_base:zr.onboarding_base??jr.onboarding_base},gt=document.getElementById("root")||document.getElementById("app"),If=()=>{if(!document.head.querySelector("style[data-ddnsto-host]")){const y=document.createElement("style");y.setAttribute("data-ddnsto-host","true"),y.textContent=Nf,document.head.appendChild(y)}},Mf=gt?.hasAttribute("data-ddnsto-shadow")||gt?.dataset.shadow==="true";let Ui=gt;const Ul=typeof window<"u"?Rf():"light";if(gt){If();const y=`${Cf} + */const vf=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],Vu=Gt("smartphone",vf);function yf(){return m.jsx("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:m.jsx("div",{className:"flex items-start",children:m.jsxs("div",{className:"flex-1",children:[m.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[m.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-50 flex items-center justify-center",children:m.jsx(Bu,{className:"w-6 h-6 text-blue-600"})}),m.jsx("h2",{className:"text-slate-800",children:"DDNSTO 远程访问"})]}),m.jsx("p",{className:"text-slate-600 text-sm mb-2",children:"DDNSTO 远程访问,不需要公网 IP、不需要开放端口。只需一个链接,即可从任何地方安全访问您的 NAS、路由器和桌面。"}),m.jsxs("a",{href:"https://www.ddnsto.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-blue-600 hover:underline",children:["了解更多",m.jsx(Al,{className:"w-3 h-3"})]})]})})})}function wf({isRunning:y,isConfigured:E,hostname:d,address:U,deviceId:T,version:L,featEnabled:B,tunnelOk:G,onRefreshStatus:A}){const[Q,Z]=C.useState(!1),W={label:y?"运行中":"已停止",bgColor:y?"bg-green-100":"bg-slate-200",textColor:y?"text-green-700":"text-slate-600"},H=U&&U.trim().length>0?U:"未配置",q=Q,ae=G===!0,V=q?"检查中...":G===!0?"正常":G===!1?"无法连接服务器":"未知",Y=B==="1"||B===!0?"已开启":"未开启",we=T||"-",ze=async()=>{if(A){Z(!0);try{await A()}finally{Z(!1)}}};return m.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[m.jsx("h3",{className:"text-slate-800 mb-4",children:"运行状态"}),m.jsxs("div",{className:"flex items-center justify-between pb-6 border-b border-slate-100",children:[m.jsxs("div",{className:"flex items-center gap-4",children:[m.jsx("span",{className:`px-3 py-1 rounded-full text-sm ${W.bgColor} ${W.textColor}`,children:W.label}),E&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-sm text-slate-500",children:"远程访问域名:"}),U&&U.trim().length>0?m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("a",{href:H,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-blue-600 hover:underline flex items-center gap-1",children:[H,m.jsx(Al,{className:"w-3 h-3"})]}),m.jsx("span",{className:"text-xs text-amber-600",title:"如域名已失效,请重新运行快速向导",children:"(如失效请重新运行快速向导)"})]}):m.jsx("span",{className:"text-sm text-slate-500",children:H})]})]}),m.jsx("div",{className:"flex items-center gap-2",children:m.jsxs("button",{onClick:ze,className:"px-3 py-2 rounded-md text-blue-600 text-sm hover:bg-blue-50 transition-colors flex items-center gap-1",children:[m.jsx(hf,{className:"w-4 h-4"}),"刷新状态"]})})]}),m.jsx("div",{className:"mt-6",children:m.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-700",children:[m.jsx(Bu,{className:"w-4 h-4 text-slate-400"}),q&&m.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-slate-300 border-t-blue-600 animate-spin"}),m.jsxs("h4",{className:"text-sm text-slate-700",children:["服务器连接:",ae?m.jsx("span",{className:"text-green-600",children:V}):m.jsx("span",{children:V}),"| 设备 ID:",we," | 拓展功能:",Y,L?` | 版本:${L}`:""]})]})})]})}function Qu({checked:y,onChange:E,label:d,id:U,disabled:T,containerClassName:L,...B}){return m.jsxs("div",{className:`ddnsto-toggle-container ${L||""}`,children:[d&&m.jsx("label",{htmlFor:U,className:"text-sm text-slate-700 mr-3 whitespace-nowrap",children:d}),m.jsxs("label",{className:"ddnsto-toggle-switch","aria-label":d||"toggle",children:[m.jsx("input",{id:U,type:"checkbox",checked:y,disabled:T,onChange:G=>E(G.target.checked),...B}),m.jsx("span",{className:"ddnsto-toggle-slider","aria-hidden":!0})]})]})}function kf({onSave:y,isInTab:E,token:d,enabled:U,advancedConfig:T,onRegisterSave:L,onTokenChange:B,onEnabledChange:G}){const[A,Q]=C.useState(d||""),[Z,W]=C.useState(U);C.useEffect(()=>{Q(d||"")},[d]),C.useEffect(()=>{W(U)},[T,U]);const H=()=>{A.trim()&&y(A,Z?"1":"0",T)};return C.useEffect(()=>{L&&L(()=>H())},[L,A,Z,T]),m.jsxs("div",{className:E?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!E&&m.jsxs(m.Fragment,{children:[m.jsx("h3",{className:"text-slate-800 mb-2",children:"手动配置"}),m.jsx("p",{className:"text-xs text-slate-400 mb-6",children:"如果您已经在 DDNSTO 控制台获取了令牌,可以直接在此填写并启动插件。"})]}),m.jsxs("div",{className:"space-y-5",children:[m.jsx("div",{className:"pb-4",children:m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h4",{className:"text-sm text-slate-700",children:"启用 DDNSTO"}),m.jsx(Qu,{checked:Z,onChange:q=>{W(q),G?.(q)},"aria-label":"启用 DDNSTO",containerClassName:"ml-6"})]})}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[m.jsxs("label",{className:"text-sm text-slate-700",children:["用户令牌(Token) ",m.jsx("span",{className:"text-red-500",children:"*"})]}),m.jsxs("a",{href:"https://doc.ddnsto.com/zh/guide/ddnsto/quickstart/",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline flex items-center gap-1",children:["如何查看用户令牌",m.jsx(Al,{className:"w-3 h-3"})]})]}),m.jsx("div",{className:"relative",children:m.jsx("input",{type:"text",value:A,onChange:q=>{Q(q.target.value),B?.(q.target.value)},placeholder:"请输入您的 DDNSTO 令牌",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})}),m.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"令牌将保存在路由器本地,请勿泄露。"})]})]})]})}function xf({token:y,enabled:E,advancedConfig:d,onSave:U,isInTab:T,onRegisterSave:L}){const[B,G]=C.useState(d.feat_enabled==="1"),A=K=>K.feat_disk_path_selected?K.feat_disk_path_selected:K.mounts&&K.mounts.length>0?K.mounts[0]:"",[Q,Z]=C.useState(A(d)),[W,H]=C.useState(d.feat_port||"3033"),[q,ae]=C.useState(d.feat_username||"ddnsto"),[V,Y]=C.useState(d.feat_password||""),[we,ze]=C.useState(!1),[ke,fe]=C.useState(d.index||"");C.useEffect(()=>{G(d.feat_enabled==="1"),Z(A(d)),d.feat_port&&H(d.feat_port),d.feat_username&&ae(d.feat_username),d.feat_password&&Y(d.feat_password),d.index!==void 0&&fe(d.index)},[d]);const Ce=()=>{U(y,E?"1":"0",{feat_enabled:B?"1":"0",feat_port:W,feat_username:q,feat_password:V,feat_disk_path_selected:Q,mounts:d.mounts,index:ke})};return C.useEffect(()=>{L&&L(()=>Ce())},[L,y,E,B,Q,W,q,V,ke,d.mounts]),m.jsxs("div",{className:T?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!T&&m.jsx("h3",{className:"text-slate-800 mb-4",children:"高级功能"}),m.jsxs("div",{className:"space-y-5",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-700 mb-2",children:"设备编号(可选)"}),m.jsx("input",{type:"text",value:ke,onChange:K=>fe(K.target.value),placeholder:"",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"}),m.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"如有多台设备id重复,请修改此编号(0~100),正常情况不需要修改"})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("h4",{className:"text-sm text-slate-700",children:"启用拓展功能"}),m.jsx(Qu,{checked:B,onChange:K=>G(K),"aria-label":"启用拓展功能",containerClassName:"ml-6"})]}),m.jsxs("div",{className:"flex items-center gap-2 -mt-2",children:[m.jsx("p",{className:"text-xs text-slate-400",children:"启用后可支持控制台的「文件管理」及「远程开机」功能"}),m.jsxs("a",{href:"https://doc.ddnsto.com/zh/guide/ddnsto/scenarios/file-management.html",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline flex items-center gap-1 whitespace-nowrap",children:["查看教程",m.jsx(Al,{className:"w-3 h-3"})]})]}),B&&m.jsxs("div",{className:"space-y-4",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(ff,{className:"w-4 h-4 text-slate-600"}),m.jsx("h5",{className:"text-sm text-slate-700",children:"WebDAV 服务配置"})]}),m.jsxs("div",{className:"space-y-4 pl-6",children:[m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"可访问的文件目录"}),m.jsx("select",{value:Q,onChange:K=>Z(K.target.value),className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white",children:d.mounts&&d.mounts.length>0?d.mounts.map(K=>m.jsx("option",{value:K,children:K},K)):m.jsx("option",{value:"",disabled:!0,children:"未检测到挂载点"})}),m.jsx("p",{className:"text-xs text-slate-400 mt-1",children:"控制台上的文件管理将只能看到此目录及其子目录。"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"服务端口"}),m.jsx("input",{type:"text",value:W,onChange:K=>H(K.target.value),placeholder:"3033",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"授权用户名"}),m.jsx("input",{type:"text",value:q,onChange:K=>ae(K.target.value),placeholder:"ddnsto",className:"w-full px-3 py-2 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"block text-sm text-slate-600 mb-2",children:"授权用户密码"}),m.jsxs("div",{className:"relative",children:[m.jsx("input",{type:we?"text":"password",value:V,onChange:K=>Y(K.target.value),placeholder:"设置访问密码",className:"w-full px-3 py-2 pr-10 border border-slate-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"}),m.jsx("button",{type:"button",onClick:()=>ze(!we),className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600",children:we?m.jsx(sf,{className:"w-4 h-4"}):m.jsx(cf,{className:"w-4 h-4"})})]})]})]})]})]})]})}function Sf({ddnstoToken:y,ddnstoEnabled:E,advancedConfig:d,onSave:U,saveBanner:T}){const[L,B]=C.useState("basic"),G=C.useRef(null),A=C.useRef(),Q=C.useRef(),[Z,W]=C.useState(y||""),[H,q]=C.useState(E==="1");C.useEffect(()=>{W(y||"")},[y]),C.useEffect(()=>{q(E==="1")},[E]);const ae=()=>{L==="basic"?A.current?.():Q.current?.()};return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 mb-4",children:[m.jsx("div",{className:"border-b border-slate-200 px-6",children:m.jsx("div",{className:"flex items-center justify-between",children:m.jsxs("div",{className:"flex items-center -mb-px",children:[m.jsx("button",{onClick:()=>B("basic"),className:`px-4 py-4 text-sm border-b-2 transition-colors ${L==="basic"?"border-blue-600 text-blue-600":"border-transparent text-slate-600 hover:text-slate-800"}`,children:"基础配置"}),m.jsx("button",{onClick:()=>B("advanced"),className:`px-4 py-4 text-sm border-b-2 transition-colors ${L==="advanced"?"border-blue-600 text-blue-600":"border-transparent text-slate-600 hover:text-slate-800"}`,children:"高级功能"})]})})}),m.jsxs("div",{ref:G,className:"p-6",children:[L==="basic"&&m.jsx(kf,{token:Z,enabled:H,advancedConfig:d,onSave:U,isInTab:!0,onRegisterSave:V=>{A.current=V},onTokenChange:W,onEnabledChange:q}),L==="advanced"&&m.jsx(xf,{token:Z,enabled:H,advancedConfig:d,onSave:U,isInTab:!0,onRegisterSave:V=>{Q.current=V}})]})]}),m.jsx("div",{className:"flex justify-end gap-3 mt-4",children:m.jsxs("button",{onClick:ae,disabled:!Z.trim(),className:"ddnsto-btn ddnsto-btn-primary",children:[m.jsx(gf,{className:"ddnsto-btn-icon"}),"保存配置并应用"]})}),T.state!=="idle"&&m.jsxs("div",{className:["mt-2 rounded-md border px-3 py-2 text-sm",T.state==="loading"?"bg-blue-50 border-blue-200 text-blue-800":"",T.state==="success"?"bg-emerald-50 border-emerald-200 text-emerald-800":"",T.state==="error"?"bg-red-50 border-red-200 text-red-800":""].join(" "),children:[m.jsx("div",{className:"font-medium",children:T.message}),T.description&&m.jsx("div",{className:"text-xs mt-1 opacity-80 break-words",children:T.description})]})]})}const bn={auth:0,starting:1,binding:2,domain:3,checking:4};function _f({apiBase:y,csrfToken:E,deviceId:d,onboardingBase:U,onComplete:T,onRefreshStatus:L,isInTab:B}){const[G,A]=C.useState(!1),[Q,Z]=C.useState(U||"https://www.kooldns.cn/bind"),[W,H]=C.useState(`${U||"https://www.kooldns.cn/bind"}/#/auth?send=1&source=openwrt&callback=*`),[q,ae]=C.useState("auth"),[V,Y]=C.useState(d||""),[we,ze]=C.useState(""),[ke,fe]=C.useState(""),[Ce,K]=C.useState(!1),[Re,he]=C.useState(null),xe=C.useRef("auth"),ue=E||(typeof window<"u"?window.ddnstoCsrfToken:""),Qe=C.useCallback(g=>{ae(u=>bn[g]>bn[u]?g:u)},[]);C.useEffect(()=>{xe.current=q},[q]),C.useEffect(()=>{console.log("Onboarding iframe url:",W)},[W]);const Le=C.useCallback(()=>{ae("auth"),ze(""),fe(""),he(null),Y(d||""),H(`${Q}/#/auth?send=1&source=openwrt&callback=*`)},[Qe,d,Q]);C.useEffect(()=>{const g="/#/auth?send=1&source=openwrt&callback=*",u=U||"https://www.kooldns.cn/bind";Z(u),H(`${u}${g}`)},[U]),C.useEffect(()=>{Y(d||"")},[d]);const me=C.useCallback(async()=>{for(let v=0;v<20;v+=1){const M=await fetch(`${y}/admin/services/ddnsto/api/status`,{credentials:"same-origin"});if(M.ok){const X=(await M.json())?.data||{},O=X.deviceId||X.device_id||"";if(O&&Y(O),X.running)return{running:!0,deviceId:O}}await new Promise(b=>setTimeout(b,2e3))}throw new Error("ddnsto not running")},[y]),ge=C.useCallback(async g=>{const u={url:g};ue&&(u.token=ue);const v=await fetch(`${y}/admin/services/ddnsto/api/onboarding/address`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",...ue?{"X-LuCI-Token":ue}:{}},body:JSON.stringify(u)});if(!v.ok)throw new Error(`HTTP ${v.status}`);const M=await v.json();if(!M?.ok)throw new Error(M?.error||"save address failed")},[y,ue]),Ie=C.useCallback(async(g,u)=>{K(!0),he(null);const v=V||d||"",M=`${Q}/#/bind?status=starting&token=${encodeURIComponent(g)}&sign=${encodeURIComponent(u)}${v?`&routerId=${encodeURIComponent(v)}`:""}`;H(M),Qe("starting");try{const b=await fetch(`${y}/admin/services/ddnsto/api/onboarding/start`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json",...ue?{"X-LuCI-Token":ue}:{}},body:JSON.stringify({token:g})});if(!b.ok)throw new Error(`HTTP ${b.status}`);const X=await b.json();if(!X?.ok)throw new Error(X?.error||"start failed");L&&await L();const re=(await me())?.deviceId||V||d||"";if(bn[xe.current]>=bn.domain)return;const ee=`${Q}/#/bind?status=starting&routerId=${encodeURIComponent(re)}&token=${encodeURIComponent(g)}&sign=${encodeURIComponent(u)}`;H(ee),Qe("binding"),Y(re)}catch{he("启动失败,请稍后重试")}finally{K(!1)}},[Qe,y,d,ue,Q,L,me,Le,V]),Ne=C.useCallback(g=>{const u=g||V;if(!we||!ke||!u)return;const v=`${Q}/#/domain?sign=${encodeURIComponent(ke)}&token=${encodeURIComponent(we)}&routerId=${encodeURIComponent(u)}&netaddr=127.0.0.1&source=openwrt`;H(v),ae("domain")},[ke,we,Q,V]),ie=C.useCallback(async g=>{H(`${Q}/#/check?url=${encodeURIComponent(g)}`),ae("checking"),T();try{await ge(g),L&&await L()}catch{he("保存域名失败,请重试")}},[Q,T,L,ge]),x=C.useCallback(()=>{A(!0),Le()},[Le]);C.useEffect(()=>{const g=u=>{if(!G)return;console.log("Onboarding message:",u.data);const v=u.data;let M=v;if(typeof v=="string")try{M=JSON.parse(v)}catch{return}if(!M||typeof M!="object")return;const b=M.data,O=b&&typeof b=="object"?b:M;if((typeof O.auth=="string"?O.auth:"")!=="ddnsto")return;const ee=typeof O.sign=="string"?O.sign:"",oe=typeof O.token=="string"?O.token:"",Ue=typeof O.step=="string"?O.step:"",fn=typeof O.status=="string"?O.status:"",Un=typeof O.url=="string"?O.url:"",Tt=O.success,An=typeof Tt=="number"?Tt:Number(Tt);if(ee&&oe&&q==="auth"&&!Ce){ze(oe),fe(ee),Ie(oe,ee);return}if(Ue==="bind"&&fn==="success"){const Zt=typeof O.router_uid=="string"?O.router_uid:V;Zt&&Y(Zt),Ne(Zt);return}Ue==="domain"&&Un&&An===0&&bn[xe.current]window.removeEventListener("message",g)},[Ne,ie,Ce,Ie,G,q]);const I=()=>m.jsx("div",{className:"flex items-center justify-between mb-6",children:m.jsx("h3",{className:"text-slate-800",children:"快速向导"})});return G?m.jsxs("div",{className:B?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!B&&I(),m.jsx("div",{className:"rounded-lg border border-slate-200 overflow-hidden",children:m.jsx("iframe",{src:W,title:"快速向导",className:"w-full",style:{width:"100%",height:"70vh",maxHeight:"400px",border:0},loading:"lazy"})})]}):m.jsxs("div",{className:B?"":"bg-white rounded-lg border border-slate-200 p-6 mb-4",children:[!B&&I(),m.jsxs("div",{className:"text-center py-8",children:[m.jsx("div",{className:"mb-4 flex justify-center",children:m.jsx("div",{className:"w-16 h-16 rounded-full bg-blue-50 flex items-center justify-center",children:m.jsx(Vu,{className:"w-8 h-8 text-blue-600"})})}),m.jsx("h4",{className:"text-slate-800 mb-2",children:"欢迎使用 DDNSTO!"}),m.jsx("p",{className:"text-sm text-slate-600 mb-6 max-w-md mx-auto",children:"通过微信扫码登录,我们将引导您完成插件配置"}),m.jsxs("button",{onClick:x,className:"ddnsto-btn ddnsto-btn-primary",children:[m.jsx(Vu,{className:"ddnsto-btn-icon"}),"开始配置"]})]})]})}function Ef({config:y}){const[E,d]=C.useState(!1),[U,T]=C.useState(!1),[L,B]=C.useState("OpenWrt"),[G,A]=C.useState(""),[Q,Z]=C.useState(""),[W,H]=C.useState(""),[q,ae]=C.useState(""),[V,Y]=C.useState("1"),[we,ze]=C.useState({feat_enabled:"0",feat_port:"",feat_username:"",feat_password:"",feat_disk_path_selected:"",mounts:[],index:""}),[,ke]=C.useState(null),[fe,Ce]=C.useState(null),[K,Re]=C.useState({state:"idle",message:""}),he=C.useRef(),xe=(y?.api_base||"/cgi-bin/luci").replace(/\/$/,""),ue=y?.token||"",Qe=(y?.onboarding_base||"https://www.kooldns.cn/bind").replace(/\/$/,""),Le=C.useCallback((x,I,g,u)=>{he.current&&window.clearTimeout(he.current),Re({state:x,message:I,description:g}),u&&(he.current=window.setTimeout(()=>{Re({state:"idle",message:""})},u))},[]);C.useEffect(()=>()=>{he.current&&window.clearTimeout(he.current)},[]);const me=C.useCallback(async()=>{try{const x=await fetch(`${xe}/admin/services/ddnsto/api/config`,{credentials:"same-origin"});if(!x.ok)throw new Error(`HTTP ${x.status}`);const g=(await x.json())?.data||{};g.address&&A(g.address),g.device_id!==void 0?Z(g.device_id):g.deviceId!==void 0&&Z(g.deviceId),g.version!==void 0&&H(g.version),g.token&&ae(g.token),g.enabled!==void 0&&Y(g.enabled),ze({feat_enabled:g.feat_enabled||"0",feat_port:g.feat_port||"",feat_username:g.feat_username||"",feat_password:g.feat_password||"",feat_disk_path_selected:g.feat_disk_path_selected||"",mounts:g.mounts||[],index:g.index||""})}catch(x){console.error("Failed to fetch ddnsto config",x)}},[xe]),ge=C.useCallback(async()=>{try{const x=await fetch(`${xe}/admin/services/ddnsto/api/status`,{credentials:"same-origin"});if(!x.ok)throw new Error(`HTTP ${x.status}`);const g=(await x.json())?.data||{};d(!!g.running),g.token_set&&T(!0),g.hostname&&B(g.hostname),g.device_id!==void 0?Z(g.device_id):g.deviceId!==void 0&&Z(g.deviceId),g.address&&A(g.address),g.version!==void 0&&H(g.version),ke(null)}catch(x){console.error("Failed to fetch ddnsto status",x),ke("无法获取运行状态")}},[xe]),Ie=C.useCallback(async()=>{try{const x=await fetch(`${xe}/admin/services/ddnsto/api/connectivity`,{credentials:"same-origin"});if(!x.ok)throw new Error(`HTTP ${x.status}`);const g=(await x.json())?.data||{};g.tunnel_ok!==void 0&&g.tunnel_ok!==null?Ce(g.tunnel_ok===!0):Ce(null)}catch(x){console.error("Failed to fetch ddnsto connectivity",x),Ce(null)}},[xe]),Ne=C.useCallback(async()=>{await me(),await ge(),await Ie()},[me,ge,Ie]),ie=C.useCallback(async(x,I,g)=>{Le("loading","正在保存配置...","正在将配置写入路由器,请稍候");try{const u=new URLSearchParams;ue&&u.append("token",ue),u.append("ddnsto_token",x),u.append("enabled",I),u.append("feat_enabled",g.feat_enabled),u.append("feat_port",g.feat_port),u.append("feat_username",g.feat_username),u.append("feat_password",g.feat_password),u.append("feat_disk_path_selected",g.feat_disk_path_selected),u.append("index",g.index||"");const v=await fetch(`${xe}/admin/services/ddnsto/api/config`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded",...ue?{"X-LuCI-Token":ue}:{}},body:u});if(!v.ok)throw new Error(`HTTP ${v.status}`);const M=await v.json();if(!M?.ok)throw new Error(M?.error||"Save failed");Le("success","配置已保存并生效",void 0,3e3),T(!0),await me(),await ge()}catch(u){console.error("Failed to save config",u);const v=u instanceof Error?u.message:String(u);Le("error","保存失败,请重试",v,4e3)}},[xe,ue,me,ge]);return C.useEffect(()=>{me(),ge(),Ie()},[me,ge,Ie]),C.useEffect(()=>{const x=window.setInterval(ge,5e3);return()=>{window.clearInterval(x)}},[ge]),m.jsx("div",{className:"min-h-screen bg-slate-50",children:m.jsx("main",{children:m.jsxs("div",{className:"max-w-5xl mx-auto px-6 py-8",children:[m.jsx(yf,{}),m.jsx(wf,{isRunning:E,isConfigured:U,hostname:L,address:G,deviceId:Q,version:W,featEnabled:we.feat_enabled,tunnelOk:fe,onRefreshStatus:Ne}),m.jsx(_f,{apiBase:xe,csrfToken:ue,deviceId:Q,onboardingBase:Qe,onRefreshStatus:Ne,onComplete:()=>T(!0)}),m.jsx(Sf,{ddnstoToken:q,ddnstoEnabled:V,advancedConfig:we,onSave:ie,saveBanner:K})]})})})}const Cf='/*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */*,:before,:after,::backdrop{--tw-border-style: solid}@layer properties{@supports (((-webkit-hyphens: none)) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x: 0;--tw-translate-y: 0;--tw-translate-z: 0;--tw-rotate-x: rotateX(0);--tw-rotate-y: rotateY(0);--tw-rotate-z: rotateZ(0);--tw-skew-x: skewX(0);--tw-skew-y: skewY(0);--tw-space-y-reverse: 0;--tw-border-style: solid;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000}}}@layer theme{:root,:host{--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-500: oklch(.637 .237 25.331);--color-amber-50: oklch(.987 .022 95.277);--color-amber-200: oklch(.924 .12 95.746);--color-amber-600: oklch(.666 .179 58.318);--color-green-50: oklch(.982 .018 155.826);--color-green-100: oklch(.962 .044 156.743);--color-green-200: oklch(.925 .084 155.995);--color-green-600: oklch(.627 .194 149.214);--color-green-700: oklch(.527 .154 150.069);--color-green-800: oklch(.448 .119 151.328);--color-blue-50: oklch(.97 .014 254.604);--color-blue-200: oklch(.882 .059 254.128);--color-blue-500: oklch(.623 .214 259.815);--color-blue-600: oklch(.546 .245 262.881);--color-blue-700: oklch(.488 .243 264.376);--color-slate-50: oklch(.984 .003 247.858);--color-slate-100: oklch(.968 .007 247.896);--color-slate-200: oklch(.929 .013 255.508);--color-slate-300: oklch(.869 .022 252.894);--color-slate-400: oklch(.704 .04 256.788);--color-slate-500: oklch(.554 .046 257.417);--color-slate-600: oklch(.446 .043 257.281);--color-slate-700: oklch(.372 .044 257.287);--color-slate-800: oklch(.279 .041 260.031);--color-white: #fff;--spacing: .25rem;--container-md: 28rem;--container-5xl: 64rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-base: 1rem;--text-lg: 1.125rem;--text-xl: 1.25rem;--text-2xl: 1.5rem;--font-weight-normal: 400;--font-weight-medium: 500;--default-transition-duration: .15s;--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);--default-font-family: var(--font-sans);--default-font-feature-settings: var(--font-sans--font-feature-settings);--default-font-variation-settings: var(--font-sans--font-variation-settings);--default-mono-font-family: var(--font-mono);--default-mono-font-feature-settings: var(--font-mono--font-feature-settings);--default-mono-font-variation-settings: var(--font-mono--font-variation-settings)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1;color:currentColor}@supports (color: color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentColor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}body{background-color:var(--background);color:var(--foreground)}*{border-color:var(--border);outline-color:var(--ring)}@supports (color: color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring) 50%,transparent)}}body{background-color:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h1{font-size:var(--text-2xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h2{font-size:var(--text-xl);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h3{font-size:var(--text-lg);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) h4,:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) label,:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) button{font-size:var(--text-base);font-weight:var(--font-weight-medium);line-height:1.5}:where(:not(:has([class*=" text-"]),:not(:has([class^=text-])))) input{font-size:var(--text-base);font-weight:var(--font-weight-normal);line-height:1.5}}@layer utilities{.absolute{position:absolute}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.right-2{right:calc(var(--spacing) * 2)}.z-10{z-index:10}.-mx-4{margin-inline:calc(var(--spacing) * -4)}.mx-auto{margin-inline:auto}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-6{margin-top:calc(var(--spacing) * 6)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.block{display:block}.flex{display:flex}.grid{display:grid}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-3{height:calc(var(--spacing) * 3)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-8{height:calc(var(--spacing) * 8)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-16{height:calc(var(--spacing) * 16)}.h-40{height:calc(var(--spacing) * 40)}.min-h-screen{min-height:100vh}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-8{width:calc(var(--spacing) * 8)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-12{width:calc(var(--spacing) * 12)}.w-16{width:calc(var(--spacing) * 16)}.w-40{width:calc(var(--spacing) * 40)}.w-full{width:100%}.max-w-5xl{max-width:var(--container-5xl)}.max-w-md{max-width:var(--container-md)}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.translate-x-1{--tw-translate-x: calc(var(--spacing) * 1);translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-6{--tw-translate-x: calc(var(--spacing) * 6);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x) var(--tw-rotate-y) var(--tw-rotate-z) var(--tw-skew-x) var(--tw-skew-y)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.grid-rows-8{grid-template-rows:repeat(8,minmax(0,1fr))}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-8{gap:calc(var(--spacing) * 8)}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-8{column-gap:calc(var(--spacing) * 8)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-600{border-color:var(--color-blue-600)}.border-green-200{border-color:var(--color-green-200)}.border-slate-100{border-color:var(--color-slate-100)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-transparent{border-color:#0000}.bg-amber-50{background-color:var(--color-amber-50)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-600{background-color:var(--color-green-600)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-200{background-color:var(--color-slate-200)}.bg-slate-300{background-color:var(--color-slate-300)}.bg-slate-800{background-color:var(--color-slate-800)}.bg-white{background-color:var(--color-white)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-6{padding:calc(var(--spacing) * 6)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-6{padding-top:calc(var(--spacing) * 6)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pl-7{padding-left:calc(var(--spacing) * 7)}.text-center{text-align:center}.text-right{text-align:right}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-red-500{color:var(--color-red-500)}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-white{color:var(--color-white)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}@media(hover:hover){.hover\\:bg-blue-50:hover{background-color:var(--color-blue-50)}}@media(hover:hover){.hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}}@media(hover:hover){.hover\\:bg-green-700:hover{background-color:var(--color-green-700)}}@media(hover:hover){.hover\\:bg-slate-50:hover{background-color:var(--color-slate-50)}}@media(hover:hover){.hover\\:text-slate-600:hover{color:var(--color-slate-600)}}@media(hover:hover){.hover\\:text-slate-800:hover{color:var(--color-slate-800)}}@media(hover:hover){.hover\\:underline:hover{text-decoration-line:underline}}.focus\\:ring-2:focus{--tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-blue-500:focus{--tw-ring-color: var(--color-blue-500)}.focus\\:outline-none:focus{--tw-outline-style: none;outline-style:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:bg-slate-300:disabled{background-color:var(--color-slate-300)}}:root,:host{--font-size: 16px;--background: #fff;--foreground: oklch(.145 0 0);--card: #fff;--card-foreground: oklch(.145 0 0);--popover: oklch(1 0 0);--popover-foreground: oklch(.145 0 0);--primary: #030213;--primary-foreground: oklch(1 0 0);--secondary: oklch(.95 .0058 264.53);--secondary-foreground: #030213;--muted: #ececf0;--muted-foreground: #717182;--accent: #e9ebef;--accent-foreground: #030213;--destructive: #d4183d;--destructive-foreground: #fff;--border: #0000001a;--input: transparent;--input-background: #f3f3f5;--switch-background: #cbced4;--font-weight-medium: 500;--font-weight-normal: 400;--ring: oklch(.708 0 0);--chart-1: oklch(.646 .222 41.116);--chart-2: oklch(.6 .118 184.704);--chart-3: oklch(.398 .07 227.392);--chart-4: oklch(.828 .189 84.429);--chart-5: oklch(.769 .188 70.08);--radius: .625rem;--sidebar: oklch(.985 0 0);--sidebar-foreground: oklch(.145 0 0);--sidebar-primary: #030213;--sidebar-primary-foreground: oklch(.985 0 0);--sidebar-accent: oklch(.97 0 0);--sidebar-accent-foreground: oklch(.205 0 0);--sidebar-border: oklch(.922 0 0);--sidebar-ring: oklch(.708 0 0)}.dark{--background: oklch(.145 0 0);--foreground: oklch(.985 0 0);--card: oklch(.145 0 0);--card-foreground: oklch(.985 0 0);--popover: oklch(.145 0 0);--popover-foreground: oklch(.985 0 0);--primary: oklch(.985 0 0);--primary-foreground: oklch(.205 0 0);--secondary: oklch(.269 0 0);--secondary-foreground: oklch(.985 0 0);--muted: oklch(.269 0 0);--muted-foreground: oklch(.708 0 0);--accent: oklch(.269 0 0);--accent-foreground: oklch(.985 0 0);--destructive: oklch(.396 .141 25.723);--destructive-foreground: oklch(.637 .237 25.331);--border: oklch(.269 0 0);--input: oklch(.269 0 0);--ring: oklch(.439 0 0);--font-weight-medium: 500;--font-weight-normal: 400;--chart-1: oklch(.488 .243 264.376);--chart-2: oklch(.696 .17 162.48);--chart-3: oklch(.769 .188 70.08);--chart-4: oklch(.627 .265 303.9);--chart-5: oklch(.645 .246 16.439);--sidebar: oklch(.205 0 0);--sidebar-foreground: oklch(.985 0 0);--sidebar-primary: oklch(.488 .243 264.376);--sidebar-primary-foreground: oklch(.985 0 0);--sidebar-accent: oklch(.269 0 0);--sidebar-accent-foreground: oklch(.985 0 0);--sidebar-border: oklch(.269 0 0);--sidebar-ring: oklch(.439 0 0)}html{font-size:var(--font-size);font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}@property --tw-translate-x{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-y{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-z{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-rotate-x{syntax: "*"; inherits: false; initial-value: rotateX(0);}@property --tw-rotate-y{syntax: "*"; inherits: false; initial-value: rotateY(0);}@property --tw-rotate-z{syntax: "*"; inherits: false; initial-value: rotateZ(0);}@property --tw-skew-x{syntax: "*"; inherits: false; initial-value: skewX(0);}@property --tw-skew-y{syntax: "*"; inherits: false; initial-value: skewY(0);}@property --tw-space-y-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false}@property --tw-shadow-alpha{syntax: ""; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false}@property --tw-inset-shadow-alpha{syntax: ""; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false}@property --tw-ring-offset-width{syntax: ""; inherits: false; initial-value: 0;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}:root,:host{--ddn-bg: #f8fafc;--ddn-surface: #ffffff;--ddn-surface-muted: #f1f5f9;--ddn-border: #e2e8f0;--ddn-border-strong: #cbd5e1;--ddn-text-primary: #0f172a;--ddn-text-secondary: #475569;--ddn-text-muted: #64748b;--ddn-primary: #2563eb;--ddn-primary-strong: #1d4ed8;--ddn-input-bg: #ffffff;--ddn-disabled-bg: #e2e8f0;--ddn-disabled-text: #94a3b8;--ddn-divider: #e2e8f0;--ddn-spinner: #94a3b8}[data-darkmode=true],:host([data-darkmode="true"]){--ddn-bg: #0f172a;--ddn-surface: #111827;--ddn-surface-muted: #1f2937;--ddn-border: #334155;--ddn-border-strong: #475569;--ddn-text-primary: #e5e7eb;--ddn-text-secondary: #cbd5e1;--ddn-text-muted: #94a3b8;--ddn-primary: #3b82f6;--ddn-primary-strong: #2563eb;--ddn-input-bg: #0b1220;--ddn-disabled-bg: #1f2937;--ddn-disabled-text: #64748b;--ddn-divider: #1f2937;--ddn-spinner: #cbd5e1}[data-darkmode=true],:host([data-darkmode="true"]){color:var(--ddn-text-primary)}[data-darkmode=true] .bg-slate-50,:host([data-darkmode="true"]) .bg-slate-50{background-color:var(--ddn-bg)!important}[data-darkmode=true] .bg-white,:host([data-darkmode="true"]) .bg-white{background-color:var(--ddn-surface)!important;color:var(--ddn-text-primary)}[data-darkmode=true] .border-slate-200,:host([data-darkmode="true"]) .border-slate-200,[data-darkmode=true] .border-slate-100,:host([data-darkmode="true"]) .border-slate-100{border-color:var(--ddn-border)!important}[data-darkmode=true] .border-slate-300,:host([data-darkmode="true"]) .border-slate-300{border-color:var(--ddn-border-strong)!important}[data-darkmode=true] .text-slate-800,:host([data-darkmode="true"]) .text-slate-800,[data-darkmode=true] .text-slate-700,:host([data-darkmode="true"]) .text-slate-700{color:var(--ddn-text-primary)!important}[data-darkmode=true] .text-slate-600,:host([data-darkmode="true"]) .text-slate-600,[data-darkmode=true] .text-slate-500,:host([data-darkmode="true"]) .text-slate-500{color:var(--ddn-text-secondary)!important}[data-darkmode=true] .text-slate-400,:host([data-darkmode="true"]) .text-slate-400{color:var(--ddn-text-muted)!important}[data-darkmode=true] .bg-blue-50,:host([data-darkmode="true"]) .bg-blue-50{background-color:#2563eb1f!important;color:var(--ddn-text-primary)}[data-darkmode=true] .bg-emerald-50,:host([data-darkmode="true"]) .bg-emerald-50{background-color:#10b98124!important;color:var(--ddn-text-primary)}[data-darkmode=true] .bg-red-50,:host([data-darkmode="true"]) .bg-red-50{background-color:#f871711f!important;color:var(--ddn-text-primary)}[data-darkmode=true] .border-b,:host([data-darkmode="true"]) .border-b{border-color:var(--ddn-divider)!important}[data-darkmode=true] input,:host([data-darkmode="true"]) input,[data-darkmode=true] select,:host([data-darkmode="true"]) select,[data-darkmode=true] textarea,:host([data-darkmode="true"]) textarea{background-color:var(--ddn-input-bg);color:var(--ddn-text-primary)}[data-darkmode=true] .animate-spin,:host([data-darkmode="true"]) .animate-spin{border-color:var(--ddn-spinner)!important}',Nf=".ddnsto-host{padding:16px 20px;background-color:#f8fafc;border-radius:16px;overflow:hidden}.ddnsto-host[data-darkmode=true]{background-color:#0b1220}.ddnsto-host #app{display:block}",jf='.ddnsto-toggle-container{display:inline-flex;align-items:center}.ddnsto-toggle-switch{position:relative;display:inline-block;width:44px;height:22px;cursor:pointer}.ddnsto-toggle-switch input{opacity:0;width:0;height:0;position:absolute;inset:0;margin:0}.ddnsto-toggle-slider{position:absolute;cursor:pointer;inset:0;background-color:#e5e7eb;transition:.2s ease;border-radius:22px;border:1px solid #cbd5e1;box-shadow:0 1px 2px #0000000a inset}.ddnsto-toggle-slider:before{position:absolute;content:"";height:16px;width:16px;left:2px;top:2px;background-color:#fff;transition:.2s ease;border-radius:50%;box-shadow:0 1px 2px #0003}.ddnsto-toggle-switch input:checked+.ddnsto-toggle-slider{background-color:#3b82f6;border-color:#3b82f6}.ddnsto-toggle-switch input:checked+.ddnsto-toggle-slider:before{transform:translate(22px)}.ddnsto-toggle-switch input:focus-visible+.ddnsto-toggle-slider{box-shadow:0 0 0 3px #3b82f640}.ddnsto-toggle-switch input:disabled+.ddnsto-toggle-slider{opacity:.6;cursor:not-allowed}',zf=".ddnsto-btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;padding:.625rem 1.25rem;border-radius:.5rem;border:1px solid transparent;font-size:.875rem;font-weight:600;line-height:1.2;text-decoration:none;cursor:pointer;transition:background-color .15s ease,color .15s ease,box-shadow .15s ease,border-color .15s ease;user-select:none}.ddnsto-btn:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.ddnsto-btn-primary{background-color:var(--ddn-primary);color:#fff;border-color:var(--ddn-primary-strong);box-shadow:0 1px 2px #00000014}.ddnsto-btn-primary:hover:not(:disabled){background-color:var(--ddn-primary-strong)}.ddnsto-btn-primary:active:not(:disabled){background-color:#1e3a8a}.ddnsto-btn:disabled,.ddnsto-btn[aria-disabled=true]{background-color:var(--ddn-disabled-bg);border-color:var(--ddn-border);color:var(--ddn-disabled-text);cursor:not-allowed;box-shadow:none}.ddnsto-btn-icon{width:1rem;height:1rem}",Pf="ddnsto-theme",Tf=y=>{const E=y.match(/\d+/g);if(E&&E.length>=3)return{r:parseInt(E[0],10),g:parseInt(E[1],10),b:parseInt(E[2],10)};if(y.startsWith("#")){const d=y.replace("#","");if(d.length===3)return{r:parseInt(d[0]+d[0],16),g:parseInt(d[1]+d[1],16),b:parseInt(d[2]+d[2],16)};if(d.length===6)return{r:parseInt(d.slice(0,2),16),g:parseInt(d.slice(2,4),16),b:parseInt(d.slice(4,6),16)}}return null},Rf=()=>{try{const y=localStorage.getItem(Pf);if(y==="dark"||y==="light")return y}catch{}if(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches)return"dark";try{const y=getComputedStyle(document.body).backgroundColor,E=Tf(y);if(E)return .2126*E.r+.7152*E.g+.0722*E.b<128?"dark":"light"}catch{}return"light"},bl=(y,E)=>{y&&(E==="dark"?y.setAttribute("data-darkmode","true"):y.removeAttribute("data-darkmode"))},jr={token:"",prefix:"",api_base:"/cgi-bin/luci",lang:"zh-cn",onboarding_base:"https://web.ddnsto.com/openwrt-bind"},zr=typeof window<"u"&&window.ddnstoConfig||{},Lf={token:zr.token??jr.token,prefix:zr.prefix??jr.prefix,api_base:zr.api_base??jr.api_base,lang:zr.lang??jr.lang,onboarding_base:zr.onboarding_base??jr.onboarding_base},gt=document.getElementById("root")||document.getElementById("app"),If=()=>{if(!document.head.querySelector("style[data-ddnsto-host]")){const y=document.createElement("style");y.setAttribute("data-ddnsto-host","true"),y.textContent=Nf,document.head.appendChild(y)}},Mf=gt?.hasAttribute("data-ddnsto-shadow")||gt?.dataset.shadow==="true";let Ui=gt;const Ul=typeof window<"u"?Rf():"light";if(gt){If();const y=`${Cf} ${jf} ${zf}`;if(Mf&>.attachShadow){const E=gt.shadowRoot||gt.attachShadow({mode:"open"});if(!E.querySelector("style[data-ddnsto-style]")){const d=document.createElement("style");d.setAttribute("data-ddnsto-style","true"),d.textContent=y,E.appendChild(d)}Ui=E,bl(gt,Ul),bl(gt.parentElement,Ul)}else{if(!document.head.querySelector("style[data-ddnsto-style]")){const E=document.createElement("style");E.setAttribute("data-ddnsto-style","true"),E.textContent=y,document.head.appendChild(E)}bl(gt,Ul),bl(gt.parentElement,Ul)}Ui&&qd.createRoot(Ui).render(m.jsx(Kd.StrictMode,{children:m.jsx(Ef,{config:Lf})}))} diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 49ef1ae65..e5165606b 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=26.5.11 -PKG_RELEASE:=129 +PKG_VERSION:=26.5.20 +PKG_RELEASE:=130 PKG_PO_VERSION:=$(PKG_VERSION) PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index 363866c12..4730c2742 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -78,6 +78,7 @@ if not arg_select_proto:find("_") then load_normal_options = true end +local netdev_list = api.get_network_devices() local node_list = api.get_node_list() local fallback_list = {} local is_balancer = nil @@ -273,8 +274,10 @@ end -- [[ 负载均衡 End ]] if load_iface_options then -- [[ 自定义接口 Start ]] o = s:option(Value, _n("iface"), translate("Interface")) - o.default = "eth1" o:depends({ [_n("protocol")] = "_iface" }) + for _, d in ipairs(netdev_list) do + o:value(d.name, d.label) + end end -- [[ 自定义接口 End ]] @@ -818,8 +821,7 @@ if not load_shunt_options then o3 = s:option(Value, _n("outbound_iface"), translate("Outbound Interface")) o3:depends({ [_n("chain_proxy")] = "3" }) o3:value("", translate("All")) - local iface = api.get_network_devices() - for _, d in ipairs(iface) do + for _, d in ipairs(netdev_list) do o3:value(d.name, d.label) end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index ada8094f8..c232b3c42 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -91,6 +91,7 @@ if not arg_select_proto:find("_") then load_normal_options = true end +local netdev_list = api.get_network_devices() local node_list = api.get_node_list() if load_urltest_options then -- [[ URLTest Start ]] @@ -196,8 +197,10 @@ end -- [[ URLTest End ]] if load_iface_options then -- [[ 自定义接口 Start ]] o = s:option(Value, _n("iface"), translate("Interface")) - o.default = "eth1" o:depends({ [_n("protocol")] = "_iface" }) + for _, d in ipairs(netdev_list) do + o:value(d.name, d.label) + end end @@ -836,8 +839,7 @@ if not load_shunt_options then o3 = s:option(Value, _n("outbound_iface"), translate("Outbound Interface")) o3:depends({ [_n("chain_proxy")] = "3" }) o3:value("", translate("All")) - local iface = api.get_network_devices() - for _, d in ipairs(iface) do + for _, d in ipairs(netdev_list) do o3:value(d.name, d.label) end diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua index ec45fac0c..f2545104d 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua @@ -483,8 +483,11 @@ o:depends({ [_n("outbound_node")] = "_socks"}) o:depends({ [_n("outbound_node")] = "_http"}) o = s:option(Value, _n("outbound_node_iface"), translate("Interface")) -o.default = "eth1" o:depends({ [_n("outbound_node")] = "_iface"}) +local netdev_list = api.get_network_devices() +for _, d in ipairs(netdev_list) do + o:value(d.name, d.label) +end o = s:option(TextValue, _n("custom_config"), translate("Custom Config")) o.rows = 10 diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua index 5fafd25ba..ce5766fcf 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua @@ -461,8 +461,11 @@ o:depends({ [_n("outbound_node")] = "_socks" }) o:depends({ [_n("outbound_node")] = "_http" }) o = s:option(Value, _n("outbound_node_iface"), translate("Interface")) -o.default = "eth1" o:depends({ [_n("outbound_node")] = "_iface" }) +local netdev_list = api.get_network_devices() +for _, d in ipairs(netdev_list) do + o:value(d.name, d.label) +end o = s:option(TextValue, _n("custom_config"), translate("Custom Config")) o.rows = 10 diff --git a/teleproxy/Makefile b/teleproxy/Makefile index d687edf9c..1088ae80b 100644 --- a/teleproxy/Makefile +++ b/teleproxy/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=teleproxy PKG_VERSION:=4.12.2 -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_MAINTAINER:=Kosntantine Shevlakov PKG_LICENSE:=GPLv2 @@ -10,7 +10,7 @@ PKG_LICENSE_FILES:=LICENSE PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/teleproxy/teleproxy.git -PKG_SOURCE_VERSION:=12a822ef794bab357772348d698dfef3a13487de +PKG_SOURCE_VERSION:=2f26609daf78765e09fcea8b0d906d9e2532faf9 PKG_SOURCE_SUBDIR:=$(PKG_NAME) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz