WOL 전용 토큰 API 추가

This commit is contained in:
seo
2026-07-22 01:17:39 +09:00
parent 8fe2726c70
commit 01cc393ebe
3 changed files with 71 additions and 4 deletions
+20
View File
@@ -696,6 +696,26 @@ function signed_in(): bool
return auto_login_from_cookie();
}
function control_api_token_valid(string $scope): bool
{
global $controlSecretConfig;
$provided = (string)(
$_SERVER['HTTP_X_CONTROL_API_TOKEN']
?? $_POST['api_token']
?? ''
);
if ($provided === '') {
return false;
}
$tokens = is_array($controlSecretConfig['api_tokens'] ?? null) ? $controlSecretConfig['api_tokens'] : [];
$expected = (string)($tokens[$scope] ?? '');
return $expected !== '' && hash_equals($expected, $provided);
}
function control_admin_session_from_rhymix_or_custom(): bool
{
static $checked = null;