🎨 Sync 2026-04-23 20:24:27

This commit is contained in:
github-actions[bot] 2026-04-23 20:24:27 +08:00
parent 75feb953da
commit f7cc7b7fee
30 changed files with 3026 additions and 97 deletions

View File

@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk
-include $(dir $(lastword $(MAKEFILE_LIST)))../version.mk
PKG_NAME:=easytier
PKG_VERSION:=$(or $(EASYTIER_VERSION),2.6.0)
PKG_RELEASE:=2
PKG_VERSION:=$(or $(EASYTIER_VERSION),2.6.1)
PKG_RELEASE:=3
ifeq ($(ARCH),mipsel)
APP_ARCH:=mipsel

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
-include $(dir $(lastword $(MAKEFILE_LIST)))../version.mk
PKG_VERSION:=$(or $(EASYTIER_VERSION),2.6.0)
PKG_RELEASE:=6
PKG_RELEASE:=7
LUCI_TITLE:=LuCI support for EasyTier
LUCI_DEPENDS:=+kmod-tun +easytier +luci-compat

View File

@ -163,7 +163,7 @@ function get_upload_config()
easytierbin = uci:get_first("easytier", "easytier", "easytierbin") or "/usr/bin/easytier-core",
webbin = uci:get_first("easytier", "easytier", "webbin") or "/usr/bin/easytier-web",
github_proxys = {},
fallback_version = uci:get_first("easytier", "easytier", "fallback_version") or "v2.6.0"
fallback_version = uci:get_first("easytier", "easytier", "fallback_version") or "v2.6.1"
}
-- 读取代理列表list 类型)
@ -200,7 +200,7 @@ function save_upload_config()
-- 保存配置
uci:set("easytier", "@easytier[0]", "easytierbin", data.easytierbin or "/usr/bin/easytier-core")
uci:set("easytier", "@easytier[0]", "webbin", data.webbin or "/usr/bin/easytier-web")
uci:set("easytier", "@easytier[0]", "fallback_version", data.fallback_version or "v2.6.0")
uci:set("easytier", "@easytier[0]", "fallback_version", data.fallback_version or "v2.6.1")
-- 删除旧的代理列表
uci:delete("easytier", "@easytier[0]", "github_proxys")

View File

@ -383,7 +383,7 @@ local translate = i18n.translate
<select id="fallback_version_select" class="config-input" style="display:none;width:100%;">
<option value=""><%=translate("Loading versions...")%></option>
</select>
<input type="text" id="fallback_version" class="config-input" placeholder="v2.6.0" style="display:none;width:100%;">
<input type="text" id="fallback_version" class="config-input" placeholder="v2.6.1" style="display:none;width:100%;">
</div>
<button type="button" class="upload-btn" onclick="showDownloadModal()" style="padding:8px 16px;min-width:auto;flex-shrink:0;">
<%=translate("Online Download")%>
@ -758,14 +758,14 @@ function loadConfig() {
proxyList = Array.isArray(proxys) ? proxys : [];
renderProxyList();
versionManager.setVersion(config.fallback_version || 'v2.6.0');
versionManager.setVersion(config.fallback_version || 'v2.6.1');
// 保存原始配置
originalConfig = {
easytierbin: config.easytierbin || '/usr/bin/easytier-core',
webbin: config.webbin || '/usr/bin/easytier-web',
github_proxys: JSON.stringify(proxyList),
fallback_version: config.fallback_version || 'v2.6.0'
fallback_version: config.fallback_version || 'v2.6.1'
};
checkDiskSpace('easytierbin');
@ -843,7 +843,7 @@ function getCurrentConfig() {
easytierbin: document.getElementById('easytierbin').value || '/usr/bin/easytier-core',
webbin: document.getElementById('webbin').value || '/usr/bin/easytier-web',
github_proxys: JSON.stringify(proxyList),
fallback_version: versionManager.getCurrentVersion() || 'v2.6.0'
fallback_version: versionManager.getCurrentVersion() || 'v2.6.1'
};
}
@ -868,7 +868,7 @@ function saveConfig() {
easytierbin: document.getElementById('easytierbin').value || '/usr/bin/easytier-core',
webbin: document.getElementById('webbin').value || '/usr/bin/easytier-web',
github_proxys: proxyList,
fallback_version: versionManager.getCurrentVersion() || 'v2.6.0'
fallback_version: versionManager.getCurrentVersion() || 'v2.6.1'
};
var xhr = new XMLHttpRequest();

View File

@ -44,7 +44,7 @@ while true; do
break
fi
sleep $((time))
[ "$(du -k /log/easytier.log | cut -f1)" = "1000" ] && echo " " >/tmp/easytier.log
[ "$(du -k /tmp/easytier.log | cut -f1)" = "1000" ] && echo " " >/tmp/easytier.log
done
EOF
chmod +x /tmp/easytier_check
@ -103,7 +103,7 @@ check_bin() {
# 如果获取失败,从 UCI 配置或使用默认版本
if [ -z "$tag" ]; then
tag=$(uci -q get easytier.@easytier[0].fallback_version)
[ -z "$tag" ] && tag="v2.6.0"
[ -z "$tag" ] && tag="v2.6.1"
fi
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 开始在线下载${tag}版本,${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip下载较慢耐心等候" >>/tmp/easytier.log
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 开始在线下载${tag}版本,${proxy}https://github.com/EasyTier/EasyTier/releases/download/${tag}/easytier-linux-${cpucore}-${tag}.zip下载较慢耐心等候" >>/tmp/easytierweb.log
@ -165,7 +165,7 @@ check_config() {
get_tz
[ -z "$SET_TZ" ] || procd_set_param env TZ="$SET_TZ"
procd_set_param command /bin/sh -c "
${easytierbin} -c ${config_file} --console-log-level ${log} >> /tmp/easytier.log 2>&1 &
cd /tmp ; ${easytierbin} -c ${config_file} --console-log-level ${log} >> /tmp/easytier.log 2>&1 &
ET_CORE_PID=\$!
{
while true; do
@ -583,7 +583,7 @@ start_et() {
[ -z "$desvice_name" ] || core_cmd="${core_cmd} --hostname $desvice_name"
fi
procd_set_param command /bin/sh -c "
${easytierbin} ${core_cmd} --console-log-level ${log} >> /tmp/easytier.log 2>&1 &
cd /tmp ; ${easytierbin} ${core_cmd} --console-log-level ${log} >> /tmp/easytier.log 2>&1 &
ET_CORE_PID=\$!
{
while true; do
@ -636,6 +636,7 @@ start_et() {
start_web() {
webbin="$(uci -q get easytier.@easytier[0].webbin)"
path=$(dirname "$webbin")
if [ -f /tmp/easytier-web-embed ] ; then
echo "$(date '+%Y-%m-%d %H:%M:%S') easytier : 找到上传的easytier-web程序替换${webbin} " >>/tmp/easytierweb.log
mv -f /tmp/easytier-web-embed "$webbin"
@ -730,7 +731,7 @@ start_web() {
web_cmd="${web_cmd} --console-log-level $weblog"
fi
procd_set_param command /bin/sh -c "
${webbin} ${web_cmd} >> /tmp/easytierweb.log 2>&1 &
cd /tmp ; ${webbin} ${web_cmd} >> /tmp/easytierweb.log 2>&1 &
ET_WEB_PID=\$!
{
while true; do

View File

@ -0,0 +1,15 @@
# See /LICENSE for more information.
# This is free software, licensed under the GNU General Public License v2.
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for one-click AP mode switching
LUCI_DEPENDS:=+luci-base +luci-mod-network
LUCI_PKGARCH:=all
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=lean (coolsnowwolf@gmail.com)
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,91 @@
'use strict';
'require view';
'require fs';
'require ui';
return view.extend({
handleSaveApply: null,
handleSave: null,
handleReset: null,
load: function() {
return L.resolveDefault(fs.exec_direct('/usr/libexec/onekeyap', [ 'status' ], 'json'), {});
},
renderValue: function(title, value) {
return E('div', { 'class': 'cbi-value' }, [
E('label', { 'class': 'cbi-value-title' }, [ title ]),
E('div', { 'class': 'cbi-value-field' }, [ value || _('Not detected') ])
]);
},
handleToggle: function() {
var status = this.status || {};
var command = (status.mode === 'ap') ? 'enable-router' : 'enable-ap';
var buttonText = (status.mode === 'ap') ? _('Enable Router Mode') : _('Enable AP Mode');
ui.showModal(_('Switching mode'), [
E('p', { 'class': 'spinning' }, [
_('Running %s, the network will reload briefly. Please wait...').format(buttonText)
])
]);
return L.resolveDefault(fs.exec_direct('/usr/libexec/onekeyap', [ command ], 'json'), {
code: 1,
message: _('Command execution failed')
}).then(function(res) {
ui.hideModal();
if (+res.code !== 0)
throw new Error(res.message || _('Switching failed'));
ui.addNotification(null, E('p', [
res.message || _('The switch request has been submitted. The page will refresh in a few seconds. If the address changes, you can still use 192.168.0.1.')
]));
window.setTimeout(function() {
location.reload();
}, 8000);
}).catch(function(err) {
ui.hideModal();
ui.addNotification(null, E('p', [
err.message || String(err)
]), 'danger');
});
},
render: function(status) {
this.status = status || {};
var modeText = (this.status.mode === 'ap') ? _('AP Mode') : _('Router Mode');
var buttonText = (this.status.mode === 'ap') ? _('Enable Router Mode') : _('Enable AP Mode');
var currentLanPorts = (this.status.current_lan_ports || []).join(', ');
var savedLanPorts = (this.status.saved_lan_ports || []).join(', ');
var savedWanPorts = (this.status.saved_wan_ports || []).join(', ');
var currentIps = (this.status.current_lan_ipv4 || []).join(', ');
var fallbackIp = this.status.fallback_ip || '192.168.0.1/24';
return E('div', { 'class': 'cbi-map' }, [
E('h2', [ _('One-Key AP Mode') ]),
E('div', { 'class': 'cbi-map-descr' }, [
_('Merge current WAN ports into LAN with one click. In AP mode, LAN becomes a DHCP client while keeping 192.168.0.1/24 as a fallback management address.')
]),
E('div', { 'class': 'cbi-section' }, [
this.renderValue(_('Current Mode'), modeText),
this.renderValue(_('Current LAN Ports'), currentLanPorts),
this.renderValue(_('Current LAN IPv4'), currentIps),
this.renderValue(_('Original LAN Ports'), savedLanPorts),
this.renderValue(_('Original WAN Ports'), savedWanPorts),
this.renderValue(_('Fallback Address'), fallbackIp),
E('div', { 'class': 'cbi-page-actions' }, [
E('button', {
'id': 'onekeyap-toggle',
'class': 'cbi-button cbi-button-action',
'type': 'button',
'click': ui.createHandlerFn(this, 'handleToggle')
}, [ buttonText ])
])
])
]);
}
});

View File

@ -0,0 +1,79 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-onekeyap/root/usr/share/rpcd/acl.d/luci-app-onekeyap.json:3
msgid "Grant access to one-key AP mode switching"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:16
msgid "Not detected"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:22
msgid "Enable Router Mode"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:22
msgid "Enable AP Mode"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:24
msgid "Switching mode"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:26
msgid "Running %s, the network will reload briefly. Please wait..."
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:32
msgid "Command execution failed"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:37
msgid "Switching failed"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:40
msgid "The switch request has been submitted. The page will refresh in a few seconds. If the address changes, you can still use 192.168.0.1."
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:54
msgid "AP Mode"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:54
msgid "Router Mode"
msgstr ""
#: applications/luci-app-onekeyap/root/usr/share/luci/menu.d/luci-app-onekeyap.json:3
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:62
msgid "One-Key AP Mode"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:64
msgid "Merge current WAN ports into LAN with one click. In AP mode, LAN becomes a DHCP client while keeping 192.168.0.1/24 as a fallback management address."
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:67
msgid "Current Mode"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:68
msgid "Current LAN Ports"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:69
msgid "Current LAN IPv4"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:70
msgid "Original LAN Ports"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:71
msgid "Original WAN Ports"
msgstr ""
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:72
msgid "Fallback Address"
msgstr ""

1
luci-app-onekeyap/po/zh-cn Symbolic link
View File

@ -0,0 +1 @@
zh_Hans

View File

@ -0,0 +1,86 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: luci-app-onekeyap\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: applications/luci-app-onekeyap/root/usr/share/rpcd/acl.d/luci-app-onekeyap.json:3
msgid "Grant access to one-key AP mode switching"
msgstr "授予一键 AP 模式切换访问权限"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:16
msgid "Not detected"
msgstr "未检测到"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:22
msgid "Enable Router Mode"
msgstr "开启路由器模式"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:22
msgid "Enable AP Mode"
msgstr "开启 AP 模式"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:24
msgid "Switching mode"
msgstr "正在切换模式"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:26
msgid "Running %s, the network will reload briefly. Please wait..."
msgstr "正在执行 %s网络会短暂重载请稍候..."
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:32
msgid "Command execution failed"
msgstr "命令执行失败"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:37
msgid "Switching failed"
msgstr "切换失败"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:40
msgid "The switch request has been submitted. The page will refresh in a few seconds. If the address changes, you can still use 192.168.0.1."
msgstr "切换请求已提交。页面将在几秒后自动刷新,如果地址变化,可继续通过 192.168.0.1 访问。"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:54
msgid "AP Mode"
msgstr "AP 模式"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:54
msgid "Router Mode"
msgstr "路由器模式"
#: applications/luci-app-onekeyap/root/usr/share/luci/menu.d/luci-app-onekeyap.json:3
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:62
msgid "One-Key AP Mode"
msgstr "一键 AP 模式"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:64
msgid "Merge current WAN ports into LAN with one click. In AP mode, LAN becomes a DHCP client while keeping 192.168.0.1/24 as a fallback management address."
msgstr "一键把当前 WAN 口并入 LAN并在 AP 模式下让 LAN 改为 DHCP Client同时保留 192.168.0.1/24 作为保底管理地址。"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:67
msgid "Current Mode"
msgstr "当前模式"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:68
msgid "Current LAN Ports"
msgstr "当前 LAN 口"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:69
msgid "Current LAN IPv4"
msgstr "当前 LAN IPv4"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:70
msgid "Original LAN Ports"
msgstr "原始 LAN 口"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:71
msgid "Original WAN Ports"
msgstr "原始 WAN 口"
#: applications/luci-app-onekeyap/htdocs/luci-static/resources/view/network/onekeyap.js:72
msgid "Fallback Address"
msgstr "保底地址"

View File

@ -0,0 +1,5 @@
config settings 'main'
option mode 'router'
option fallback_ip '192.168.0.1'
option fallback_mask '255.255.255.0'
option fallback_cidr '24'

View File

@ -0,0 +1,6 @@
#!/bin/sh
[ "$ACTION" = "ifup" ] || [ "$ACTION" = "ifupdate" ] || exit 0
[ "$INTERFACE" = "lan" ] || exit 0
/usr/libexec/onekeyap refresh-fallback >/dev/null 2>&1

View File

@ -0,0 +1,490 @@
#!/bin/sh
. /lib/functions.sh
. /usr/share/libubox/jshn.sh
STATE_CONFIG="onekeyap"
STATE_SECTION="main"
BACKUP_DIR="/etc/onekeyap"
NETWORK_BACKUP="${BACKUP_DIR}/network.backup"
DHCP_BACKUP="${BACKUP_DIR}/dhcp.backup"
RELOAD_LOG="/tmp/onekeyap-reload.log"
append_unique() {
local var="$1"
local item current
shift
eval "current=\${$var}"
for item in "$@"; do
[ -n "$item" ] || continue
case " $current " in
*" $item "*) ;;
*) current="${current:+$current }$item" ;;
esac
done
eval "$var=\$current"
}
ensure_state() {
if ! uci -q get "${STATE_CONFIG}.${STATE_SECTION}" >/dev/null; then
uci batch <<-EOF >/dev/null
set ${STATE_CONFIG}.${STATE_SECTION}=settings
set ${STATE_CONFIG}.${STATE_SECTION}.mode='router'
set ${STATE_CONFIG}.${STATE_SECTION}.fallback_ip='192.168.0.1'
set ${STATE_CONFIG}.${STATE_SECTION}.fallback_mask='255.255.255.0'
set ${STATE_CONFIG}.${STATE_SECTION}.fallback_cidr='24'
EOF
uci commit "${STATE_CONFIG}" >/dev/null
fi
}
state_get() {
uci -q get "${STATE_CONFIG}.${STATE_SECTION}.$1"
}
state_set() {
uci set "${STATE_CONFIG}.${STATE_SECTION}.$1=$2"
}
state_set_list() {
local option="$1"
local item
shift
uci -q delete "${STATE_CONFIG}.${STATE_SECTION}.${option}"
for item in "$@"; do
[ -n "$item" ] || continue
uci add_list "${STATE_CONFIG}.${STATE_SECTION}.${option}=${item}"
done
}
reply_json() {
local code="${1:-0}"
local mode="${2}"
local message="${3}"
json_init
json_add_int code "${code}"
[ -n "${mode}" ] && json_add_string mode "${mode}"
[ -n "${message}" ] && json_add_string message "${message}"
json_dump
}
json_add_words() {
local name="$1"
local item
shift
json_add_array "${name}"
for item in "$@"; do
[ -n "${item}" ] || continue
json_add_string "" "${item}"
done
json_close_array
}
collect_ipv4_addrs() {
local dev="$1"
[ -n "${dev}" ] || return 0
ip -o -4 addr show dev "${dev}" 2>/dev/null | awk '{ print $4 }'
}
find_device_section_match=""
find_device_section_cb() {
local section="$1"
local target="$2"
local name
config_get name "${section}" name
[ "${name}" = "${target}" ] && find_device_section_match="${section}"
}
find_device_section() {
local target="$1"
find_device_section_match=""
config_load network
config_foreach find_device_section_cb device "${target}"
printf '%s\n' "${find_device_section_match}"
}
collect_interface_devices() {
local iface="$1"
local direct dev section ports type
direct="$(uci -q get "network.${iface}.device")"
[ -n "${direct}" ] || direct="$(uci -q get "network.${iface}.device")"
[ -n "${direct}" ] || return 0
for dev in ${direct}; do
case "${dev}" in
@*) continue ;;
esac
section="$(find_device_section "${dev}")"
type="$(uci -q get "network.${section}.type")"
if [ -n "${section}" ] && [ "${type}" = "bridge" ]; then
ports="$(uci -q get "network.${section}.ports")"
if [ -n "${ports}" ]; then
printf '%s\n' "${ports}"
else
printf '%s\n' "${dev}"
fi
else
printf '%s\n' "${dev}"
fi
done
}
zone_networks=""
find_zone_networks_cb() {
local section="$1"
local target="$2"
local name network
config_get name "${section}" name
[ "${name}" = "${target}" ] || return 0
config_get network "${section}" network
zone_networks="${network}"
}
get_wan_networks() {
local iface result=""
zone_networks=""
config_load firewall
config_foreach find_zone_networks_cb zone "wan"
if [ -n "${zone_networks}" ]; then
for iface in ${zone_networks}; do
uci -q get "network.${iface}" >/dev/null || continue
append_unique result "${iface}"
done
fi
if [ -z "${result}" ]; then
for iface in wan wan6; do
uci -q get "network.${iface}" >/dev/null || continue
append_unique result "${iface}"
done
fi
printf '%s\n' "${result}"
}
get_lan_ports() {
local result="" item
for item in $(collect_interface_devices lan); do
append_unique result "${item}"
done
printf '%s\n' "${result}"
}
get_wan_ports() {
local iface result="" item
for iface in $(get_wan_networks); do
for item in $(collect_interface_devices "${iface}"); do
append_unique result "${item}"
done
done
printf '%s\n' "${result}"
}
ensure_lan_bridge() {
local current_lan_device bridge_section final_device port
current_lan_device="$(uci -q get network.lan.device)"
final_device="${current_lan_device}"
if [ -n "${current_lan_device}" ]; then
bridge_section="$(find_device_section "${current_lan_device}")"
fi
if [ -n "${bridge_section}" ] && [ "$(uci -q get "network.${bridge_section}.type")" = "bridge" ]; then
final_device="${current_lan_device}"
else
final_device="br-lan"
bridge_section="$(find_device_section "${final_device}")"
[ -n "${bridge_section}" ] || bridge_section="$(uci add network device)"
fi
uci set "network.${bridge_section}=device"
uci set "network.${bridge_section}.name=${final_device}"
uci set "network.${bridge_section}.type=bridge"
uci -q delete "network.${bridge_section}.ports"
for port in "$@"; do
[ -n "${port}" ] || continue
uci add_list "network.${bridge_section}.ports=${port}"
done
uci set "network.lan.device=${final_device}"
uci -q delete network.lan.device
uci -q delete network.lan.type
printf '%s\n' "${final_device}"
}
schedule_reload() {
local target_mode="$1"
(
sleep 1
/etc/init.d/network restart
/etc/init.d/dnsmasq restart
/etc/init.d/odhcpd restart
/etc/init.d/firewall restart
[ "${target_mode}" = "ap" ] && /usr/libexec/onekeyap refresh-fallback
) >"${RELOAD_LOG}" 2>&1 &
}
get_lan_runtime_device() {
local json dev
json="$(ubus call network.interface.lan status 2>/dev/null)"
if [ -n "${json}" ]; then
json_load "${json}"
json_get_var dev l3_device
[ -n "${dev}" ] || json_get_var dev device
json_cleanup
fi
[ -n "${dev}" ] || dev="$(uci -q get network.lan.device)"
[ -n "${dev}" ] || dev="$(state_get ap_lan_device)"
printf '%s\n' "${dev}"
}
refresh_fallback() {
local mode dev fallback_ip fallback_cidr
ensure_state
mode="$(state_get mode)"
[ "${mode}" = "ap" ] || exit 0
dev="$(get_lan_runtime_device)"
fallback_ip="$(state_get fallback_ip)"
fallback_cidr="$(state_get fallback_cidr)"
[ -n "${dev}" ] || exit 0
[ -n "${fallback_ip}" ] || exit 0
[ -n "${fallback_cidr}" ] || fallback_cidr="24"
ip -o -4 addr show dev "${dev}" 2>/dev/null | grep -q " ${fallback_ip}/${fallback_cidr} " && exit 0
ip addr add "${fallback_ip}/${fallback_cidr}" dev "${dev}" 2>/dev/null
}
remove_current_fallback() {
local dev fallback_ip fallback_cidr
dev="$(get_lan_runtime_device)"
fallback_ip="$(state_get fallback_ip)"
fallback_cidr="$(state_get fallback_cidr)"
[ -n "${dev}" ] || return 0
[ -n "${fallback_ip}" ] || return 0
[ -n "${fallback_cidr}" ] || fallback_cidr="24"
ip addr del "${fallback_ip}/${fallback_cidr}" dev "${dev}" 2>/dev/null
}
status() {
local mode button_text fallback_ip fallback_cidr
local current_lan_ports current_lan_ipv4
local saved_lan_ports saved_wan_ports
local lan_runtime_dev item current_lan_ports_words="" current_lan_ipv4_words=""
ensure_state
mode="$(state_get mode)"
[ -n "${mode}" ] || mode="router"
if [ "${mode}" = "ap" ]; then
button_text="开启路由器模式"
else
button_text="开启 AP 模式"
fi
fallback_ip="$(state_get fallback_ip)"
fallback_cidr="$(state_get fallback_cidr)"
[ -n "${fallback_ip}" ] || fallback_ip="192.168.0.1"
[ -n "${fallback_cidr}" ] || fallback_cidr="24"
current_lan_ports="$(get_lan_ports)"
saved_lan_ports="$(state_get last_lan_ports)"
saved_wan_ports="$(state_get last_wan_ports)"
lan_runtime_dev="$(get_lan_runtime_device)"
for item in ${current_lan_ports}; do
append_unique current_lan_ports_words "${item}"
done
for item in $(collect_ipv4_addrs "${lan_runtime_dev}"); do
append_unique current_lan_ipv4_words "${item}"
done
json_init
json_add_int code 0
json_add_string mode "${mode}"
json_add_string button_text "${button_text}"
json_add_string fallback_ip "${fallback_ip}/${fallback_cidr}"
json_add_words current_lan_ports ${current_lan_ports_words}
json_add_words current_lan_ipv4 ${current_lan_ipv4_words}
json_add_words saved_lan_ports ${saved_lan_ports}
json_add_words saved_wan_ports ${saved_wan_ports}
json_dump
}
enable_ap() {
local mode lan_ports wan_ports all_ports="" lan_device iface item
ensure_state
mode="$(state_get mode)"
if [ "${mode}" = "ap" ]; then
reply_json 0 "ap" "当前已经是 AP 模式。"
return 0
fi
mkdir -p "${BACKUP_DIR}" || {
reply_json 1 "router" "无法创建备份目录。"
return 0
}
cp /etc/config/network "${NETWORK_BACKUP}" || {
reply_json 1 "router" "备份 network 配置失败。"
return 0
}
cp /etc/config/dhcp "${DHCP_BACKUP}" || {
reply_json 1 "router" "备份 dhcp 配置失败。"
return 0
}
lan_ports="$(get_lan_ports)"
wan_ports="$(get_wan_ports)"
for item in ${lan_ports} ${wan_ports}; do
append_unique all_ports "${item}"
done
if [ -z "${all_ports}" ]; then
reply_json 1 "router" "未检测到可并入 LAN 的接口。"
return 0
fi
lan_device="$(ensure_lan_bridge ${all_ports})"
uci set network.lan.proto='dhcp'
uci -q delete network.lan.ipaddr
uci -q delete network.lan.netmask
uci -q delete network.lan.gateway
uci -q delete network.lan.broadcast
uci -q delete network.lan.ip6assign
uci -q delete network.lan.ip6hint
uci -q delete network.lan.ip6ifaceid
uci -q delete network.lan.ip6class
for iface in $(get_wan_networks); do
uci -q get "network.${iface}" >/dev/null || continue
uci set "network.${iface}.proto=none"
uci set "network.${iface}.auto=0"
uci -q delete "network.${iface}.device"
uci -q delete "network.${iface}.device"
done
if ! uci -q get dhcp.lan >/dev/null; then
uci set dhcp.lan=dhcp
uci set dhcp.lan.interface='lan'
fi
uci set dhcp.lan.ignore='1'
uci set dhcp.lan.dhcpv4='disabled'
uci set dhcp.lan.dhcpv6='disabled'
uci set dhcp.lan.ra='disabled'
uci set dhcp.lan.ndp='disabled'
state_set mode 'ap'
state_set ap_lan_device "${lan_device}"
state_set_list last_lan_ports ${lan_ports}
state_set_list last_wan_ports ${wan_ports}
state_set_list last_wan_networks $(get_wan_networks)
uci commit network >/dev/null
uci commit dhcp >/dev/null
uci commit "${STATE_CONFIG}" >/dev/null
schedule_reload ap
reply_json 0 "ap" "AP 模式切换请求已提交WAN 口会并入 LAN并保留 192.168.0.1/24 作为保底地址。"
}
enable_router() {
local mode
ensure_state
mode="$(state_get mode)"
if [ "${mode}" != "ap" ]; then
reply_json 0 "router" "当前已经是路由器模式。"
return 0
fi
if [ ! -f "${NETWORK_BACKUP}" ] || [ ! -f "${DHCP_BACKUP}" ]; then
reply_json 1 "ap" "未找到原始配置备份,无法恢复路由器模式。"
return 0
fi
remove_current_fallback
cp "${NETWORK_BACKUP}" /etc/config/network || {
reply_json 1 "ap" "恢复 network 配置失败。"
return 0
}
cp "${DHCP_BACKUP}" /etc/config/dhcp || {
reply_json 1 "ap" "恢复 dhcp 配置失败。"
return 0
}
state_set mode 'router'
uci commit "${STATE_CONFIG}" >/dev/null
schedule_reload router
reply_json 0 "router" "路由器模式恢复请求已提交,原始 WAN/LAN 配置会被还原。"
}
case "$1" in
status)
status
;;
enable-ap)
enable_ap
;;
enable-router)
enable_router
;;
refresh-fallback)
refresh_fallback
;;
*)
reply_json 1 "" "用法: $0 {status|enable-ap|enable-router|refresh-fallback}"
;;
esac

View File

@ -0,0 +1,13 @@
{
"admin/network/onekeyap": {
"title": "One-Key AP Mode",
"order": 36,
"action": {
"type": "view",
"path": "network/onekeyap"
},
"depends": {
"acl": [ "luci-app-onekeyap" ]
}
}
}

View File

@ -0,0 +1,17 @@
{
"luci-app-onekeyap": {
"description": "Grant access to one-key AP mode switching",
"read": {
"cgi-io": [ "exec" ],
"file": {
"/usr/libexec/onekeyap status": [ "exec" ]
}
},
"write": {
"file": {
"/usr/libexec/onekeyap enable-ap": [ "exec" ],
"/usr/libexec/onekeyap enable-router": [ "exec" ]
}
}
}
}

View File

@ -0,0 +1,15 @@
# See /LICENSE for more information.
# This is free software, licensed under the GNU General Public License v2.
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for wireless repeater / client uplink
LUCI_DEPENDS:=+luci-base +luci-mod-network
LUCI_PKGARCH:=all
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=lean (coolsnowwolf@gmail.com)
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,393 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:101
msgid "2.4 GHz"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:103
msgid "5 GHz"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:105
msgid "6 GHz"
msgstr ""
#: applications/luci-app-repeater/root/usr/share/rpcd/acl.d/luci-app-repeater.json:3
msgid "Grant access to wireless repeater configuration"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:107
msgid "Unknown"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:127
msgid "Open / None"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:129
msgid "OWE"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:131
msgid "WEP Open System"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:133
msgid "WEP Shared Key"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:135
msgid "WPA-PSK"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:137
msgid "WPA2-PSK"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:139
msgid "WPA/WPA2-PSK Mixed"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:141
msgid "WPA3-SAE"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:143
msgid "WPA2/WPA3-SAE Mixed"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:221
msgid "Password may be incorrect"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:224
msgid "The access point rejected association"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:227
msgid "Authentication failed or timed out"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:230
msgid "Target SSID was not found"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:233
msgid "Unable to complete the connection attempt"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:356
msgid "Start refresh"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:361
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:481
msgid "Stop refresh"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:395
msgid "The selected network uses an enterprise or unsupported authentication mode. You may need to configure it manually."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:443
msgid "hidden"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:450
msgid "Use this network"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:456
msgid "No networks found nearby."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:467
msgid "Signal"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:468
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:855
msgid "SSID"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:469
msgid "Channel"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:470
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:859
msgid "BSSID"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:471
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:864
msgid "Encryption"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:483
msgid "Starting wireless scan..."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:485
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:849
msgid "Wireless Scan"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:493
msgid "Dismiss"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:511
msgid "Please choose a wireless radio first."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:521
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:962
msgid "Stop Wireless Repeater"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:522
msgid "This will remove the wireless station, the generated network interface, and related firewall bindings created by this app."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:527
msgid "Cancel"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:532
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:965
msgid "Stop"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:543
msgid "Cleaning up repeater configuration..."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:604
msgid "A wireless radio must be selected."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:607
msgid "SSID must not be empty."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:610
msgid "The selected radio is not available."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:613
msgid "A password or key is required for the selected encryption mode."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:670
msgid "LAN interface was not found. Please create network.lan first."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:701
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:753
msgid "Not configured"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:702
msgid "Choose a radio, scan for an SSID, then save and apply the settings."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:724
msgid "Connected to %s, waiting for DHCP"
msgstr ""
#: applications/luci-app-repeater/root/usr/share/luci/menu.d/luci-app-repeater.json:3
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:724
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:731
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:814
msgid "Wireless Repeater"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:731
msgid "Connected to %s"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:735
msgid "IP: %s"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:736
msgid "Bridged through %s"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:744
msgid "Authenticating / connecting..."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:745
msgid "Wireless interface: %s"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:745
msgid "The station interface is starting."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:753
msgid "Connection failed"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:753
msgid "Not connected"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:754
msgid "The repeater station is not associated with the selected SSID."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:787
msgid "Unable to query repeater status"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:808
msgid "Stopped"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:809
msgid "The repeater is not currently running. Click Save & Apply to start it again."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:815
msgid "Create a wireless client uplink, scan nearby access points, and attach the resulting station either to WAN or to LAN."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:823
msgid "Repeater Settings"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:825
msgid "Connection Status"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:828
msgid "Collecting status..."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:832
msgid "Wireless Radio"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:833
msgid "Choose the 2.4 GHz, 5 GHz, or 6 GHz radio that should work as the repeater station."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:842
msgid "Attach As"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:843
msgid "Attach the repeater client either as a WAN uplink or directly into LAN bridge mode."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:844
msgid "WAN"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:845
msgid "LAN"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:850
msgid "Open a scan dialog similar to the standard wireless page and copy the selected SSID into the fields below."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:963
msgid "Immediately remove the wireless station, the generated network interface, and related firewall bindings created by this app."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:852
msgid "Scan"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:855
msgid "Target SSID"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:856
msgid "Filled automatically after scan, but you can also enter the SSID manually for hidden networks."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:859
msgid "Lock To BSSID"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:860
msgid "Optional. If set, only the selected BSSID will be used instead of roaming between APs with the same SSID."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:865
msgid "The detected encryption is filled automatically after scan. You can still adjust it before applying."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1060
msgid "Algorithm"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1061
msgid "Choose the cipher algorithm used by the target wireless network, for example AES (CCMP)."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1062
msgid "auto"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1063
msgid "AES (CCMP)"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1064
msgid "AES (CCMP-256)"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1065
msgid "AES (GCMP)"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1066
msgid "AES (GCMP-256)"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1067
msgid "TKIP"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1068
msgid "TKIP + AES (CCMP)"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1085
msgid "WPA3-SAE does not support TKIP. Please choose an AES-based algorithm."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:878
msgid "Password / Key"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:879
msgid "Enter the WPA passphrase or WEP key for the selected network."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:896
msgid "A password or key is required."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:900
msgid "Expecting a valid WEP key."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:903
msgid "Expecting a WPA key with at least 8 characters."
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:908
msgid "Note"
msgstr ""
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:911
msgid "LAN mode bridges the wireless client into the existing LAN network. Some chipsets may require 4addr/WDS support from the upstream access point."
msgstr ""

1
luci-app-repeater/po/zh-cn Symbolic link
View File

@ -0,0 +1 @@
zh_Hans

View File

@ -0,0 +1,395 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: luci-app-repeater\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: zh-Hans\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:101
msgid "2.4 GHz"
msgstr "2.4 GHz"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:103
msgid "5 GHz"
msgstr "5 GHz"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:105
msgid "6 GHz"
msgstr "6 GHz"
#: applications/luci-app-repeater/root/usr/share/rpcd/acl.d/luci-app-repeater.json:3
msgid "Grant access to wireless repeater configuration"
msgstr "授予无线中继配置访问权限"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:107
msgid "Unknown"
msgstr "未知"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:127
msgid "Open / None"
msgstr "开放 / 无加密"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:129
msgid "OWE"
msgstr "OWE"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:131
msgid "WEP Open System"
msgstr "WEP 开放式"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:133
msgid "WEP Shared Key"
msgstr "WEP 共享密钥"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:135
msgid "WPA-PSK"
msgstr "WPA-PSK"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:137
msgid "WPA2-PSK"
msgstr "WPA2-PSK"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:139
msgid "WPA/WPA2-PSK Mixed"
msgstr "WPA/WPA2-PSK 混合"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:141
msgid "WPA3-SAE"
msgstr "WPA3-SAE"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:143
msgid "WPA2/WPA3-SAE Mixed"
msgstr "WPA2/WPA3-SAE 混合"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:221
msgid "Password may be incorrect"
msgstr "密码可能不正确"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:224
msgid "The access point rejected association"
msgstr "接入点拒绝了关联请求"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:227
msgid "Authentication failed or timed out"
msgstr "认证失败或超时"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:230
msgid "Target SSID was not found"
msgstr "未找到目标 SSID"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:233
msgid "Unable to complete the connection attempt"
msgstr "无法完成连接尝试"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:356
msgid "Start refresh"
msgstr "开始刷新"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:361
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:481
msgid "Stop refresh"
msgstr "停止刷新"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:395
msgid "The selected network uses an enterprise or unsupported authentication mode. You may need to configure it manually."
msgstr "所选网络使用企业级或当前页面不支持的认证方式,可能需要手动配置。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:443
msgid "hidden"
msgstr "隐藏"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:450
msgid "Use this network"
msgstr "使用该网络"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:456
msgid "No networks found nearby."
msgstr "附近未发现无线网络。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:467
msgid "Signal"
msgstr "信号"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:468
msgid "SSID"
msgstr "SSID"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:469
msgid "Channel"
msgstr "信道"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:470
msgid "BSSID"
msgstr "BSSID"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:471
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:864
msgid "Encryption"
msgstr "加密方式"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:483
msgid "Starting wireless scan..."
msgstr "正在启动无线扫描..."
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:485
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:849
msgid "Wireless Scan"
msgstr "无线扫描"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:493
msgid "Dismiss"
msgstr "关闭"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:511
msgid "Please choose a wireless radio first."
msgstr "请先选择一个无线射频。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:521
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:962
msgid "Stop Wireless Repeater"
msgstr "停止无线中继"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:522
msgid "This will remove the wireless station, the generated network interface, and related firewall bindings created by this app."
msgstr "这会移除本应用下发的无线客户端、生成的网络接口以及相关防火墙绑定。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:527
msgid "Cancel"
msgstr "取消"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:532
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:965
msgid "Stop"
msgstr "停止"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:543
msgid "Cleaning up repeater configuration..."
msgstr "正在清理无线中继配置..."
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:604
msgid "A wireless radio must be selected."
msgstr "必须选择一个无线射频。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:607
msgid "SSID must not be empty."
msgstr "SSID 不能为空。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:610
msgid "The selected radio is not available."
msgstr "所选射频不可用。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:613
msgid "A password or key is required for the selected encryption mode."
msgstr "当前加密方式需要填写密码或密钥。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:670
msgid "LAN interface was not found. Please create network.lan first."
msgstr "未找到 LAN 接口,请先创建 network.lan。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:701
msgid "Not configured"
msgstr "尚未配置"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:702
msgid "Choose a radio, scan for an SSID, then save and apply the settings."
msgstr "请选择射频、扫描 SSID然后保存并应用设置。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:724
msgid "Connected to %s, waiting for DHCP"
msgstr "已连接到 %s正在等待 DHCP"
#: applications/luci-app-repeater/root/usr/share/luci/menu.d/luci-app-repeater.json:3
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:814
msgid "Wireless Repeater"
msgstr "无线中继"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:731
msgid "Connected to %s"
msgstr "已连接到 %s"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:735
msgid "IP: %s"
msgstr "IP%s"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:736
msgid "Bridged through %s"
msgstr "已通过 %s 桥接"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:744
msgid "Authenticating / connecting..."
msgstr "正在认证 / 连接中..."
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:745
msgid "Wireless interface: %s"
msgstr "无线接口:%s"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:745
msgid "The station interface is starting."
msgstr "无线客户端接口正在启动。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:753
msgid "Connection failed"
msgstr "连接失败"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:753
msgid "Not connected"
msgstr "未连接"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:754
msgid "The repeater station is not associated with the selected SSID."
msgstr "无线中继客户端尚未关联到所选 SSID。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:787
msgid "Unable to query repeater status"
msgstr "无法获取中继状态"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:808
msgid "Stopped"
msgstr "已停止"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:809
msgid "The repeater is not currently running. Click Save & Apply to start it again."
msgstr "无线中继当前未运行,点击“保存并应用”即可再次启动。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:815
msgid "Create a wireless client uplink, scan nearby access points, and attach the resulting station either to WAN or to LAN."
msgstr "创建无线客户端上联,扫描附近 AP并将生成的客户端接口接入 WAN 或 LAN。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:823
msgid "Repeater Settings"
msgstr "中继设置"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:825
msgid "Connection Status"
msgstr "连接状态"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:828
msgid "Collecting status..."
msgstr "正在收集状态..."
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:832
msgid "Wireless Radio"
msgstr "无线射频"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:833
msgid "Choose the 2.4 GHz, 5 GHz, or 6 GHz radio that should work as the repeater station."
msgstr "选择要作为无线中继客户端使用的 2.4 GHz、5 GHz 或 6 GHz 射频。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:842
msgid "Attach As"
msgstr "接入方式"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:843
msgid "Attach the repeater client either as a WAN uplink or directly into LAN bridge mode."
msgstr "将无线中继客户端作为 WAN 上联接入,或直接桥接到 LAN。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:844
msgid "WAN"
msgstr "WAN"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:845
msgid "LAN"
msgstr "LAN"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:850
msgid "Open a scan dialog similar to the standard wireless page and copy the selected SSID into the fields below."
msgstr "打开一个类似标准无线页面的扫描窗口,并将选中的 SSID 回填到下方字段。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:963
msgid "Immediately remove the wireless station, the generated network interface, and related firewall bindings created by this app."
msgstr "立即移除本应用下发的无线客户端、生成的网络接口以及相关防火墙绑定。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:852
msgid "Scan"
msgstr "扫描"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:855
msgid "Target SSID"
msgstr "目标 SSID"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:856
msgid "Filled automatically after scan, but you can also enter the SSID manually for hidden networks."
msgstr "扫描后会自动填充;对于隐藏网络,也可以手动输入 SSID。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:859
msgid "Lock To BSSID"
msgstr "锁定到 BSSID"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:860
msgid "Optional. If set, only the selected BSSID will be used instead of roaming between APs with the same SSID."
msgstr "可选。如果填写,只会连接到指定的 BSSID而不会在相同 SSID 的多个 AP 之间漫游。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:865
msgid "The detected encryption is filled automatically after scan. You can still adjust it before applying."
msgstr "扫描后会自动填入检测到的加密方式,你仍可在应用前手动调整。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1060
msgid "Algorithm"
msgstr "算法"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1061
msgid "Choose the cipher algorithm used by the target wireless network, for example AES (CCMP)."
msgstr "选择目标无线网络使用的加密算法,例如 AESCCMP。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1062
msgid "auto"
msgstr "自动"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1063
msgid "AES (CCMP)"
msgstr "AESCCMP"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1064
msgid "AES (CCMP-256)"
msgstr "AESCCMP-256"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1065
msgid "AES (GCMP)"
msgstr "AESGCMP"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1066
msgid "AES (GCMP-256)"
msgstr "AESGCMP-256"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1067
msgid "TKIP"
msgstr "TKIP"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1068
msgid "TKIP + AES (CCMP)"
msgstr "TKIP + AESCCMP"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:1085
msgid "WPA3-SAE does not support TKIP. Please choose an AES-based algorithm."
msgstr "WPA3-SAE 不支持 TKIP请选择基于 AES 的算法。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:878
msgid "Password / Key"
msgstr "密码 / 密钥"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:879
msgid "Enter the WPA passphrase or WEP key for the selected network."
msgstr "输入所选网络的 WPA 密码或 WEP 密钥。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:896
msgid "A password or key is required."
msgstr "需要填写密码或密钥。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:900
msgid "Expecting a valid WEP key."
msgstr "请输入有效的 WEP 密钥。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:903
msgid "Expecting a WPA key with at least 8 characters."
msgstr "请输入至少 8 个字符的 WPA 密钥。"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:908
msgid "Note"
msgstr "注意"
#: applications/luci-app-repeater/htdocs/luci-static/resources/view/network/repeater.js:911
msgid "LAN mode bridges the wireless client into the existing LAN network. Some chipsets may require 4addr/WDS support from the upstream access point."
msgstr "LAN 模式会把无线客户端桥接到现有 LAN 网络。某些芯片可能需要上游 AP 支持 4addr/WDS。"

View File

@ -0,0 +1,9 @@
config repeater 'main'
option role 'wan'
option encryption 'psk2'
option cipher 'auto'
option applied '0'
option wireless_sid 'repeater_sta'
option network_name 'repeater_wwan'
option zone_name 'wan'
option managed_network '1'

View File

@ -0,0 +1,16 @@
{
"admin/network/repeater": {
"title": "Wireless Repeater",
"order": 35,
"action": {
"type": "view",
"path": "network/repeater"
},
"depends": {
"acl": [ "luci-app-repeater" ],
"uci": {
"wireless": true
}
}
}
}

View File

@ -0,0 +1,26 @@
{
"luci-app-repeater": {
"description": "Grant access to wireless repeater configuration",
"read": {
"file": {
"/sbin/logread": [ "exec" ]
},
"ubus": {
"file": [ "exec" ],
"iwinfo": [ "freqlist", "info" ],
"luci-rpc": [ "getBoardJSON", "getHostHints", "getNetworkDevices", "getWirelessDevices" ],
"network": [ "get_proto_handlers" ],
"network.interface": [ "dump" ],
"network.wireless": [ "status" ]
},
"uci": [ "firewall", "luci", "network", "repeater", "wireless" ]
},
"write": {
"ubus": {
"file": [ "exec" ],
"iwinfo": [ "scan" ]
},
"uci": [ "firewall", "network", "repeater", "wireless" ]
}
}
}

View File

@ -180,6 +180,14 @@ return view.extend({
o.rmempty = false;
o.depends('fastpath_mh_eth_hnat', '1');
if (features.hasMTKWEDWO) {
o = s.option(form.Flag, 'fastpath_mh_eth_hnat_wed', _('MTK WED WO offloading'),
_('Requires hardware support, implemented at least for Filogic 8x0'));
o.default = o.disabled;
o.rmempty = false;
o.depends({ 'fastpath': 'flow_offloading', 'fastpath_fo_hw': '1' });
}
o = s.option(form.ListValue, 'fullcone', _('Full cone NAT'),
_('Full cone NAT (NAT1) can improve gaming performance effectively.'));
o.value('0', _('Disable'))

View File

@ -2,3 +2,4 @@ config turboacc 'global'
option set '0'
config turboacc 'config'
option fastpath_mh_eth_hnat_wed '0'

View File

@ -6,11 +6,94 @@ START=90
STOP=10
USE_PROCD=1
MTK_WED_MODULES="mt7915e mt7996e"
start_service() {
config_load "turboacc"
local fastpath
config_get fastpath "config" "fastpath"
local fastpath_fo_hw
config_get_bool fastpath_fo_hw "config" "fastpath_fo_hw" "0"
local fastpath_mh_eth_hnat_wed
config_get_bool fastpath_mh_eth_hnat_wed "config" "fastpath_mh_eth_hnat_wed" "0"
local kernel_version
kernel_version="$(uname -r)"
find_wed_module() {
local mod
for mod in $MTK_WED_MODULES; do
lsmod | grep -q "^$mod " && {
echo "$mod"
return 0
}
done
for mod in $MTK_WED_MODULES; do
[ -e "/lib/modules/$kernel_version/$mod.ko" ] && {
echo "$mod"
return 0
}
done
return 1
}
find_loaded_wed_module() {
local mod
for mod in $MTK_WED_MODULES; do
lsmod | grep -q "^$mod " && {
echo "$mod"
return 0
}
done
return 1
}
is_wed_wo_enabled() {
local mod="$1"
local value
[ -n "$mod" ] || return 1
[ -r "/sys/module/$mod/parameters/wed_enable" ] || return 1
value="$(cat "/sys/module/$mod/parameters/wed_enable" 2>/dev/null)"
[ "$value" = "Y" ] || [ "$value" = "1" ]
}
load_wed_wo() {
local mod
local loaded_mod
mod="$(find_wed_module)" || return 0
loaded_mod="$(find_loaded_wed_module)" || true
[ "$loaded_mod" = "$mod" ] && is_wed_wo_enabled "$mod" && return 0
wifi down >/dev/null 2>&1
rmmod "$mod" 2>/dev/null
sleep 1
modprobe "$mod" wed_enable=Y 2>/dev/null || modprobe "$mod" 2>/dev/null
wifi up >/dev/null 2>&1
}
unload_wed_wo() {
local mod
mod="$(find_loaded_wed_module)" || return 0
is_wed_wo_enabled "$mod" || return 0
wifi down >/dev/null 2>&1
rmmod "$mod" 2>/dev/null
sleep 1
modprobe "$mod" 2>/dev/null
wifi up >/dev/null 2>&1
}
if [ "$fastpath" != "fast_classifier" ] && lsmod | grep -q "fast_classifier"; then
echo "0" > "/sys/fast_classifier/skip_to_bridge_ingress" 2>"/dev/null"
@ -65,6 +148,14 @@ start_service() {
;;
esac
if [ "$fastpath_mh_eth_hnat_wed" -eq "1" ] &&
[ "$fastpath" = "flow_offloading" ] &&
[ "$fastpath_fo_hw" -eq "1" ]; then
load_wed_wo
else
unload_wed_wo
fi
uci -q set "firewall.@defaults[0].flow_offloading"="$flow_offloading"
uci -q set "firewall.@defaults[0].flow_offloading_hw"="$flow_offloading_hw"

View File

@ -20,6 +20,7 @@ elif [ -e "/lib/modules/$kernel_ver/mtkhnat.ko" ]; then
uci -q set "turboacc.config.fastpath"="mediatek_hnat"
uci -q set "turboacc.config.fastpath_mh_eth_hnat"="1"
uci -q set "turboacc.config.fastpath_mh_eth_hnat_v6"="1"
uci -q set "turboacc.config.fastpath_mh_eth_hnat_wed"="0"
elif [ -e "/lib/modules/$kernel_ver/xt_FLOWOFFLOAD.ko" ]; then
uci -q set "turboacc.config.fastpath"="flow_offloading"
if grep -q "mt762" "/etc/openwrt_release"; then

View File

@ -8,11 +8,38 @@ local sys = require "luci.sys"
string.trim = util.trim
local mtk_wed_modules = {
"mt7915e",
"mt7996e"
}
local function readfile(path)
local s = fs.readfile(path)
return s and (s:gsub("^%s+", ""):gsub("%s+$", ""))
end
local function has_mtkwed_module(kernel)
for _, mod in ipairs(mtk_wed_modules) do
if fs.access("/lib/modules/" .. kernel .. "/" .. mod .. ".ko") then
return true
end
end
return false
end
local function get_mtkwed_param()
for _, mod in ipairs(mtk_wed_modules) do
local path = "/sys/module/" .. mod .. "/parameters/wed_enable"
if fs.access(path) then
return readfile(path)
end
end
return nil
end
local methods = {
getSystemFeatures = {
call = function()
@ -24,6 +51,8 @@ local methods = {
hasSHORTCUTFECM = fs.access("/lib/modules/" .. boardinfo.kernel .. "/shortcut-fe-cm.ko"),
hasNSSECM = fs.access("/etc/init.d/qca-nss-ecm"),
hasMEDIATEKHNAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/mtkhnat.ko"),
hasMTKWEDWO = (sys.call("grep -Eq 'mediatek' /etc/openwrt_release") == 0) and
has_mtkwed_module(boardinfo.kernel),
hasXTFULLCONENAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/xt_FULLCONENAT.ko"),
hasNFTFULLCONENAT = fs.access("/lib/modules/" .. boardinfo.kernel .. "/nft_fullcone.ko"),
hasTCPCCA = readfile("/proc/sys/net/ipv4/tcp_available_congestion_control")
@ -49,8 +78,15 @@ local methods = {
elseif fs.stat("/sys/kernel/debug/hnat", "type") == "dir" then
local ethernet_hnat = (readfile("/sys/kernel/debug/hnat/hook_toggle") ~= "enabled") and
" / Ethernet HNAT Disabled" or ""
local wireless_hnat = (sys.call("grep -q 'WHNAT=1' '/etc/wireless/mediatek/'*_card*.dat") ~= 0) and
" / Wireless HNAT Disabled" or ""
local wireless_hnat = ""
local wed_enabled = get_mtkwed_param()
if wed_enabled ~= nil then
wireless_hnat = (wed_enabled == "Y" or wed_enabled == "1") and "" or
" / Wireless HNAT Disabled"
else
wireless_hnat = (sys.call("grep -q 'WHNAT=1' '/etc/wireless/mediatek/'*_card*.dat") ~= 0) and
" / Wireless HNAT Disabled" or ""
end
if (ethernet_hnat == "") or (wireless_hnat == "") then
fptype = "MediaTek HNAT" .. ethernet_hnat .. wireless_hnat
end

View File

@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=my-default-settings
PKG_VERSION:=2
PKG_RELEASE:=5
PKG_RELEASE:=6
include $(INCLUDE_DIR)/package.mk

View File

@ -9,11 +9,9 @@ sed -i "s/op.supes.top/dl.openwrt.ai/" /etc/opkg/distfeeds.conf
ln -sf /root/.bash_history /tmp/.busybox_ash_history
}
# [[ "$(df | grep overlay)" && ! "$(df | grep /rom/overlay)" ]] && firstboot
version=$(uci -q get base_config.@status[0].version)
version=`uci -q get base_config.@status[0].version`
hostname=`uci -q get system.@system[0].hostname`
hostname=$(uci -q get system.@system[0].hostname)
[ -n "${hostname}" ] || hostname="Kwrt"
if [ "$(uci -q get dhcp.@dnsmasq[0].port)" != "53" ]; then
@ -23,31 +21,33 @@ fi
sed -i '/profile.d/d' /lib/upgrade/keep.d/base-files
echo $(uci -q get uhttpd.main.index_page) | grep -q "cgi-bin/luci" ||
uci -q add_list uhttpd.main.index_page='cgi-bin/luci' && uci commit uhttpd
if ! echo "$(uci -q get uhttpd.main.index_page)" | grep -q "cgi-bin/luci"; then
uci -q add_list uhttpd.main.index_page='cgi-bin/luci'
uci commit uhttpd
fi
if [[ "$(uci -q get dropbear.main._direct)" != "1" && "$(uci -q get dropbear.main.Interface)" == "lan" ]]; then
if [ "$(uci -q get dropbear.main._direct)" != "1" ] && [ -n "$(uci -q get dropbear.main.Interface)" ]; then
uci del dropbear.main.Interface
uci commit dropbear
fi
[[ -x /usr/bin/wget && ! -x /usr/bin/wget-ssl ]] &&
[ -x /usr/bin/wget ] && [ ! -x /usr/bin/wget-ssl ] && \
ln -s /usr/bin/wget /usr/bin/wget-ssl
sed -i "s/git-.*-\(.*\)/git-\1/g" /usr/lib/lua/luci/version.lua
if [ -f /etc/uwsgi/vassals/luci-webui.ini ]; then
processor=`cat /proc/cpuinfo | grep 'processor' | wc -l`
[ -n "$processor" ] || processor=3
sed -i "/^threads =/c\threads = $processor" /etc/uwsgi/vassals/luci-webui.ini
processor=$(grep -c 'processor' /proc/cpuinfo)
[ -n "$processor" ] && [ "$processor" -gt 0 ] || processor=3
sed -i "/^threads =/c\threads = $processor" /etc/uwsgi/vassals/luci-webui.ini
fi
if [ -f /etc/config/attendedsysupgrade ]; then
uci -q set attendedsysupgrade.server.url='https://openwrt.ai'
uci commit attendedsysupgrade
uci -q set attendedsysupgrade.server.url='https://openwrt.ai'
uci commit attendedsysupgrade
fi
if [[ ! "$version" || "$version" -lt 1 ]]; then
if [ -z "$version" ] || [ "$version" -lt 1 ]; then
uci -q set luci.main.lang='auto'
uci -q set luci.main.mediaurlbase=/luci-static/argon
uci commit luci
@ -74,20 +74,20 @@ if [[ ! "$version" || "$version" -lt 1 ]]; then
(echo "root"; sleep 1; echo "root") | /bin/busybox passwd root >/dev/null 2>&1 &
uci -q set firewall.@defaults[0].flow_offloading='1'
uci -q set firewall.@defaults[0].flow_offloading_hw='1'
uci commit firewall
uci -q set firewall.@defaults[0].flow_offloading='1'
uci -q set firewall.@defaults[0].flow_offloading_hw='1'
uci commit firewall
uci -q set upnpd.config.enabled='1'
uci commit upnpd
grep -q log-facility /etc/dnsmasq.conf ||
grep -q log-facility /etc/dnsmasq.conf || \
echo "log-facility=/dev/null" >> /etc/dnsmasq.conf
#kernel_version="$(echo -n $(uname -r))"
#if [[ -f /lib/modules/$kernel_version/xt_FULLCONENAT.ko || -f /lib/modules/$kernel_version/nft_fullcone.ko ]]; then
#uci -q set firewall.@defaults[0].fullcone='1'
#uci commit firewall
#kernel_version=$(uname -r)
#if [ -f "/lib/modules/$kernel_version/xt_FULLCONENAT.ko" ] || [ -f "/lib/modules/$kernel_version/nft_fullcone.ko" ]; then
# uci -q set firewall.@defaults[0].fullcone='1'
# uci commit firewall
#fi
uci -q set fstab.@global[0].anon_mount=1
@ -106,17 +106,14 @@ if [[ ! "$version" || "$version" -lt 1 ]]; then
uci -q set dhcp.lan.ra='hybrid'
uci -q set dhcp.lan.ndp='hybrid'
uci -q set dhcp.lan.dhcpv6='hybrid'
uci -q set dhcp.lan.force='1'
uci commit dhcp
uci -q set nft-qos.default.limit_enable='0'
uci commit nft-qos
fi
# kB
memtotal=`grep MemTotal /proc/meminfo | awk '{print $2}'`
memtotal=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if [ "$memtotal" -ge 1048576 ]; then
# > 1024M
cachesize=10000
@ -149,7 +146,7 @@ else
nf_conntrack_max=16384
fi
if [[ ! "$version" || "$version" -lt 1 ]]; then
if [ -z "$version" ] || [ "$version" -lt 1 ]; then
uci -q get dhcp.@dnsmasq[0] || uci -q add dhcp dnsmasq
uci -q set dhcp.@dnsmasq[0].cachesize="$cachesize"
uci -q set dhcp.@dnsmasq[0].dnsforwardmax="$dnsforwardmax"
@ -158,47 +155,49 @@ if [[ ! "$version" || "$version" -lt 1 ]]; then
uci -q set dhcp.@dnsmasq[0].rebind_protection='0'
uci -q set dhcp.@dnsmasq[0].rebind_localhost='1'
uci commit dhcp
uci -q set system.@system[0].zram_comp_algo='zstd'
uci -q set system.@system[0].zram_size_mb="$(expr $memtotal / 1024 / 3)"
uci -q set system.@system[0].zram_size_mb="$((memtotal / 1024 / 3))"
uci commit system
# sysctl overwrite
SYSCTL_LOCAL=/etc/sysctl.d/50-local.conf
mkdir -p /etc/sysctl.d
echo -n >$SYSCTL_LOCAL
echo net.nf_conntrack_max=$nf_conntrack_max >>$SYSCTL_LOCAL
echo net.core.rmem_max=$nf_conntrack_max >>$SYSCTL_LOCAL
> "$SYSCTL_LOCAL"
echo "net.nf_conntrack_max=$nf_conntrack_max" >> "$SYSCTL_LOCAL"
echo "net.core.rmem_max=$nf_conntrack_max" >> "$SYSCTL_LOCAL"
if [ -n "$(command -v nginx)" ]; then
uci add wizard shortcuts
uci set wizard.@shortcuts[-1].shortcut='pw'
uci set wizard.@shortcuts[-1].to_url='http://10.0.0.1/cgi-bin/luci/admin/services/passwall'
uci set wizard.@shortcuts[-1].comments='passwall'
uci commit wizard
if [ -n "$(command -v nginx)" ]; then
uci add wizard shortcuts
uci set wizard.@shortcuts[-1].shortcut='pw'
uci set wizard.@shortcuts[-1].to_url='http://10.0.0.1/cgi-bin/luci/admin/services/passwall'
uci set wizard.@shortcuts[-1].comments='passwall'
uci commit wizard
uci -q set nginx._sc_pw=server
uci -q set nginx._sc_pw.server_name="pw"
uci -q add_list nginx._sc_pw.listen="80"
uci -q add_list nginx._sc_pw.listen="443"
uci -q set nginx._sc_pw.return="302 http://10.0.0.1/cgi-bin/luci/admin/services/passwall"
uci -q set nginx._sc_pw=server
uci -q set nginx._sc_pw.server_name="pw"
uci -q add_list nginx._sc_pw.listen="80"
uci -q add_list nginx._sc_pw.listen="443"
uci -q set nginx._sc_pw.return="302 http://10.0.0.1/cgi-bin/luci/admin/services/passwall"
uci -q set dhcp._sc_pw=domain
uci -q set dhcp._sc_pw.name="pw"
uci -q set dhcp._sc_pw.ip="10.0.0.1"
uci -q set dhcp._sc_pw.comments="PassWall"
uci commit dhcp
fi
if [ -z "`uci -q get dhcp._ta`" ]; then
uci -q set dhcp._ta=domain
uci -q set dhcp._ta.name="time.android.com"
uci -q set dhcp._ta.ip="203.107.6.88"
uci -q set dhcp._ta.comments="time.android"
uci commit dhcp
fi
uci -q set dhcp._sc_pw=domain
uci -q set dhcp._sc_pw.name="pw"
uci -q set dhcp._sc_pw.ip="10.0.0.1"
uci -q set dhcp._sc_pw.comments="PassWall"
uci commit dhcp
fi
if [ -z "$(uci -q get dhcp._ta)" ]; then
uci -q set dhcp._ta=domain
uci -q set dhcp._ta.name="time.android.com"
uci -q set dhcp._ta.ip="203.107.6.88"
uci -q set dhcp._ta.comments="time.android"
uci commit dhcp
fi
version=1
fi
if [ -z "`uci -q get dhcp.default_server`" ]; then
if [ -z "$(uci -q get dhcp.default_server)" ]; then
uci -q set dhcp.default_server=domain
uci -q set dhcp.default_server.name='kwrt'
uci -q set dhcp.default_server.ip='10.0.0.1'
@ -207,38 +206,40 @@ if [ -z "`uci -q get dhcp.default_server`" ]; then
fi
if [ -n "$(command -v nginx)" ]; then
if [ -z "`uci -q get nginx.default_server`" ]; then
uci -q set nginx.default_server=server
uci -q set nginx.default_server.server_name='kwrt'
uci -q add_list nginx.default_server.listen='80 default_server'
uci -q add_list nginx.default_server.listen='[::]:80 default_server'
uci -q add_list nginx.default_server.include='conf.d/*.locations'
uci -q set nginx.default_server.access_log='off; # logd openwrt'
uci commit nginx
fi
grep -q "uwsgi_read_timeout" /etc/nginx/conf.d/luci.locations 2>/dev/null || {
sed -i "s/include uwsgi_params;/include uwsgi_params;\n\t\tuwsgi_read_timeout 300s;/" /etc/nginx/conf.d/luci.locations
sed -i '/ubus_parallel_req/a\ ubus_script_timeout 600;' /etc/nginx/conf.d/luci.locations
}
if [ -z "$(uci -q get nginx.default_server)" ]; then
uci -q set nginx.default_server=server
uci -q set nginx.default_server.server_name='kwrt'
uci -q add_list nginx.default_server.listen='80 default_server'
uci -q add_list nginx.default_server.listen='[::]:80 default_server'
uci -q add_list nginx.default_server.include='conf.d/*.locations'
uci -q set nginx.default_server.access_log='off; # logd openwrt'
uci commit nginx
fi
grep -q "uwsgi_read_timeout" /etc/nginx/conf.d/luci.locations 2>/dev/null || {
sed -i "s/include uwsgi_params;/include uwsgi_params;\n\t\tuwsgi_read_timeout 300s;/" /etc/nginx/conf.d/luci.locations
sed -i '/ubus_parallel_req/a\ ubus_script_timeout 600;' /etc/nginx/conf.d/luci.locations
}
sed -i \
-e "s/client_max_body_size 128M/client_max_body_size 3072M/" \
-e "s/large_client_header_buffers 2 1k/large_client_header_buffers 4 512k/" \
/etc/nginx/uci.conf.template
grep -q "client_body_buffer_size" /etc/nginx/uci.conf.template ||
sed -i \
-e "s/client_max_body_size 128M/client_max_body_size 3072M/" \
-e "s/large_client_header_buffers 2 1k/large_client_header_buffers 4 512k/" \
/etc/nginx/uci.conf.template
grep -q "client_body_buffer_size" /etc/nginx/uci.conf.template || \
sed -i "/large_client_header_buffers/a\ client_body_buffer_size 128K;" /etc/nginx/uci.conf.template
fi
rm -rf /tmp/luci-*
uci -q set base_config.@status[0].version=$version
uci -q set base_config.@status[0].version="$version"
uci commit base_config
grep -q "cgi-timeout" /etc/uwsgi/vassals/luci-*.ini 2>/dev/null || sed -i '$a cgi-timeout = 500' /etc/uwsgi/vassals/luci-*.ini
sed -i "s/limit-as = 1000/limit-as = 5000/g" /etc/uwsgi/vassals/luci-webui.ini
modprobe xt_FULLCONENAT || {
[ "$(iptables -L -t nat | grep "FULLCONENAT")" ] || {
uci -q set firewall.@defaults[0].fullcone='0'
uci commit firewall
}
if ! iptables -L -t nat 2>/dev/null | grep -q "FULLCONENAT"; then
uci -q set firewall.@defaults[0].fullcone='0'
uci commit firewall
fi
}