mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
feat(core): enable socket cors (#12823)
fix android & ios selfhost syncing <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved WebSocket connection compatibility by enabling cross-origin requests with credentials and restricting allowed HTTP methods to GET and POST. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: fengmk2 <fengmk2@gmail.com>
This commit is contained in:
@@ -20,6 +20,12 @@ export class SocketIoAdapter extends IoAdapter {
|
|||||||
const server: Server = super.createIOServer(port, {
|
const server: Server = super.createIOServer(port, {
|
||||||
...config,
|
...config,
|
||||||
...options,
|
...options,
|
||||||
|
// Enable CORS for Socket.IO
|
||||||
|
cors: {
|
||||||
|
origin: true, // Allow all origins
|
||||||
|
credentials: true, // Allow credentials (cookies, auth headers)
|
||||||
|
methods: ['GET', 'POST'],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (config.canActivate) {
|
if (config.canActivate) {
|
||||||
|
|||||||
Reference in New Issue
Block a user