Add map import and export with durable refresh progress

This commit is contained in:
2026-10-07 19:44:49 +05:00
parent dac8650ac1
commit 1307436e65
37 changed files with 2207 additions and 85 deletions

26
docs/map-sharing.md Normal file
View File

@@ -0,0 +1,26 @@
# Share a map with friends
The original owner can choose **Export ZIP** in their map editor or on the public
map page. The ZIP includes the saved map, selected panoramas, coordinates, and
signed original-owner attribution. Save edits before exporting. Raw world files,
server addresses, account IDs, tokens, and storage links are excluded.
On **Servers**, choose **Import** beside search, then select the exported ZIP.
Sign in first to keep the imported map in your dashboard. The ZIP limit is 256 MB.
Files upload directly to private Supabase Storage, then the deployed image
processor checks sizes, hashes, formats, and dimensions and creates the draft.
Neither Minecraft nor the terrain-rendering worker is required for these imports.
Imported maps are private and show **Owned by [original owner]**. The recipient
can play solo or host an invite-only multiplayer room after processing, with no
moderator approval. Submission, publication, and re-export of imported copies
are blocked. The original owner keeps the normal export and public review flow.
Private imported games do not contribute to the public leaderboard.
Apply `supabase/migrations/20261007145000_map_sharing.sql` before deploying.
Archive ownership signatures use a purpose-specific HMAC derived from the
server's Supabase secret key. Rotating that key invalidates ownership signatures
in older ZIPs; the original owner can export a new ZIP.
Verification: `npm test`, `npm run typecheck -- --incremental false`,
`node scripts/test-map-sharing-sql.mjs`, and `npm run build`.

View File

@@ -33,8 +33,9 @@ its contributor token, Minecraft connection address, and export settings.
The website accepts 1.21.11 and 26.1/26.2 capture manifests. The updated worker
selects and verifies vanilla models/textures for each export's version. Restart
the rendering worker on its existing host after updating these source files;
Vercel deploys only the website and JAR downloads, not that separate worker.
the terrain rendering worker on its existing host after updating these source
files. Vercel includes processing for the mod's captured PNGs; plugin terrain
rendering still runs on that separate worker host.
Verification commands:

View File

@@ -3,7 +3,16 @@
Run `npm run deploy` from the project directory. The script collects all web
source files and public assets, uploads them in one request, waits for the build,
and prints the deployment URL. It uses the [Vercel deployments API](https://vercel.com/docs/rest-api/deployments/create-a-new-deployment). The database credentials already configured in
Vercel remain there. The Minecraft rendering worker stays on its current host.
Vercel remain there. Mod captures are processed by the deployed Vercel API:
upload finalization starts background image processing with Next.js `after`,
and the authenticated dashboard resumes queued or expired jobs. The function
has a 300-second limit and uses the existing Supabase queue, Storage buckets,
retry count, and completion transaction. It processes one PNG at a time in
memory, so it needs no local capture directory or running Minecraft client.
Plugin terrain exports still require the standalone Minecraft rendering worker
on its current host. That renderer builds panoramas with Chromium and vanilla
Minecraft assets; it is separate from the deployed mod-image processor.
The script excludes Git metadata, local environment files, caches, generated
captures, tests, Java build sources, and development tools. It checks uploaded
@@ -33,5 +42,9 @@ additional Supabase credentials.
Multiplayer uses the Supabase migration described in [multiplayer.md](multiplayer.md).
Apply that migration to a new database before deploying the multiplayer web files.
Map ZIP sharing requires `20261007145000_map_sharing.sql`. Imported maps stay
private and can be played without moderation; publication is blocked. See
[map-sharing.md](map-sharing.md) for the archive format and verification.
The script targets the existing MineGeo project. Set `VERCEL_PROJECT_ID` and
`VERCEL_ORG_ID` to deploy a copy to another Vercel project.