add API version check #13, #14

This commit is contained in:
ghost 2023-09-21 15:22:02 +03:00
parent 3507abc35f
commit fe2a7a575f
4 changed files with 19 additions and 4 deletions

View file

@ -58,7 +58,8 @@ try
// Manifest
$manifest =
[
'updated' => time(),
'updated' => time(),
'version' => (string) API_VERSION,
'settings' => (object)
[
@ -119,7 +120,6 @@ try
'MAGNET_STOP_WORDS_SIMILAR' => (object) MAGNET_STOP_WORDS_SIMILAR,
'API_VERSION' => (string) API_VERSION,
'API_USER_AGENT' => (string) API_USER_AGENT,
'API_EXPORT_ENABLED' => (bool) API_EXPORT_ENABLED,

View file

@ -135,6 +135,19 @@ try
continue;
}
if (empty($manifest->version) || $manifest->version !== API_VERSION)
{
array_push(
$debug['dump'],
sprintf(
_('Manifest API not compatible with local version "%s"'),
API_VERSION
)
);
continue;
}
if (empty($manifest->export))
{
array_push(