mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 01:32:33 +02:00
fix ip filter
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -40,16 +40,10 @@ function on_start()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fetch the current outbound IP via a public API.
|
local result, err = shell_pipe("curl -sf https://api.ipify.org 2>/dev/null")
|
||||||
local ok, result = pcall(function()
|
result = result and result:match("^%s*(.-)%s*$") or nil
|
||||||
local handle = io.popen("curl -sf https://api.ipify.org 2>/dev/null")
|
|
||||||
if not handle then return nil end
|
|
||||||
local ip = handle:read("*a")
|
|
||||||
handle:close()
|
|
||||||
return ip and ip:match("^%s*(.-)%s*$") or nil
|
|
||||||
end)
|
|
||||||
|
|
||||||
if not ok or not result or result == "" then
|
if err or not result or result == "" then
|
||||||
log("could not determine outbound IP, skipping check")
|
log("could not determine outbound IP, skipping check")
|
||||||
notif("IP Filter", "Could not determine outbound IP, skipping check", "warning")
|
notif("IP Filter", "Could not determine outbound IP, skipping check", "warning")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user