mirror of
https://github.com/kenzok8/small-package
synced 2025-01-07 07:06:58 +08:00
update 2023-08-16 23:36:13
This commit is contained in:
parent
22c1eef592
commit
b894c36d79
@ -154,9 +154,9 @@ return baseclass.extend({
|
||||
if (padding)
|
||||
str = str + Array(padding + 1).join('=');
|
||||
|
||||
return decodeURIComponent(Array.prototype.map.call(atob(str), (c) => {
|
||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||
}).join(''));
|
||||
return decodeURIComponent(Array.prototype.map.call(atob(str), (c) =>
|
||||
'%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
|
||||
).join(''));
|
||||
},
|
||||
|
||||
getBuiltinFeatures: function() {
|
||||
@ -171,16 +171,16 @@ return baseclass.extend({
|
||||
|
||||
generateUUIDv4: function() {
|
||||
/* Thanks to https://stackoverflow.com/a/2117523 */
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
|
||||
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, (c) =>
|
||||
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
|
||||
);
|
||||
},
|
||||
|
||||
loadDefaultLabel: function(uciconfig, ucisection) {
|
||||
var label = uci.get(uciconfig, ucisection, 'label');
|
||||
if (label)
|
||||
if (label) {
|
||||
return label;
|
||||
else {
|
||||
} else {
|
||||
uci.set(uciconfig, ucisection, 'label', ucisection);
|
||||
return ucisection;
|
||||
}
|
||||
@ -226,9 +226,8 @@ return baseclass.extend({
|
||||
return L.resolveDefault(callWriteCertificate(filename), {}).then((ret) => {
|
||||
if (ret.result === true)
|
||||
ui.addNotification(null, E('p', _('Your %s was successfully uploaded. Size: %sB.').format(type, res.size)));
|
||||
else {
|
||||
else
|
||||
ui.addNotification(null, E('p', _('Failed to upload %s, error: %s.').format(type, ret.error)));
|
||||
}
|
||||
});
|
||||
}, this, ev.target))
|
||||
.catch((e) => { ui.addNotification(null, E('p', e.message)) });
|
||||
|
@ -51,11 +51,10 @@ function getServiceStatus() {
|
||||
function renderStatus(isRunning) {
|
||||
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
|
||||
var renderHTML;
|
||||
if (isRunning) {
|
||||
if (isRunning)
|
||||
renderHTML = spanTemp.format('green', _('HomeProxy'), _('RUNNING'));
|
||||
} else {
|
||||
else
|
||||
renderHTML = spanTemp.format('red', _('HomeProxy'), _('NOT RUNNING'));
|
||||
}
|
||||
|
||||
return renderHTML;
|
||||
}
|
||||
|
@ -420,8 +420,9 @@ return view.extend({
|
||||
.then(L.bind(this.map.reset, this.map))
|
||||
.then(L.ui.hideModal)
|
||||
.catch(function() {});
|
||||
} else
|
||||
} else {
|
||||
return ui.hideModal();
|
||||
}
|
||||
})
|
||||
}, [ _('Import') ])
|
||||
])
|
||||
@ -996,8 +997,9 @@ return view.extend({
|
||||
if (['hysteria', 'shadowtls'].includes(type)) {
|
||||
tls.checked = true;
|
||||
tls.disabled = true;
|
||||
} else
|
||||
} else {
|
||||
tls.disabled = null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1237,9 +1239,9 @@ return view.extend({
|
||||
o.inputstyle = 'apply';
|
||||
o.inputtitle = function(section_id) {
|
||||
var sublist = uci.get(data[0], section_id, 'subscription_url') || [];
|
||||
if (sublist.length > 0)
|
||||
if (sublist.length > 0) {
|
||||
return _('Update %s subscriptions').format(sublist.length);
|
||||
else {
|
||||
} else {
|
||||
this.readonly = true;
|
||||
return _('No subscription available')
|
||||
}
|
||||
|
@ -33,11 +33,10 @@ function getServiceStatus() {
|
||||
function renderStatus(isRunning) {
|
||||
var spanTemp = '<em><span style="color:%s"><strong>%s %s</strong></span></em>';
|
||||
var renderHTML;
|
||||
if (isRunning) {
|
||||
if (isRunning)
|
||||
renderHTML = spanTemp.format('green', _('HomeProxy Server'), _('RUNNING'));
|
||||
} else {
|
||||
else
|
||||
renderHTML = spanTemp.format('red', _('HomeProxy Server'), _('NOT RUNNING'));
|
||||
}
|
||||
|
||||
return renderHTML;
|
||||
}
|
||||
@ -362,8 +361,9 @@ return view.extend({
|
||||
if (['hysteria'].includes(type)) {
|
||||
tls.checked = true;
|
||||
tls.disabled = true;
|
||||
} else
|
||||
} else {
|
||||
tls.disabled = null;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -11,10 +11,9 @@ singc_log_file="/var/run/$NAME/sing-box-c.log"
|
||||
sings_log_file="/var/run/$NAME/sing-box-s.log"
|
||||
|
||||
while true; do
|
||||
sleep 180
|
||||
for i in "$main_log_file" "$singc_log_file" "$sings_log_file"; do
|
||||
[ -s "$i" ] || continue
|
||||
[ "$(( $(ls -l "$i" | awk -F ' ' '{print $5}') / 1024 >= log_max_size))" -eq "0" ] || echo "" > "$i"
|
||||
done
|
||||
|
||||
sleep 180
|
||||
done
|
||||
|
@ -10,10 +10,13 @@ LUCI_TITLE:=multi account Virtual WAN config generator
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+kmod-macvlan +luci-app-mwan3
|
||||
|
||||
PKG_NAME:=luci-app-multiaccountdial
|
||||
PKG_VERSION:=2.2
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=2.2-2
|
||||
PKG_RELEASE:=
|
||||
|
||||
define Package/luci-app-multiaccountdial/conffiles
|
||||
/etc/config/multiaccountdial
|
||||
/etc/multiaccountdial/config
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
@ -12,28 +12,25 @@ function index()
|
||||
end
|
||||
|
||||
function redial()
|
||||
os.execute("killall -9 pppd")
|
||||
os.execute("/usr/libexec/multiaccountdial/multi_account_dial redial")
|
||||
os.execute("logger -t multiaccountdial redial")
|
||||
end
|
||||
|
||||
|
||||
function add_vwan()
|
||||
os.execute("multi_account_dial add")
|
||||
os.execute("/usr/libexec/multiaccountdial/multi_account_dial add")
|
||||
os.execute("logger -t multiaccountdial add_vwan")
|
||||
end
|
||||
|
||||
function del_vwan()
|
||||
os.execute("multi_account_dial del")
|
||||
os.execute("/usr/libexec/multiaccountdial/multi_account_dial del")
|
||||
os.execute("logger -t multiaccountdial del_vwan")
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
local mwan3_status = luci.util.exec("mwan3 status")
|
||||
e.num_online = 0
|
||||
for _ in mwan3_status:gmatch("tracking is active") do
|
||||
e.num_online = e.num_online + 1
|
||||
end
|
||||
local num_online = luci.util.exec("/usr/libexec/multiaccountdial/multi_account_dial count_online")
|
||||
e.num_online = num_online
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
@ -7,8 +7,8 @@ syncdial_num=2
|
||||
macvlan_index=0
|
||||
command=$1
|
||||
track_ip='119.29.29.29 www.baidu.com 114.114.114.114'
|
||||
add_mwan=$(uci get multiaccountdial.@base_setting[0].add_mwan)
|
||||
dial_num=$(uci get multiaccountdial.@base_setting[0].dial_num)
|
||||
add_mwan=$(uci -q get multiaccountdial.@base_setting[0].add_mwan)
|
||||
dial_num=$(uci -q get multiaccountdial.@base_setting[0].dial_num)
|
||||
if [ "$dial_num" != "" ]; then
|
||||
syncdial_num=$dial_num
|
||||
fi
|
||||
@ -90,6 +90,7 @@ set network.vwan$index.password=$password
|
||||
set network.vwan$index.metric=$metric
|
||||
set network.vwan$index.defaultroute=0
|
||||
set network.vwan$index.ipv6=0
|
||||
set network.vwan$index.scriptmark=1
|
||||
add_list firewall.@zone[1].network=vwan$index
|
||||
set dhcp.vwan$index=dhcp
|
||||
set dhcp.vwan$index.interface=vwan$index
|
||||
@ -153,6 +154,35 @@ do
|
||||
done
|
||||
}
|
||||
|
||||
redial_if(){
|
||||
local if_cfg=$1
|
||||
uci -q get network.${if_cfg}.scriptmark && {
|
||||
echo redial interface ${if_cfg}
|
||||
ifdown $if_cfg
|
||||
ifup $if_cfg
|
||||
}
|
||||
}
|
||||
|
||||
redial_all(){
|
||||
config_load network
|
||||
config_foreach redial_if interface
|
||||
}
|
||||
|
||||
count_if(){
|
||||
local if_cfg=$1
|
||||
uci -q get network.${if_cfg}.scriptmark>/dev/null && {
|
||||
local up=$(ifstatus ${if_cfg} |grep '"up": true,' |wc -l )
|
||||
local down=$(ifstatus ${if_cfg} |grep '"up": false,' |wc -l )
|
||||
if [ $up -eq 1 ];then online=${online}1;fi
|
||||
if [ $down -eq 1 ];then offline=${offline}1;fi
|
||||
}
|
||||
}
|
||||
|
||||
count_all(){
|
||||
config_load network
|
||||
config_foreach count_if interface
|
||||
}
|
||||
|
||||
case $command in
|
||||
"add")
|
||||
add_vwan
|
||||
@ -166,6 +196,14 @@ case $command in
|
||||
uci commit firewall
|
||||
uci commit mwan3
|
||||
;;
|
||||
"redial")
|
||||
redial_all
|
||||
;;
|
||||
"count_online")
|
||||
count_all
|
||||
echo 在线:$(echo -e $online | wc -L)
|
||||
echo 离线:$(echo -e $offline | wc -L)
|
||||
;;
|
||||
*)
|
||||
echo "unknown command $command"
|
||||
;;
|
@ -11,7 +11,7 @@ LUCI_DEPENDS:=+luci-lib-xterm +taskd
|
||||
LUCI_EXTRA_DEPENDS:=taskd (>=1.0.3-1)
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=1.0.17
|
||||
PKG_VERSION:=1.0.18
|
||||
PKG_RELEASE:=
|
||||
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
|
||||
|
||||
|
@ -3,6 +3,7 @@ module("luci.controller.tasks-lib", package.seeall)
|
||||
|
||||
|
||||
function index()
|
||||
entry({"admin", "system", "tasks"}, call("tasks_ping")).dependent=false -- just for compatible
|
||||
entry({"admin", "system", "tasks", "status"}, call("tasks_status")).dependent=false
|
||||
entry({"admin", "system", "tasks", "log"}, call("tasks_log")).dependent=false
|
||||
entry({"admin", "system", "tasks", "stop"}, post("tasks_stop")).dependent=false
|
||||
@ -14,6 +15,11 @@ local ltn12 = require "luci.ltn12"
|
||||
|
||||
local taskd = require "luci.model.tasks"
|
||||
|
||||
function tasks_ping()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({})
|
||||
end
|
||||
|
||||
function tasks_status()
|
||||
local data = taskd.status(luci.http.formvalue("task_id"))
|
||||
luci.http.prepare_content("application/json")
|
||||
|
Loading…
Reference in New Issue
Block a user