From e59415bc55fa4b95752537c651a96fb6ec964fc7 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Fri, 11 Dec 2020 21:15:19 -0600 Subject: [PATCH] Allow TW to use cloud variables --- index.html | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 8cd38a5..3b02147 100644 --- a/index.html +++ b/index.html @@ -390,6 +390,17 @@ along with this program. If not, see . preview: false }; + const getProjectId = () => { + if (O.project.source !== 'id') { + return ''; + } + const match = O.project.id.match(/\d+/); + if (!match) { + return ''; + } + return match[0]; + }; + const loadProject = async () => { if (O.project.source === 'file') { if (!O.project.file) { @@ -398,11 +409,8 @@ along with this program. If not, see . // File is a Blob return new Packager.Project(O.project.file, await SBDownloader.identifyProjectType(O.project.file)); } else if (O.project.source === 'id') { - const match = O.project.id.match(/\d+/); - if (!match) { - throw new Error('Invalid project ID'); - } - const project = await SBDownloader.download(match[0], { + const projectId = getProjectId(); + const project = await SBDownloader.download(projectId, { progressTarget }); return new Packager.Project(await project.asBlob(), project.type); @@ -413,6 +421,7 @@ along with this program. If not, see . const getRuntime = async (projectType) => { switch (O.runtime.name) { case 'turbowarp': return new Packager.runtimes.TurboWarp({ + projectId: getProjectId(), compilerOptions: O.turbowarp.compilerOptions, framerate: O.turbowarp.framerate, highQualityPen: O.turbowarp.highQualityPen,