update 2024-03-19 20:28:46
This commit is contained in:
parent
afdc1544a7
commit
029bd2df22
|
@ -1,51 +0,0 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-only
|
|
||||||
#
|
|
||||||
# Copyright (C) 2021-2023 ImmortalWrt.org
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=gowebdav
|
|
||||||
PKG_VERSION:=0.0.5
|
|
||||||
PKG_RELEASE:=2
|
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
||||||
PKG_SOURCE_URL:=https://codeload.github.com/1715173329/gowebdav/tar.gz/v$(PKG_VERSION)?
|
|
||||||
PKG_HASH:=ee0ac5a52a3b7a1e1c687b850c3f7b55e10bbdc88da0b6b1dd8b790fc53d10c6
|
|
||||||
|
|
||||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=golang/host
|
|
||||||
PKG_BUILD_PARALLEL:=1
|
|
||||||
PKG_BUILD_FLAGS:=no-mips16
|
|
||||||
|
|
||||||
GO_PKG:=github.com/1715173329/gowebdav
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
|
||||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
|
||||||
|
|
||||||
define Package/gowebdav
|
|
||||||
SECTION:=net
|
|
||||||
CATEGORY:=Network
|
|
||||||
SUBMENU:=File Transfer
|
|
||||||
TITLE:=A simple WebDav server written in Go
|
|
||||||
URL:=https://github.com/1715173329/gowebdav
|
|
||||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/gowebdav/conffiles
|
|
||||||
/etc/config/gowebdav
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/gowebdav/install
|
|
||||||
$(call GoPackage/Package/Install/Bin,$(1))
|
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(INSTALL_CONF) $(CURDIR)/files/gowebdav.config $(1)/etc/config/gowebdav
|
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
|
||||||
$(INSTALL_BIN) $(CURDIR)/files/gowebdav.init $(1)/etc/init.d/gowebdav
|
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
|
||||||
$(INSTALL_BIN) $(CURDIR)/files/gowebdav-migrate-config.sh $(1)/etc/uci-defaults/90-gowebdav-migrate-config
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call GoBinPackage,gowebdav))
|
|
||||||
$(eval $(call BuildPackage,gowebdav))
|
|
|
@ -1,24 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
. /lib/functions.sh
|
|
||||||
|
|
||||||
config_load "gowebdav"
|
|
||||||
config_get enable "config" "enable"
|
|
||||||
[ -z "$enable" ] || uci -q rename "gowebdav.config.enable"="enabled"
|
|
||||||
|
|
||||||
config_get root_dir "config" "root_dir"
|
|
||||||
[ -z "$root_dir" ] || uci -q rename "gowebdav.config.root_dir"="mount_dir"
|
|
||||||
|
|
||||||
config_get allow_wan "config" "allow_wan"
|
|
||||||
[ -z "$allow_wan" ] || uci -q rename "gowebdav.config.allow_wan"="public_access"
|
|
||||||
|
|
||||||
config_get enable_auth "config" "enable_auth"
|
|
||||||
config_get username "config" "username"
|
|
||||||
[ -z "$enable_auth" -a -n "$username" ] && uci -q set "gowebdav.config.enable_auth"="1"
|
|
||||||
|
|
||||||
config_get use_https "config" "use_https"
|
|
||||||
[ -z "$use_https" ] || uci -q rename "gowebdav.config.use_https"="enable_https"
|
|
||||||
|
|
||||||
[ -z "$(uci -q changes "gowebdav")" ] || uci -q commit "gowebdav"
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,14 +0,0 @@
|
||||||
|
|
||||||
config gowebdav 'config'
|
|
||||||
option enabled '0'
|
|
||||||
option listen_port '6086'
|
|
||||||
option mount_dir '/mnt'
|
|
||||||
option read_only '0'
|
|
||||||
option public_access '0'
|
|
||||||
option enable_auth '0'
|
|
||||||
option username ''
|
|
||||||
option password ''
|
|
||||||
option enable_https '0'
|
|
||||||
option cert_cer ''
|
|
||||||
option cert_key ''
|
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
#!/bin/sh /etc/rc.common
|
|
||||||
# Copyright (C) 2021-2023 ImmortalWrt.org
|
|
||||||
|
|
||||||
START=99
|
|
||||||
USE_PROCD=1
|
|
||||||
|
|
||||||
CONF="gowebdav"
|
|
||||||
PROG="/usr/bin/gowebdav"
|
|
||||||
|
|
||||||
start_service() {
|
|
||||||
config_load "$CONF"
|
|
||||||
|
|
||||||
local enabled
|
|
||||||
config_get_bool enabled "config" "enabled" "0"
|
|
||||||
[ "$enabled" -eq "1" ] || return 1
|
|
||||||
|
|
||||||
local listen_port mount_dir read_only public_access
|
|
||||||
local enable_auth username password
|
|
||||||
local enable_https cert_cer cert_key
|
|
||||||
|
|
||||||
config_get listen_port "config" "listen_port" "6086"
|
|
||||||
config_get mount_dir "config" "mount_dir" "/mnt"
|
|
||||||
config_get_bool read_only "config" "read_only" "0"
|
|
||||||
config_get_bool public_access "config" "public_access" "0"
|
|
||||||
|
|
||||||
config_get_bool enable_auth "config" "enable_auth" "0"
|
|
||||||
config_get username "config" "username"
|
|
||||||
config_get password "config" "password"
|
|
||||||
|
|
||||||
config_get_bool enable_https "config" "enable_https" "0"
|
|
||||||
config_get cert_cer "config" "cert_cer"
|
|
||||||
config_get cert_key "config" "cert_key"
|
|
||||||
|
|
||||||
[ -d "$mount_dir" ] || mkdir -p "$mount_dir"
|
|
||||||
|
|
||||||
procd_open_instance
|
|
||||||
procd_set_param command "$PROG"
|
|
||||||
procd_append_param command -dir "$mount_dir"
|
|
||||||
procd_append_param command -http ":$listen_port"
|
|
||||||
[ "$read_only" -eq "0" ] || procd_append_param command -read-only
|
|
||||||
|
|
||||||
if [ "$enable_auth" -eq "1" ]; then
|
|
||||||
if [ -z "$username" ] || [ -z "$password" ]; then
|
|
||||||
logger -p daemon.err -t "$CONF" "Authentication enabled with empty username or password!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
procd_append_param command -user "$username"
|
|
||||||
procd_append_param command -password "$password"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$enable_https" -eq "1" ]; then
|
|
||||||
if [ -z "$cert_cer" ] || [ -z "$cert_key" ]; then
|
|
||||||
logger -p daemon.err -t "$CONF" "HTTPS enabled with empty certificate!"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
procd_append_param command -https-mode
|
|
||||||
procd_append_param command -https-cert-file "$cert_cer"
|
|
||||||
procd_append_param command -https-key-file "$cert_key"
|
|
||||||
fi
|
|
||||||
|
|
||||||
procd_set_param limits core="unlimited"
|
|
||||||
procd_set_param limits nofile="1000000 1000000"
|
|
||||||
procd_set_param respawn
|
|
||||||
procd_set_param stdout 1
|
|
||||||
procd_set_param stderr 1
|
|
||||||
|
|
||||||
if [ "$public_access" -eq "1" ]; then
|
|
||||||
procd_open_data
|
|
||||||
json_add_array firewall
|
|
||||||
json_add_object ""
|
|
||||||
json_add_string type rule
|
|
||||||
json_add_string name "Allow-access-GoWebDav-at-$listen_port"
|
|
||||||
json_add_string src "*"
|
|
||||||
json_add_string dest_port "$listen_port"
|
|
||||||
json_add_string proto tcp
|
|
||||||
json_add_string target ACCEPT
|
|
||||||
json_close_object
|
|
||||||
json_close_array
|
|
||||||
procd_close_data
|
|
||||||
fi
|
|
||||||
|
|
||||||
procd_close_instance
|
|
||||||
}
|
|
||||||
|
|
||||||
service_started() {
|
|
||||||
procd_set_config_changed firewall
|
|
||||||
}
|
|
||||||
|
|
||||||
service_stopped() {
|
|
||||||
procd_set_config_changed firewall
|
|
||||||
}
|
|
||||||
|
|
||||||
service_triggers() {
|
|
||||||
procd_add_reload_trigger "$CONF"
|
|
||||||
}
|
|
|
@ -10,11 +10,11 @@ include $(TOPDIR)/rules.mk
|
||||||
PKG_ARCH_LINKEASE:=$(ARCH)
|
PKG_ARCH_LINKEASE:=$(ARCH)
|
||||||
|
|
||||||
PKG_NAME:=linkease
|
PKG_NAME:=linkease
|
||||||
PKG_VERSION:=1.3.6
|
PKG_VERSION:=1.3.9
|
||||||
PKG_RELEASE:=$(PKG_ARCH_LINKEASE)-2
|
PKG_RELEASE:=$(PKG_ARCH_LINKEASE)-2
|
||||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://fw0.koolcenter.com/binary/LinkEase/LinuxStorage/
|
PKG_SOURCE_URL:=http://fw0.koolcenter.com/binary/LinkEase/LinuxStorage/
|
||||||
PKG_HASH:=e4a6ac49e6760c927fbfffaa184aa62aaa8ecc54ddc74ef196611c946209708f
|
PKG_HASH:=3477cc56e11a42e15239c39cd01d9bc289ddc406825b8e0378ac175cebbf5196
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-binary-$(PKG_VERSION)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=4.75-10
|
PKG_VERSION:=4.76-1
|
||||||
PKG_RELEASE:=
|
PKG_RELEASE:=
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -54,6 +54,7 @@ function index()
|
||||||
entry({"admin", "services", appname, "socks_autoswitch_remove_node"}, call("socks_autoswitch_remove_node")).leaf = true
|
entry({"admin", "services", appname, "socks_autoswitch_remove_node"}, call("socks_autoswitch_remove_node")).leaf = true
|
||||||
entry({"admin", "services", appname, "get_now_use_node"}, call("get_now_use_node")).leaf = true
|
entry({"admin", "services", appname, "get_now_use_node"}, call("get_now_use_node")).leaf = true
|
||||||
entry({"admin", "services", appname, "get_redir_log"}, call("get_redir_log")).leaf = true
|
entry({"admin", "services", appname, "get_redir_log"}, call("get_redir_log")).leaf = true
|
||||||
|
entry({"admin", "services", appname, "get_socks_log"}, call("get_socks_log")).leaf = true
|
||||||
entry({"admin", "services", appname, "get_log"}, call("get_log")).leaf = true
|
entry({"admin", "services", appname, "get_log"}, call("get_log")).leaf = true
|
||||||
entry({"admin", "services", appname, "clear_log"}, call("clear_log")).leaf = true
|
entry({"admin", "services", appname, "clear_log"}, call("clear_log")).leaf = true
|
||||||
entry({"admin", "services", appname, "status"}, call("status")).leaf = true
|
entry({"admin", "services", appname, "status"}, call("status")).leaf = true
|
||||||
|
@ -179,6 +180,18 @@ function get_redir_log()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function get_socks_log()
|
||||||
|
local name = luci.http.formvalue("name")
|
||||||
|
local path = "/tmp/etc/passwall/SOCKS_" .. name .. ".log"
|
||||||
|
if nixio.fs.access(path) then
|
||||||
|
local content = luci.sys.exec("cat ".. path)
|
||||||
|
content = content:gsub("\n", "<br />")
|
||||||
|
luci.http.write(content)
|
||||||
|
else
|
||||||
|
luci.http.write(string.format("<script>alert('%s');window.close();</script>", i18n.translate("Not enabled log")))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function get_log()
|
function get_log()
|
||||||
-- luci.sys.exec("[ -f /tmp/log/passwall.log ] && sed '1!G;h;$!d' /tmp/log/passwall.log > /tmp/log/passwall_show.log")
|
-- luci.sys.exec("[ -f /tmp/log/passwall.log ] && sed '1!G;h;$!d' /tmp/log/passwall.log > /tmp/log/passwall_show.log")
|
||||||
luci.http.write(luci.sys.exec("[ -f '/tmp/log/passwall.log' ] && cat /tmp/log/passwall.log"))
|
luci.http.write(luci.sys.exec("[ -f '/tmp/log/passwall.log' ] && cat /tmp/log/passwall.log"))
|
||||||
|
|
|
@ -146,6 +146,10 @@ o.default = 0
|
||||||
o:depends("auto_update", true)
|
o:depends("auto_update", true)
|
||||||
|
|
||||||
o = s:option(Value, "user_agent", translate("User-Agent"))
|
o = s:option(Value, "user_agent", translate("User-Agent"))
|
||||||
o.default = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"
|
o.default = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0"
|
||||||
|
o:value("curl")
|
||||||
|
o:value("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0")
|
||||||
|
o:value("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0")
|
||||||
|
o:value("Passwall/OpenWrt")
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local api = require "luci.passwall.api"
|
local api = require "luci.passwall.api"
|
||||||
local appname = "passwall"
|
local appname = "passwall"
|
||||||
local uci = api.uci
|
local uci = api.uci
|
||||||
|
local has_singbox = api.finded_com("singbox")
|
||||||
local has_xray = api.finded_com("xray")
|
local has_xray = api.finded_com("xray")
|
||||||
|
|
||||||
m = Map(appname)
|
m = Map(appname)
|
||||||
|
@ -54,12 +55,16 @@ o.default = n + 1080
|
||||||
o.datatype = "port"
|
o.datatype = "port"
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
||||||
if has_xray then
|
if has_singbox or has_xray then
|
||||||
o = s:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use"))
|
o = s:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use"))
|
||||||
o.default = 0
|
o.default = 0
|
||||||
o.datatype = "port"
|
o.datatype = "port"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
o = s:option(Flag, "log", translate("Enable") .. " " .. translate("Log"))
|
||||||
|
o.default = 1
|
||||||
|
o.rmempty = false
|
||||||
|
|
||||||
o = s:option(Flag, "enable_autoswitch", translate("Auto Switch"))
|
o = s:option(Flag, "enable_autoswitch", translate("Auto Switch"))
|
||||||
o.default = 0
|
o.default = 0
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
|
@ -10,7 +10,7 @@ jsonc = require "luci.jsonc"
|
||||||
i18n = require "luci.i18n"
|
i18n = require "luci.i18n"
|
||||||
|
|
||||||
appname = "passwall"
|
appname = "passwall"
|
||||||
curl_args = { "-skfL", "--connect-timeout 3", "--retry 3", "-m 60" }
|
curl_args = { "-skfL", "--connect-timeout 3", "--retry 3" }
|
||||||
command_timeout = 300
|
command_timeout = 300
|
||||||
OPENWRT_ARCH = nil
|
OPENWRT_ARCH = nil
|
||||||
DISTRIB_ARCH = nil
|
DISTRIB_ARCH = nil
|
||||||
|
@ -820,7 +820,10 @@ function to_download(app_name, url, size)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local return_code, result = curl_logic(url, tmp_file, curl_args)
|
local _curl_args = clone(curl_args)
|
||||||
|
table.insert(_curl_args, "-m 60")
|
||||||
|
|
||||||
|
local return_code, result = curl_logic(url, tmp_file, _curl_args)
|
||||||
result = return_code == 0
|
result = return_code == 0
|
||||||
|
|
||||||
if not result then
|
if not result then
|
||||||
|
|
|
@ -62,7 +62,7 @@ _M["chinadns-ng"] = {
|
||||||
default_path = "/usr/bin/chinadns-ng",
|
default_path = "/usr/bin/chinadns-ng",
|
||||||
match_fmt_str = "%s",
|
match_fmt_str = "%s",
|
||||||
file_tree = {
|
file_tree = {
|
||||||
x86_64 = "x86_64",
|
x86_64 = "x86_64@",
|
||||||
x86 = "i686",
|
x86 = "i686",
|
||||||
mips = "mips%-.*mips32%+soft_float@",
|
mips = "mips%-.*mips32%+soft_float@",
|
||||||
mipsel = "mipsel.*mips32%+soft_float@",
|
mipsel = "mipsel.*mips32%+soft_float@",
|
||||||
|
|
|
@ -125,12 +125,21 @@ local api = require "luci.passwall.api"
|
||||||
node_select.title = node_select.options[node_select.options.selectedIndex].text;
|
node_select.title = node_select.options[node_select.options.selectedIndex].text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var new_html = ""
|
||||||
|
|
||||||
var new_a = document.createElement("a");
|
var new_a = document.createElement("a");
|
||||||
new_a.innerHTML = "<%:Edit%>";
|
new_a.innerHTML = "<%:Edit%>";
|
||||||
new_a.href = "#";
|
new_a.href = "#";
|
||||||
new_a.setAttribute("onclick","location.href='" + '<%=api.url("node_config")%>' + "/" + node_select_value + "'");
|
new_a.setAttribute("onclick","location.href='" + '<%=api.url("node_config")%>' + "/" + node_select_value + "'");
|
||||||
|
new_html = new_a.outerHTML;
|
||||||
|
|
||||||
|
var log_a = document.createElement("a");
|
||||||
|
log_a.innerHTML = "<%:Log%>";
|
||||||
|
log_a.href = "#";
|
||||||
|
log_a.setAttribute("onclick", "window.open('" + '<%=api.url("get_socks_log")%>' + "?name=" + id.replace("cbi-passwall-", "") + "', '_blank')");
|
||||||
|
new_html += " " + log_a.outerHTML;
|
||||||
|
|
||||||
node_select.insertAdjacentHTML("afterend", "  " + new_a.outerHTML);
|
node_select.insertAdjacentHTML("afterend", "  " + new_html);
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<%
|
<%
|
||||||
local api = require "luci.passwall.api"
|
local api = require "luci.passwall.api"
|
||||||
-%>
|
-%>
|
||||||
|
<script src="<%=resource%>/qrcode.min.js"></script>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
let has_singbox = "<%=api.finded_com("singbox")%>"
|
let has_singbox = "<%=api.finded_com("singbox")%>"
|
||||||
let has_xray = "<%=api.finded_com("xray")%>"
|
let has_xray = "<%=api.finded_com("xray")%>"
|
||||||
|
@ -72,6 +73,20 @@ local api = require "luci.passwall.api"
|
||||||
};
|
};
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function genQrcode(btn, urlname, sid) {
|
||||||
|
var qrcode_div = document.getElementById("qrcode_div");
|
||||||
|
qrcode_div.style.display = null;
|
||||||
|
document.getElementById("qrcode").innerHTML = "";
|
||||||
|
var url = buildUrl(btn, urlname, sid);
|
||||||
|
if (url) {
|
||||||
|
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
||||||
|
width: 150,
|
||||||
|
height: 150
|
||||||
|
});
|
||||||
|
qrcode.makeCode(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function buildUrl(btn, urlname, sid) {
|
function buildUrl(btn, urlname, sid) {
|
||||||
var opt = {
|
var opt = {
|
||||||
|
@ -115,12 +130,6 @@ local api = require "luci.passwall.api"
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var s = document.getElementById(urlname + "-status");
|
|
||||||
if (!s) {
|
|
||||||
alert("Never");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
opt.base = "cbid." + urlname + "." + sid;
|
opt.base = "cbid." + urlname + "." + sid;
|
||||||
opt.client = urlname.indexOf("server") === -1;
|
opt.client = urlname.indexOf("server") === -1;
|
||||||
var v_type = opt.get("type").value;
|
var v_type = opt.get("type").value;
|
||||||
|
@ -384,12 +393,27 @@ local api = require "luci.passwall.api"
|
||||||
}
|
}
|
||||||
if (url) {
|
if (url) {
|
||||||
url = protocol.toLowerCase() + "://" + url;
|
url = protocol.toLowerCase() + "://" + url;
|
||||||
|
return url;
|
||||||
|
} else {
|
||||||
|
alert("<%:Not a supported scheme:%> " + v_type);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function exportUrl(btn, urlname, sid) {
|
||||||
|
var url = buildUrl(btn, urlname, sid);
|
||||||
|
if (url) {
|
||||||
var textarea = document.createElement("textarea");
|
var textarea = document.createElement("textarea");
|
||||||
textarea.textContent = url;
|
textarea.textContent = url;
|
||||||
textarea.style.position = "fixed";
|
textarea.style.position = "fixed";
|
||||||
document.body.appendChild(textarea);
|
document.body.appendChild(textarea);
|
||||||
textarea.select();
|
textarea.select();
|
||||||
try {
|
try {
|
||||||
|
var s = document.getElementById(urlname + "-status");
|
||||||
|
if (!s) {
|
||||||
|
alert("Never");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
document.execCommand("copy"); // Security exception may be thrown by some browsers.
|
document.execCommand("copy"); // Security exception may be thrown by some browsers.
|
||||||
s.innerHTML = "<font color='green'><%:Share URL to clipboard successfully.%></font>";
|
s.innerHTML = "<font color='green'><%:Share URL to clipboard successfully.%></font>";
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
|
@ -397,11 +421,7 @@ local api = require "luci.passwall.api"
|
||||||
} finally {
|
} finally {
|
||||||
document.body.removeChild(textarea);
|
document.body.removeChild(textarea);
|
||||||
}
|
}
|
||||||
//alert(url);
|
|
||||||
} else {
|
|
||||||
alert("<%:Not a supported scheme:%> " + v_type);
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fromUrl(btn, urlname, sid) {
|
function fromUrl(btn, urlname, sid) {
|
||||||
|
@ -921,6 +941,10 @@ local api = require "luci.passwall.api"
|
||||||
|
|
||||||
//]]></script>
|
//]]></script>
|
||||||
<input type="button" class="btn cbi-button cbi-button-apply" value='<%:From Share URL%>' onclick="return fromUrl(this, '<%=self.option%>', '<%=self.value%>')" />
|
<input type="button" class="btn cbi-button cbi-button-apply" value='<%:From Share URL%>' onclick="return fromUrl(this, '<%=self.option%>', '<%=self.value%>')" />
|
||||||
<input type="button" class="btn cbi-button cbi-button-apply" value='<%:Build Share URL%>' onclick="return buildUrl(this, '<%=self.option%>', '<%=self.value%>')" />
|
<input type="button" class="btn cbi-button cbi-button-apply" value='<%:Build Share URL%>' onclick="return exportUrl(this, '<%=self.option%>', '<%=self.value%>')" />
|
||||||
|
<input type="button" class="btn cbi-button cbi-button-apply" value='<%:Generate QRCode%>' onclick="return genQrcode(this, '<%=self.option%>', '<%=self.value%>')" />
|
||||||
|
<div id="qrcode_div" style="margin-top: 1rem;display:none">
|
||||||
|
<div id="qrcode"></div>
|
||||||
|
</div>
|
||||||
<span id="<%=self.option%>-status"></span>
|
<span id="<%=self.option%>-status"></span>
|
||||||
<%+cbi/valuefooter%>
|
<%+cbi/valuefooter%>
|
||||||
|
|
|
@ -475,6 +475,9 @@ msgstr "导入分享URL"
|
||||||
msgid "Build Share URL"
|
msgid "Build Share URL"
|
||||||
msgstr "导出分享URL"
|
msgstr "导出分享URL"
|
||||||
|
|
||||||
|
msgid "Generate QRCode"
|
||||||
|
msgstr "生成二维码"
|
||||||
|
|
||||||
msgid "Import Finished"
|
msgid "Import Finished"
|
||||||
msgstr "导入完成:"
|
msgstr "导入完成:"
|
||||||
|
|
||||||
|
|
|
@ -1021,9 +1021,11 @@ start_socks() {
|
||||||
local port=$(config_n_get $id port)
|
local port=$(config_n_get $id port)
|
||||||
local config_file="SOCKS_${id}.json"
|
local config_file="SOCKS_${id}.json"
|
||||||
local log_file="SOCKS_${id}.log"
|
local log_file="SOCKS_${id}.log"
|
||||||
|
local log=$(config_n_get $id log 1)
|
||||||
|
[ "$log" == "0" ] && log_file=""
|
||||||
local http_port=$(config_n_get $id http_port 0)
|
local http_port=$(config_n_get $id http_port 0)
|
||||||
local http_config_file="HTTP2SOCKS_${id}.json"
|
local http_config_file="HTTP2SOCKS_${id}.json"
|
||||||
run_socks flag=$id node=$node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file
|
run_socks flag=$id node=$node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||||
echo $node > $TMP_ID_PATH/socks_${id}
|
echo $node > $TMP_ID_PATH/socks_${id}
|
||||||
|
|
||||||
#自动切换逻辑
|
#自动切换逻辑
|
||||||
|
@ -1049,10 +1051,12 @@ socks_node_switch() {
|
||||||
local port=$(config_n_get $flag port)
|
local port=$(config_n_get $flag port)
|
||||||
local config_file="SOCKS_${flag}.json"
|
local config_file="SOCKS_${flag}.json"
|
||||||
local log_file="SOCKS_${flag}.log"
|
local log_file="SOCKS_${flag}.log"
|
||||||
|
local log=$(config_n_get $flag log 1)
|
||||||
|
[ "$log" == "0" ] && log_file=""
|
||||||
local http_port=$(config_n_get $flag http_port 0)
|
local http_port=$(config_n_get $flag http_port 0)
|
||||||
local http_config_file="HTTP2SOCKS_${flag}.json"
|
local http_config_file="HTTP2SOCKS_${flag}.json"
|
||||||
LOG_FILE="/dev/null"
|
LOG_FILE="/dev/null"
|
||||||
run_socks flag=$flag node=$new_node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file
|
run_socks flag=$flag node=$new_node bind=0.0.0.0 socks_port=$port config_file=$config_file http_port=$http_port http_config_file=$http_config_file log_file=$log_file
|
||||||
echo $new_node > $TMP_ID_PATH/socks_${flag}
|
echo $new_node > $TMP_ID_PATH/socks_${flag}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -898,13 +898,11 @@ local function processData(szType, content, add_mode, add_from)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function curl(url, file, ua)
|
local function curl(url, file, ua)
|
||||||
if not ua or ua == "" then
|
local curl_args = api.clone(api.curl_args)
|
||||||
ua = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36"
|
if ua and ua ~= "" and ua ~= "curl" then
|
||||||
|
table.insert(curl_args, '--user-agent "' .. ua .. '"')
|
||||||
end
|
end
|
||||||
local args = {
|
local return_code, result = api.curl_logic(url, file, curl_args)
|
||||||
"-skL", "--retry 3", "--connect-timeout 3", '--user-agent "' .. ua .. '"'
|
|
||||||
}
|
|
||||||
local return_code, result = api.curl_logic(url, file, args)
|
|
||||||
return return_code
|
return return_code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue