You've already forked brave-origin-unlocker
mirror of
https://github.com/ObjectAscended/brave-origin-unlocker.git
synced 2026-06-21 12:42:34 +00:00
1921dc190e
Skips missing versions to avoid crashes and alerts the user if neither is installed.
35 lines
839 B
TypeScript
35 lines
839 B
TypeScript
const localAppData = Deno.env.get("LOCALAPPDATA");
|
|
|
|
const versions = ["Brave-Origin-Beta", "Brave-Origin-Nightly"];
|
|
let foundAny = false;
|
|
|
|
for (const version of versions) {
|
|
const localStatePath = localAppData + "\\BraveSoftware\\" + version + "\\User Data\\Local State";
|
|
|
|
try {
|
|
const localState = JSON.parse(await Deno.readTextFile(localStatePath));
|
|
|
|
localState.brave.origin = { purchase_validated: true };
|
|
|
|
localState.skus = {
|
|
state: {
|
|
"67": JSON.stringify({
|
|
credentials: {
|
|
items: { "6": "7" },
|
|
},
|
|
}),
|
|
},
|
|
};
|
|
|
|
await Deno.writeTextFile(localStatePath, JSON.stringify(localState));
|
|
|
|
console.log(version.replace(/-/g, " ") + " unlocked successfully!");
|
|
foundAny = true;
|
|
} catch {
|
|
}
|
|
}
|
|
|
|
if (!foundAny) {
|
|
console.log("Brave Origin not found.");
|
|
}
|