Sync 2026-04-22 04:42:14

This commit is contained in:
github-actions[bot] 2026-04-22 04:42:14 +08:00
parent 51e98c642e
commit cfcd70695f
17 changed files with 275 additions and 43 deletions

66
ghttpd/Makefile Normal file
View File

@ -0,0 +1,66 @@
#
# Copyright (C) 2015-2016 OpenWrt.org
# Copyright (C) 2020 jjm2473@gmail.com
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_ARCH_ghttpd:=$(ARCH)
PKG_NAME:=ghttpd
PKG_VERSION:=0.0.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/
PKG_HASH:=skip
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=ghttpd
DEPENDS:=@(x86_64||aarch64||arm) +docker
URL:=https://github.com/Carseason/openwrt-packages
endef
define Package/$(PKG_NAME)/description
ghttpd is a dashboard & user guide
endef
define Package/$(PKG_NAME)/conffiles
/etc/config/ghttpd
endef
define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
if [ -f /etc/uci-defaults/09-ghttpd ]; then
chmod 755 /etc/uci-defaults/09-ghttpd
/etc/uci-defaults/09-ghttpd && rm -f /etc/uci-defaults/09-ghttpd
fi
fi
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/uci-defaults $(1)/etc/config
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ghttpd.$(PKG_ARCH_ghttpd) $(1)/usr/sbin/ghttpd
$(INSTALL_BIN) ./files/ghttpd.init $(1)/etc/init.d/ghttpd
$(INSTALL_BIN) ./files/ghttpd.uci-default $(1)/etc/uci-defaults/09-ghttpd
$(INSTALL_CONF) ./files/ghttpd.config $(1)/etc/config/ghttpd
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View File

@ -0,0 +1,3 @@
config ghttpd
option 'enabled' '0'
option port '8333'

27
ghttpd/files/ghttpd.init Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh /etc/rc.common
START=93
USE_PROCD=1
get_config() {
config_get enabled $1 enabled "0"
config_get port $1 port "8333"
}
start_service() {
config_load ghttpd
config_foreach get_config ghttpd
[ $enabled != 1 ] && return 1
procd_open_instance
procd_set_param command /usr/sbin/ghttpd openwrt
if [ -n "$port" ]; then
procd_append_param command --port "$port"
fi
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
}
service_triggers() {
procd_add_reload_trigger "ghttpd"
}

View File

@ -0,0 +1,7 @@
#!/bin/sh
/etc/init.d/ghttpd enable
/etc/init.d/ghttpd start
exit 0

18
luci-app-ghttpd/Makefile Normal file
View File

@ -0,0 +1,18 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=0.0.1
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for ghttpd
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+ghttpd
define Package/luci-app-ghttpd/conffiles
/etc/config/ghttpd
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,7 @@
module("luci.controller.ghttpd", package.seeall)
function index()
entry({"admin", "services", "ghttpd"}, alias("admin", "services", "ghttpd", "config"), _("Ghttpd"), 31).dependent = true
entry({"admin", "services", "ghttpd", "config"}, cbi("ghttpd"))
end

View File

@ -0,0 +1,21 @@
local m, s
m = Map("ghttpd", translate("Ghttpd"), translate("Ghttpd"))
m:section(SimpleSection).template = "ghttpd/ghttpd_status"
s=m:section(TypedSection, "ghttpd", translate("Global settings"))
s.addremove=false
s.anonymous=true
e = s:option(Flag, "enabled", translate("Enable"))
e.rmempty=false
o = s:option(Value, "port", translate("HTTP Port").."<b>*</b>")
o.rmempty = false
o.default = "8990"
o.datatype = "port"
return m

View File

@ -0,0 +1,31 @@
<%
local util = require "luci.util"
local container_status = util.trim(util.exec("/usr/libexec/istorec/mfun.sh status"))
local container_install = (string.len(container_status) > 0)
local container_running = container_status == "running"
-%>
<div class="cbi-value">
<label class="cbi-value-title"><%:Status%></label>
<div class="cbi-value-field">
<% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%:Mfun is running%></button>
<% else %>
<button class="cbi-button cbi-button-negative" disabled="true"><%:Mfun is not running%></button>
<% end %>
</div>
</div>
<%
if container_running then
local port=util.trim(util.exec("/usr/libexec/istorec/mfun.sh port"))
if port == "" then
port="8990"
end
-%>
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title">&nbsp;</label>
<div class="cbi-value-field">
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Mfun%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
</div>
</div>
<% end %>

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall
PKG_VERSION:=26.4.15
PKG_RELEASE:=88
PKG_RELEASE:=89
PKG_PO_VERSION:=$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \

View File

@ -65,6 +65,15 @@ stop() {
restart() {
set_lock
[ $? == 1 ] && echolog "脚本已经在运行,不重复运行,退出." && exit 0
rule_lock=${LOCK_FILE_DIR}/${CONFIG}_rule_update.lock
sub_lock=${LOCK_FILE_DIR}/${CONFIG}_subscribe.lock
for i in $(seq 1 300); do
if [ ! -f "$rule_lock" ] && [ ! -f "$sub_lock" ]; then
break
fi
sleep 2
done
rm -f "$rule_lock" "$sub_lock"
$APP_FILE stop
$APP_FILE start $1
unset_lock

View File

@ -1558,7 +1558,7 @@ start_dns() {
start_adblock() {
[ "$(config_t_get global adblock 0)" != "1" ] && {
[ -s $RULES_PATH/my_block_host ] && ln -sf $RULES_PATH/my_block_host $RULES_PATH/block_host
[ -s $RULES_PATH/my_block_host ] && ln -sf $RULES_PATH/my_block_host $RULES_PATH/block_host || echo "" >$RULES_PATH/block_host
return
}
"$APP_PATH/adblock.sh" > /dev/null 2>&1 &

View File

@ -669,6 +669,34 @@ if geo2rule ~= "1" and gfwlist_update == "0" and chnroute_update == "0" and chnr
os.exit(0)
end
local function check_instance(action)
local rule_lock = "/var/lock/" .. name .. "_rule_update.lock"
local sub_lock = "/var/lock/" .. name .. "_subscribe.lock"
if action == "start" then
math.randomseed(os.time() + math.floor(os.clock() * 1000))
api.nixio.nanosleep(0, math.random(100, 1000) * 1000000)
if fs.access(rule_lock) then
log("有[规则更新]实例正在运行,请稍后再试...\n")
os.exit(0)
else
luci.sys.call("touch " .. rule_lock)
end
elseif action == "end" then
luci.sys.call("rm -f " .. rule_lock)
return
end
if fs.access(sub_lock) then
log("[订阅]实例正在运行,[规则更新]进入队列等待...\n")
end
while fs.access(sub_lock) do
api.nixio.nanosleep(2, 0)
end
end
check_instance("start")
log("开始更新规则...")
local function safe_call(func, err_msg)
xpcall(func, function(e)
@ -769,3 +797,5 @@ if reboot == 1 then
api.uci_save(uci, name, true, true)
end
log("规则更新完毕...\n")
check_instance("end")

View File

@ -2174,20 +2174,30 @@ local execute = function()
end
end
function check_instance(action)
local lock_file = "/var/lock/" .. appname .. "_subscribe.lock"
local function check_instance(action)
local sub_lock = "/var/lock/" .. appname .. "_subscribe.lock"
local rule_lock = "/var/lock/" .. appname .. "_rule_update.lock"
if action == "start" then
math.randomseed(os.time() + math.floor(os.clock() * 1000))
api.nixio.nanosleep(0, math.random(100, 1000) * 1000000)
if fs.access(lock_file) then
log("订阅实例正在运行,请稍后再试...\n")
if fs.access(sub_lock) then
log("[订阅]实例正在运行,请稍后再试...\n")
os.exit(0)
else
luci.sys.call("touch " .. lock_file)
luci.sys.call("touch " .. sub_lock)
uci:revert(appname)
end
elseif action == "end" then
luci.sys.call("rm -f " .. lock_file)
luci.sys.call("rm -f " .. sub_lock)
return
end
if fs.access(rule_lock) then
log("[规则更新]实例正在运行,[订阅]进入队列等待...\n")
end
while fs.access(rule_lock) do
api.nixio.nanosleep(2, 0)
end
end

View File

@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2
PKG_VERSION:=26.4.20
PKG_RELEASE:=39
PKG_RELEASE:=40
PKG_PO_VERSION:=$(PKG_VERSION)
PKG_CONFIG_DEPENDS:= \

View File

@ -659,7 +659,11 @@ function save_node_list_opt()
end
function update_rules()
local update = http.formvalue("update")
local update = http.formvalue("update") or ""
if update == "" then
http_write_json_error({ message = "missing update target" })
return
end
luci.sys.call("lua /usr/share/passwall2/rule_update.lua log '" .. update .. "' > /dev/null 2>&1 &")
http_write_json()
end

View File

@ -298,7 +298,7 @@ table td, .table .td {
function to_add_node() {
ajaxAbortAll();
const dom = document.getElementsByClassName("cbi-tab")[0];
const current_group = dom.getAttribute("group_name")
const current_group = dom ? (dom.getAttribute("group_name") || "default") : "default";
window.location.href='<%=api.url("add_node")%>?redirect=1&group=' + current_group;
}

View File

@ -471,35 +471,35 @@ end
-- Processing data
local function processData(szType, content, add_mode, group, sub_cfg)
--log(2, content, add_mode, group)
local default_allowinsecure = DEFAULT_ALLOWINSECURE
local default_ss_type = DEFAULT_SS_TYPE
local default_trojan_type = DEFAULT_TROJAN_TYPE
local default_vmess_type = DEFAULT_VMESS_TYPE
local default_vless_type = DEFAULT_VLESS_TYPE
local default_hysteria2_type = DEFAULT_HYSTERIA2_TYPE
local sub_allowinsecure = DEFAULT_ALLOWINSECURE
local sub_ss_type = DEFAULT_SS_TYPE
local sub_trojan_type = DEFAULT_TROJAN_TYPE
local sub_vmess_type = DEFAULT_VMESS_TYPE
local sub_vless_type = DEFAULT_VLESS_TYPE
local sub_hysteria2_type = DEFAULT_HYSTERIA2_TYPE
if sub_cfg then
if sub_cfg.allowInsecure and sub_cfg.allowInsecure ~= "1" then
default_allowinsecure = nil
sub_allowinsecure = nil
end
local ss_type = sub_cfg.ss_type or "global"
if ss_type ~= "global" and core_has[ss_type] then
default_ss_type = ss_type
sub_ss_type = ss_type
end
local trojan_type = sub_cfg.trojan_type or "global"
if trojan_type ~= "global" and core_has[trojan_type] then
default_trojan_type = trojan_type
sub_trojan_type = trojan_type
end
local vmess_type = sub_cfg.vmess_type or "global"
if vmess_type ~= "global" and core_has[vmess_type] then
default_vmess_type = vmess_type
sub_vmess_type = vmess_type
end
local vless_type = sub_cfg.vless_type or "global"
if vless_type ~= "global" and core_has[vless_type] then
default_vless_type = vless_type
sub_vless_type = vless_type
end
local hysteria2_type = sub_cfg.hysteria2_type or "global"
if hysteria2_type ~= "global" and core_has[hysteria2_type] then
default_hysteria2_type = hysteria2_type
sub_hysteria2_type = hysteria2_type
end
end
local result = {
@ -541,15 +541,14 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.remarks = base64Decode(params.remarks)
elseif szType == 'vmess' then
local info = jsonParse(content)
if default_vmess_type == "sing-box" and has_singbox then
if sub_vmess_type == "sing-box" and has_singbox then
result.type = 'sing-box'
elseif default_vmess_type == "xray" and has_xray then
elseif sub_vmess_type == "xray" and has_xray then
result.type = "Xray"
else
log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "VMess", "VMess"))
return nil
end
result.alter_id = info.aid
result.address = info.add
result.port = info.port
result.protocol = 'vmess'
@ -649,7 +648,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tls_CertSha = info.pcs
result.tls_CertByName = info.vcn
local insecure = info.allowinsecure or info.allowInsecure or info.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
else
result.tls = "0"
end
@ -665,7 +664,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
return nil
end
elseif szType == "ss" then
result = set_ss_implementation(default_ss_type, result)
result = set_ss_implementation(sub_ss_type, result)
if not result then return nil end
--SS-URI = "ss://" userinfo "@" hostname ":" port [ "/" ] [ "?" plugin ] [ "#" tag ]
@ -928,7 +927,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
end
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
result.uot = params.udp
elseif (params.type ~= "tcp" and params.type ~= "raw") and (params.headerType and params.headerType ~= "none") then
result.error_msg = i18n.translatef("Please replace Xray or Sing-Box to support more transmission methods in Shadowsocks.")
@ -937,7 +936,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
if params["shadow-tls"] then
if result.type ~= "sing-box" and result.type ~= "SS-Rust" then
result.error_msg = default_ss_type .. " " .. i18n.translatef("unsupport %s plugin.", "shadow-tls")
result.error_msg = sub_ss_type .. " " .. i18n.translatef("unsupport %s plugin.", "shadow-tls")
else
-- Parsing SS Shadow-TLS plugin parameters
local function parseShadowTLSParams(b64str, out)
@ -979,10 +978,10 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
end
elseif szType == "trojan" then
if default_trojan_type == "sing-box" and has_singbox then
if sub_trojan_type == "sing-box" and has_singbox then
result.type = 'sing-box'
result.protocol = 'trojan'
elseif default_trojan_type == "xray" and has_xray then
elseif sub_trojan_type == "xray" and has_xray then
result.type = 'Xray'
result.protocol = 'trojan'
else
@ -1032,7 +1031,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tls_CertSha = params.pcs
result.tls_CertByName = params.vcn
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
if not params.type then params.type = "tcp" end
params.type = string.lower(params.type)
@ -1117,7 +1116,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
end
elseif szType == "ssd" then
result = set_ss_implementation(default_ss_type, result)
result = set_ss_implementation(sub_ss_type, result)
if not result then return nil end
result.address = content.server
result.port = content.port
@ -1128,9 +1127,9 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.group = content.airport
result.remarks = content.remarks
elseif szType == "vless" then
if default_vless_type == "sing-box" and has_singbox then
if sub_vless_type == "sing-box" and has_singbox then
result.type = 'sing-box'
elseif default_vless_type == "xray" and has_xray then
elseif sub_vless_type == "xray" and has_xray then
result.type = "Xray"
else
log(2, i18n.translatef("Skipping the %s node is due to incompatibility with the %s core program or incorrect node usage type settings.", "VLESS", "VLESS"))
@ -1283,7 +1282,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.reality_mldsa65Verify = params.pqv or nil
end
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
end
result.port = port
@ -1340,7 +1339,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.hysteria_auth_password = params.auth
result.tls_serverName = params.peer or params.sni or ""
local insecure = params.allowinsecure or params.allowInsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
result.alpn = params.alpn
result.hysteria_up_mbps = params.upmbps
result.hysteria_down_mbps = params.downmbps
@ -1386,12 +1385,12 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tls_CertSha = params.pcs
result.tls_CertByName = params.vcn
local insecure = params.allowinsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
result.hysteria2_tls_pinSHA256 = params.pinSHA256
result.hysteria2_hop = params.mport
if (default_hysteria2_type == "sing-box" and has_singbox) or (default_hysteria2_type == "xray" and has_xray) then
local is_singbox = default_hysteria2_type == "sing-box" and has_singbox
if (sub_hysteria2_type == "sing-box" and has_singbox) or (sub_hysteria2_type == "xray" and has_xray) then
local is_singbox = sub_hysteria2_type == "sing-box" and has_singbox
result.type = is_singbox and 'sing-box' or 'Xray'
result.protocol = "hysteria2"
if params["obfs-password"] or params["obfs_password"] then
@ -1466,7 +1465,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
result.tuic_congestion_control = params.congestion_control or "cubic"
result.tuic_udp_relay_mode = params.udp_relay_mode or "native"
local insecure = params.allowinsecure or params.insecure or params.allow_insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
elseif szType == "anytls" then
if has_singbox then
result.type = 'sing-box'
@ -1530,7 +1529,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
end
result.port = port
local insecure = params.allowinsecure or params.insecure
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (default_allowinsecure and "1" or "0")
result.tls_allowInsecure = (insecure == "1" or insecure == "0") and insecure or (sub_allowinsecure and "1" or "0")
end
elseif szType == 'naive+https' or szType == 'naive+quic' then
if has_singbox then