From 4240c4ceb9887536b6ccfb60ec724d49e23ba672 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 19 May 2026 20:54:04 +0200 Subject: [PATCH] fix ip filter Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- plugins/ip_filter.lua | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/plugins/ip_filter.lua b/plugins/ip_filter.lua index d5569ec..6f94ddd 100644 --- a/plugins/ip_filter.lua +++ b/plugins/ip_filter.lua @@ -40,16 +40,10 @@ function on_start() return end - -- Fetch the current outbound IP via a public API. - local ok, result = pcall(function() - 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) + local result, err = shell_pipe("curl -sf https://api.ipify.org 2>/dev/null") + result = result and result:match("^%s*(.-)%s*$") or nil - 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") notif("IP Filter", "Could not determine outbound IP, skipping check", "warning") return