From 2b79dd1bab35da417a23ef6c1ce11f2964dd12be Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 07:48:04 +0800 Subject: [PATCH] update 05-11 07:48:04 --- luci-app-adguardhome/Makefile | 1 - .../resources/view/wizard/initsetup.js | 15 ++++++++ luci-app-wizard/root/etc/init.d/wizard | 34 ++++++++++++++++++- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/luci-app-adguardhome/Makefile b/luci-app-adguardhome/Makefile index db52e7627..db03e8acb 100644 --- a/luci-app-adguardhome/Makefile +++ b/luci-app-adguardhome/Makefile @@ -25,7 +25,6 @@ define Package/luci-app-adguardhome/conffiles /usr/share/AdGuardHome/links.txt /etc/config/AdGuardHome /etc/AdGuardHome.yaml -/etc/AdGuardHome.yaml endef define Package/luci-app-adguardhome/postinst diff --git a/luci-app-wizard/htdocs/luci-static/resources/view/wizard/initsetup.js b/luci-app-wizard/htdocs/luci-static/resources/view/wizard/initsetup.js index b790373a9..441f1374f 100644 --- a/luci-app-wizard/htdocs/luci-static/resources/view/wizard/initsetup.js +++ b/luci-app-wizard/htdocs/luci-static/resources/view/wizard/initsetup.js @@ -19,6 +19,11 @@ return view.extend({ render: function(data) { var m, s, o; + var has_wifi = false; + + if (uci.sections('wireless', 'wifi-device').length > 0) { + has_wifi = true; + } m = new form.Map('wizard', [_('Inital Router Setup')], _('If you are using this router for the first time, please configure it here.')); @@ -83,6 +88,16 @@ return view.extend({ o = s.taboption('firmware', form.Flag, 'cookie_p', _('Persistent cookies'),_('保持后台登录状态,避免每次关闭浏览器后都需要重新登录')); o.default = o.enabled; + if (has_wifi) { + s.tab('wifisetup', _('Wireless Settings'), _('Set the router\'s wireless name and password. For more advanced settings, please go to the Network-Wireless page.')); + o = s.taboption('wifisetup', form.Value, 'wifi_ssid', _('ESSID')); + o.datatype = 'maxlength(32)'; + + o = s.taboption("wifisetup", form.Value, "wifi_key", _("Key")); + o.datatype = 'wpakey'; + o.password = true; + } + setTimeout("document.getElementsByClassName('cbi-button-apply')[0].children[3].children[0].value='1'",1000) return m.render(); diff --git a/luci-app-wizard/root/etc/init.d/wizard b/luci-app-wizard/root/etc/init.d/wizard index e6695e479..f0fbf1866 100644 --- a/luci-app-wizard/root/etc/init.d/wizard +++ b/luci-app-wizard/root/etc/init.d/wizard @@ -13,7 +13,7 @@ add_wizard() { local cfg="$1" local wan_proto wan_pppoe_user wan_pppoe_pass local lan_ipaddr lan_netmask lan_dns lan_gateway dhcp - local device ipv6 old_ipv6 + local device ipv6 old_ipv6 wifi_ssid wifi_key old_wifi_ssid old_wifi_key config_get wan_proto "$cfg" wan_proto @@ -108,6 +108,38 @@ add_wizard() { uci -q set wizard.default.old_ipv6="${ipv6}" fi + wifi_setup_radio(){ + local radio=$1 + uci -q get wireless.${radio} >/dev/null 2>&1 && { + if [ "$(uci -q get wireless.${radio}.band)" = "5g" ]; then + uci -q set wireless.default_${radio}.ssid="${wifi_ssid}_5G" + else + uci -q set wireless.default_${radio}.ssid="${wifi_ssid}_2.4G" + fi + uci -q set wireless.default_${radio}.device="${radio}" + if [ "${wifi_key}" ]; then + uci -q set wireless.default_${radio}.encryption='psk2' + uci -q set wireless.default_${radio}.key="${wifi_key}" + else + uci -q set wireless.default_${radio}.encryption='none' + fi + } + } + + config_get wifi_ssid "$cfg" wifi_ssid + config_get wifi_key "$cfg" wifi_key + config_get old_wifi_ssid "$cfg" old_wifi_ssid + config_get old_wifi_key "$cfg" old_wifi_key + + if [[ "${wifi_ssid}" != "${old_wifi_ssid}" || "${wifi_key}" != "${old_wifi_key}" ]]; then + test -n "${wifi_ssid}" && { + for radio in radio0 radio1 radio2 radio3; do + wifi_setup_radio ${radio} + done + uci commit wireless + } + fi + uci commit wizard uci commit dhcp uci commit firewall