false, 'error' => 'Methode nicht erlaubt.']); } if (!camera_remote_is_authorized(is_array($groups ?? null) ? $groups : [])) { camera_remote_response(403, ['ok' => false, 'error' => 'Keine Berechtigung für die Kamera-Fernbedienung.']); } try { camera_remote_verify_csrf($_POST['csrf_token'] ?? null); $action = is_string($_POST['action'] ?? null) ? $_POST['action'] : ''; camera_remote_run($action); camera_remote_response(200, ['ok' => true]); } catch (InvalidArgumentException $exception) { camera_remote_response(400, ['ok' => false, 'error' => $exception->getMessage()]); } catch (RuntimeException $exception) { camera_remote_response(503, ['ok' => false, 'error' => $exception->getMessage()]); } catch (Throwable $exception) { error_log('Camera Remote: ' . $exception->getMessage()); camera_remote_response(500, ['ok' => false, 'error' => 'Der Kamerabefehl konnte nicht ausgeführt werden.']); }