93 lines
5.3 KiB
Markdown
93 lines
5.3 KiB
Markdown
# Fractured Launcher (Electron)
|
||
|
||
Windows launcher with **no extra console window**, **native Browse folder** dialog, GitHub **release assets** + repo file sync, **realmlist**, optional **auth**, **Play**, and **auto-update** (via `electron-updater`). This is the **only** supported client launcher in this repo.
|
||
|
||
## Requirements
|
||
|
||
- [Node.js](https://nodejs.org/) 20+ (includes npm)
|
||
|
||
## Run from source
|
||
|
||
```bash
|
||
cd tools/fractured-launcher-electron
|
||
npm install
|
||
npm start
|
||
```
|
||
|
||
On first run, `launcher.json` is created next to the app (dev: in this folder). By default **`github.repo`** is **`Fractured-Distro`** (public release assets); no token is required for patches. Set **GITHUB_TOKEN** only if you override `github` to a **private** repo.
|
||
|
||
## Build Windows installers
|
||
|
||
```bash
|
||
npm install
|
||
npm run pack:win
|
||
```
|
||
|
||
Produces under **`dist/`**:
|
||
|
||
| Artifact | Purpose |
|
||
|----------|---------|
|
||
| `Fractured-Launcher-${version}-Setup.exe` (NSIS) | **Recommended for players** — supports seamless **auto-update** and restart. |
|
||
| `Fractured-Launcher-${version}-Windows-Portable.exe` | No installer; players replace the file manually. Auto-update is **less reliable** than NSIS. |
|
||
|
||
## Auto-update behaviour
|
||
|
||
- **Packaged** builds only (`npm run pack:win` output). In `npm start` dev mode, update checks are skipped (button still explains that).
|
||
- **~5 seconds** after launch, then **every 6 hours**, the app checks for a newer version.
|
||
- When a download finishes, a dialog offers **Restart now** (calls `quitAndInstall`) or **Later**.
|
||
- **Manual check:** button **Check launcher updates** in the UI.
|
||
|
||
### Where updates are hosted
|
||
|
||
**`package.json`** → `build.publish` targets **`Dawnforger/Fractured-Distro`** (public). `electron-updater` reads **`latest.yml`** from the **latest** release there; players do not need a GitHub token for launcher updates.
|
||
|
||
**Private GitHub** (if you change `build.publish` or `github` back to a private repo): set **`GH_TOKEN`** / **`GITHUB_TOKEN`** / **`github.token_env`** before starting the launcher so the updater can authenticate.
|
||
|
||
**Public generic feed** (optional CDN): set **`update_feed_url`** or **`LAUNCHER_UPDATE_URL`** to a folder that hosts `latest.yml` + installers; optional Bearer token if the host requires it.
|
||
|
||
### Publishing a new launcher version
|
||
|
||
1. Bump **`version`** in `package.json` (semver, e.g. `1.0.1`).
|
||
2. Create a **GitHub personal access token** with `repo` (or `public_repo` for public repos).
|
||
3. From this directory:
|
||
|
||
```bash
|
||
set GH_TOKEN=ghp_your_token_here
|
||
npm run publish:win
|
||
```
|
||
|
||
That builds NSIS + portable and **uploads** update metadata and installers to the configured GitHub repo’s **releases** (see [electron-builder publish](https://www.electron.build/configuration/publish)).
|
||
|
||
Players on an older NSIS install will pick up the next version automatically on the next check.
|
||
|
||
## Public distro repo (patches + launcher binaries)
|
||
|
||
Default **`default-launcher.json`** uses **`github.repo`: `Fractured-Distro`** so **`from_release`** assets (`patch-Z.MPQ`, `Wow-patched.exe`, …) download from **[Dawnforger/Fractured-Distro releases](https://github.com/Dawnforger/Fractured-Distro/releases)** — **no player token**.
|
||
|
||
Publish assets there by:
|
||
|
||
- **GitHub Actions** — workflow **Sync release to Fractured-Distro** (`.github/workflows/distro-release-sync.yml`): on **release published** on `Dawnforger/Fractured`, it **builds the Electron launcher** from that tag on Windows (`npm run pack:win`), **downloads every asset** attached to that release (patches, `Wow-patched.exe`, …), merges them (launcher files overwrite on duplicate names), and creates or updates the **same tag** on **`Fractured-Distro`**. Requires repository secret **`DISTRO_SYNC_TOKEN`**. **Manual:** Actions → run workflow with an existing tag.
|
||
- **Locally:** `scripts/publish-to-distro.sh` (see script header) if you need to upload without a full release cycle.
|
||
|
||
If your public repo slug is not `Fractured-Distro`, edit **`DISTRO_REPO`** in the workflow / script and **`github.repo`** in `launcher.json`.
|
||
|
||
### Private `github.repo` (optional)
|
||
|
||
For a **private** release source, set `GITHUB_TOKEN` (or `github.token_env`) with read access — **do not** embed a shared PAT in shipped `launcher.json` for all players.
|
||
|
||
**Release asset names** must match **`files[].source`** exactly when **`from_release`**: true. Use **`release_tag`: `"latest"`** for the newest release, or pin a tag.
|
||
|
||
## CI
|
||
|
||
Workflow **Fractured launcher CI** (`.github/workflows/fractured-launcher-ci.yml`) runs on pushes/PRs under `tools/fractured-launcher-electron/`: Windows **`npm run pack:win`** and **artifacts** (`*.exe`, `latest.yml`, blockmaps). **Actions → Fractured launcher CI → Run workflow** runs it manually.
|
||
|
||
## Config
|
||
|
||
Schema is defined by **`default-launcher.json`** (shipped in the app; first run copies to `launcher.json` beside the executable):
|
||
|
||
- **`game_dir`**: WoW 3.3.5a root (contains `Wow.exe`).
|
||
- **`update_feed_url`**: optional generic HTTPS base for launcher auto-update (overrides default GitHub feed when set).
|
||
- **`github`**: `owner`, `repo`, `ref` (repo file paths), **`release_tag`** (`latest` or e.g. `v1.0.0`), **`token_env`** (env var name for a PAT when using private sources).
|
||
- **`files`**: `source`, `dest`, `backup`, **`from_release`** (asset name on GitHub release vs repo path).
|
||
- **`realmlist`**, **`auth`**, **`launch`**.
|