From bacb8b17bf21b6d9e891ee1b90f799ef39fc3c06 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 15 Sep 2023 04:02:37 +0300 Subject: [PATCH] skip feed processing from self and non-condition url --- src/crontab/import/feed.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/crontab/import/feed.php b/src/crontab/import/feed.php index f24737a..5e2468f 100644 --- a/src/crontab/import/feed.php +++ b/src/crontab/import/feed.php @@ -35,6 +35,35 @@ try file_get_contents(__DIR__ . '/../../config/nodes.json') ) as $node) { + + // Skip reading to non-condition addresses + if ($manifestUrl = Yggverse\Parser\Url::parse($node->manifest)) + { + if (!preg_match(YGGDRASIL_HOST_REGEX, str_replace(['[',']'], false, $manifestUrl->host->name))) + { + continue; + } + } + + else + { + continue; + } + + // Skip reading current host + if ($thisUrl = Yggverse\Parser\Url::parse(WEBSITE_URL)) + { + if ($manifestUrl->host->name == $thisUrl->host->name) // @TODO some mirrors could be available, improve condition + { + continue; + } + } + + else + { + continue; + } + // Manifest if ($manifest = @json_decode(@file_get_contents($node->manifest))) {