Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: prefix url (#1361)

Himself6576a83fd60bfb
diff --git a/apps/web/src/atoms/public-workspace/index.ts b/apps/web/src/atoms/public-workspace/index.ts
index adffc93d29..b7032955fd 100644
--- a/apps/web/src/atoms/public-workspace/index.ts
+++ b/apps/web/src/atoms/public-workspace/index.ts
@@ -12,9 +12,16 @@ export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
throw new Error('No workspace id');
}
const binary = await apis.downloadWorkspace(workspaceId, true);
+ // fixme: this is a hack
+ const params = new URLSearchParams(window.location.search);
+ const prefixUrl = params.get('prefixUrl')
+ ? (params.get('prefixUrl') as string)
+ : '/';
const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
workspaceId,
- (_: string) => undefined
+ (k: string) =>
+ // fixme: token could be expired
+ ({ api: `${prefixUrl}api/workspace`, token: apis.auth.token }[k])
);
BlockSuiteWorkspace.Y.applyUpdate(
blockSuiteWorkspace.doc,