Repository navigation
Repair the Copy URL shortcut for Brave Origin profiles #10308
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
6 commits
Select commit
Hold shift + click to select a range
230fcd3
Repair the Copy URL shortcut for Brave Origin profiles
dhh 232feb2
Merge quattro, keeping the Copy URL migration test
omarchybot 4c4f346
Rerun the Copy URL repair on Brave Origin's roots alone
omarchybot 2ba11a4
Renumber the Brave Origin Copy URL rerun after quattro's migrations
ryanrhughes 84c2f54
Leave Brave Origin's roots to the rerun alone
ryanrhughes 4fa9615
Cut the Copy URL migration test down to the Brave Origin rerun
ryanrhughes 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,15 @@ | ||
| echo "Repair the Copy URL shortcut for Brave Origin profiles" | ||
|
|
||
| # The repair in 1786643346 walked every Chromium-family profile root except | ||
| # Brave Origin's, which Omarchy has installed since before the extension id | ||
| # was pinned. Those profiles still bind Alt+Shift+L to a ghost id. | ||
| # | ||
| # Rerun it on Brave Origin's roots alone: every profile it already repaired | ||
| # kept a backup it reads as a repair still to verify, and would ask for that | ||
| # browser to be closed again. | ||
| profile_roots=( | ||
| "$HOME/.config/BraveSoftware/Brave-Origin" | ||
| "$HOME/.config/BraveSoftware/Brave-Origin-Beta" | ||
| "$HOME/.config/BraveSoftware/Brave-Origin-Nightly" | ||
| ) | ||
| source "$OMARCHY_PATH/migrations/1786643346.sh" |
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,43 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| source "$(dirname "${BASH_SOURCE[0]}")/base-test.sh" | ||
|
|
||
| require_command jq | ||
| require_command python3 | ||
|
|
||
| test_dir=$(mktemp -d) | ||
| trap 'rm -rf "$test_dir"' EXIT | ||
|
|
||
| home="$test_dir/home" | ||
| stub_bin="$test_dir/bin" | ||
| mkdir -p "$stub_bin" | ||
| # Any browser prompt fails the run, so a pass also proves nobody was asked. | ||
| printf '#!/bin/bash\nexit 1\n' >"$stub_bin/gum" | ||
| chmod +x "$stub_bin/gum" | ||
|
|
||
| ghost_id="ikkebdkaanlebnifjnbeiaklodhbjcci" | ||
| pinned_id="bgpiichlckmfanooecilcjemknkcpngb" | ||
|
|
||
| run_rerun() { | ||
| HOME="$home" PATH="$stub_bin:$PATH" OMARCHY_PATH="$ROOT" bash -euo pipefail "$ROOT/migrations/1792474908.sh" >/dev/null 2>&1 | ||
| } | ||
|
|
||
| # The first repair skipped Brave Origin, so its ghost binding is still there. | ||
| brave_origin="$home/.config/BraveSoftware/Brave-Origin/Default/Preferences" | ||
| mkdir -p "$(dirname "$brave_origin")" | ||
| jq -n --arg ghost "$ghost_id" '{extensions: {commands: {"linux:Alt+Shift+L": {command_name: "copy-url", extension: $ghost}}, settings: {}}}' >"$brave_origin" | ||
|
|
||
| # A profile the first repair fixed keeps its backup, which that repair reads as | ||
| # still to verify; with the browser open the rerun must not ask again. | ||
| chromium="$home/.config/chromium/Default/Preferences" | ||
| mkdir -p "$(dirname "$chromium")" | ||
| jq -n --arg pinned "$pinned_id" '{extensions: {commands: {"linux:Alt+Shift+L": {command_name: "copy-url", extension: $pinned}}, settings: {}}}' >"$chromium" | ||
| cp "$chromium" "$chromium.omarchy-copy-url-repair.bak" | ||
| ln -sfn "test-host-1234" "$home/.config/chromium/SingletonLock" | ||
|
|
||
| run_rerun || fail "Brave Origin rerun completes without prompting for profiles the first repair fixed" | ||
| jq -e --arg pinned "$pinned_id" '.extensions.commands["linux:Alt+Shift+L"].extension == $pinned' "$brave_origin" >/dev/null || | ||
| fail "Brave Origin rerun rebinds the Copy URL shortcut to the pinned id" | ||
| pass "Brave Origin rerun repairs Brave Origin and leaves already-repaired profiles alone" | ||
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.
The shortened test runs the new migration only once against a stale Brave Origin shortcut. It no longer checks a second run or an existing user-chosen shortcut, as
docs/testing.mdasks for migrations still being written. Add those cases for the Brave Origin rerun so changes that rewrite repaired profiles or replace custom bindings do not pass unnoticed.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!