mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 13:38:49 +08:00
fix(core): canvas font loading in desktop (#6025)
This commit is contained in:
@@ -88,6 +88,7 @@ jobs:
|
|||||||
BUILD_TYPE: ${{ github.event.inputs.flavor }}
|
BUILD_TYPE: ${{ github.event.inputs.flavor }}
|
||||||
SHOULD_REPORT_TRACE: false
|
SHOULD_REPORT_TRACE: false
|
||||||
PUBLIC_PATH: '/'
|
PUBLIC_PATH: '/'
|
||||||
|
SELF_HOSTED: true
|
||||||
- name: Download selfhost fonts
|
- name: Download selfhost fonts
|
||||||
run: node ./scripts/download-blocksuite-fonts.mjs
|
run: node ./scripts/download-blocksuite-fonts.mjs
|
||||||
- name: Upload core artifact
|
- name: Upload core artifact
|
||||||
|
|||||||
Vendored
+1
@@ -45,6 +45,7 @@ export const runtimeFlagsSchema = z.object({
|
|||||||
z.literal('internal'),
|
z.literal('internal'),
|
||||||
z.literal('canary'),
|
z.literal('canary'),
|
||||||
]),
|
]),
|
||||||
|
isSelfHosted: z.boolean().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type BlockSuiteFeatureFlags = z.infer<typeof blockSuiteFeatureFlags>;
|
export type BlockSuiteFeatureFlags = z.infer<typeof blockSuiteFeatureFlags>;
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
|||||||
: buildFlags.mode === 'development'
|
: buildFlags.mode === 'development'
|
||||||
? true
|
? true
|
||||||
: currentBuildPreset.allowLocalWorkspace,
|
: currentBuildPreset.allowLocalWorkspace,
|
||||||
|
isSelfHosted: process.env.SELF_HOSTED === 'true',
|
||||||
};
|
};
|
||||||
|
|
||||||
const testEnvironmentPreset = {
|
const testEnvironmentPreset = {
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ class CustomAttachmentService extends AttachmentService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function customLoadFonts(service: RootService): void {
|
function customLoadFonts(service: RootService): void {
|
||||||
const officialDomains = new Set(['app.affine.pro', 'affine.fail']);
|
if (runtimeConfig.isSelfHosted) {
|
||||||
if (!officialDomains.has(window.location.host)) {
|
|
||||||
const fonts = CanvasTextFonts.map(font => ({
|
const fonts = CanvasTextFonts.map(font => ({
|
||||||
...font,
|
...font,
|
||||||
// self-hosted fonts are served from /assets
|
// self-hosted fonts are served from /assets
|
||||||
|
|||||||
Reference in New Issue
Block a user