Skip to content

Commit 7ea5c18

Browse files
authored
Merge pull request #24 from GCWing/gcwing/dev
feat: add BitFun-Installer module
2 parents 34d35b5 + afed0d8 commit 7ea5c18

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+10522
-0
lines changed

BitFun-Installer/.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules/
2+
dist/
3+
.DS_Store
4+
5+
src-tauri/target/
6+
src-tauri/payload/
7+
src-tauri/*.log
8+
9+
*.log
10+
npm-debug.log*
11+
yarn-debug.log*
12+
pnpm-debug.log*

BitFun-Installer/README.md

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# BitFun Installer
2+
3+
A fully custom, branded installer for BitFun — built with **Tauri 2 + React** for maximum UI flexibility.
4+
5+
## Why a Custom Installer?
6+
7+
Instead of relying on the generic NSIS wizard UI from Tauri's built-in bundler, this project provides:
8+
9+
- **100% custom UI** — React-based, with smooth animations, dark theme, and brand consistency
10+
- **Modern experience** — Similar to Discord, Figma, and VS Code installers
11+
- **Full control** — Custom installation logic, right-click context menu, PATH integration
12+
- **Cross-platform potential** — Same codebase can target Windows, macOS, and Linux
13+
14+
## Architecture
15+
16+
```
17+
BitFun-Installer/
18+
├── src-tauri/ # Tauri / Rust backend
19+
│ ├── src/
20+
│ │ ├── main.rs # Entry point
21+
│ │ ├── lib.rs # Tauri app setup
22+
│ │ └── installer/
23+
│ │ ├── commands.rs # Tauri IPC commands
24+
│ │ ├── extract.rs # Archive extraction
25+
│ │ ├── registry.rs # Windows registry (uninstall, context menu, PATH)
26+
│ │ ├── shortcut.rs # Desktop & Start Menu shortcuts
27+
│ │ └── types.rs # Shared types
28+
│ ├── capabilities/
29+
│ ├── icons/
30+
│ ├── Cargo.toml
31+
│ └── tauri.conf.json
32+
├── src/ # React frontend
33+
│ ├── pages/
34+
│ │ ├── LanguageSelect.tsx # First screen language picker
35+
│ │ ├── Options.tsx # Path picker + install options
36+
│ │ ├── Progress.tsx # Install progress + confirm
37+
│ │ ├── ModelSetup.tsx # Optional model provider setup
38+
│ │ └── ThemeSetup.tsx # Theme preview + finish
39+
│ ├── components/
40+
│ │ ├── WindowControls.tsx # Custom titlebar
41+
│ │ ├── Checkbox.tsx # Styled checkbox
42+
│ │ └── ProgressBar.tsx # Animated progress bar
43+
│ ├── hooks/
44+
│ │ └── useInstaller.ts # Core installer state machine
45+
│ ├── styles/
46+
│ │ ├── global.css # Base styles
47+
│ │ ├── variables.css # Design tokens
48+
│ │ └── animations.css # Keyframe animations
49+
│ ├── types/
50+
│ │ └── installer.ts # TypeScript types
51+
│ ├── App.tsx
52+
│ └── main.tsx
53+
├── scripts/
54+
│ └── build-installer.cjs # End-to-end build script
55+
├── index.html
56+
├── package.json
57+
├── vite.config.ts
58+
└── tsconfig.json
59+
```
60+
61+
## Installation Flow
62+
63+
```
64+
Language Select → Options → Progress → Model Setup → Theme Setup
65+
│ │ │ │ │
66+
choose UI path + run real optional AI save theme,
67+
language options install model config launch/close
68+
```
69+
70+
## Development
71+
72+
### Prerequisites
73+
74+
- Node.js 18+
75+
- Rust (latest stable)
76+
- pnpm (or npm)
77+
78+
### Setup
79+
80+
```bash
81+
cd BitFun-Installer
82+
npm install
83+
```
84+
85+
### Repository Hygiene
86+
87+
Keep generated artifacts out of commits. This project ignores:
88+
89+
- `node_modules/`
90+
- `dist/`
91+
- `src-tauri/target/`
92+
- `src-tauri/payload/`
93+
94+
### Dev Mode
95+
96+
Run the installer in development mode with hot reload:
97+
98+
```bash
99+
npm run tauri:dev
100+
```
101+
102+
### Uninstall Mode (Dev + Runtime)
103+
104+
Key behavior:
105+
106+
- Install phase creates `uninstall.exe` in the install directory.
107+
- Windows uninstall registry entry points to:
108+
`"<installPath>\\uninstall.exe" --uninstall "<installPath>"`.
109+
- Launching with `--uninstall` opens the dedicated uninstall UI flow.
110+
111+
Local debug command:
112+
113+
```bash
114+
npx tauri dev -- -- --uninstall "D:\\tmp\\bitfun-uninstall-test"
115+
```
116+
117+
Core implementation:
118+
119+
- Launch arg parsing + uninstall execution: `src-tauri/src/installer/commands.rs`
120+
- Uninstall registry command: `src-tauri/src/installer/registry.rs`
121+
- Uninstall UI page: `src/pages/Uninstall.tsx`
122+
- Frontend mode switching/state: `src/hooks/useInstaller.ts`
123+
124+
### Build
125+
126+
Build the complete installer (builds main app first):
127+
128+
```bash
129+
node scripts/build-installer.cjs
130+
```
131+
132+
Build installer only (skip main app build):
133+
134+
```bash
135+
node scripts/build-installer.cjs --skip-app-build
136+
```
137+
138+
### Output
139+
140+
The built installer will be at:
141+
142+
```
143+
src-tauri/target/release/bundle/nsis/BitFun-Installer_x.x.x_x64-setup.exe
144+
```
145+
146+
## Customization Guide
147+
148+
### Changing the UI Theme
149+
150+
Edit `src/styles/variables.css` — all colors, spacing, and animations are controlled by CSS custom properties.
151+
152+
### Adding Install Steps
153+
154+
1. Add a new step key to `InstallStep` type in `src/types/installer.ts`
155+
2. Create a new page component in `src/pages/`
156+
3. Add the step to the `STEPS` array in `src/hooks/useInstaller.ts`
157+
4. Add the page render case in `src/App.tsx`
158+
159+
### Modifying Install Logic
160+
161+
- **File extraction**`src-tauri/src/installer/extract.rs`
162+
- **Registry operations**`src-tauri/src/installer/registry.rs`
163+
- **Shortcuts**`src-tauri/src/installer/shortcut.rs`
164+
- **Tauri commands**`src-tauri/src/installer/commands.rs`
165+
166+
### Adding Installer Payload
167+
168+
Place the built BitFun application files in `src-tauri/payload/` before building the installer. The build script handles this automatically.
169+
170+
## Integration with CI/CD
171+
172+
Add to your GitHub Actions workflow:
173+
174+
```yaml
175+
- name: Build Installer
176+
run: |
177+
cd BitFun-Installer
178+
npm install
179+
node scripts/build-installer.cjs --skip-app-build
180+
181+
- name: Upload Installer
182+
uses: actions/upload-artifact@v4
183+
with:
184+
name: BitFun-Setup
185+
path: BitFun-Installer/src-tauri/target/release/bundle/nsis/*.exe
186+
```

BitFun-Installer/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Install BitFun</title>
7+
<style>
8+
/* Prevent flash of white during load */
9+
html, body { background: transparent; margin: 0; padding: 0; }
10+
</style>
11+
</head>
12+
<body>
13+
<div id="root"></div>
14+
<script type="module" src="/src/main.tsx"></script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)