From 76bfc512d5cdd6ec06fcf77c82e00b7b3506218e Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Wed, 11 Jun 2025 08:21:00 +0200 Subject: [PATCH 1/3] feat: Allow Console UI as Access-Control-Allow-Origin for WASM in CDN --- src/services/functions/publish.services.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/functions/publish.services.ts b/src/services/functions/publish.services.ts index 3511d548..75f0989d 100644 --- a/src/services/functions/publish.services.ts +++ b/src/services/functions/publish.services.ts @@ -1,4 +1,4 @@ -import {isNullish} from '@dfinity/utils'; +import {isNullish, nonNullish} from '@dfinity/utils'; import {uploadAssetWithProposal} from '@junobuild/cdn'; import { type DeployResultWithProposal, @@ -18,6 +18,7 @@ import {readWasmFileMetadata} from '../../utils/wasm.utils'; import {assertSatelliteMemorySize} from '../assets/deploy/deploy.assert.services'; import {type UploadFileFnParamsWithProposal} from '../assets/deploy/deploy.execute.services'; import {clearProposalStagedAssets} from '../changes/changes.clear.services'; +import {ENV} from '../../env'; export const publish = async (args?: string[]) => { const {satellite} = await assertConfigAndLoadSatelliteContext(); @@ -108,7 +109,10 @@ const publishWasmWithProposal = async ({ // @ts-expect-error type incompatibility NodeJS vs bundle data, fullPath: storagePath ?? fullPath, - headers, + headers: [ + ...headers, + ["Access-Control-Allow-Origin", ENV.console.urls.root] + ], token: crypto.randomUUID(), description: `change=${proposalId};version=${version}` } From b0715024a6c2b67fbb544c820f8ddbf1e606ca82 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Wed, 11 Jun 2025 08:21:21 +0200 Subject: [PATCH 2/3] chore: fmt --- src/services/functions/publish.services.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/services/functions/publish.services.ts b/src/services/functions/publish.services.ts index 75f0989d..55756596 100644 --- a/src/services/functions/publish.services.ts +++ b/src/services/functions/publish.services.ts @@ -1,4 +1,4 @@ -import {isNullish, nonNullish} from '@dfinity/utils'; +import {isNullish} from '@dfinity/utils'; import {uploadAssetWithProposal} from '@junobuild/cdn'; import { type DeployResultWithProposal, @@ -12,13 +12,13 @@ import {red} from 'kleur'; import {dirname} from 'node:path'; import {SATELLITE_OUTPUT} from '../../constants/dev.constants'; import {CDN_RELEASES_FULL_PATH} from '../../constants/functions.constants'; +import {ENV} from '../../env'; import type {SatelliteParametersWithId} from '../../types/satellite'; import {assertConfigAndLoadSatelliteContext} from '../../utils/satellite.utils'; import {readWasmFileMetadata} from '../../utils/wasm.utils'; import {assertSatelliteMemorySize} from '../assets/deploy/deploy.assert.services'; import {type UploadFileFnParamsWithProposal} from '../assets/deploy/deploy.execute.services'; import {clearProposalStagedAssets} from '../changes/changes.clear.services'; -import {ENV} from '../../env'; export const publish = async (args?: string[]) => { const {satellite} = await assertConfigAndLoadSatelliteContext(); @@ -109,10 +109,7 @@ const publishWasmWithProposal = async ({ // @ts-expect-error type incompatibility NodeJS vs bundle data, fullPath: storagePath ?? fullPath, - headers: [ - ...headers, - ["Access-Control-Allow-Origin", ENV.console.urls.root] - ], + headers: [...headers, ['Access-Control-Allow-Origin', ENV.console.urls.root]], token: crypto.randomUUID(), description: `change=${proposalId};version=${version}` } From 987d9c95788a24b1f1d804083ad192bd385f176f Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Wed, 11 Jun 2025 08:26:35 +0200 Subject: [PATCH 3/3] feat: add options to help --- src/help/functions.publish.help.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/help/functions.publish.help.ts b/src/help/functions.publish.help.ts index ef26f3c3..cc0f7e47 100644 --- a/src/help/functions.publish.help.ts +++ b/src/help/functions.publish.help.ts @@ -4,7 +4,8 @@ import { NOTE_KEEP_STAGED, OPTION_HELP, OPTION_KEEP_STAGED, - OPTION_SRC + OPTION_SRC, + OPTIONS_HELP } from '../constants/help.constants'; import {helpOutput} from './common.help'; import {TITLE} from './help'; @@ -15,6 +16,7 @@ Options: ${yellow('--no-apply')} Submit the release as a change but do not apply it yet. ${OPTION_KEEP_STAGED} ${OPTION_SRC} + ${OPTIONS_HELP} ${OPTION_HELP} Notes: