mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 02:21:51 +08:00
feat: only follow serverUrlPrefix at redirect to client (#5295)
This commit is contained in:
+3
-1
@@ -140,7 +140,9 @@ export const AffineSharePage = (props: ShareMenuProps) => {
|
|||||||
lineHeight: '20px',
|
lineHeight: '20px',
|
||||||
}}
|
}}
|
||||||
value={
|
value={
|
||||||
isSharedPage ? sharingUrl : `${runtimeConfig.serverUrlPrefix}/...`
|
isSharedPage
|
||||||
|
? sharingUrl
|
||||||
|
: `${location.protocol}//${location.hostname}/...`
|
||||||
}
|
}
|
||||||
readOnly
|
readOnly
|
||||||
/>
|
/>
|
||||||
|
|||||||
+4
-1
@@ -19,8 +19,11 @@ export const generateUrl = ({
|
|||||||
// to generate a public url like https://affine.app/share/123/456
|
// to generate a public url like https://affine.app/share/123/456
|
||||||
// or https://affine.app/share/123/456?mode=edgeless
|
// or https://affine.app/share/123/456?mode=edgeless
|
||||||
|
|
||||||
|
const { protocol, hostname, port } = window.location;
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`${runtimeConfig.serverUrlPrefix}/${urlType}/${workspaceId}/${pageId}`
|
`${protocol}//${hostname}${
|
||||||
|
port ? `:${port}` : ''
|
||||||
|
}/${urlType}/${workspaceId}/${pageId}`
|
||||||
);
|
);
|
||||||
return url.toString();
|
return url.toString();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ export async function downloadBinaryFromCloud(
|
|||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
const response = await fetchWithTraceReport(
|
const response = await fetchWithTraceReport(
|
||||||
runtimeConfig.serverUrlPrefix +
|
`/api/workspaces/${rootGuid}/docs/${pageGuid}`,
|
||||||
`/api/workspaces/${rootGuid}/docs/${pageGuid}`,
|
|
||||||
{
|
{
|
||||||
priority: 'high',
|
priority: 'high',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ import useSWRMutation from 'swr/mutation';
|
|||||||
|
|
||||||
setupGlobal();
|
setupGlobal();
|
||||||
|
|
||||||
export const fetcher = gqlFetcherFactory(
|
export const fetcher = gqlFetcherFactory('/graphql');
|
||||||
runtimeConfig.serverUrlPrefix + '/graphql'
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A `useSWR` wrapper for sending graphql queries
|
* A `useSWR` wrapper for sending graphql queries
|
||||||
|
|||||||
@@ -20,15 +20,13 @@ export const createAffineCloudBlobStorage = (
|
|||||||
? key
|
? key
|
||||||
: `/api/workspaces/${workspaceId}/blobs/${key}`;
|
: `/api/workspaces/${workspaceId}/blobs/${key}`;
|
||||||
|
|
||||||
return fetchWithTraceReport(runtimeConfig.serverUrlPrefix + suffix).then(
|
return fetchWithTraceReport(suffix).then(async res => {
|
||||||
async res => {
|
if (!res.ok) {
|
||||||
if (!res.ok) {
|
// status not in the range 200-299
|
||||||
// status not in the range 200-299
|
return undefined;
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
return await res.blob();
|
|
||||||
}
|
}
|
||||||
);
|
return await res.blob();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
set: async (key, value) => {
|
set: async (key, value) => {
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export function getIoManager(): Manager {
|
|||||||
if (ioManager) {
|
if (ioManager) {
|
||||||
return ioManager;
|
return ioManager;
|
||||||
}
|
}
|
||||||
ioManager = new Manager(runtimeConfig.serverUrlPrefix + '/', {
|
ioManager = new Manager('/', {
|
||||||
autoConnect: false,
|
autoConnect: false,
|
||||||
transports: ['websocket'],
|
transports: ['websocket'],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user