update 2026-09-26 11:07:27

This commit is contained in:
action committed 2026-09-26 11:07:27 +08:00
1 parent 7b88b273d0
commit 97ae9f68da
4898 files changed
-1712274

No files matched your search

-21
View File
@@ -1,21 +0,0 @@
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
# Copyright (C) 2020-2021 Hyy2001X <https://github.com/Hyy2001X>
# Copyright (C) 2024-2025 Duan <duan@d-jy.net>
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-npc
PKG_VERSION:=1.8
PKG_RELEASE:=2
LUCI_TITLE:=LuCI support for NPC
#LUCI_DEPENDS:=+npc
LUCI_PKGARCH:=all
define Package/$(PKG_NAME)/conffiles
/etc/config/npc
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
-31
View File
@@ -1,31 +0,0 @@
module("luci.controller.npc",package.seeall)
function index()
if not nixio.fs.access("/etc/config/npc") then
return
end
entry({"admin", "services", "npc"}, cbi("npc"), _("NPS Client"), 99).dependent = true
entry({"admin", "services", "npc", "status"}, call("act_status")).leaf = true
end
function act_status()
local fs = require "nixio.fs"
local e = {}
if not fs.access("/usr/bin/npc") then
e.installed = false
e.running = false
e.version = ""
e.core_version = ""
else
e.installed = true
e.running = (luci.sys.call("pgrep npc > /dev/null") == 0)
local ver_out = luci.sys.exec("/usr/bin/npc -version 2>/dev/null")
e.version = ver_out:match("Version:%s*([v%d%.%-]+)") or ""
e.core_version = ver_out:match("Core version:%s*([v%d%.%-]+)") or ""
end
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
-60
View File
@@ -1,60 +0,0 @@
m = Map("npc", translate("NPS Client"), translate("NPS is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."))
m.apply_on_parse = true
function m.on_after_commit(self)
local enabled = luci.model.uci.cursor():get("npc", "@npc[0]", "enable")
if enabled == "1" then
luci.sys.call("/etc/init.d/npc restart >/dev/null 2>&1")
else
luci.sys.call("/etc/init.d/npc stop >/dev/null 2>&1")
end
end
m:section(SimpleSection).template = "npc/npc_status"
s = m:section(TypedSection, "npc")
s.addremove = false
s.anonymous = true
enable = s:option(Flag, "enable", translate("Enable"))
enable.rmempty = false
enable.default = "0"
server = s:option(Value, "server_addr", translate("Server Address"), translate("(host:port) e.g. xxx.com:8024,yyy.com:8025..."))
server.rmempty = false
vkey = s:option(Value, "vkey", translate("vkey"), translate("(vkey) e.g. vkey1,vkey2..."))
vkey.password = true
vkey.rmempty = false
protocol = s:option(Value, "protocol", translate("Protocol Type"), translate("(tcp|tls|kcp) e.g. tcp,tls..."))
protocol.default = "tcp"
dns = s:option(Value, "dns", translate("DNS Server"), translate("e.g. 8.8.8.8"))
dns.default = ""
extra_args = s:option(Value, "extra_args", translate("Extra Arguments"), translate("Additional NPC arguments, e.g. '-xxx=yyy -aaa=bbb'"))
extra_args.rmempty = true
extra_args.default = ""
update_button = s:option(Button, "update_button", translate("Update NPC"), translate("Click to update to the latest version"))
update_button.modal = false
function update_button.write(self, section, value)
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "npc"))
luci.sys.call("( /usr/bin/npc update -dns_server= && /etc/init.d/npc restart ) >/tmp/npc_update.log 2>&1 &")
end
install_button = s:option(Button, "install_button", translate("Install NPC"), translate("Click to install or update NPC via script"))
install_button.modal = false
function install_button.write(self, section, value)
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "npc"))
luci.sys.call("( wget -qO- https://fastly.jsdelivr.net/gh/djylb/nps@master/install.sh | sh -s npc && /etc/init.d/npc restart ) >/tmp/npc_install.log 2>&1 &")
end
github_button = s:option(Button, "github_button", "Github", "https://github.com/djylb/nps-openwrt")
github_button.modal = false
function github_button.write(self, section, value)
luci.http.status(200)
luci.http.redirect("https://github.com/djylb/nps-openwrt")
end
return m
@@ -1,23 +0,0 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[npc]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('npc_status');
if (data && tb) {
if (!data.installed) {
tb.innerHTML = '<em><b><font color="red">NPC <%:NOT INSTALLED%></font></b></em>';
} else if (data.running) {
tb.innerHTML = '<em><b><font color=green>NPC(' + data.version + ') <%:RUNNING%></font></b></em>';
} else {
tb.innerHTML = '<em><b><font color=red>NPC(' + data.version + ') <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="npc_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>
-59
View File
@@ -1,59 +0,0 @@
msgid "NPS Client"
msgstr "NPS 内网穿透客户端"
msgid "NPS is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."
msgstr "NPS 是一种快速反向代理,可帮助您将 NAT 或防火墙后的本地服务器公开到 Internet"
msgid "(host:port) e.g. xxx.com:8024,yyy.com:8025..."
msgstr "(host:port) 例如: xxx.com:8024,yyy.com:8025..."
msgid "(vkey) e.g. vkey1,vkey2..."
msgstr "(vkey) 例如: vkey1,vkey2..."
msgid "(tcp|tls|kcp) e.g. tcp,tls..."
msgstr "(tcp|tls|kcp) 例如: tcp,tls..."
msgid "e.g. 8.8.8.8"
msgstr "例如: 8.8.8.8"
msgid "Additional NPC arguments, e.g. '-xxx=yyy -aaa=bbb'"
msgstr "其他 NPC 参数,例如: '-xxx=yyy -aaa=bbb'"
msgid "NOT INSTALLED"
msgstr "未安装"
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Basic Setting"
msgstr "基本设置"
msgid "Protocol Type"
msgstr "协议类型"
msgid "Server Address"
msgstr "服务端地址"
msgid "vkey"
msgstr "唯一验证密钥"
msgid "DNS Server"
msgstr "DNS 服务器"
msgid "Extra Arguments"
msgstr "额外参数"
msgid "Update NPC"
msgstr "更新 NPC"
msgid "Click to update to the latest version"
msgstr "点击即可更新到最新版本"
msgid "Install NPC"
msgstr "安装 NPC"
msgid "Click to install or update NPC via script"
msgstr "点击通过脚本安装或更新 NPC"
-59
View File
@@ -1,59 +0,0 @@
msgid "NPS Client"
msgstr "NPS 内网穿透客户端"
msgid "NPS is a fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."
msgstr "NPS 是一种快速反向代理,可帮助您将 NAT 或防火墙后的本地服务器公开到 Internet"
msgid "(host:port) e.g. xxx.com:8024,yyy.com:8025..."
msgstr "(host:port) 例如: xxx.com:8024,yyy.com:8025..."
msgid "(vkey) e.g. vkey1,vkey2..."
msgstr "(vkey) 例如: vkey1,vkey2..."
msgid "(tcp|tls|kcp) e.g. tcp,tls..."
msgstr "(tcp|tls|kcp) 例如: tcp,tls..."
msgid "e.g. 8.8.8.8"
msgstr "例如: 8.8.8.8"
msgid "Additional NPC arguments, e.g. '-xxx=yyy -aaa=bbb'"
msgstr "其他 NPC 参数,例如: '-xxx=yyy -aaa=bbb'"
msgid "NOT INSTALLED"
msgstr "未安装"
msgid "RUNNING"
msgstr "运行中"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "Basic Setting"
msgstr "基本设置"
msgid "Protocol Type"
msgstr "协议类型"
msgid "Server Address"
msgstr "服务端地址"
msgid "vkey"
msgstr "唯一验证密钥"
msgid "DNS Server"
msgstr "DNS 服务器"
msgid "Extra Arguments"
msgstr "额外参数"
msgid "Update NPC"
msgstr "更新 NPC"
msgid "Click to update to the latest version"
msgstr "点击即可更新到最新版本"
msgid "Install NPC"
msgstr "安装 NPC"
msgid "Click to install or update NPC via script"
msgstr "点击通过脚本安装或更新 NPC"
-9
View File
@@ -1,9 +0,0 @@
config npc
option enable '0'
option server_addr '1.2.3.4:123'
option protocol 'tcp'
option vkey 'abcdefg'
option dns ''
option extra_args '-debug=false -log=off'
-69
View File
@@ -1,69 +0,0 @@
#!/bin/sh /etc/rc.common
START=95
USE_PROCD=1
LOGGER="logger -t [NPC]"
npc_Path="$(command -v npc)"
start_service() {
if [ -f /usr/local/bin/npc ] ; then
${LOGGER} "Moving npc to /usr/bin ..."
mv -f /usr/local/bin/npc /usr/bin/npc
fi
if [ -f /usr/local/bin/npc-update ] ; then
${LOGGER} "Moving npc-update to /usr/bin ..."
mv -f /usr/local/bin/npc-update /usr/bin/npc-update
fi
local basic_list="enable server_addr protocol vkey dns extra_args"
for i in $(echo $basic_list);do
local eval $i="$(uci_get_by_type npc 0 $i)"
done;unset i
if [ "$enable" != "1" ]; then
${LOGGER} "NPS Client(NPC) is disabled"
return
fi
${LOGGER} "Starting NPS Client(NPC) ..."
cmd_args=""
if ! printf '%s\n' "$extra_args" | grep -q -- '\-server='; then
cmd_args="$cmd_args -server=${server_addr}"
fi
if ! printf '%s\n' "$extra_args" | grep -q -- '\-vkey='; then
cmd_args="$cmd_args -vkey=${vkey}"
fi
if ! printf '%s\n' "$extra_args" | grep -q -- '\-type='; then
cmd_args="$cmd_args -type=${protocol}"
fi
if ! printf '%s\n' "$extra_args" | grep -q -- '\-dns_server='; then
cmd_args="$cmd_args -dns_server=${dns}"
fi
[ -n "$extra_args" ] && cmd_args="$cmd_args $extra_args"
if ! printf '%s\n' "$cmd_args" | grep -q -- '\-log='; then
cmd_args="$cmd_args -log=off"
fi
procd_open_instance
procd_set_param command $npc_Path $cmd_args
procd_set_param respawn
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
stop_service() {
${LOGGER} "Stopping NPS Client(NPC) ..."
}
service_triggers() {
procd_add_reload_trigger "npc"
}
uci_get_by_type() {
local ret=$(uci get npc.@$1[$2].$3 2>/dev/null)
echo ${ret:=$4}
}
@@ -1,11 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@npc[-1]
add ucitrack npc
set ucitrack.@npc[-1].init=npc
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0
@@ -1,11 +0,0 @@
{
"luci-app-npc": {
"description": "Grant UCI access for luci-app-npc",
"read": {
"uci": [ "npc" ]
},
"write": {
"uci": [ "npc" ]
}
}
}