fix(vikon): use correct VIKON API endpoints

- CheckAccessAction: pull_updates/assist/getModulesTreeAsync (not checkAccessJson)
- CheckVersionAction: pull_updates/assist/getUpdateVersionJson (not getLatestVersion)

These are the actual endpoints used by the original vikon_core update.js
This commit is contained in:
F4ilji
2026-07-04 13:57:17 +05:00
parent 967db81d3c
commit 93721fc5ae
2 changed files with 28 additions and 6 deletions
@@ -21,15 +21,37 @@ class CheckAccessAction
return ['has_access' => false, 'error' => 'Токен недействителен. Выполните повторную авторизацию.'];
}
$nonWritable = $this->findNonWritable($this->publicPath);
if (!empty($nonWritable)) {
try {
$response = $this->http->getWithToken('pull_updates/assist/getModulesTreeAsync', $accessToken);
$body = $response->json();
if (!isset($body['tree_access'])) {
return [
'has_access' => false,
'error' => 'Нет прав на обновление. Обратитесь к администратору VIKON.',
];
}
$nonWritable = $this->findNonWritable($this->publicPath);
if (!empty($nonWritable)) {
return [
'has_access' => false,
'error' => 'Нет прав на запись: ' . implode(', ', array_slice($nonWritable, 0, 3)),
];
}
return [
'has_access' => true,
'error' => null,
'modules_tree' => $body['tree_access'],
];
} catch (\Throwable $e) {
Log::error('Vikon access check failed', ['error' => $e->getMessage()]);
return [
'has_access' => false,
'error' => 'Нет прав на запись: ' . implode(', ', array_slice($nonWritable, 0, 3)),
'error' => 'Не удалось проверить права: ' . $e->getMessage(),
];
}
return ['has_access' => true, 'error' => null];
}
private function findNonWritable(string $path, int $depth = 0): array
@@ -15,7 +15,7 @@ class CheckVersionAction
public function run(string $accessToken): array
{
try {
$response = $this->http->getWithToken('pull_updates/getLatestVersion', $accessToken);
$response = $this->http->getWithToken('pull_updates/assist/getUpdateVersionJson', $accessToken);
$body = $response->json();
$latest = $body['version'] ?? null;
return [