From 1921dc190e24e646d15fdcf117f5d64937c0aea2 Mon Sep 17 00:00:00 2001 From: cybe42 Date: Sun, 17 May 2026 04:39:48 +0100 Subject: [PATCH 1/2] Add support for both Beta and Nightly Skips missing versions to avoid crashes and alerts the user if neither is installed. --- unlock.ts | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/unlock.ts b/unlock.ts index 91d41b3..ee36fc8 100644 --- a/unlock.ts +++ b/unlock.ts @@ -1,22 +1,34 @@ const localAppData = Deno.env.get("LOCALAPPDATA"); -const localStatePath = - `${localAppData}\\BraveSoftware\\Brave-Origin-Beta\\User Data\\Local State`; +const versions = ["Brave-Origin-Beta", "Brave-Origin-Nightly"]; +let foundAny = false; -const localState = JSON.parse(await Deno.readTextFile(localStatePath)); +for (const version of versions) { + const localStatePath = localAppData + "\\BraveSoftware\\" + version + "\\User Data\\Local State"; -localState.brave.origin = { purchase_validated: true }; + try { + const localState = JSON.parse(await Deno.readTextFile(localStatePath)); -localState.skus = { - state: { - "67": JSON.stringify({ - credentials: { - items: { "6": "7" }, + localState.brave.origin = { purchase_validated: true }; + + localState.skus = { + state: { + "67": JSON.stringify({ + credentials: { + items: { "6": "7" }, + }, + }), }, - }), - }, -}; + }; -await Deno.writeTextFile(localStatePath, JSON.stringify(localState)); + await Deno.writeTextFile(localStatePath, JSON.stringify(localState)); -console.log("Brave Origin Beta unlocked successfully!"); + console.log(version.replace(/-/g, " ") + " unlocked successfully!"); + foundAny = true; + } catch { + } +} + +if (!foundAny) { + console.log("Brave Origin not found."); +} From 888690ac123dee81b3f3ef6c7e724b4523fe35bb Mon Sep 17 00:00:00 2001 From: ObjectAscended <93239187+ObjectAscended@users.noreply.github.com> Date: Sat, 16 May 2026 21:04:55 -0700 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- unlock.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unlock.ts b/unlock.ts index ee36fc8..b875fec 100644 --- a/unlock.ts +++ b/unlock.ts @@ -25,7 +25,12 @@ for (const version of versions) { console.log(version.replace(/-/g, " ") + " unlocked successfully!"); foundAny = true; - } catch { + } catch (error) { + if (error instanceof Deno.errors.NotFound) { + continue; + } + + throw error; } }