diff --git a/docs/web/control-ui.md b/docs/web/control-ui.md index 67ae9da10bb..831d4e4d987 100644 --- a/docs/web/control-ui.md +++ b/docs/web/control-ui.md @@ -215,7 +215,7 @@ Override the VAPID keypair through env vars on the Gateway process when you want - `OPENCLAW_VAPID_PUBLIC_KEY` - `OPENCLAW_VAPID_PRIVATE_KEY` -- `OPENCLAW_VAPID_SUBJECT` (defaults to `mailto:openclaw@localhost`) +- `OPENCLAW_VAPID_SUBJECT` (defaults to `https://openclaw.ai`) The Control UI uses these scope-gated Gateway methods to register and test browser subscriptions: diff --git a/src/infra/push-web.test.ts b/src/infra/push-web.test.ts index e5ba88a4896..9f76e030fb4 100644 --- a/src/infra/push-web.test.ts +++ b/src/infra/push-web.test.ts @@ -58,7 +58,11 @@ describe("resolveVapidKeys", () => { const keys = await resolveVapidKeys(tmpDir); expect(keys.publicKey).toBe("test-public-key-base64url"); expect(keys.privateKey).toBe("test-private-key-base64url"); - expect(keys.subject).toMatch(/^mailto:/); + expect(keys.subject).toBe("https://openclaw.ai"); + const persistedKeys = JSON.parse( + await fs.readFile(path.join(tmpDir, "push", "vapid-keys.json"), "utf8"), + ) as { subject?: string }; + expect(persistedKeys.subject).toBe("https://openclaw.ai"); // Second call returns same keys. const keys2 = await resolveVapidKeys(tmpDir); @@ -211,7 +215,7 @@ describe("sending", () => { expect(result.ok).toBe(true); expect(vi.mocked(webPush.setVapidDetails)).toHaveBeenCalledTimes(1); expect(vi.mocked(webPush.setVapidDetails)).toHaveBeenCalledWith( - "mailto:openclaw@localhost", + "https://openclaw.ai", "test-public-key-base64url", "test-private-key-base64url", ); diff --git a/src/infra/push-web.ts b/src/infra/push-web.ts index e1c35011361..5fc8ca4576b 100644 --- a/src/infra/push-web.ts +++ b/src/infra/push-web.ts @@ -36,7 +36,7 @@ const WEB_PUSH_STATE_FILENAME = "push/web-push-subscriptions.json"; const VAPID_KEYS_FILENAME = "push/vapid-keys.json"; const MAX_ENDPOINT_LENGTH = 2048; const MAX_KEY_LENGTH = 512; -const DEFAULT_VAPID_SUBJECT = "mailto:openclaw@localhost"; +const DEFAULT_VAPID_SUBJECT = "https://openclaw.ai"; const withLock = createAsyncLock();