update 05-06 23:44:05
This commit is contained in:
parent
40e33463db
commit
cf2d19e895
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=aliyundrive-fuse
|
||||
PKG_VERSION:=0.1.10
|
||||
PKG_VERSION:=0.1.11
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
|
|
|
@ -5,3 +5,4 @@ config default
|
|||
option domain_id ''
|
||||
option mount_point '/mnt/aliyundrive'
|
||||
option read_buffer_size '10485760'
|
||||
option allow_other '1'
|
||||
|
|
|
@ -20,6 +20,7 @@ start_service() {
|
|||
local domain_id=$(uci_get_by_type default domain_id)
|
||||
local mount_point=$(uci_get_by_type default mount_point)
|
||||
local read_buf_size=$(uci_get_by_type default read_buffer_size 10485760)
|
||||
local allow_other=$(uci_get_by_type default allow_other 0)
|
||||
|
||||
local extra_options=""
|
||||
|
||||
|
@ -27,6 +28,10 @@ start_service() {
|
|||
extra_options="$extra_options --domain-id $domain_id"
|
||||
fi
|
||||
|
||||
if [ "$allow_other" = "1" ]; then
|
||||
extra_options="$extra_options --allow-other"
|
||||
fi
|
||||
|
||||
mkdir -p "$mount_point"
|
||||
procd_open_instance
|
||||
procd_set_param command /bin/sh -c "/usr/bin/$NAME $extra_options -S $read_buf_size --workdir /var/run/$NAME $mount_point >>/var/log/$NAME.log 2>&1"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-aliyundrive-fuse
|
||||
PKG_VERSION:=0.1.10
|
||||
PKG_VERSION:=0.1.11
|
||||
PKG_RELEASE:=1
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ read_buffer_size.datatype = "uinteger"
|
|||
domain_id = e:option(Value, "domain_id", translate("Domain ID"))
|
||||
domain_id.description = translate("Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>")
|
||||
|
||||
allow_other = e:option(Flag, "allow_other", translate("Allow Other users Access"))
|
||||
allow_other.description = translate("Allow other users to access the drive, enable this if you share with samba")
|
||||
allow_other.rmempty = false
|
||||
|
||||
debug = e:option(Flag, "debug", translate("Debug Mode"))
|
||||
debug.rmempty = false
|
||||
|
||||
|
|
|
@ -48,3 +48,9 @@ msgstr "阿里云相册与云盘服务 domainId"
|
|||
|
||||
msgid "Input domain_id option will use <a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">Aliyun PDS</a> instead of <a href=\"https://www.aliyundrive.com\" target=\"_blank\">AliyunDrive</a>"
|
||||
msgstr "填写此选项将使用<a href=\"https://www.aliyun.com/product/storage/pds\" target=\"_blank\">阿里云相册与网盘服务</a>而不是<a href=\"https://www.aliyundrive.com\" target=\"_blank\">阿里云盘</a>"
|
||||
|
||||
msgid "Allow Other users Access"
|
||||
msgstr "允许其他用户访问"
|
||||
|
||||
msgid "Allow other users to access the drive, enable this if you share with samba"
|
||||
msgstr "允许其他用户访问此驱动,如果你想用Samba分享请开启此开关"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.45.12
|
||||
PKG_VERSION:=0.45.16
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ function index()
|
|||
entry({"admin", "services", "openclash", "lastversion"},call("action_lastversion"))
|
||||
entry({"admin", "services", "openclash", "save_corever_branch"},call("action_save_corever_branch"))
|
||||
entry({"admin", "services", "openclash", "update"},call("action_update"))
|
||||
entry({"admin", "services", "openclash", "update_info"},call("action_update_info"))
|
||||
entry({"admin", "services", "openclash", "update_ma"},call("action_update_ma"))
|
||||
entry({"admin", "services", "openclash", "opupdate"},call("action_opupdate"))
|
||||
entry({"admin", "services", "openclash", "coreupdate"},call("action_coreupdate"))
|
||||
|
@ -89,6 +90,10 @@ local fs = require "luci.openclash"
|
|||
local json = require "luci.jsonc"
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local datatype = require "luci.cbi.datatypes"
|
||||
local opkg
|
||||
if pcall(require, "luci.model.ipkg") then
|
||||
opkg = require "luci.model.ipkg"
|
||||
end
|
||||
|
||||
local core_path_mode = uci:get("openclash", "config", "small_flash_memory")
|
||||
if core_path_mode ~= "1" then
|
||||
|
@ -193,42 +198,45 @@ local function startlog()
|
|||
line_trans = info
|
||||
if string.len(info) > 0 then
|
||||
if not string.find (info, "【") and not string.find (info, "】") then
|
||||
line_trans = luci.i18n.translate(string.sub(info, 0, -1))
|
||||
else
|
||||
line_trans = trans_line(info)
|
||||
line_trans = luci.i18n.translate(string.sub(info, 0, -1))
|
||||
else
|
||||
line_trans = trans_line(info)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return line_trans
|
||||
end
|
||||
|
||||
local function coremodel()
|
||||
local coremodel = luci.sys.exec("opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null")
|
||||
return coremodel
|
||||
if opkg and opkg.info("libc") and opkg.info("libc")["libc"] then
|
||||
return opkg.info("libc")["libc"]["Architecture"]
|
||||
else
|
||||
return luci.sys.exec("opkg status libc 2>/dev/null |grep 'Architecture' |awk -F ': ' '{print $2}' 2>/dev/null")
|
||||
end
|
||||
end
|
||||
|
||||
local function corecv()
|
||||
if not nixio.fs.access(dev_core_path) then
|
||||
return "0"
|
||||
else
|
||||
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",dev_core_path))
|
||||
end
|
||||
if not nixio.fs.access(dev_core_path) then
|
||||
return "0"
|
||||
else
|
||||
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",dev_core_path))
|
||||
end
|
||||
end
|
||||
|
||||
local function coretuncv()
|
||||
if not nixio.fs.access(tun_core_path) then
|
||||
return "0"
|
||||
else
|
||||
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",tun_core_path))
|
||||
end
|
||||
if not nixio.fs.access(tun_core_path) then
|
||||
return "0"
|
||||
else
|
||||
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $2}'",tun_core_path))
|
||||
end
|
||||
end
|
||||
|
||||
local function coremetacv()
|
||||
if not nixio.fs.access(meta_core_path) then
|
||||
return "0"
|
||||
else
|
||||
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $3}'",meta_core_path))
|
||||
end
|
||||
if not nixio.fs.access(meta_core_path) then
|
||||
return "0"
|
||||
else
|
||||
return luci.sys.exec(string.format("%s -v 2>/dev/null |awk -F ' ' '{print $3}'",meta_core_path))
|
||||
end
|
||||
end
|
||||
|
||||
local function corelv()
|
||||
|
@ -240,18 +248,22 @@ local function corelv()
|
|||
end
|
||||
|
||||
local function opcv()
|
||||
return luci.sys.exec("opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'")
|
||||
if opkg and opkg.info("luci-app-openclash") and opkg.info("luci-app-openclash")["luci-app-openclash"] then
|
||||
return "v" .. opkg.info("luci-app-openclash")["luci-app-openclash"]["Version"]
|
||||
else
|
||||
return luci.sys.exec("opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print \"v\"$2}'")
|
||||
end
|
||||
end
|
||||
|
||||
local function oplv()
|
||||
local new = luci.sys.call(string.format("sh /usr/share/openclash/openclash_version.sh"))
|
||||
local oplv = luci.sys.exec("sed -n 1p /tmp/openclash_last_version 2>/dev/null")
|
||||
return oplv .. "," .. new
|
||||
local new = luci.sys.call(string.format("sh /usr/share/openclash/openclash_version.sh"))
|
||||
local oplv = luci.sys.exec("sed -n 1p /tmp/openclash_last_version 2>/dev/null")
|
||||
return oplv .. "," .. new
|
||||
end
|
||||
|
||||
local function opup()
|
||||
luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && sh /usr/share/openclash/openclash_version.sh >/dev/null 2>&1")
|
||||
return luci.sys.call("sh /usr/share/openclash/openclash_update.sh >/dev/null 2>&1 &")
|
||||
luci.sys.call("rm -rf /tmp/*_last_version 2>/dev/null && sh /usr/share/openclash/openclash_version.sh >/dev/null 2>&1")
|
||||
return luci.sys.call("sh /usr/share/openclash/openclash_update.sh >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
local function coreup()
|
||||
|
@ -282,18 +294,18 @@ local function save_corever_branch()
|
|||
end
|
||||
|
||||
local function upchecktime()
|
||||
local corecheck = os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/tmp/clash_last_version"))
|
||||
local opcheck
|
||||
if not corecheck or corecheck == "" then
|
||||
opcheck = os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/tmp/openclash_last_version"))
|
||||
if not opcheck or opcheck == "" then
|
||||
return "1"
|
||||
else
|
||||
return opcheck
|
||||
end
|
||||
else
|
||||
return corecheck
|
||||
end
|
||||
local corecheck = os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/tmp/clash_last_version"))
|
||||
local opcheck
|
||||
if not corecheck or corecheck == "" then
|
||||
opcheck = os.date("%Y-%m-%d %H:%M:%S",fs.mtime("/tmp/openclash_last_version"))
|
||||
if not opcheck or opcheck == "" then
|
||||
return "1"
|
||||
else
|
||||
return opcheck
|
||||
end
|
||||
else
|
||||
return corecheck
|
||||
end
|
||||
end
|
||||
|
||||
local function historychecktime()
|
||||
|
@ -310,18 +322,18 @@ end
|
|||
|
||||
function download_rule()
|
||||
local filename = luci.http.formvalue("filename")
|
||||
local state = luci.sys.call(string.format('/usr/share/openclash/openclash_download_rule_list.sh "%s" >/dev/null 2>&1',filename))
|
||||
return state
|
||||
local state = luci.sys.call(string.format('/usr/share/openclash/openclash_download_rule_list.sh "%s" >/dev/null 2>&1',filename))
|
||||
return state
|
||||
end
|
||||
|
||||
function download_disney_domains()
|
||||
local state = luci.sys.call(string.format('/usr/share/openclash/openclash_download_rule_list.sh "%s" >/dev/null 2>&1',"disney_domains"))
|
||||
return state
|
||||
local state = luci.sys.call(string.format('/usr/share/openclash/openclash_download_rule_list.sh "%s" >/dev/null 2>&1',"disney_domains"))
|
||||
return state
|
||||
end
|
||||
|
||||
function download_netflix_domains()
|
||||
local state = luci.sys.call(string.format('/usr/share/openclash/openclash_download_rule_list.sh "%s" >/dev/null 2>&1',"netflix_domains"))
|
||||
return state
|
||||
local state = luci.sys.call(string.format('/usr/share/openclash/openclash_download_rule_list.sh "%s" >/dev/null 2>&1',"netflix_domains"))
|
||||
return state
|
||||
end
|
||||
|
||||
function action_flush_fakeip_cache()
|
||||
|
@ -936,19 +948,25 @@ end
|
|||
function action_update()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
coremodel = coremodel(),
|
||||
corecv = corecv(),
|
||||
coretuncv = coretuncv(),
|
||||
coremetacv = coremetacv(),
|
||||
coremodel = coremodel(),
|
||||
opcv = opcv(),
|
||||
corever = corever(),
|
||||
release_branch = release_branch(),
|
||||
upchecktime = upchecktime(),
|
||||
corelv = corelv(),
|
||||
oplv = oplv();
|
||||
})
|
||||
end
|
||||
|
||||
function action_update_info()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
corever = corever(),
|
||||
release_branch = release_branch();
|
||||
})
|
||||
end
|
||||
|
||||
function action_update_ma()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
<%
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local RELEASE_BRANCH = uci:get("openclash", "config", "release_branch")
|
||||
local random = tostring(os.time()):reverse():sub(1, 9)
|
||||
%>
|
||||
<fieldset class="cbi-section">
|
||||
<table width="100%">
|
||||
|
@ -38,30 +39,30 @@
|
|||
<%
|
||||
if uci:get("openclash", "config", "enable_meta_core") ~= '1' then
|
||||
%>
|
||||
<img id="logo" src="https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/logo.png" loading="lazy" onerror="return imgerrorfuns(this,'/luci-static/resources/openclash/img/logo.png')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
|
||||
<img id="logo" src="https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/logo.png" loading="lazy" onerror="return imgerrorfuns(this,'/luci-static/resources/openclash/img/logo.png?<%=random%>')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<img id="logo" src="https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/meta.png" loading="lazy" onerror="return imgerrorfuns(this,'/luci-static/resources/openclash/img/meta.png')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
|
||||
<img id="logo" src="https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/meta.png" loading="lazy" onerror="return imgerrorfuns(this,'/luci-static/resources/openclash/img/meta.png?<%=random%>')" title="Hello, World!" alt="OpenClash" onclick="return homepage()" />
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</p>
|
||||
<p id="_clashversion" style="margin: 10px 0; text-align: center">
|
||||
<img src="/luci-static/resources/openclash/img/version.svg" onerror="return imgerrorfuns(this,'https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/version.png')" alt="currentversion" height="21px" onclick="return go_update()">
|
||||
<img src="/luci-static/resources/openclash/img/version.svg?<%=random%>" onerror="return imgerrorfuns(this,'https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/version.png')" alt="currentversion" height="21px" onclick="return go_update()">
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td colspan="4" width="100%">
|
||||
<p style="margin: 10px 0; text-align: center">
|
||||
<img id="gitbook" src="/luci-static/resources/openclash/img/Wiki.svg" loading="lazy" alt="GitBook" width="50px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Wiki--lightgrey?logo=GitBook&style=social')" onclick="return gitbookpage()" />
|
||||
<img id="gitbook" src="/luci-static/resources/openclash/img/Wiki.svg?<%=random%>" loading="lazy" alt="GitBook" width="50px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Wiki--lightgrey?logo=GitBook&style=social')" onclick="return gitbookpage()" />
|
||||
|
||||
<img id="wiki" src="/luci-static/resources/openclash/img/Tutorials.svg" loading="lazy" alt="Wiki" width="75px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Tutorials--lightgrey?logo=Wikipedia&style=social')" onclick="return wikipage()" />
|
||||
<img id="wiki" src="/luci-static/resources/openclash/img/Tutorials.svg?<%=random%>" loading="lazy" alt="Wiki" width="75px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Tutorials--lightgrey?logo=Wikipedia&style=social')" onclick="return wikipage()" />
|
||||
|
||||
<img id="star" src="/luci-static/resources/openclash/img/Star.svg" loading="lazy" alt="star" width="50px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Star--lightgrey?logo=github&style=social')" onclick="return homepage()" />
|
||||
<img id="star" src="/luci-static/resources/openclash/img/Star.svg?<%=random%>g" loading="lazy" alt="star" width="50px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Star--lightgrey?logo=github&style=social')" onclick="return homepage()" />
|
||||
|
||||
<img id="telegram" src="/luci-static/resources/openclash/img/Telegram.svg" loading="lazy" alt="Telegram" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Telegram--lightgrey?logo=Telegram&style=social')" onclick="return telegrampage()" />
|
||||
<img id="telegram" src="/luci-static/resources/openclash/img/Telegram.svg?<%=random%>" loading="lazy" alt="Telegram" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Telegram--lightgrey?logo=Telegram&style=social')" onclick="return telegrampage()" />
|
||||
|
||||
<img id="sponsor" src="/luci-static/resources/openclash/img/Sponsor.svg" loading="lazy" alt="Sponsor" width="73px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Sponsor--lightgrey?logo=ko-fi&style=social')" onclick="return sponsorpage()" />
|
||||
<img id="sponsor" src="/luci-static/resources/openclash/img/Sponsor.svg?<%=random%>" loading="lazy" alt="Sponsor" width="73px" height="20px" onerror="return imgerrorfuns(this,'https://img.shields.io/badge/Sponsor--lightgrey?logo=ko-fi&style=social')" onclick="return sponsorpage()" />
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td width="100%" colspan="4">
|
||||
|
@ -877,7 +878,7 @@
|
|||
|
||||
function clashversion_error()
|
||||
{
|
||||
clashversion.innerHTML = '<img id="clashversion" src="/luci-static/resources/openclash/img/version.svg" alt="currentversion" height="21px" onerror="return imgerrorfuns(this,\'https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/version.png\')" onclick="return go_update()">';
|
||||
clashversion.innerHTML = '<img id="clashversion" src="/luci-static/resources/openclash/img/version.svg?<%=random%>" alt="currentversion" height="21px" onerror="return imgerrorfuns(this,\'https://mirrors.tuna.tsinghua.edu.cn/osdn/storage/g/o/op/openclash/<%=RELEASE_BRANCH%>/img/version.png\')" onclick="return go_update()">';
|
||||
};
|
||||
|
||||
function imgerrorfuns(imgobj,imgSrc){
|
||||
|
|
|
@ -95,8 +95,8 @@
|
|||
</fieldset>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var core_version = document.getElementById('CORE_VERSION');
|
||||
var checktime = document.getElementById('CHECKTIME');
|
||||
var core_version = document.getElementById('CORE_VERSION');
|
||||
var checktime = document.getElementById('CHECKTIME');
|
||||
var cpu_model = document.getElementById('CPU_MODEL');
|
||||
var core_cv = document.getElementById('CORE_CV');
|
||||
var core_lv = document.getElementById('CORE_LV');
|
||||
|
@ -120,8 +120,20 @@
|
|||
var one_key_update = document.getElementById('one_key_update');
|
||||
var remove_core = document.getElementById('remove_core');
|
||||
var release_branch = document.getElementById('RELEASE_BRANCH');
|
||||
core_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Dev\')"/>';
|
||||
core_tun_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'TUN\')"/>';
|
||||
core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Meta\')"/>';
|
||||
op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return op_update(this)"/>';
|
||||
ma_core_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'Dev\')"/>';
|
||||
ma_core_tun_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'TUN\')"/>';
|
||||
ma_core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'Meta\')"/>';
|
||||
ma_op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_op_update(this)"/>';
|
||||
restore.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Restore Default Config%>" onclick="return restore_config(this)"/>';
|
||||
one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update%>" onclick="return all_one_key_update(this)"/>';
|
||||
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
|
||||
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update")%>', null, function(x, status) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "update_info")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.corever != "0" && status.corever != "" ) {
|
||||
core_version.value = status.corever;
|
||||
|
@ -179,42 +191,42 @@
|
|||
var corelvis = arr_core[0];
|
||||
var coretunlvis = arr_core[1];
|
||||
var coremetalvis = arr_core[2];
|
||||
if (corelvis != status.corecv && corelvis != "") {
|
||||
if (corelvis != status.corecv && corelvis != "" && corelvis != "\n") {
|
||||
core_lv.innerHTML = "<b style=color:green>"+corelvis+"<%:<New>%></b>";
|
||||
}
|
||||
else if (corelvis != "" && corelvis == status.corecv) {
|
||||
else if (corelvis != "" && corelvis == status.corecv && corelvis != "\n") {
|
||||
core_lv.innerHTML = "<b style=color:green>"+corelvis+"</b>";
|
||||
}
|
||||
else {
|
||||
core_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
|
||||
}
|
||||
if (coretunlvis != status.coretuncv && coretunlvis != "") {
|
||||
if (coretunlvis != status.coretuncv && coretunlvis != "" && coretunlvis != "\n") {
|
||||
core_tun_lv.innerHTML = "<b style=color:green>"+coretunlvis+"<%:<New>%></b>";
|
||||
}
|
||||
else if (coretunlvis != "" && coretunlvis == status.coretuncv) {
|
||||
else if (coretunlvis != "" && coretunlvis == status.coretuncv && coretunlvis != "\n") {
|
||||
core_tun_lv.innerHTML = "<b style=color:green>"+coretunlvis+"</b>";
|
||||
}
|
||||
else {
|
||||
core_tun_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
|
||||
}
|
||||
if (coremetalvis != status.coremetacv && coremetalvis != "") {
|
||||
if (coremetalvis != status.coremetacv && coremetalvis != "" && coremetalvis != "\n") {
|
||||
core_meta_lv.innerHTML = "<b style=color:green>"+coremetalvis+"<%:<New>%></b>";
|
||||
}
|
||||
else if (coremetalvis != "" && coremetalvis == status.coremetacv) {
|
||||
else if (coremetalvis != "" && coremetalvis == status.coremetacv && coremetalvis != "\n") {
|
||||
core_meta_lv.innerHTML = "<b style=color:green>"+coremetalvis+"</b>";
|
||||
}
|
||||
else {
|
||||
core_meta_lv.innerHTML = "<b style=color:=red><%:Unknown%></b>";
|
||||
core_meta_lv.innerHTML = "<b style=color:red><%:Unknown%></b>";
|
||||
}
|
||||
var oplv = status.oplv;
|
||||
var arr_op = oplv.split(",");
|
||||
var oplvis = arr_op[0];
|
||||
var new_op = arr_op[1];
|
||||
op_cv.innerHTML = status.opcv ? "<b style=color:green>"+status.opcv+"</b>" : "<b style=color:red><%:Unknown%></b>";
|
||||
if ( new_op == "2" && oplvis != "") {
|
||||
if ( new_op == "2" && oplvis != "" && oplvis != "\n") {
|
||||
op_lv.innerHTML = "<b style=color:green>"+oplvis+"<%:<New>%></b>";
|
||||
}
|
||||
else if (oplvis != "") {
|
||||
else if (oplvis != "" && oplvis != "\n") {
|
||||
op_lv.innerHTML = "<b style=color:green>"+oplvis+"</b>";
|
||||
}
|
||||
else {
|
||||
|
@ -222,19 +234,34 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
core_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Dev\')"/>';
|
||||
core_tun_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'TUN\')"/>';
|
||||
core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return core_update(this,\'Meta\')"/>';
|
||||
op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return op_update(this)"/>';
|
||||
ma_core_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'Dev\')"/>';
|
||||
ma_core_tun_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'TUN\')"/>';
|
||||
ma_core_meta_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_core_update(this,\'Meta\')"/>';
|
||||
ma_op_up.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Download%>" onclick="return ma_op_update(this)"/>';
|
||||
restore.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Restore Default Config%>" onclick="return restore_config(this)"/>';
|
||||
one_key_update.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:One Click Check Update%>" onclick="return all_one_key_update(this)"/>';
|
||||
remove_core.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Remove Core%>" onclick="return remove_all_core(this)"/>';
|
||||
backup.innerHTML = '<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Backup OpenClash%>" onclick="return backup_all_file(this)"/>';
|
||||
|
||||
XHR.poll(7, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.startlog == "\n" || status.startlog == "" ) {
|
||||
var rdmdl=Math.floor(Math.random()*2)+1;
|
||||
if(rdmdl==1)
|
||||
{
|
||||
update_tip.innerHTML = '<b><font><%:Note: if the update fails, you can manually download and upload%></font></b>';
|
||||
}
|
||||
if(rdmdl==2)
|
||||
{
|
||||
update_tip.innerHTML = '<b><font><%:Note: the client may not support update, because the firmware with squashfs format will not release flash space after updating%></font></b>';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
XHR.poll(1, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', null, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.startlog.match("level=fatal") ) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "del_start_log")%>', null, function(x) {});
|
||||
alert('<%:OpenClash Start Failed%> :\n\n' + status.startlog.split('msg=')[1]);
|
||||
}
|
||||
else if ( status.startlog != "\n" && status.startlog != "" ) {
|
||||
update_tip.innerHTML = '<b style=color:green>'+status.startlog+'</b>';
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
function core_update(btn,type)
|
||||
{
|
||||
|
@ -416,29 +443,5 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
XHR.poll(7, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.startlog == "\n" || status.startlog == "" ) {
|
||||
var rdmdl=Math.floor(Math.random()*2)+1;
|
||||
if(rdmdl==1)
|
||||
{
|
||||
update_tip.innerHTML = '<b><font><%:Note: if the update fails, you can manually download and upload%></font></b>';
|
||||
}
|
||||
if(rdmdl==2)
|
||||
{
|
||||
update_tip.innerHTML = '<b><font><%:Note: the client may not support update, because the firmware with squashfs format will not release flash space after updating%></font></b>';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "services", "openclash", "startlog")%>', status.startlog, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.startlog != "\n" && status.startlog != "" ) {
|
||||
update_tip.innerHTML = '<b style=color:green>'+status.startlog+'</b>';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//]]></script>
|
||||
|
|
|
@ -1273,10 +1273,6 @@ if [ -n "$en_mode_tun" ]; then
|
|||
TUN_WAIT=0
|
||||
ip link set utun up
|
||||
|
||||
if [ "$enable_meta_core" == "1" ]; then
|
||||
route add -net 198.18.0.0/16 dev utun
|
||||
fi
|
||||
|
||||
while ( [ -n "$(pidof clash)" ] && [ -z "$(ip route list |grep utun)" ] && [ "$TUN_WAIT" -le 3 ] )
|
||||
do
|
||||
ip link set utun up
|
||||
|
@ -1360,7 +1356,7 @@ fi
|
|||
|
||||
#ipv6
|
||||
if [ "$ipv6_enable" -eq 1 ] && [ -n "$(ip6tables -t mangle -L 2>&1 | grep -o 'Chain')" ]; then
|
||||
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(ip6tables -t nat -nL PREROUTING --line-number |grep 'dns_hijack')"]; then
|
||||
if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(ip6tables -t nat -nL PREROUTING --line-number |grep 'DNS Hijack')"]; then
|
||||
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
skip-sni:
|
||||
skip-domain:
|
||||
- '+.apple.com'
|
||||
- Mijia Cloud
|
||||
- '+.jd.com'
|
|
@ -1,3 +1,4 @@
|
|||
port-whitelist:
|
||||
- 443
|
||||
- 80
|
||||
# - 8080-9090
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -8,9 +8,9 @@
|
|||
<meta name="description" content="Clash web port" />
|
||||
<!--meta name="external-controller" content="http://secret@example.com:9090"-->
|
||||
<title>Clash</title>
|
||||
<script type="module" crossorigin src="./assets/index.ff31c246.js"></script>
|
||||
<link rel="modulepreload" href="./assets/vendor.2c5fdbe2.js">
|
||||
<link rel="stylesheet" href="./assets/index.e3125dbb.css">
|
||||
<script type="module" crossorigin src="./assets/index.44e2a61b.js"></script>
|
||||
<link rel="modulepreload" href="./assets/vendor.91f359a7.js">
|
||||
<link rel="stylesheet" href="./assets/index.e71ce3d7.css">
|
||||
<link rel="manifest" href="./manifest.webmanifest"><script>if('serviceWorker' in navigator) {window.addEventListener('load', () => {navigator.serviceWorker.register('./sw.js', { scope: './' })})}</script></head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
|
|
@ -1 +1 @@
|
|||
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>n(e,r),d={module:{uri:r},exports:o,require:l};s[r]=Promise.all(i.map((e=>d[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-4ee7f24a"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.e3125dbb.css",revision:null},{url:"assets/index.ff31c246.js",revision:null},{url:"assets/vendor.2c5fdbe2.js",revision:null},{url:"index.html",revision:"9d6c3a673c0ee9338a15bdb49ef25307"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));
|
||||
if(!self.define){let e,s={};const n=(n,i)=>(n=new URL(n+".js",i).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(i,t)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(s[r])return;let o={};const l=e=>n(e,r),d={module:{uri:r},exports:o,require:l};s[r]=Promise.all(i.map((e=>d[e]||l(e)))).then((e=>(t(...e),o)))}}define(["./workbox-4ee7f24a"],(function(e){"use strict";self.addEventListener("message",(e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()})),e.precacheAndRoute([{url:"assets/index.44e2a61b.js",revision:null},{url:"assets/index.e71ce3d7.css",revision:null},{url:"assets/vendor.91f359a7.js",revision:null},{url:"index.html",revision:"1c8ba5d53f770fbbaecd74a82639363d"},{url:"manifest.webmanifest",revision:"d3dd1da0aa7614180924343e65244285"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}));
|
||||
|
|
|
@ -325,7 +325,7 @@ Thread.new{
|
|||
if ${20} == 1 and ${21} == 1 then
|
||||
Value_sniffer={'sniffer'=>{'enable'=>true}};
|
||||
Value['sniffer']=Value_sniffer['sniffer'];
|
||||
Value_sniffer={'sniffing'=>['tls']};
|
||||
Value_sniffer={'sniffing'=>['tls','http']};
|
||||
Value['sniffer'].merge!(Value_sniffer);
|
||||
if File::exist?('/etc/openclash/custom/openclash_force_sniffing_domain.yaml') and ${24} == 1 then
|
||||
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_force_sniffing_domain.yaml');
|
||||
|
@ -337,8 +337,12 @@ Thread.new{
|
|||
if File::exist?('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml') and ${24} == 1 then
|
||||
Value_7 = YAML.load_file('/etc/openclash/custom/openclash_sniffing_domain_filter.yaml');
|
||||
if Value_7 != false and not Value_7['skip-sni'].to_a.empty? then
|
||||
Value['sniffer']['skip-sni']=Value_7['skip-sni'];
|
||||
Value['sniffer']['skip-sni']=Value['sniffer']['skip-sni'].uniq;
|
||||
Value['sniffer']['skip-domain']=Value_7['skip-sni'];
|
||||
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
|
||||
end
|
||||
if Value_7 != false and not Value_7['skip-domain'].to_a.empty? then
|
||||
Value['sniffer']['skip-domain']=Value_7['skip-domain'];
|
||||
Value['sniffer']['skip-domain']=Value['sniffer']['skip-domain'].uniq;
|
||||
end
|
||||
end;
|
||||
if File::exist?('/etc/openclash/custom/openclash_sniffing_port_filter.yaml') and ${24} == 1 then
|
||||
|
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.12-beta"><title>Current Version: v0.45.12-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.12-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.12-beta</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="186" height="20" role="img" aria-label="Current Version: v0.45.16-beta"><title>Current Version: v0.45.16-beta</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="186" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="97" height="20" fill="#555"/><rect x="97" width="89" height="20" fill="#007ec6"/><rect width="186" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="495" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="870">Current Version</text><text x="495" y="140" transform="scale(.1)" fill="#fff" textLength="870">Current Version</text><text aria-hidden="true" x="1405" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="790">v0.45.16-beta</text><text x="1405" y="140" transform="scale(.1)" fill="#fff" textLength="790">v0.45.16-beta</text></g></svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for quickstart
|
|||
LUCI_DEPENDS:=+quickstart +shadow-utils +shadow-useradd +luci-app-store +mount-utils
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=0.3.8-1
|
||||
PKG_VERSION:=0.3.9-1
|
||||
# PKG_RELEASE MUST be empty for luci.mk
|
||||
PKG_RELEASE:=
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
|||
|
||||
LUCI_TITLE:=LuCI support for Time Control
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1-20220406
|
||||
PKG_VERSION:=1.1
|
||||
PKG_RELEASE:=20220505
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
|
|
@ -1,80 +1,96 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
CONFIG=timecontrol
|
||||
|
||||
uci_get_by_type() {
|
||||
local index=0
|
||||
[ -n $4 ] && index=$4
|
||||
local ret=$(uci -q get $CONFIG.@$1[$index].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
TIMECONTROL_ENABLE=0
|
||||
|
||||
iptables_w(){
|
||||
iptables -w 1 "$@"
|
||||
}
|
||||
|
||||
add_rule(){
|
||||
local count=$(uci show $CONFIG | grep "@macbind" | sed -n '$p' | cut -d '[' -f 2 | cut -d ']' -f 1)
|
||||
[ -n "$count" ] && [ "$count" -ge 0 ] && {
|
||||
u_get() {
|
||||
local ret=$(uci -q get $CONFIG.@macbind[$1].$2)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
for i in $(seq 0 $count); do
|
||||
local enable=$(u_get $i enable 0)
|
||||
local macaddr=$(u_get $i macaddr)
|
||||
local timeoff=$(u_get $i timeoff)
|
||||
local timeon=$(u_get $i timeon)
|
||||
local z1=$(u_get $i z1)
|
||||
local z2=$(u_get $i z2)
|
||||
local z3=$(u_get $i z3)
|
||||
local z4=$(u_get $i z4)
|
||||
local z5=$(u_get $i z5)
|
||||
local z6=$(u_get $i z6)
|
||||
local z7=$(u_get $i z7)
|
||||
[ "$z1" == "1" ] && local Z1="Mon,"
|
||||
[ "$z2" == "1" ] && local Z2="Tue,"
|
||||
[ "$z3" == "1" ] && local Z3="Wed,"
|
||||
[ "$z4" == "1" ] && local Z4="Thu,"
|
||||
[ "$z5" == "1" ] && local Z5="Fri,"
|
||||
[ "$z6" == "1" ] && local Z6="Sat,"
|
||||
[ "$z7" == "1" ] && local Z7="Sun"
|
||||
if [ -z $enable ] || [ -z $macaddr ] || [ -z $timeoff ] || [ -z $timeon ]; then
|
||||
continue
|
||||
fi
|
||||
if [ "$enable" == "1" ]; then
|
||||
iptables -t filter -I TIMECONTROL -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j DROP
|
||||
iptables -t nat -I PREROUTING 1 -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -m comment --comment "TIMECONTROL" -j RETURN
|
||||
fi
|
||||
done
|
||||
}
|
||||
echo "/etc/init.d/timecontrol restart" > "/var/etc/timecontrol.include"
|
||||
local enable macaddr timeoff timeon z1 z2 z3 z4 z5 z6 z7
|
||||
config_get enable "$1" enable "0"
|
||||
config_get macaddr "$1" macaddr
|
||||
config_get timeoff "$1" timeoff
|
||||
config_get timeon "$1" timeon
|
||||
config_get z1 "$1" z1
|
||||
config_get z2 "$1" z2
|
||||
config_get z3 "$1" z3
|
||||
config_get z4 "$1" z4
|
||||
config_get z5 "$1" z5
|
||||
config_get z6 "$1" z6
|
||||
config_get z7 "$1" z7
|
||||
|
||||
if [ -z $enable ] || [ "$enable" != "1" ] || [ -z $macaddr ] || [ -z $timeoff ] || [ -z $timeon ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local Z1 Z2 Z3 Z4 Z5 Z6 Z7
|
||||
[ "$z1" == "1" ] && Z1="Mon,"
|
||||
[ "$z2" == "1" ] && Z2="Tue,"
|
||||
[ "$z3" == "1" ] && Z3="Wed,"
|
||||
[ "$z4" == "1" ] && Z4="Thu,"
|
||||
[ "$z5" == "1" ] && Z5="Fri,"
|
||||
[ "$z6" == "1" ] && Z6="Sat,"
|
||||
[ "$z7" == "1" ] && Z7="Sun"
|
||||
|
||||
local table
|
||||
for table in filter nat; do
|
||||
iptables_w -t $table -A TIMECONTROL_RULES -m mac --mac-source $macaddr -m time --kerneltz --timestart $timeon --timestop $timeoff --weekdays $Z1$Z2$Z3$Z4$Z5$Z6$Z7 -j TIMECONTROL_REJECT
|
||||
done
|
||||
}
|
||||
|
||||
del_rule(){
|
||||
nums=$(iptables -t nat -n -L PREROUTING 2>/dev/null | grep -c "TIMECONTROL")
|
||||
if [ -n "$nums" ]; then
|
||||
until [ "$nums" = 0 ]
|
||||
do
|
||||
rules=$(iptables -t nat -n -L PREROUTING --line-num 2>/dev/null | grep "TIMECONTROL" | awk '{print $1}')
|
||||
for rule in $rules
|
||||
do
|
||||
iptables -t nat -D PREROUTING $rule 2>/dev/null
|
||||
break
|
||||
done
|
||||
nums=$(expr $nums - 1)
|
||||
done
|
||||
fi
|
||||
timecontrol_header(){
|
||||
config_get TIMECONTROL_ENABLE "$1" enable "0"
|
||||
}
|
||||
|
||||
start(){
|
||||
ENABLED=$(uci_get_by_type basic enable 0)
|
||||
[ "$ENABLED" != "1" ] && exit 0
|
||||
iptables -t filter -N TIMECONTROL
|
||||
iptables -t filter -I FORWARD -j TIMECONTROL
|
||||
add_rule
|
||||
local table
|
||||
config_load timecontrol
|
||||
config_foreach timecontrol_header basic
|
||||
|
||||
[ "$TIMECONTROL_ENABLE" != "1" ] && return 0
|
||||
# resolve interface
|
||||
local interface=$(
|
||||
. /lib/functions/network.sh
|
||||
|
||||
network_is_up "lan" && network_get_device device "lan"
|
||||
echo "${device:-br-lan}"
|
||||
)
|
||||
|
||||
for table in filter nat; do
|
||||
iptables_w -t $table -N TIMECONTROL
|
||||
iptables_w -t $table -F TIMECONTROL
|
||||
iptables_w -t $table -N TIMECONTROL_RULES
|
||||
iptables_w -t $table -F TIMECONTROL_RULES
|
||||
iptables_w -t $table -N TIMECONTROL_REJECT
|
||||
iptables_w -t $table -F TIMECONTROL_REJECT
|
||||
done
|
||||
iptables_w -t filter -I TIMECONTROL_REJECT -j DROP
|
||||
iptables_w -t filter -I TIMECONTROL_REJECT -p tcp -j REJECT --reject-with tcp-reset
|
||||
iptables_w -t nat -I TIMECONTROL_REJECT -j ACCEPT
|
||||
|
||||
config_foreach add_rule macbind
|
||||
|
||||
iptables_w -t filter -I TIMECONTROL -i $interface -j TIMECONTROL_RULES
|
||||
iptables_w -t filter -I FORWARD -j TIMECONTROL
|
||||
iptables_w -t nat -I TIMECONTROL -i $interface -j TIMECONTROL_RULES
|
||||
iptables_w -t nat -I PREROUTING -j TIMECONTROL
|
||||
echo "/etc/init.d/timecontrol restart" > "/var/etc/timecontrol.include"
|
||||
}
|
||||
|
||||
stop(){
|
||||
iptables -t filter -D FORWARD -j TIMECONTROL 2>/dev/null
|
||||
iptables -t filter -F TIMECONTROL 2>/dev/null
|
||||
iptables -t filter -X TIMECONTROL 2>/dev/null
|
||||
del_rule
|
||||
local table
|
||||
iptables_w -t filter -D FORWARD -j TIMECONTROL
|
||||
iptables_w -t nat -D PREROUTING -j TIMECONTROL
|
||||
|
||||
for table in filter nat; do
|
||||
iptables_w -t $table -F TIMECONTROL
|
||||
iptables_w -t $table -X TIMECONTROL
|
||||
iptables_w -t $table -F TIMECONTROL_RULES
|
||||
iptables_w -t $table -X TIMECONTROL_RULES
|
||||
iptables_w -t $table -F TIMECONTROL_REJECT
|
||||
iptables_w -t $table -X TIMECONTROL_REJECT
|
||||
done
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -658,7 +658,7 @@ small {
|
|||
|
||||
|
||||
.sidenav-header {
|
||||
padding: 1.5rem;
|
||||
padding: 1.5rem .5rem;
|
||||
text-align: center;
|
||||
|
||||
.brand {
|
||||
|
@ -670,7 +670,6 @@ small {
|
|||
text-align: center;
|
||||
cursor: default;
|
||||
vertical-align: text-bottom;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1016,7 +1015,6 @@ div[style="width:100%;height:300px;border:1px solid #000;background:#fff"] {
|
|||
list-style: none;
|
||||
|
||||
a {
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
@ -1539,9 +1537,11 @@ tr>th,
|
|||
text-align: center !important;
|
||||
}
|
||||
|
||||
.cbi-section-table-row>.cbi-value-field .control-group {
|
||||
.control-group {
|
||||
display: inline-flex;
|
||||
width: 100%;
|
||||
flex-wrap: wrap;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
div>table>tbody>tr:nth-of-type(2n),
|
||||
|
@ -2643,6 +2643,7 @@ body.modal-overlay-active #modal_overlay {
|
|||
.cbi-page-actions {
|
||||
padding-top: 1rem;
|
||||
text-align: right;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.cbi-page-actions>form[method="post"] {
|
||||
|
@ -2659,6 +2660,7 @@ body.modal-overlay-active #modal_overlay {
|
|||
|
||||
.ifacebadge {
|
||||
display: inline-flex;
|
||||
gap: .2rem;
|
||||
padding: .5rem .8rem;
|
||||
border-bottom: thin solid #ccc;
|
||||
background: #eee;
|
||||
|
@ -2676,7 +2678,6 @@ td>.ifacebadge,
|
|||
.ifacebadge>img {
|
||||
display: inline-block;
|
||||
align-self: flex-start;
|
||||
margin: 0 .2rem;
|
||||
}
|
||||
|
||||
.ifacebadge>img+img {
|
||||
|
@ -2709,6 +2710,7 @@ td>.ifacebadge,
|
|||
.network-status-table .ifacebox-body>div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: .7rem;
|
||||
}
|
||||
|
||||
.network-status-table .ifacebox-body .ifacebadge {
|
||||
|
@ -3831,8 +3833,7 @@ pre.command-output {
|
|||
}
|
||||
|
||||
.cbi-progressbar::after {
|
||||
font-size: .5rem;
|
||||
line-height: 1.5;
|
||||
font-size: .6rem;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
|||
PKG_ARCH_quickstart:=$(ARCH)
|
||||
|
||||
PKG_NAME:=quickstart
|
||||
PKG_VERSION:=0.3.8
|
||||
PKG_VERSION:=0.3.9
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE:=$(PKG_NAME)-binary-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://fw.koolcenter.com/binary/quickstart/
|
||||
|
|
Loading…
Reference in New Issue