update 2024-12-13 04:23:47

This commit is contained in:
kenzok8 2024-12-13 04:23:47 +08:00
parent dd10ee5dd5
commit 40dc890db5
5 changed files with 93 additions and 76 deletions

View File

@ -7,13 +7,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=alist
PKG_VERSION:=3.40.0
PKG_WEB_VERSION:=3.39.2
PKG_VERSION:=3.41.0
PKG_WEB_VERSION:=3.41.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/alist-org/alist/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=350f6d0610cebb70c645e52a87aaf0e8cb5bb275593ee22778ed8348da48b005
PKG_HASH:=0336a1c0089d558e7e3efd0337e51e9c45bc80f22ee8a71103e12417a7d647a2
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILE:=LICENSE
@ -23,7 +23,7 @@ define Download/$(PKG_NAME)-web
FILE:=$(PKG_NAME)-web-$(PKG_WEB_VERSION).tar.gz
URL_FILE:=dist.tar.gz
URL:=https://github.com/alist-org/alist-web/releases/download/$(PKG_WEB_VERSION)/
HASH:=d998315aff5544e7d7248214d02a3b04a92366bf0ac50fb4791b23833e8b543a
HASH:=7fbc3e83874fca15eb6590aad2c09cd6eb4f15aa7febe2b25a961ea56ba5265b
endef
PKG_BUILD_DEPENDS:=golang/host

View File

@ -77,6 +77,11 @@ function index()
entry({"admin", "services", appname, "delete_select_nodes"}, call("delete_select_nodes")).leaf = true
entry({"admin", "services", appname, "update_rules"}, call("update_rules")).leaf = true
--[[rule_list]]
entry({"admin", "services", appname, "read_gfwlist"}, call("read_rulelist", "gfw")).leaf = true
entry({"admin", "services", appname, "read_chnlist"}, call("read_rulelist", "chn")).leaf = true
entry({"admin", "services", appname, "read_chnroute"}, call("read_rulelist", "chnroute")).leaf = true
--[[Components update]]
entry({"admin", "services", appname, "check_passwall"}, call("app_check")).leaf = true
local coms = require "luci.passwall.com"
@ -475,3 +480,19 @@ function com_update(comname)
http_write_json(json)
end
function read_rulelist(list)
local rule_path
if list == "gfw" then
rule_path = "/usr/share/passwall/rules/gfwlist"
elseif list == "chn" then
rule_path = "/usr/share/passwall/rules/chnlist"
else
rule_path = "/usr/share/passwall/rules/chnroute"
end
if api.fs.access(rule_path) then
luci.http.prepare_content("text/plain")
luci.http.write(api.fs.readfile(rule_path))
end
end

View File

@ -273,71 +273,41 @@ end
if api.fs.access(gfwlist_path) then
s:tab("gfw_list", translate("GFW List"))
o = s:taboption("gfw_list", TextValue, "gfw_list", "")
o.readonly = true
o.rows = 45
o.wrap = "off"
o.cfgvalue = function(self, section)
local limit = 100 -- 限制行数
local cmd = string.format("head -n %d %s", limit, gfwlist_path)
return api.sys.exec(cmd) or ""
-- return fs.readfile(gfwlist_path) or ""
end
local total_lines_cmd = string.format("wc -l < %s", gfwlist_path)
local total_lines = tonumber(api.sys.exec(total_lines_cmd)) or 0
local displayed_lines = 100
local total_lines_label = s:taboption("gfw_list", DummyValue, "total_lines", translate("Total Lines"))
total_lines_label.value = translatef("%d lines", total_lines)
local displayed_lines_label = s:taboption("gfw_list", DummyValue, "displayed_lines", translate("Displayed Lines"))
displayed_lines_label.value = translatef("%d lines", displayed_lines)
o = s:taboption("gfw_list", DummyValue, "_gfw_fieldset")
o.rawhtml = true
o.default = string.format([[
<div style="display: flex; align-items: center;">
<input class="btn cbi-button cbi-button-add" type="button" onclick="read_gfw()" value="%s" />
<label id="gfw_total_lines" style="margin-left: auto; margin-right: 10px;"></label>
</div>
<textarea id="gfw_textarea" class="cbi-input-textarea" style="width: 100%%; margin-top: 10px;" rows="40" wrap="off" readonly="readonly"></textarea>
]], translate("Read List"))
end
if api.fs.access(chnlist_path) then
s:tab("chn_list", translate("China List") .. "(" .. translate("Domain") .. ")")
o = s:taboption("chn_list", TextValue, "chn_list", "")
o.readonly = true
o.rows = 45
o.wrap = "off"
o.cfgvalue = function(self, section)
local limit = 100 -- 限制行数
local cmd = string.format("head -n %d %s", limit, chnlist_path)
return api.sys.exec(cmd) or ""
-- return fs.readfile(chnlist_path) or ""
end
local total_lines_cmd = string.format("wc -l < %s", chnlist_path)
local total_lines = tonumber(api.sys.exec(total_lines_cmd)) or 0
local displayed_lines = 100
local total_lines_label = s:taboption("chn_list", DummyValue, "total_lines", translate("Total Lines"))
total_lines_label.value = translatef("%d lines", total_lines)
local displayed_lines_label = s:taboption("chn_list", DummyValue, "displayed_lines", translate("Displayed Lines"))
displayed_lines_label.value = translatef("%d lines", displayed_lines)
o = s:taboption("chn_list", DummyValue, "_chn_fieldset")
o.rawhtml = true
o.default = string.format([[
<div style="display: flex; align-items: center;">
<input class="btn cbi-button cbi-button-add" type="button" onclick="read_chn()" value="%s" />
<label id="chn_total_lines" style="margin-left: auto; margin-right: 10px;"></label>
</div>
<textarea id="chn_textarea" class="cbi-input-textarea" style="width: 100%%; margin-top: 10px;" rows="40" wrap="off" readonly="readonly"></textarea>
]], translate("Read List"))
end
if api.fs.access(chnroute_path) then
s:tab("chnroute_list", translate("China List") .. "(IP)")
o = s:taboption("chnroute_list", TextValue, "chnroute_list", "")
o.readonly = true
o.rows = 45
o.wrap = "off"
o.cfgvalue = function(self, section)
local limit = 100 -- 限制行数
local cmd = string.format("head -n %d %s", limit, chnroute_path)
return api.sys.exec(cmd) or ""
-- return fs.readfile(chnroute_path) or ""
end
local total_lines_cmd = string.format("wc -l < %s", chnroute_path)
local total_lines = tonumber(api.sys.exec(total_lines_cmd)) or 0
local displayed_lines = 100
local total_lines_label = s:taboption("chnroute_list", DummyValue, "total_lines", translate("Total Lines"))
total_lines_label.value = translatef("%d lines", total_lines)
local displayed_lines_label = s:taboption("chnroute_list", DummyValue, "displayed_lines", translate("Displayed Lines"))
displayed_lines_label.value = translatef("%d lines", displayed_lines)
o = s:taboption("chnroute_list", DummyValue, "_chnroute_fieldset")
o.rawhtml = true
o.default = string.format([[
<div style="display: flex; align-items: center;">
<input class="btn cbi-button cbi-button-add" type="button" onclick="read_chnroute()" value="%s" />
<label id="chnroute_total_lines" style="margin-left: auto; margin-right: 10px;"></label>
</div>
<textarea id="chnroute_textarea" class="cbi-input-textarea" style="width: 100%%; margin-top: 10px;" rows="40" wrap="off" readonly="readonly"></textarea>
]], translate("Read List"))
end
m:append(Template(appname .. "/rule_list/js"))

View File

@ -1,18 +1,47 @@
<%
local api = require "luci.passwall.api"
local translate = luci.i18n.translate
local total_lines_text = translate("Total Lines")
-%>
<script type="text/javascript">
//<![CDATA[
let dom = document.getElementById("cbi-passwall-global_rules");
if (dom) {
let textareas = dom.getElementsByTagName("textarea");
for (let i = 0; i < textareas.length; i++) {
let o = textareas[i];
if (o.readOnly) {
o.removeAttribute("name");
o.removeAttribute("id");
}
}
function read_gfw() {
fetch('<%= api.url("read_gfwlist") %>')
.then(response => response.text())
.then(data => {
var total_lines = data.split("\n").length;
var textarea = document.getElementById('gfw_textarea');
textarea.innerHTML = data;
//textarea.scrollTop = textarea.scrollHeight;
var totalLinesLabel = document.getElementById('gfw_total_lines');
totalLinesLabel.innerHTML = "<%= total_lines_text %> " + total_lines;
})
}
function read_chn() {
fetch('<%= api.url("read_chnlist") %>')
.then(response => response.text())
.then(data => {
var total_lines = data.split("\n").length;
var textarea = document.getElementById('chn_textarea');
textarea.innerHTML = data;
//textarea.scrollTop = textarea.scrollHeight;
var totalLinesLabel = document.getElementById('chn_total_lines');
totalLinesLabel.innerHTML = "<%= total_lines_text %> " + total_lines;
})
}
function read_chnroute() {
fetch('<%= api.url("read_chnroute") %>')
.then(response => response.text())
.then(data => {
var total_lines = data.split("\n").length;
var textarea = document.getElementById('chnroute_textarea');
textarea.innerHTML = data;
//textarea.scrollTop = textarea.scrollHeight;
var totalLinesLabel = document.getElementById('chnroute_total_lines');
totalLinesLabel.innerHTML = "<%= total_lines_text %> " + total_lines;
})
}
//]]>
</script>

View File

@ -1729,8 +1729,5 @@ msgstr "为 sing-box 节点设置默认的域名解析策略。"
msgid "Total Lines"
msgstr "总行数:"
msgid "Displayed Lines"
msgstr "展示行数:"
msgid "%d lines"
msgstr "%d 行"
msgid "Read List"
msgstr "读取列表"