Skip to content

Commit 2a569e6

Browse files
committed
Fix Simple 3D "Open sample project" button
1 parent 00be351 commit 2a569e6

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src-main/windows/editor.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -615,15 +615,23 @@ class EditorWindow extends ProjectRunningWindow {
615615
}
616616

617617
handleWindowOpen (details) {
618+
const url = new URL(details.url);
619+
const params = new URLSearchParams(url.search);
620+
618621
// Open extension sample projects in-app
619-
const extensionSamplesMatch = details.url.match(
620-
/^tw-editor:\/\/\.\/gui\/editor\?project_url=(https:\/\/extensions\.turbowarp\.org\/samples\/.+\.sb3)$/
621-
);
622-
if (extensionSamplesMatch) {
623-
EditorWindow.openFiles([extensionSamplesMatch[1]], false, '');
624-
return {
625-
action: 'deny'
626-
};
622+
if (
623+
url.protocol === 'tw-editor:' &&
624+
url.host === '.' &&
625+
params.has('project_url')
626+
) {
627+
const projectUrl = params.get('project_url');
628+
const parsedFile = parseOpenedFile(projectUrl, null);
629+
if (parsedFile.type === TYPE_SAMPLE) {
630+
new EditorWindow(parsedFile, null);
631+
return {
632+
action: 'deny'
633+
};
634+
}
627635
}
628636

629637
// Open extension documentation in-app

0 commit comments

Comments
 (0)