mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-27 02:11:19 +08:00
💐 Sync 2026-05-25 21:11:41
This commit is contained in:
parent
6a3fdbbd43
commit
9d0be29ac0
55
baidudrive/Makefile
Normal file
55
baidudrive/Makefile
Normal file
@ -0,0 +1,55 @@
|
||||
#
|
||||
# Copyright (C) 2015-2016 OpenWrt.org
|
||||
# Copyright (C) 2026 jjm2473@gmail.com
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_ARCH_baidudrive:=$(ARCH)
|
||||
|
||||
PKG_NAME:=baidudrive
|
||||
PKG_VERSION:=0.3.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/linkease/istore-packages/releases/download/prebuilt/
|
||||
PKG_HASH:=skip
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(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:=BaiduDrive
|
||||
DEPENDS:=@(x86_64||aarch64)
|
||||
URL:=https://github.com/linkease/istore-packages
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
BaiduDrive provides a Baidu Netdisk Web UI for iStoreOS.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/baidudrive
|
||||
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/config
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/baidudrive.$(PKG_ARCH_baidudrive) $(1)/usr/sbin/baidudrive
|
||||
$(INSTALL_BIN) ./files/baidudrive.init $(1)/etc/init.d/baidudrive
|
||||
$(INSTALL_CONF) ./files/baidudrive.config $(1)/etc/config/baidudrive
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
4
baidudrive/files/baidudrive.config
Normal file
4
baidudrive/files/baidudrive.config
Normal file
@ -0,0 +1,4 @@
|
||||
config baidudrive
|
||||
option 'enabled' '0'
|
||||
option 'data_dir' ''
|
||||
option 'port' '8080'
|
||||
35
baidudrive/files/baidudrive.init
Normal file
35
baidudrive/files/baidudrive.init
Normal file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=93
|
||||
USE_PROCD=1
|
||||
|
||||
get_config() {
|
||||
config_get_bool enabled "$1" enabled 1
|
||||
config_get data_dir "$1" data_dir ""
|
||||
config_get port "$1" port "8080"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load baidudrive
|
||||
config_foreach get_config baidudrive
|
||||
if [ "$enabled" != 1 ]; then
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$data_dir" ]; then
|
||||
logger -t baidudrive "data_dir is empty; please set option data_dir in /etc/config/baidudrive"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p "$data_dir" || return 1
|
||||
|
||||
logger -t baidudrive "Starting BaiduDrive Service"
|
||||
procd_open_instance baidudrive
|
||||
procd_set_param command /usr/sbin/baidudrive --port "$port" --data "$data_dir"
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "baidudrive"
|
||||
}
|
||||
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=beszel-agent
|
||||
PKG_VERSION:=0.18.7
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_ARCH:=arm64
|
||||
|
||||
@ -7,43 +7,47 @@ USE_PROCD=1
|
||||
PROG=/usr/bin/beszel-agent
|
||||
|
||||
start_service() {
|
||||
local enabled port key url token
|
||||
|
||||
config_load 'beszel-agent'
|
||||
config_get_bool enabled 'agent' 'enabled' '0'
|
||||
config_get port 'agent' 'port' '45876'
|
||||
config_get key 'agent' 'public_key' ''
|
||||
config_get url 'agent' 'hub_url' ''
|
||||
config_get token 'agent' 'token' ''
|
||||
|
||||
[ "$enabled" -eq 0 ] && return 0
|
||||
local enabled port key url token
|
||||
|
||||
[ -z "$key" ] && {
|
||||
logger -t beszel-agent "Public key not set!"
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ -n "$url" ] || [ -n "$token" ]; then
|
||||
if [ -z "$url" ] || [ -z "$token" ]; then
|
||||
logger -t beszel-agent "Outbound mode requires both hub_url and token, but only one set!"
|
||||
return 1
|
||||
fi
|
||||
config_load 'beszel-agent'
|
||||
config_get_bool enabled 'agent' 'enabled' '0'
|
||||
config_get port 'agent' 'port' '45876'
|
||||
config_get key 'agent' 'public_key' ''
|
||||
config_get url 'agent' 'hub_url' ''
|
||||
config_get token 'agent' 'token' ''
|
||||
|
||||
[ "$enabled" -eq 0 ] && return 0
|
||||
|
||||
[ -z "$key" ] && {
|
||||
logger -t beszel-agent "Public key not set!"
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ -n "$url" ] || [ -n "$token" ]; then
|
||||
if [ -z "$url" ] || [ -z "$token" ]; then
|
||||
logger -t beszel-agent "Outbound mode requires both hub_url and token, but only one set!"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
procd_open_instance beszel-agent
|
||||
procd_set_param command "$PROG" -listen "$port" -key "$key"
|
||||
[ -n "$url" ] && [ -n "$token" ] && {
|
||||
procd_append_param command -url "$url" -token "$token"
|
||||
}
|
||||
procd_set_param respawn 3600 5 5
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param user root
|
||||
procd_close_instance
|
||||
mkdir -p /usr/share/beszel-agent
|
||||
|
||||
procd_open_instance beszel-agent
|
||||
procd_set_param command "$PROG" -listen "$port" -key "$key"
|
||||
[ -n "$url" ] && [ -n "$token" ] && {
|
||||
procd_append_param command -url "$url" -token "$token"
|
||||
}
|
||||
|
||||
procd_set_param env DATA_DIR=/usr/share/beszel-agent
|
||||
procd_set_param respawn 3600 5 5
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param user root
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
service_stop "$PROG"
|
||||
service_stop "$PROG"
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
||||
@ -11,7 +11,7 @@ PKG_ARCH_ghttpd:=$(ARCH)
|
||||
|
||||
PKG_NAME:=ghttpd
|
||||
PKG_VERSION:=0.0.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/Carseason/openwrt-packages/releases/download/prebuilt/
|
||||
PKG_HASH:=skip
|
||||
|
||||
@ -24,4 +24,4 @@ start_service() {
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "ghttpd"
|
||||
}
|
||||
}
|
||||
28
luci-app-baidudrive/Makefile
Normal file
28
luci-app-baidudrive/Makefile
Normal file
@ -0,0 +1,28 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=baidudrive
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
LUCI_DEPENDS:=+baidudrive +luci-compat
|
||||
LUCI_MINIFY_CSS:=0
|
||||
LUCI_MINIFY_JS:=0
|
||||
|
||||
define Package/luci-app-baidudrive/conffiles
|
||||
/etc/config/baidudrive
|
||||
endef
|
||||
|
||||
define Package/luci-app-baidudrive/postrm
|
||||
#!/bin/sh
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
25
luci-app-baidudrive/luasrc/controller/baidudrive.lua
Normal file
25
luci-app-baidudrive/luasrc/controller/baidudrive.lua
Normal file
@ -0,0 +1,25 @@
|
||||
local http = require "luci.http"
|
||||
|
||||
module("luci.controller.baidudrive", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/baidudrive") then
|
||||
return
|
||||
end
|
||||
local page
|
||||
page = entry({"admin", "services", "baidudrive"}, cbi("baidudrive"), _("BaiduDrive"), 100)
|
||||
page.dependent = true
|
||||
entry({"admin", "services", "baidudrive_status"}, call("baidudrive_status"))
|
||||
end
|
||||
|
||||
function baidudrive_status()
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local port = uci:get_first("baidudrive", "baidudrive", "port") or "8080"
|
||||
local status = {
|
||||
running = (sys.call("pidof baidudrive >/dev/null") == 0),
|
||||
port = port
|
||||
}
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(status)
|
||||
end
|
||||
53
luci-app-baidudrive/luasrc/model/baidudrive.lua
Normal file
53
luci-app-baidudrive/luasrc/model/baidudrive.lua
Normal file
@ -0,0 +1,53 @@
|
||||
local jsonc = require "luci.jsonc"
|
||||
|
||||
local baidudrive = {}
|
||||
|
||||
baidudrive.blocks = function()
|
||||
local f = io.popen("lsblk -s -f -b -o NAME,FSSIZE,MOUNTPOINT --json", "r")
|
||||
local vals = {}
|
||||
if f then
|
||||
local ret = f:read("*all")
|
||||
f:close()
|
||||
local obj = jsonc.parse(ret)
|
||||
for _, val in pairs(obj and obj["blockdevices"] or {}) do
|
||||
local fsize = val["fssize"]
|
||||
if fsize ~= nil and string.len(fsize) > 10 and val["mountpoint"] then
|
||||
vals[#vals + 1] = val["mountpoint"]
|
||||
end
|
||||
end
|
||||
end
|
||||
return vals
|
||||
end
|
||||
|
||||
baidudrive.home = function()
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local home_dirs = {}
|
||||
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/root")
|
||||
home_dirs["Configs"] = uci:get_first("quickstart", "main", "conf_dir", home_dirs["main_dir"] .. "/Configs")
|
||||
home_dirs["Public"] = uci:get_first("quickstart", "main", "pub_dir", home_dirs["main_dir"] .. "/Public")
|
||||
home_dirs["Downloads"] = uci:get_first("quickstart", "main", "dl_dir", home_dirs["Public"] .. "/Downloads")
|
||||
home_dirs["Caches"] = uci:get_first("quickstart", "main", "tmp_dir", home_dirs["main_dir"] .. "/Caches")
|
||||
return home_dirs
|
||||
end
|
||||
|
||||
baidudrive.find_paths = function(blocks, home_dirs, path_name)
|
||||
local default_path = ""
|
||||
local paths = {}
|
||||
|
||||
default_path = home_dirs[path_name] .. "/BaiduDrive"
|
||||
if #blocks == 0 then
|
||||
table.insert(paths, default_path)
|
||||
else
|
||||
for _, val in pairs(blocks) do
|
||||
table.insert(paths, val .. "/" .. path_name .. "/BaiduDrive")
|
||||
end
|
||||
local without_conf_dir = "/root/" .. path_name .. "/BaiduDrive"
|
||||
if default_path == without_conf_dir then
|
||||
default_path = paths[1]
|
||||
end
|
||||
end
|
||||
|
||||
return paths, default_path
|
||||
end
|
||||
|
||||
return baidudrive
|
||||
32
luci-app-baidudrive/luasrc/model/cbi/baidudrive.lua
Normal file
32
luci-app-baidudrive/luasrc/model/cbi/baidudrive.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local m, s
|
||||
|
||||
m = Map("baidudrive", translate("BaiduDrive"), translate("BaiduDrive provides a Baidu Netdisk Web UI."))
|
||||
m:section(SimpleSection).template = "baidudrive/baidudrive_status"
|
||||
|
||||
s = m:section(TypedSection, "baidudrive", translate("Global settings"))
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
s:option(Flag, "enabled", translate("Enable")).rmempty = false
|
||||
|
||||
local baidudrive_model = require "luci.model.baidudrive"
|
||||
local blocks = baidudrive_model.blocks()
|
||||
local home = baidudrive_model.home()
|
||||
|
||||
local data_dir = s:option(Value, "data_dir", translate("Data directory"))
|
||||
data_dir.rmempty = false
|
||||
data_dir.description = translate("Required. BaiduDrive stores its config, session and task data under this directory.")
|
||||
|
||||
local paths, default_path = baidudrive_model.find_paths(blocks, home, "Configs")
|
||||
for _, val in pairs(paths) do
|
||||
data_dir:value(val, val)
|
||||
end
|
||||
data_dir.default = default_path
|
||||
|
||||
local port = s:option(Value, "port", translate("Listen port"))
|
||||
port.default = "8080"
|
||||
port.rmempty = false
|
||||
port.datatype = "port"
|
||||
port.description = translate("Port for BaiduDrive HTTP server.")
|
||||
|
||||
return m
|
||||
@ -0,0 +1,21 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(5, '<%=url("admin/services/baidudrive_status")%>', null, function(x, st) {
|
||||
var el = document.getElementById('baidudrive_status');
|
||||
if (st && el) {
|
||||
if (!st.running) {
|
||||
el.innerHTML = '<br/><em style=\"color:red\"><%:The BaiduDrive service is not running.%></em>';
|
||||
}
|
||||
if (st.running) {
|
||||
el.innerHTML = '<br/><em style=\"color:green\"><%:The BaiduDrive service is running.%></em>'
|
||||
+ "<br/><br/><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:Click to open BaiduDrive%> \" onclick=\"window.open('http://" + window.location.hostname + ":" + st.port + "/')\"/>";
|
||||
}
|
||||
}
|
||||
});
|
||||
//]]></script>
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<legend><%:Status%></legend>
|
||||
<p id="baidudrive_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_VERSION:=0.0.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
LUCI_TITLE:=LuCI support for ghttpd
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
local m, s
|
||||
|
||||
m = Map("ghttpd", translate("Ghttpd"), translate("Ghttpd"))
|
||||
m:section(SimpleSection).template = "ghttpd/ghttpd_status"
|
||||
m:section(SimpleSection).template = "ghttpd/status"
|
||||
|
||||
s=m:section(TypedSection, "ghttpd", translate("Global settings"))
|
||||
s.addremove=false
|
||||
|
||||
@ -1,31 +1,26 @@
|
||||
<%
|
||||
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"
|
||||
local sys = require "luci.sys"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local running = (sys.call("pidof ghttpd >/dev/null") == 0)
|
||||
local port = uci:get("ghttpd", "config", "port") or "8333"
|
||||
-%>
|
||||
<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>
|
||||
<% if running then %>
|
||||
<button class="cbi-button cbi-button-success" disabled="true"><%:Ghttpd is running%></button>
|
||||
<% else %>
|
||||
<button class="cbi-button cbi-button-negative" disabled="true"><%:Mfun is not running%></button>
|
||||
<button class="cbi-button cbi-button-negative" disabled="true"><%:Ghttpd 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"> </label>
|
||||
<div class="cbi-value-field">
|
||||
<% if running then %>
|
||||
<div class="cbi-value cbi-value-last">
|
||||
<label class="cbi-value-title"> </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')">
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" name="start" value="<%:Open Ghttpd%>" onclick="window.open('http://'+location.hostname+':<%=port%>/', '_blank')">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.5.20
|
||||
PKG_RELEASE:=136
|
||||
PKG_RELEASE:=137
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@ -62,11 +62,13 @@ o.rewrite_option = o.option
|
||||
o = s:option(ListValue, _n("obfs_type"), translate("Obfs Type"))
|
||||
o:value("", translate("Disable"))
|
||||
o:value("salamander")
|
||||
o:value("gecko")
|
||||
o.rewrite_option = o.option
|
||||
|
||||
o = s:option(Value, _n("obfs_password"), translate("Obfs Password"))
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("obfs_type")] = "salamander" })
|
||||
o:depends({ [_n("obfs_type")] = "gecko" })
|
||||
|
||||
o = s:option(Flag, _n("fast_open"), translate("Fast Open"))
|
||||
o.default = "0"
|
||||
|
||||
@ -386,10 +386,12 @@ if singbox_tags:find("with_quic") then
|
||||
o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type"))
|
||||
o:value("", translate("Disable"))
|
||||
o:value("salamander")
|
||||
o:value("gecko")
|
||||
o:depends({ [_n("protocol")] = "hysteria2" })
|
||||
|
||||
o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password"))
|
||||
o:depends({ [_n("hysteria2_obfs_type")] = "salamander" })
|
||||
o:depends({ [_n("hysteria2_obfs_type")] = "gecko" })
|
||||
|
||||
o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps"))
|
||||
o:depends({ [_n("protocol")] = "hysteria2" })
|
||||
|
||||
@ -50,12 +50,14 @@ o:depends({ [_n("custom")] = false })
|
||||
o = s:option(ListValue, _n("obfs_type"), translate("Obfs Type"))
|
||||
o:value("", translate("Disable"))
|
||||
o:value("salamander")
|
||||
o:value("gecko")
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("custom")] = false })
|
||||
|
||||
o = s:option(Value, _n("obfs_password"), translate("Obfs Password"))
|
||||
o.rewrite_option = o.option
|
||||
o:depends({ [_n("obfs_type")] = "salamander" })
|
||||
o:depends({ [_n("obfs_type")] = "gecko" })
|
||||
|
||||
o = s:option(Flag, _n("udp"), translate("UDP"))
|
||||
o.default = "1"
|
||||
|
||||
@ -175,10 +175,12 @@ if singbox_tags:find("with_quic") then
|
||||
o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type"))
|
||||
o:value("", translate("Disable"))
|
||||
o:value("salamander")
|
||||
o:value("gecko")
|
||||
o:depends({ [_n("protocol")] = "hysteria2" })
|
||||
|
||||
o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password"))
|
||||
o:depends({ [_n("hysteria2_obfs_type")] = "salamander" })
|
||||
o:depends({ [_n("hysteria2_obfs_type")] = "gecko" })
|
||||
|
||||
o = s:option(Flag, _n("hysteria2_ignore_client_bandwidth"), translate("Client BBR Flow Control"), translate("Commands the client to use the BBR flow control algorithm"))
|
||||
o.default = 0
|
||||
|
||||
@ -20,8 +20,8 @@ function gen_config_server(node)
|
||||
key = node.tls_keyFile,
|
||||
},
|
||||
obfs = (node.hysteria2_obfs_type and node.hysteria2_obfs_password) and {
|
||||
type = "salamander",
|
||||
salamander = {
|
||||
type = node.hysteria2_obfs_type,
|
||||
[node.hysteria2_obfs_type] = {
|
||||
password = node.hysteria2_obfs_password
|
||||
}
|
||||
} or nil,
|
||||
@ -104,8 +104,8 @@ function gen_config(var)
|
||||
end)() or nil
|
||||
},
|
||||
obfs = (node.hysteria2_obfs_type and node.hysteria2_obfs_password) and {
|
||||
type = "salamander",
|
||||
salamander = {
|
||||
type = node.hysteria2_obfs_type,
|
||||
[node.hysteria2_obfs_type] = {
|
||||
password = node.hysteria2_obfs_password
|
||||
}
|
||||
} or nil,
|
||||
|
||||
@ -600,7 +600,7 @@ local current_node = map:get(section)
|
||||
v_password = opt.get("hysteria2_auth_password");
|
||||
var dom_obfs = opt.get("hysteria2_obfs_password");
|
||||
if (dom_obfs && dom_obfs.value != "") {
|
||||
params += "&obfs=" + "salamander";
|
||||
params += opt.query("obfs", "hysteria2_obfs_type");
|
||||
params += opt.query("obfs-password", "hysteria2_obfs_password");
|
||||
}
|
||||
params += opt.query("mport", "hysteria2_hop");
|
||||
@ -1597,7 +1597,7 @@ local current_node = map:get(section)
|
||||
opt.set(dom_prefix + 'protocol', "hysteria2");
|
||||
opt.set(dom_prefix + 'hysteria2_auth_password', decodeURIComponent(password));
|
||||
if (queryParam["obfs-password"] || queryParam["obfs_password"]) {
|
||||
opt.set(dom_prefix + 'hysteria2_obfs_type', "salamander");
|
||||
opt.set(dom_prefix + 'hysteria2_obfs_type', queryParam.obfs || "salamander");
|
||||
opt.set(dom_prefix + 'hysteria2_obfs_password', queryParam["obfs-password"] || queryParam["obfs_password"]);
|
||||
}
|
||||
opt.set(dom_prefix + 'hysteria2_hop', queryParam.mport || "");
|
||||
@ -1608,7 +1608,7 @@ local current_node = map:get(section)
|
||||
dom_prefix = "hysteria2_"
|
||||
opt.set(dom_prefix + 'auth_password', decodeURIComponent(password));
|
||||
if (queryParam["obfs-password"] || queryParam["obfs_password"]) {
|
||||
opt.set(dom_prefix + 'obfs_type', "salamander");
|
||||
opt.set(dom_prefix + 'obfs_type', queryParam.obfs || "salamander");
|
||||
opt.set(dom_prefix + 'obfs_password', queryParam["obfs-password"] || queryParam["obfs_password"]);
|
||||
}
|
||||
opt.set(dom_prefix + 'hop', queryParam.mport || "");
|
||||
|
||||
@ -258,6 +258,7 @@ local function encode_trojan(node)
|
||||
if o.tls.sni then table.insert(p, "sni=" .. urlencode(o.tls.sni)) end
|
||||
if o.tls.fp then table.insert(p, "fp=" .. urlencode(o.tls.fp)) end
|
||||
if o.tls.alpn then table.insert(p, "alpn=" .. urlencode(o.tls.alpn)) end
|
||||
if o.tls.ech then table.insert(p, "ech=" .. urlencode(o.tls.ech)) end
|
||||
if o.tls.pcs then table.insert(p, "pcs=" .. urlencode(o.tls.pcs)) end
|
||||
table.insert(p, "allowInsecure=" .. (o.tls.insecure and "1" or "0"))
|
||||
|
||||
@ -294,6 +295,7 @@ local function encode_vmess(node)
|
||||
sni = o.tls.sni,
|
||||
alpn = o.tls.alpn,
|
||||
fp = o.tls.fp,
|
||||
ech = o.tls.ech,
|
||||
pcs = o.tls.pcs,
|
||||
insecure = o.tls.insecure and "1" or "0",
|
||||
tfo = node.tfo and "1" or "0"
|
||||
@ -425,7 +427,6 @@ local function encode_tuic(node)
|
||||
if node["disable-sni"] then table.insert(p, "disable_sni=1") end
|
||||
if node["skip-cert-verify"] then table.insert(p, "allowInsecure=1") end
|
||||
if node["udp-relay-mode"] then table.insert(p, "udp_relay_mode=" .. node["udp-relay-mode"]) end
|
||||
|
||||
|
||||
if #p > 0 then
|
||||
link = link .. "?" .. table.concat(p, "&")
|
||||
@ -436,14 +437,19 @@ end
|
||||
|
||||
-- AnyTLS
|
||||
local function encode_anytls(node)
|
||||
local o = build_common(node)
|
||||
|
||||
local link = "anytls://" .. (node.password or "") .. "@" .. host_format(node.server) .. ":" .. node.port
|
||||
local p = {}
|
||||
|
||||
if node.sni then table.insert(p, "sni=" .. urlencode(node.sni)) end
|
||||
if node["skip-cert-verify"] then table.insert(p, "allowInsecure=1") end
|
||||
|
||||
if node.alpn then
|
||||
table.insert(p, "alpn=" .. urlencode(build_alpn(node.alpn)))
|
||||
if o.tls.sni then table.insert(p, "sni=" .. urlencode(o.tls.sni)) end
|
||||
if o.tls.alpn then table.insert(p, "alpn=" .. urlencode(o.tls.alpn)) end
|
||||
if o.tls.fp then table.insert(p, "fp=" .. urlencode(o.tls.fp)) end
|
||||
if o.tls.ech then table.insert(p, "ech=" .. urlencode(o.tls.ech)) end
|
||||
if o.tls.pcs then
|
||||
table.insert(p, "allowInsecure=1")
|
||||
else
|
||||
table.insert(p, "allowInsecure=" .. (o.tls.insecure and "1" or "0"))
|
||||
end
|
||||
|
||||
if #p > 0 then
|
||||
|
||||
@ -1413,7 +1413,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.hysteria2_down_mbps = params.downmbps or sub_hy_down_mbps
|
||||
result.hysteria2_hop = params.mport
|
||||
if params["obfs-password"] or params["obfs_password"] then
|
||||
result.hysteria2_obfs_type = "salamander"
|
||||
result.hysteria2_obfs_type = params.obfs or "salamander"
|
||||
result.hysteria2_obfs_password = params["obfs-password"] or params["obfs_password"]
|
||||
end
|
||||
|
||||
@ -1547,6 +1547,10 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.reality_publicKey = params.pbk or nil
|
||||
result.reality_shortId = params.sid or nil
|
||||
end
|
||||
if params.ech and params.ech ~= "" then
|
||||
result.ech = "1"
|
||||
result.ech_config = params.ech
|
||||
end
|
||||
end
|
||||
result.port = port
|
||||
local insecure = params.allowinsecure or params.insecure
|
||||
|
||||
Loading…
Reference in New Issue
Block a user