From 1a321336b423af5a0e710708d67c19e938d8e799 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 30 Sep 2026 17:31:24 +0000 Subject: [PATCH] Fix achievement icons in launcher, allow opening OAuth URLs, live map docs - Shared achievement icon catalogue; launcher resolves icon/background/border ids - Tauri opener capability now allows http(s) URLs (fixes Discord sign-in) - Rewrite live map docs, admin guide progression section Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01DjMbLQujBHunCCu5GpsHaT --- .env.example | 4 + docs/admin-guide.md | 14 +++ docs/live-map.md | 99 +++++++++------ launcher/src-tauri/capabilities/default.json | 10 +- .../src/components/AchievementIcon.svelte | 34 +++++ .../src/components/PlayerProfileModal.svelte | 14 +-- launcher/src/lib/achievementIcons.ts | 116 ++++++++++++++++++ launcher/src/lib/mock.ts | 2 +- launcher/src/pages/Quests.svelte | 5 +- panel/server/src/livemap.rs | 29 ++++- panel/server/src/progression.rs | 67 +++++++--- panel/server/src/routes/livemap.rs | 40 +++++- panel/server/src/routes/progression.rs | 34 +++-- panel/server/tests/livemap.rs | 3 +- panel/server/tests/progression.rs | 8 +- panel/web/src/lib/achievementIcons.ts | 116 ++++++++++++++++++ panel/web/src/pages/AchievementEditor.svelte | 67 ++-------- 17 files changed, 511 insertions(+), 151 deletions(-) create mode 100644 launcher/src/components/AchievementIcon.svelte create mode 100644 launcher/src/lib/achievementIcons.ts create mode 100644 panel/web/src/lib/achievementIcons.ts diff --git a/.env.example b/.env.example index 10165ea..38002c7 100644 --- a/.env.example +++ b/.env.example @@ -10,3 +10,7 @@ RUST_LOG=info PUBLIC_URL= # Comma-separated IPs of your reverse proxies; blank means forwarded IP headers are ignored. SCOPENET_TRUSTED_PROXIES= + +# Live Map: optional static Vantage Linux release to bundle, and memory for the panel. +VANTAGE_URL= +PANEL_MEMORY=256M diff --git a/docs/admin-guide.md b/docs/admin-guide.md index 6dd386c..1765e98 100644 --- a/docs/admin-guide.md +++ b/docs/admin-guide.md @@ -83,3 +83,17 @@ Everything on this page is pushed to launchers when they start or refresh — no See the README's *Build your branded launcher*. Players get updates automatically: the launcher checks GitHub Releases on start and offers the new installer. **Code signing:** unsigned installers trigger a Windows SmartScreen warning ("More info → Run anyway"). To avoid it, sign the installer with a code-signing certificate (e.g. Azure Trusted Signing) — Tauri supports this via `bundle.windows.signCommand`. + +## Progression (quests, XP, levels) + +**Progression** in the sidebar controls how players advance: + +* **Quest limits** – how many daily and weekly quests each player is given (0 = every + enabled quest), and whether everyone draws their own set or shares one. Pin quests + on the Quests page to always include them. A player's set is stored when they first + open their quests for the period, so edits never swap out quests they've started. +* **XP & levels** – the level curve (`round(base × L^exponent)`, optional max level), + XP per playtime hour / kill / block / message, and panel-wide multipliers that stack + with each server's own. Saving a new curve recalculates stored levels; nobody loses XP. +* **Players** – search a player, then give, take, set or reset XP (global or per + server) or set their level. Changes are recorded in the Activity log with your reason. diff --git a/docs/live-map.md b/docs/live-map.md index 59198e8..e250020 100644 --- a/docs/live-map.md +++ b/docs/live-map.md @@ -1,44 +1,71 @@ -# Vantage live map +# Live Map (central Vantage) -SCOPENET can display a [Vantage](https://github.com/thoughts-on-things/vantage-mc) -world in the launcher's **Guilds & Claims → Territory** view. The map shows -live terrain, optional player positions, SCOPENET guild names, and the claim -outline for each nearby chunk. Clicking terrain selects the chunk; the Claim -and Unclaim buttons use the existing authenticated SCOPENET API. Claim -protection on the game server is unchanged. +The panel hosts a [Vantage](https://github.com/thoughts-on-things/vantage-mc) 3D map +**for every game server**, so nobody has to run Vantage next to Minecraft. -## Set up the world map +``` +Minecraft server ──(SCOPENET plugin/mod)──► Admin panel ──► Launcher "Live Map" button + chunks + players HTTPS / WebSocket mirror + Vantage Vantage viewer in-app +``` -1. Install a Vantage release on the machine that can read the Minecraft world - files. Give it read access to the save, and a separate writable cache. -2. Start a live render for that world. For example: +1. **Collect** – the SCOPENET Paper plugin / Fabric / Forge mod reads the world's + region files (only chunks newer than what the panel already has) and sends them to + the panel over HTTPS. Player positions stream over a WebSocket (HTTPS fallback). +2. **Store & render** – the panel keeps a region-file mirror per server under + `/livemap//world` and runs a `vantage server` sidecar over it on + demand (stopped again after 15 idle minutes). Sidecars listen on loopback only. +3. **Serve** – `GET /api/livemap///v1/worlds/default/…` proxies the + sidecar to signed-in launcher/admin sessions. Player markers come straight from + memory. One map per server and dimension (`overworld`, `the_nether`, `the_end`). +4. **View** – the launcher checks `GET /api/v1/servers//livemap`; when Live Map is + on for a server linked to the instance, the instance page shows a **Live Map** + button that opens the map inside the launcher (and the Guilds territory view uses + it too). Admins see the same map on *Servers → your server*. - ```sh - vantage live /srv/minecraft/world --out /var/cache/vantage/world --host 127.0.0.1 --port 8268 - ``` +Chunk data only reaches the panel when the game server has written it, so the map +follows autosaves (and `/save-all`) rather than every block change. -3. Put Vantage behind an HTTPS reverse proxy, or have your portal proxy its - map files. The launcher's **Vantage live map manifest URL** is the complete - `manifest.json` URL, such as `https://maps.example.com/manifest.json`. - A pre-rendered multi-dimension world can use `world.json` instead. In the - panel, open **Servers → your server → Edit** and save that URL. -4. Link the game server to the correct launcher instance. Open that instance's - Guilds & Claims page in the launcher. The selected game server controls both - the Vantage world and the SCOPENET claims shown on it. +## Turn it on -The native launcher streams map assets through its HTTP client so the map host -does not need browser CORS headers. Browser-only development previews require -CORS on the map host. The URL is included in the public game-server summary; -use a map you intend players to see. Keep Vantage `server` bearer credentials -out of this URL. For private worlds, put Vantage behind a session-gated proxy -that serves the manifest and tile files with the player's existing session. -Vantage's [server guide](https://github.com/thoughts-on-things/vantage-mc/blob/main/docs/server.md) -describes the sidecar and its authorization boundary. +1. **Servers → your server → Settings → Live Map** (on by default for new servers). +2. Update the plugin/mod. `livemap.enabled: true` (Paper `config.yml`) or + `livemap.enabled=true` (`config/scopenet.properties`) is the default; set it to + `false` to keep a server off the map locally. +3. The server page shows a checklist: generator, assets, world data, player positions. -Live terrain comes from Vantage's read-only view of saved world files. Claims -and guild names come from SCOPENET's claim database. If the map cannot be -loaded, the launcher falls back to the chunk grid. The map does not run inside -Minecraft; `/guild map` is still the Paper plugin's nearby chat radar. +## Panel requirements -Vantage's web package is MIT licensed. See its -[license](https://github.com/thoughts-on-things/vantage-mc/blob/main/LICENSE). +Rendering needs two things on the machine running the panel: + +| Setting | Meaning | +| --- | --- | +| `SCOPENET_VANTAGE_BIN` | The `vantage` executable (default: `vantage` on `PATH`, then `/opt/vantage/vantage`). | +| `SCOPENET_VANTAGE_ASSETS` | Minecraft client assets directory passed as `--assets` (default `/livemap/assets`). | +| `SCOPENET_VANTAGE_ARGS` | Optional extra `vantage server` flags, e.g. `--radius 2048 --memory 1024`. | + +With Docker, either mount your binary at `/opt/vantage/vantage` and the assets at +`/data/livemap/assets`, or bake a static Linux release in with +`VANTAGE_URL= docker compose build`. Until both exist the panel still +stores what servers send and launchers show "the map is being prepared". +Give the container more than the default 256 MB if Live Map is on (`PANEL_MEMORY`). + +## Security + +* Game servers authenticate with their existing `sn_…` token; the endpoints refuse + servers whose Live Map switch is off. +* Viewers must be signed in; the launcher attaches its session token natively, so it + never reaches page scripts. Anyone with an account can view a server's map — use + the server's access rules and leave Live Map off for private worlds. +* The sidecar gets a random per-process bearer token and never leaves loopback. + +## Ingest API (for reference) + +All under `/api/server/v1/livemap/` with `Authorization: Bearer `: +`GET config`, `GET manifest?dim=`, `POST chunks?dim=` (binary records of +`i32 x, i32 z, u32 timestamp, u8 compression, u32 length, bytes`), `POST level` +(`level.dat`), `POST players`, `GET ws` (WebSocket: JSON `players` frames). + +## External Vantage (advanced) + +Under *Use an external Vantage map instead* you can still point a server at a +`manifest.json` / `world.json` you host yourself. It is only used when Live Map is off. diff --git a/launcher/src-tauri/capabilities/default.json b/launcher/src-tauri/capabilities/default.json index 79318e5..4f2e82c 100644 --- a/launcher/src-tauri/capabilities/default.json +++ b/launcher/src-tauri/capabilities/default.json @@ -15,6 +15,14 @@ "core:window:allow-start-dragging", "core:window:allow-is-maximized", "dialog:allow-open", - "opener:allow-open-url" + { + "identifier": "opener:allow-open-url", + "allow": [ + { "url": "https://*" }, + { "url": "https://*/**" }, + { "url": "http://*" }, + { "url": "http://*/**" } + ] + } ] } diff --git a/launcher/src/components/AchievementIcon.svelte b/launcher/src/components/AchievementIcon.svelte new file mode 100644 index 0000000..7b0fb62 --- /dev/null +++ b/launcher/src/components/AchievementIcon.svelte @@ -0,0 +1,34 @@ + + + + + diff --git a/launcher/src/components/PlayerProfileModal.svelte b/launcher/src/components/PlayerProfileModal.svelte index 7073232..455d0b6 100644 --- a/launcher/src/components/PlayerProfileModal.svelte +++ b/launcher/src/components/PlayerProfileModal.svelte @@ -1,4 +1,5 @@