From 89d0ffdfe1b443b770f7c3603456b8bccaf840e3 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 15 Sep 2023 15:37:27 +0300 Subject: [PATCH] add missed protocol conditions --- src/crontab/import/feed.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/crontab/import/feed.php b/src/crontab/import/feed.php index 5e2468f..41a2f1b 100644 --- a/src/crontab/import/feed.php +++ b/src/crontab/import/feed.php @@ -87,9 +87,10 @@ try foreach (@json_decode(@file_get_contents($manifest->export->users)) as $remoteUser) { // Validate required fields - if (!isset($remoteUser->address) || !preg_match(YGGDRASIL_HOST_REGEX, $remoteUser->address) || - !isset($remoteUser->timeAdded) || !is_int($remoteUser->timeAdded) || - !isset($remoteUser->timeUpdated) || !is_int($remoteUser->timeUpdated) || + if (!isset($remoteUser->userId) || !is_int($remoteUser->userId) || + !isset($remoteUser->address) || !is_string($remoteUser->address) || + !isset($remoteUser->timeAdded) || !is_int($remoteUser->timeAdded) || + !isset($remoteUser->timeUpdated) || !is_int($remoteUser->timeUpdated) || !isset($remoteUser->approved) || !is_bool($remoteUser->approved)) { continue; @@ -173,7 +174,8 @@ try foreach (@json_decode(@file_get_contents($manifest->export->magnets)) as $remoteMagnet) { // Validate required fields by protocol - if (!isset($remoteMagnet->userId) || !is_int($remoteMagnet->userId) || + if (!isset($remoteMagnet->magnetId) || !is_int($remoteMagnet->magnetId) || + !isset($remoteMagnet->userId) || !is_int($remoteMagnet->userId) || !isset($aliasUserId[$remoteMagnet->userId]) || !$db->getUser($aliasUserId[$remoteMagnet->userId]) ||