mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-30 10:05:04 +00:00
refactor(gateway): dedupe default operator connect scopes
This commit is contained in:
@@ -61,6 +61,13 @@ export type GatewayBrowserClientOptions = {
|
||||
|
||||
// 4008 = application-defined code (browser rejects 1008 "Policy Violation")
|
||||
const CONNECT_FAILED_CLOSE_CODE = 4008;
|
||||
const DEFAULT_OPERATOR_CONNECT_SCOPES = [
|
||||
"operator.admin",
|
||||
"operator.read",
|
||||
"operator.write",
|
||||
"operator.approvals",
|
||||
"operator.pairing",
|
||||
];
|
||||
|
||||
export class GatewayBrowserClient {
|
||||
private ws: WebSocket | null = null;
|
||||
@@ -145,13 +152,7 @@ export class GatewayBrowserClient {
|
||||
// Gateways may reject this unless gateway.controlUi.allowInsecureAuth is enabled.
|
||||
const isSecureContext = typeof crypto !== "undefined" && !!crypto.subtle;
|
||||
|
||||
const scopes = [
|
||||
"operator.admin",
|
||||
"operator.read",
|
||||
"operator.write",
|
||||
"operator.approvals",
|
||||
"operator.pairing",
|
||||
];
|
||||
const scopes = DEFAULT_OPERATOR_CONNECT_SCOPES;
|
||||
const role = "operator";
|
||||
let deviceIdentity: Awaited<ReturnType<typeof loadOrCreateDeviceIdentity>> | null = null;
|
||||
let canFallbackToShared = false;
|
||||
|
||||
Reference in New Issue
Block a user