Skip to content

Commit

Permalink
Fix Simple 3D "Open sample project" button
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Dec 24, 2024
1 parent 00be351 commit 2a569e6
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src-main/windows/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,15 +615,23 @@ class EditorWindow extends ProjectRunningWindow {
}

handleWindowOpen (details) {
const url = new URL(details.url);
const params = new URLSearchParams(url.search);

// Open extension sample projects in-app
const extensionSamplesMatch = details.url.match(
/^tw-editor:\/\/\.\/gui\/editor\?project_url=(https:\/\/extensions\.turbowarp\.org\/samples\/.+\.sb3)$/
);
if (extensionSamplesMatch) {
EditorWindow.openFiles([extensionSamplesMatch[1]], false, '');
return {
action: 'deny'
};
if (
url.protocol === 'tw-editor:' &&
url.host === '.' &&
params.has('project_url')
) {
const projectUrl = params.get('project_url');
const parsedFile = parseOpenedFile(projectUrl, null);
if (parsedFile.type === TYPE_SAMPLE) {
new EditorWindow(parsedFile, null);
return {
action: 'deny'
};
}
}

// Open extension documentation in-app
Expand Down

0 comments on commit 2a569e6

Please sign in to comment.