Skip to content

Commit 08b55a5

Browse files
committed
Initial commit: add installer, icon, and script
0 parents  commit 08b55a5

File tree

4 files changed

+965
-0
lines changed

4 files changed

+965
-0
lines changed

README.md

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Browser Router
2+
3+
**Browser Router** is a custom link handler for Windows that intercepts HTTP and HTTPS links and opens them in different browsers based on user-defined rules.
4+
5+
This tool lets you define domain patterns (like `*.example.com`) and associate them with different browsers (Chrome, Firefox, Tor, etc.). When you click a link, Browser Router will open it in the appropriate browser according to your rules — or a default browser if no match is found.
6+
7+
---
8+
9+
## 🖥️ Features
10+
11+
- Pattern-based rule system (e.g. `*.github.com → Firefox`)
12+
- Set a default fallback browser
13+
- Built-in GUI for rule management
14+
- Automatically handles incoming HTTP/HTTPS links
15+
- Optional prompt to update browser path or download if not found
16+
17+
---
18+
19+
## 📦 Installation
20+
21+
You can install Browser Router by using the provided [`BrowserRouterInstaller.exe`](https://github.com/x011/browser-router/releases/latest/download/BrowserRouterInstaller.exe) installer (from GitHub Releases), or build your own.
22+
23+
The installer will:
24+
25+
- Copy all necessary files
26+
- Create a Start Menu and Desktop shortcut
27+
- Register Browser Router as a Windows browser handler
28+
29+
---
30+
31+
## 🧪 How to Set Browser Router to Handle HTTP and HTTPS Link Types (Windows 11)
32+
33+
To make **Browser Router** open web links by default, you need to set it as the handler for the `http` and `https` link types. You can do this in one of two ways:
34+
35+
### ✅ Option 1: Set by Link Type
36+
37+
1. Open **Settings > Apps > Default Apps**
38+
2. Click the **search box** under “**Set a default for a file type or link type**” (top of page)
39+
3. Type `http` and press Enter
40+
4. Click the result and choose **`Browser Router.exe`** from the list
41+
5. Repeat the same steps for `https`
42+
43+
---
44+
45+
### ✅ Option 2: Set by Application
46+
47+
1. Open **Settings > Apps > Default Apps**
48+
2. In the search bar at the top, type: `Browser Router`
49+
3. Click on **Browser Router** from the results
50+
4. Set it as the default for **HTTP** and **HTTPS**
51+
52+
---
53+
54+
📌 Once you've done either method, Browser Router will handle any link you click from other apps (email, chat, etc.).
55+
56+
---
57+
58+
## 📁 Configuration
59+
60+
When run, Browser Router stores config in:
61+
62+
```
63+
%LOCALAPPDATA%\Browser Router\browser_rules.json
64+
```
65+
66+
Inside the GUI, you can:
67+
68+
- Add/edit/delete rules
69+
- Set a default browser
70+
- Export/import rule sets
71+
- Manage custom browser paths
72+
73+
---
74+
75+
## 🧩 Example Use Case
76+
77+
| Pattern | Browser |
78+
|----------------------|------------------|
79+
| `*.github.com` | Firefox Developer |
80+
| `*.youtube.com` | Brave |
81+
| `*.onion` | Tor Browser |
82+
83+
Browser Router will open the link in the correct browser — no matter where you clicked it.
84+
85+
---
86+
87+
## ⚙️ Compile (Optional)
88+
89+
Browser Router is provided as a binary installer (if using prebuilt releases).
90+
But you can also compile it yourself and build a custom installer.
91+
92+
### Step 1: Compile the executable
93+
94+
Install **PyInstaller** if you haven’t already:
95+
96+
```bash
97+
pip install pyinstaller
98+
```
99+
100+
Then run:
101+
102+
```bash
103+
pyinstaller --onedir --noconsole --icon "path/to/browser_router.ico" browser_router.py
104+
```
105+
106+
This creates an output folder:
107+
108+
```
109+
dist/browser_router/
110+
```
111+
112+
### Step 2: Adjust the NSIS script
113+
114+
In your `.nsi` installer script, replace the file copy path:
115+
116+
```nsis
117+
File /r "dist\browser_router\*.*"
118+
```
119+
120+
Then compile the NSIS script using NSIS to generate your installer (`BrowserRouterInstaller.exe`).
121+
122+
---
123+
124+
## 🧑‍💻 Development
125+
126+
This project is written in **Python 3** using `tkinter`.
127+
128+
Dependencies:
129+
- Standard Library only
130+
- `pyinstaller` (for building the `.exe`)
131+
132+
---
133+
134+
## 📝 Notes
135+
136+
- Run the app once manually to initialize the config file
137+
- The installer is fully self-contained and portable
138+
- Works great for developers, security researchers, and browser nerds 👨‍💻🧪
139+
140+
---
141+
142+
## 📂 Project Structure (Suggested)
143+
144+
```
145+
browser_router/
146+
├── browser_router.py
147+
├── browser_router.ico
148+
├── browser_router.nsi
149+
├── README.md
150+
├── LICENSE
151+
├── dist/ # Output from PyInstaller
152+
│ └── browser_router/
153+
├── set_browser_router_http_https.reg # (optional, not required for Win11)
154+
├── unset_browser_router.reg # (optional, not required for Win11)
155+
```
156+
157+
---
158+
159+
## 📜 License
160+
161+
This project is licensed under the **GNU General Public License v3.0**
162+
🔗 [Read the full license text](https://www.gnu.org/licenses/gpl-3.0.html)
163+
164+
---
165+
166+
Made with 💚 by X011.

browser_router.ico

40.9 KB
Binary file not shown.

browser_router.nsi

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
;--------------------------------
2+
; Installer Attributes
3+
;--------------------------------
4+
Name "Browser Router"
5+
OutFile "BrowserRouterInstaller.exe"
6+
InstallDir "$PROGRAMFILES\Browser Router"
7+
InstallDirRegKey HKLM "Software\Browser Router" "Install_Dir"
8+
RequestExecutionLevel admin
9+
10+
;--------------------------------
11+
; Pages
12+
;--------------------------------
13+
Page directory
14+
Page instfiles
15+
16+
;--------------------------------
17+
; Sections
18+
;--------------------------------
19+
Section "Install"
20+
SetOutPath "$INSTDIR"
21+
22+
; Copy all files
23+
File /r "C:\Users\Tuga\Desktop\sandbox\browser_chooser_3\dist\browser_router\*.*"
24+
25+
; Create Start Menu and Desktop Shortcuts
26+
CreateDirectory "$SMPROGRAMS\Browser Router"
27+
CreateShortCut "$SMPROGRAMS\Browser Router\Browser Router.lnk" "$INSTDIR\browser_router.exe"
28+
CreateShortCut "$DESKTOP\Browser Router.lnk" "$INSTDIR\browser_router.exe"
29+
30+
; Write install location to registry
31+
WriteRegStr HKLM "Software\Browser Router" "Install_Dir" "$INSTDIR"
32+
33+
; Write Uninstaller
34+
WriteUninstaller "$INSTDIR\Uninstall.exe"
35+
36+
;--------------------------------
37+
; Register as a browser in Windows
38+
;--------------------------------
39+
; Root: HKCU (per-user install)
40+
WriteRegStr HKCU "Software\Clients\StartMenuInternet\BrowserRouter" "" "Browser Router"
41+
42+
WriteRegStr HKCU "Software\Clients\StartMenuInternet\BrowserRouter\Capabilities" "ApplicationDescription" "Custom Browser Router"
43+
WriteRegStr HKCU "Software\Clients\StartMenuInternet\BrowserRouter\Capabilities" "ApplicationName" "Browser Router"
44+
45+
WriteRegStr HKCU "Software\Clients\StartMenuInternet\BrowserRouter\Capabilities\URLAssociations" "http" "BrowserRouterURL"
46+
WriteRegStr HKCU "Software\Clients\StartMenuInternet\BrowserRouter\Capabilities\URLAssociations" "https" "BrowserRouterURL"
47+
48+
WriteRegStr HKCU "Software\RegisteredApplications" "Browser Router" "Software\\Clients\\StartMenuInternet\\BrowserRouter\\Capabilities"
49+
50+
WriteRegStr HKCR "BrowserRouterURL" "" "Browser Router URL"
51+
WriteRegStr HKCR "BrowserRouterURL" "URL Protocol" ""
52+
WriteRegDWORD HKCR "BrowserRouterURL" "EditFlags" 2
53+
54+
WriteRegStr HKCR "BrowserRouterURL\shell\open\command" "" '"$INSTDIR\browser_router.exe" "%1"'
55+
56+
; Optional: set as default handler for http/https
57+
WriteRegStr HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "Progid" "BrowserRouterURL"
58+
WriteRegStr HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" "Progid" "BrowserRouterURL"
59+
60+
SectionEnd
61+
62+
;--------------------------------
63+
; Uninstall Section
64+
;--------------------------------
65+
Section "Uninstall"
66+
; Remove Uninstaller
67+
Delete "$INSTDIR\Uninstall.exe"
68+
69+
; Remove Shortcuts
70+
Delete "$SMPROGRAMS\Browser Router\Browser Router.lnk"
71+
RMDir "$SMPROGRAMS\Browser Router"
72+
Delete "$DESKTOP\Browser Router.lnk"
73+
74+
; Remove InstallDir registry value
75+
DeleteRegKey HKLM "Software\Browser Router"
76+
77+
; Unregister browser
78+
DeleteRegKey HKCU "Software\Clients\StartMenuInternet\BrowserRouter"
79+
DeleteRegValue HKCU "Software\RegisteredApplications" "Browser Router"
80+
DeleteRegKey HKCR "BrowserRouterURL"
81+
DeleteRegKey HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice"
82+
DeleteRegKey HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice"
83+
84+
; Schedule self-delete of install directory with delay (via batch file)
85+
; Create a temporary batch file to force-delete the entire installation directory.
86+
SetOutPath "$TEMP"
87+
ClearErrors
88+
FileOpen $1 "$TEMP\del_install_dir.bat" "w"
89+
IfErrors 0 +3
90+
MessageBox MB_OK "Could not create temporary batch file."
91+
Goto done
92+
FileWrite $1 '@echo off$\r$\n'
93+
FileWrite $1 'ping 127.0.0.1 -n 5 > nul$\r$\n'
94+
FileWrite $1 'rd /s /q "$INSTDIR"$\r$\n'
95+
FileWrite $1 'del "%~f0"$\r$\n'
96+
FileClose $1
97+
Exec '"$TEMP\del_install_dir.bat"'
98+
99+
done:
100+
SectionEnd
101+

0 commit comments

Comments
 (0)