mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 20:12:51 +08:00
🐶 Sync 2026-03-09 08:45:34
This commit is contained in:
1 parent
727d0dbe93
commit
21dad30e61
6 files changed
+19
-17
No files matched your search
@@ -367,14 +367,14 @@ local function non_file_check(file_path, header_content)
|
||||
end
|
||||
|
||||
local function GeoToRule(rule_name, rule_type, out_path)
|
||||
if not api.is_finded("geoview") then
|
||||
log(rule_name .. "生成失败,缺少 geoview 组件。")
|
||||
return false;
|
||||
local bin = api.finded_com("geoview")
|
||||
if not (bin and api.compare_versions(api.get_app_version("geoview"), ">=", "0.1.10")) then
|
||||
log("[警告] Geoview 组件缺失或版本过低,规则生成流程已被跳过。")
|
||||
return false
|
||||
end
|
||||
local geosite_path = asset_location .. "geosite.dat"
|
||||
local geoip_path = asset_location .. "geoip.dat"
|
||||
local file_path = (rule_type == "domain") and geosite_path or geoip_path
|
||||
local bin = api.get_app_path("geoview")
|
||||
local geo_arg
|
||||
if rule_type == "domain" then
|
||||
if rule_name == "gfwlist" then
|
||||
@@ -389,7 +389,13 @@ local function GeoToRule(rule_name, rule_type, out_path)
|
||||
end
|
||||
local cmd = string.format(bin .. " -input '%s' %s -lowmem=true -output '%s'", file_path, geo_arg, out_path)
|
||||
sys.exec(cmd)
|
||||
return true;
|
||||
local local_file_size = tonumber(fs.stat(out_path, "size") or 0)
|
||||
if local_file_size == 0 then
|
||||
os.remove(out_path)
|
||||
log(rule_name .. " 生成失败,请确保 Geo 文件正确且包含目标规则。")
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
--fetch rule
|
||||
@@ -407,10 +413,10 @@ local function fetch_rule(rule_name, rule_type, url, exclude_domain, max_retries
|
||||
end
|
||||
|
||||
for k, v in ipairs(url) do
|
||||
local current_file = "/tmp/" .. rule_name .. "_dl" .. k
|
||||
local success = false
|
||||
local current_file = "/tmp/" .. rule_name .. "_dl" .. k
|
||||
local success = false
|
||||
|
||||
if v ~= "geo2rule" then
|
||||
if v ~= "geo2rule" then
|
||||
for i = 1, max_attempts do
|
||||
local http_code, header = curl(v, current_file)
|
||||
if http_code == 200 and not non_file_check(current_file, header) then
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-taskplan
|
||||
PKG_VERSION:=3.0.0
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=3
|
||||
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
@@ -18,7 +18,7 @@ return view.extend({
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
var m = new form.Map('taskplan', _('Scheduled task'),
|
||||
var m = new form.Map('taskplan', _('Scheduled Tasks'),
|
||||
_('<b>The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts</b></br>') +
|
||||
_('N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours.'));
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ return view.extend({
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
var m = new form.Map('taskplan', _('Startup task'),
|
||||
var m = new form.Map('taskplan', _('Startup Tasks'),
|
||||
_('<b>The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts</b></br>') +
|
||||
_('The task to be executed upon startup, with a startup delay time unit of seconds.'));
|
||||
|
||||
|
||||
@@ -16,12 +16,10 @@ msgstr "管控"
|
||||
msgid "Task Plan"
|
||||
msgstr "任务设置"
|
||||
|
||||
# scheduled.js - 页面标题和说明
|
||||
|
||||
msgid "Scheduled Tasks"
|
||||
msgstr "定时执行任务"
|
||||
|
||||
msgid "Startup tasks"
|
||||
msgid "Startup Tasks"
|
||||
msgstr "开机启动任务"
|
||||
|
||||
msgid "<b>The original [Timing Settings] includes scheduled task execution and startup task execution. Presets include over 10 functions, including restart, shutdown, network restart, memory release, system cleaning, network sharing, network shutdown, automatic detection of network disconnects and reconnection, MWAN3 load balancing detection of reconnection, and custom scripts</b></br>"
|
||||
@@ -30,7 +28,6 @@ msgstr "<b>原【定时设置】包括定时任务执行和启动任务执行。
|
||||
msgid "N1-N5 is continuous, N1, N3, N5 is discontinuous, */N represents every N hours or every N minutes.The week can only be 0~6, the hour can only be 0~23, the minute can only be 0~59, the unavailable time is 48 hours."
|
||||
msgstr "N1-N5为连续,N1、N3、N5为不连续,*/N表示每N小时或每N分钟。星期只能0~6,小时只能0~23,分钟只能0~59,不可用时间为48小时。"
|
||||
|
||||
# scheduled.js - 全局脚本
|
||||
msgid "Edit Custom Script"
|
||||
msgstr "编辑自定义脚本"
|
||||
|
||||
|
||||
@@ -95,8 +95,7 @@ run_taskplan()
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
echo 'wait' >> $TT
|
||||
|
||||
echo 'exit 0' >> $TT
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user