fix: ws prefix url in electron (#1896)

This commit is contained in:
Peng Xiao
2023-04-12 22:11:47 +08:00
committed by GitHub
parent 25d7f7c848
commit 95aa86cdf0
17 changed files with 237 additions and 261 deletions

View File

@@ -1,3 +1,4 @@
import { websocketPrefixUrl } from '@affine/env';
import { KeckProvider } from '@affine/workspace/affine/keck';
import { getLoginStorage } from '@affine/workspace/affine/login';
import type { AffineWebSocketProvider } from '@affine/workspace/type';
@@ -19,11 +20,8 @@ const createAffineWebSocketProvider = (
webSocketProvider = null;
},
connect: () => {
const wsUrl = `${
window.location.protocol === 'https:' ? 'wss' : 'ws'
}://${window.location.host}/api/sync/`;
webSocketProvider = new KeckProvider(
wsUrl,
websocketPrefixUrl + '/api/sync/',
blockSuiteWorkspace.id,
blockSuiteWorkspace.doc,
{