diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f5516d8 Binary files /dev/null and b/.DS_Store differ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7773828 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..e1533c2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "deno.enable": true, + "deno.lint": true +} diff --git a/README.md b/README.md index 8ae22d2..bbba01d 100644 --- a/README.md +++ b/README.md @@ -1,58 +1,62 @@ -# Brave Origin Windows Unlocker +# Brave Origin Unlocker -A TypeScript utility for unlocking Brave Origin features on Windows by modifying -the local application state. +A TypeScript utility for unlocking Brave Origin features on Windows and macOS by modifying the local application state. ## Overview -This tool modifies the Brave Origin browser's local state configuration to -unlock premium features. It works by updating the `Local State` JSON file used -by Brave to store user preferences and license validation status. +This tool modifies the Brave Origin browser's local state configuration to unlock premium features. It works by updating the `Local State` JSON file used by Brave to store user preferences and license validation status. ## Features - ✅ Unlocks Brave Origin features - ✅ Modifies purchase validation state - ✅ Updates SKU credentials -- ✅ Windows-compatible local data path handling +- ✅ Windows and macOS path compatibility +- ✅ Easy execution via Deno tasks ## Requirements - **Deno** - Modern JavaScript/TypeScript runtime -- **Windows OS** - Designed for Windows file paths +- **Windows OS or macOS** - Supported operating systems - **Brave Origin** - The browser being modified -- **File Write Permissions** - Access to `%LOCALAPPDATA%` directory +- **File Write Permissions** - Access to browser configurations ## Installation -1. Install [Deno](https://deno.land/) if you haven't already +1. Install [Deno](https://deno.land/) if you haven't already. 2. Clone this repository: ```bash git clone https://github.com/ObjectAscended/brave-origin-windows-unlocker.git cd brave-origin-windows-unlocker ``` +## How to Run 🚀 + +You can run the unlocker directly using the pre-configured Deno tasks: + +### For Windows 🪟 +```bash +deno task unlock-win +``` + +### For macOS 🍎 +```bash +deno task unlock-mac +``` + +--- + ## Pre-Bundled Deno Binaries 🎉 -In our latest releases, we offer **pre-bundled Deno binaries** that make running -the Windows unlocker easier than ever! 🚀 You can download them from our -[latest release page](https://github.com/ObjectAscended/brave-origin-windows-unlocker/releases/latest). -These binaries ensure a smooth setup and save you time, so you can focus on -enjoying your experience without unnecessary hassle! 🕒 +In our latest releases, we offer **pre-bundled Deno binaries** that make running the unlocker easier than ever! 🚀 You can download them from our [latest release page](https://github.com/ObjectAscended/brave-origin-windows-unlocker/releases/latest). These binaries ensure a smooth setup and save you time. -## Why Run the Windows Unlocker Instead of WSL? 🤔 +## Why Run the Unlocker Natively? 🤔 -Running the Windows unlocker natively is typically a better choice than running -a browser inside WSL. Here's why: +Running the unlocker natively is typically a better choice than running a browser inside virtual/emulated environments. Here's why: -1. **Performance**: The native Windows experience generally offers better - performance than emulated environments like WSL. ⚡ -2. **Simplicity**: You avoid complex setups and configurations, making it more - straightforward for users of all levels. 🛠️ -3. **Compatibility**: Some features and functionalities might only work - seamlessly in a Windows environment, ensuring you get the most out of your - tools. 🔗 -4. **User Experience**: Enjoy a more intuitive interface and fewer problems - managing dependencies. 😊 +1. **Performance**: The native experience generally offers better performance than emulated environments. ⚡ +2. **Simplicity**: You avoid complex setups and configurations, making it more straightforward for users of all levels. 🛠️ +3. **Compatibility**: Some features and functionalities might only work seamlessly in a native environment, ensuring you get the most out of your tools. 🔗 +4. **User Experience**: Enjoy a more intuitive interface and fewer problems managing dependencies. 😊 Enjoy using our tool! 🎈 diff --git a/deno.json b/deno.json new file mode 100644 index 0000000..ce23f61 --- /dev/null +++ b/deno.json @@ -0,0 +1,8 @@ +{ + "tasks": { + "unlock-win": "deno run --allow-env --allow-read --allow-write unlock.ts", + "unlock-mac": "deno run --allow-env --allow-read --allow-write unlock-mac.ts", + "compile-win": "deno compile --allow-env --allow-read --allow-write --output dist/unlock-win.exe unlock.ts", + "compile-mac": "deno compile --allow-env --allow-read --allow-write --output dist/unlock-mac unlock-mac.ts" + } +} \ No newline at end of file diff --git a/unlock-mac.ts b/unlock-mac.ts new file mode 100644 index 0000000..2aa6735 --- /dev/null +++ b/unlock-mac.ts @@ -0,0 +1,37 @@ +const homeDir = Deno.env.get("HOME"); +const versions = ["Brave-Origin", "Brave-Origin-Beta", "Brave-Origin-Nightly"]; +let foundAny = false; + +for (const version of versions) { + const localStatePath = `${homeDir}/Library/Application Support/BraveSoftware/${version}/Local State`; + + try { + const localState = JSON.parse(await Deno.readTextFile(localStatePath)); + + localState.brave = localState.brave || {}; + 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 (error) { + if (error instanceof Deno.errors.NotFound) { + continue; + } + throw error; + } +} + +if (!foundAny) { + console.log("Brave Origin not found."); +} \ No newline at end of file