mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 20:53:56 +08:00
🤞 Sync 2026-10-04 14:55:43
This commit is contained in:
1 parent
d0a3b136c4
commit
d132e566f2
5 files changed
+34
-23
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-passwall
|
PKG_NAME:=luci-app-passwall
|
||||||
PKG_VERSION:=26.10.3
|
PKG_VERSION:=26.10.3
|
||||||
PKG_RELEASE:=310
|
PKG_RELEASE:=311
|
||||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||||
|
|
||||||
PKG_CONFIG_DEPENDS:= \
|
PKG_CONFIG_DEPENDS:= \
|
||||||
|
|||||||
@@ -949,7 +949,7 @@ function create_backup()
|
|||||||
local date = os.date("%y%m%d%H%M")
|
local date = os.date("%y%m%d%H%M")
|
||||||
local tar_file = "/tmp/passwall-" .. date .. "-backup.tar.gz"
|
local tar_file = "/tmp/passwall-" .. date .. "-backup.tar.gz"
|
||||||
local version_file = "/tmp/passwall-version"
|
local version_file = "/tmp/passwall-version"
|
||||||
local version = api.get_version()
|
local version = api.get_version():match("^([^-]+)")
|
||||||
api.remove(tar_file)
|
api.remove(tar_file)
|
||||||
fs.writefile(version_file, version .. "\n")
|
fs.writefile(version_file, version .. "\n")
|
||||||
local cmd = "tar -czf " .. tar_file .. " " .. table.concat(backup_files, " ") .. " " .. "-C /tmp passwall-version"
|
local cmd = "tar -czf " .. tar_file .. " " .. table.concat(backup_files, " ") .. " " .. "-C /tmp passwall-version"
|
||||||
|
|||||||
@@ -981,9 +981,16 @@ function compare_versions(ver1, comp, ver2)
|
|||||||
local n2 = table.getn(av2)
|
local n2 = table.getn(av2)
|
||||||
if (max < n2) then max = n2 end
|
if (max < n2) then max = n2 end
|
||||||
|
|
||||||
|
local function version_part(value)
|
||||||
|
local number = tonumber(value)
|
||||||
|
if number then return number end
|
||||||
|
local revision = type(value) == "string" and value:match("^[rR](%d+)$")
|
||||||
|
return tonumber(revision) or 0
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, max, 1 do
|
for i = 1, max, 1 do
|
||||||
local s1 = tonumber(av1[i] or 0) or 0
|
local s1 = version_part(av1[i] or 0)
|
||||||
local s2 = tonumber(av2[i] or 0) or 0
|
local s2 = version_part(av2[i] or 0)
|
||||||
|
|
||||||
if comp == "~=" and (s1 ~= s2) then return true end
|
if comp == "~=" and (s1 ~= s2) then return true end
|
||||||
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
|
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
|
||||||
@@ -1442,38 +1449,33 @@ function get_version()
|
|||||||
fs.writefile(version_file, version)
|
fs.writefile(version_file, version)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return version:match("^([^-]+)") or ""
|
version = (version or ""):match("^%s*(.-)%s*$")
|
||||||
|
-- Normalize APK's -rN release notation while retaining the release number.
|
||||||
|
return version:gsub("%-r(%d+)$", "-%1")
|
||||||
end
|
end
|
||||||
|
|
||||||
function to_check_self()
|
function to_check_self()
|
||||||
local url = "https://raw.githubusercontent.com/Openwrt-Passwall/openwrt-passwall/main/luci-app-passwall/Makefile"
|
local release = get_api_json(com.passwall:get_url())
|
||||||
local tmp_file = "/tmp/passwall_makefile"
|
if type(release) == "table" and #release > 0 then
|
||||||
local gh_proxy = uci_get_c("@global_app[0]", "gh_proxy_url") or ""
|
release = release[1]
|
||||||
local return_code, result
|
|
||||||
if gh_proxy ~= "" then
|
|
||||||
url = gh_proxy .. url
|
|
||||||
return_code, result = curl_base(url, tmp_file, curl_args)
|
|
||||||
else
|
|
||||||
return_code, result = curl_auto(url, tmp_file, curl_args)
|
|
||||||
end
|
end
|
||||||
result = return_code == 0
|
if type(release) ~= "table" or not release.tag_name then
|
||||||
if not result then
|
|
||||||
exec("/bin/rm", {"-f", tmp_file})
|
|
||||||
return {
|
return {
|
||||||
code = 1,
|
code = 1,
|
||||||
error = i18n.translatef("Failed")
|
error = i18n.translate("Get remote version info failed.")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
local local_version = get_version()
|
local local_version = get_version()
|
||||||
local remote_version = sys.exec("echo -n $(grep '^PKG_VERSION' /tmp/passwall_makefile | head -n 1 | awk -F '=' '{print $2}')")
|
-- Keep the release suffix (-1, -2, ...) so package revisions are compared too.
|
||||||
exec("/bin/rm", {"-f", tmp_file})
|
local remote_version = release.tag_name:gsub("^v", "")
|
||||||
|
|
||||||
local has_update = compare_versions(local_version, "<", remote_version)
|
local has_update = compare_versions(local_version, "<", remote_version)
|
||||||
if not has_update then
|
if not has_update then
|
||||||
return {
|
return {
|
||||||
code = 0,
|
code = 0,
|
||||||
local_version = local_version,
|
local_version = local_version,
|
||||||
remote_version = remote_version
|
remote_version = remote_version,
|
||||||
|
html_url = release.html_url,
|
||||||
|
data = release.assets or {}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
@@ -1481,6 +1483,8 @@ function to_check_self()
|
|||||||
has_update = true,
|
has_update = true,
|
||||||
local_version = local_version,
|
local_version = local_version,
|
||||||
remote_version = remote_version,
|
remote_version = remote_version,
|
||||||
|
html_url = release.html_url,
|
||||||
|
data = release.assets or {},
|
||||||
error = i18n.translatef("The latest version: %s, currently does not support automatic update, if you need to update, please compile or download the ipk and then manually install.", remote_version)
|
error = i18n.translatef("The latest version: %s, currently does not support automatic update, if you need to update, please compile or download the ipk and then manually install.", remote_version)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,6 +19,13 @@ _M.order = {
|
|||||||
"hysteria"
|
"hysteria"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- PassWall uses the same cached GitHub Release API, but is not listed as a
|
||||||
|
-- downloadable component because its LuCI package update flow is handled separately.
|
||||||
|
_M.passwall = {
|
||||||
|
name = "PassWall",
|
||||||
|
get_url = gh_release_url
|
||||||
|
}
|
||||||
|
|
||||||
_M.hysteria = {
|
_M.hysteria = {
|
||||||
name = "Hysteria",
|
name = "Hysteria",
|
||||||
repo = "HyNetwork/hysteria",
|
repo = "HyNetwork/hysteria",
|
||||||
|
|||||||
@@ -1776,7 +1776,7 @@ local function curl(url, file, ua, mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ua = (ua and ua ~= "") and ua or "passwall"
|
ua = (ua and ua ~= "") and ua or "passwall"
|
||||||
ua = (ua == "passwall") and ("passwall/" .. api.get_version()) or ua
|
ua = (ua == "passwall") and ("passwall/" .. api.get_version():match("^([^-]+)")) or ua
|
||||||
curl_args[#curl_args + 1] = '--user-agent "' .. ua .. '"'
|
curl_args[#curl_args + 1] = '--user-agent "' .. ua .. '"'
|
||||||
|
|
||||||
local cookie_file = "/tmp/cookie_" .. api.gen_random_char(5)
|
local cookie_file = "/tmp/cookie_" .. api.gen_random_char(5)
|
||||||
|
|||||||
Reference in new issue
Block a user