Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/editor-api/external-types/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,6 @@ export type LaunchConfig = {
oneTrustDomainKey: string,
schema: ModelSchema,
engineVersions: EngineVersions,
wasmModules?: WasmModule[]
wasmModules?: WasmModule[],
signedUrls?: Record<string, string>
};
13 changes: 12 additions & 1 deletion src/launch/assets/assets-sync.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Observer } from '@playcanvas/observer';

import { ObserverSync } from '@/common/observer-sync';
import type { LaunchConfig } from '@/editor-api/external-types/config';

editor.once('load', () => {
const app = editor.call('viewport:app');
if (!app) {
return;
} // webgl not available

const launchConfig = config as LaunchConfig;
const settings = editor.call('settings:project');
const docs: Record<string, { unsubscribe: () => void; destroy: () => void }> = { };

Expand Down Expand Up @@ -94,13 +96,22 @@ editor.once('load', () => {
if (assetData.file) {
if (concatenateScripts && assetData.type === 'script' && assetData.file.filename.endsWith('.js') && assetData.preload && !assetData.data.loadingType) {
assetData.file.url = concatenatedScriptsUrl;
} else if (launchConfig.signedUrls && launchConfig.signedUrls[assetData.id]) {
assetData.file.url = launchConfig.signedUrls[assetData.id];
delete assetData.file.hash;
} else {
assetData.file.url = getFileUrl(assetData.path, assetData.id, assetData.revision, assetData.file.filename);
}

if (assetData.file.variants) {
for (key in assetData.file.variants) {
assetData.file.variants[key].url = getFileUrl(assetData.path, assetData.id, assetData.revision, assetData.file.variants[key].filename);
const variantSignedKey = `${assetData.id}:${key}`;
if (launchConfig.signedUrls && launchConfig.signedUrls[variantSignedKey]) {
assetData.file.variants[key].url = launchConfig.signedUrls[variantSignedKey];
delete assetData.file.variants[key].hash;
} else {
assetData.file.variants[key].url = getFileUrl(assetData.path, assetData.id, assetData.revision, assetData.file.variants[key].filename);
}
}
}
}
Expand Down