-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Speed up recipe loading from deeplinks and various fixes #3662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
260c7cc
add new unregister deeplink script for testing deeplinks easier
zanesq 64a859c
improve recipe storage loading by parallelizing
zanesq d0b6ec1
improve recipe loading from deeplink to run in app background while c…
zanesq 7c8201b
remove default fallback state for recipe splash not needed
zanesq 9fd693b
improve recipe loading from deeplink to run in app background while c…
zanesq c6c8ac3
added dedicated textarea for message: activities so multiline markdow…
zanesq d251d8a
added scrolling and markdown rendering for content in recipe warning …
zanesq 81b3131
rename splash to RecipeActivities and render messages in markdown
zanesq f87b7bb
Merge branch 'main' of github.com:block/goose into zane/fix-recipe-re…
zanesq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /** | ||
| * Script to unregister ALL goose:// protocol handlers | ||
| * Usage: node scripts/unregister-deeplink-protocols.js | ||
| */ | ||
|
|
||
| const { execSync } = require('child_process'); | ||
|
|
||
| const PROTOCOL = 'goose'; | ||
|
|
||
| function unregisterAllProtocolHandlers() { | ||
| console.log('Unregistering ALL goose:// protocol handlers...'); | ||
|
|
||
| try { | ||
| // Get all registered Goose apps | ||
| console.log('Finding all registered Goose applications...'); | ||
| const lsregisterOutput = execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep -B 10 -A 10 "claimed schemes:.*${PROTOCOL}:"`, { encoding: 'utf8' }); | ||
|
|
||
| // Extract app paths from the output | ||
| const pathMatches = lsregisterOutput.match(/path:\s+(.+\.app)/g); | ||
| const uniquePaths = new Set(); | ||
|
|
||
| if (pathMatches) { | ||
| pathMatches.forEach(match => { | ||
| const path = match.replace(/path:\s+/, '').trim(); | ||
| if (path.includes('Goose') || path.includes('goose')) { | ||
| uniquePaths.add(path); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| console.log(`Found ${uniquePaths.size} Goose app(s) to unregister:`); | ||
| uniquePaths.forEach(path => console.log(` - ${path}`)); | ||
|
|
||
| // Unregister each app | ||
| let unregisteredCount = 0; | ||
| uniquePaths.forEach(appPath => { | ||
| try { | ||
| console.log(`Unregistering: ${appPath}`); | ||
| execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u "${appPath}"`, { stdio: 'ignore' }); | ||
|
||
| unregisteredCount++; | ||
| } catch (error) { | ||
| console.log(` Warning: Could not unregister ${appPath} (may already be unregistered)`); | ||
| } | ||
| }); | ||
|
|
||
| // Also try to unregister by bundle identifier | ||
| console.log('\nUnregistering by bundle identifier...'); | ||
| const bundleIds = [ | ||
| 'com.electron.goose', | ||
| 'com.block.goose', | ||
| 'com.block.goose.dev' | ||
| ]; | ||
|
|
||
| bundleIds.forEach(bundleId => { | ||
| try { | ||
| console.log(`Unregistering bundle: ${bundleId}`); | ||
| execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -u "${bundleId}"`, { stdio: 'ignore' }); | ||
|
||
| } catch (error) { | ||
| // Ignore errors for bundle IDs that don't exist | ||
| } | ||
| }); | ||
|
|
||
| // Clean up temporary files | ||
| console.log('\nCleaning up temporary files...'); | ||
| try { | ||
| execSync('rm -rf /tmp/GooseDevApp.app', { stdio: 'ignore' }); | ||
| } catch (error) { | ||
| // Ignore cleanup errors | ||
| } | ||
|
|
||
| // Force Launch Services to rebuild its database | ||
| console.log('Rebuilding Launch Services database...'); | ||
| try { | ||
| execSync('/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user', { stdio: 'ignore' }); | ||
| } catch (error) { | ||
| console.log('Warning: Could not rebuild Launch Services database'); | ||
| } | ||
|
|
||
| console.log(`\n✅ Successfully processed ${unregisteredCount} Goose applications`); | ||
| console.log('All goose:// protocol handlers have been unregistered.'); | ||
| console.log('\nNote: You may need to restart your system for changes to take full effect.'); | ||
|
|
||
| } catch (error) { | ||
| console.error('Error during unregistration:', error.message); | ||
| console.log('\nManual cleanup options:'); | ||
| console.log('1. Use Activity Monitor to quit all Goose processes'); | ||
| console.log('2. Delete Goose apps from Applications folder'); | ||
| console.log('3. Run: sudo /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user'); | ||
| } | ||
| } | ||
|
|
||
| // Run the unregistration immediately | ||
| unregisterAllProtocolHandlers(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like it will only work on mac...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup comment at top says only mac for now