Skip to content

Commit

Permalink
fix(core): canvas font loading in desktop (#6025)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon authored Mar 6, 2024
1 parent 0ff1e8d commit 5d63ca0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
BUILD_TYPE: ${{ github.event.inputs.flavor }}
SHOULD_REPORT_TRACE: false
PUBLIC_PATH: '/'
SELF_HOSTED: true
- name: Download selfhost fonts
run: node ./scripts/download-blocksuite-fonts.mjs
- name: Upload core artifact
Expand Down
1 change: 1 addition & 0 deletions packages/common/env/src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const runtimeFlagsSchema = z.object({
z.literal('internal'),
z.literal('canary'),
]),
isSelfHosted: z.boolean().optional(),
});

export type BlockSuiteFeatureFlags = z.infer<typeof blockSuiteFeatureFlags>;
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/core/.webpack/runtime-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
: buildFlags.mode === 'development'
? true
: currentBuildPreset.allowLocalWorkspace,
isSelfHosted: process.env.SELF_HOSTED === 'true',
};

const testEnvironmentPreset = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class CustomAttachmentService extends AttachmentService {
}

function customLoadFonts(service: RootService): void {
const officialDomains = new Set(['app.affine.pro', 'affine.fail']);
if (!officialDomains.has(window.location.host)) {
if (runtimeConfig.isSelfHosted) {
const fonts = CanvasTextFonts.map(font => ({
...font,
// self-hosted fonts are served from /assets
Expand Down

0 comments on commit 5d63ca0

Please sign in to comment.