Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# ProvinceSystem
# TFMCWeb

> TF-Minecraft's web home for maps, characters, and custom creations.

ProvinceSystem powers the TFMC website and its connected world services. It brings together the interactive map, character creation, skin submissions, custom drinks, and player guides.
TFMCWeb powers the TFMC website and its connected world services. It brings together the interactive map, character creation, skin submissions, custom drinks, and player guides.

It connects the Minecraft world with a browser experience: players can explore the political landscape, manage character details, and work on creations that return to the game through the companion plugins.

Expand All @@ -23,11 +23,11 @@ It connects the Minecraft world with a browser experience: players can explore t

## Documentation

[Project documentation](https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/README.md)
[Project documentation](https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/README.md)

Technical documentation is maintained in [TF-Minecraft/Docs](https://github.com/TF-Minecraft/Docs).

[Previews and deployment](https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/DEPLOY.md)
[Previews and deployment](https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/DEPLOY.md)

## Tests

Expand Down
2 changes: 1 addition & 1 deletion backend/src/characters/wardrobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def resolve_skin_model(png_bytes: bytes, override: str | None) -> str:


def _backend_root() -> Path:
# .../ProvinceSystem/backend/src/characters/wardrobe.py → backend/
# .../TFMCWeb/backend/src/characters/wardrobe.py → backend/
return Path(__file__).resolve().parents[2]


Expand Down
2 changes: 1 addition & 1 deletion backend/src/coreprotect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Read-only CoreProtect activity, session, and movement data for the staff panel.

[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/integrations/coreprotect.md)
[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/integrations/coreprotect.md)

Technical documentation is maintained in [TF-Minecraft/Docs](https://github.com/TF-Minecraft/Docs).
2 changes: 1 addition & 1 deletion backend/src/luckperms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Permission snapshots and queued staff changes through the TFMCWeb bridge.

[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/integrations/luckperms.md)
[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/integrations/luckperms.md)

Technical documentation is maintained in [TF-Minecraft/Docs](https://github.com/TF-Minecraft/Docs).
2 changes: 1 addition & 1 deletion backend/src/patchnotes/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"Research": "Research",
"SimpleFactions": "SimpleFactions",
"TFMCCore": "TFMCCore",
"TFMCWeb": "TFMCWeb",
"TFMCWeb": "TFMCWebBridge",
"TLibs": "TLibs",
"Thievery": "Thievery",
"TrialRooms": "TrialRooms",
Expand Down
2 changes: 1 addition & 1 deletion backend/src/patreon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Supporter linking, entitlement decisions, and delivery to Discord and Minecraft.

[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/integrations/patreon-backend.md)
[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/integrations/patreon-backend.md)

Technical documentation is maintained in [TF-Minecraft/Docs](https://github.com/TF-Minecraft/Docs).
2 changes: 1 addition & 1 deletion backend/src/rail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Read-only VehicleFramework track data for the staff map.

[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/integrations/rail.md)
[Configuration and technical reference](https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/integrations/rail.md)

Technical documentation is maintained in [TF-Minecraft/Docs](https://github.com/TF-Minecraft/Docs).
4 changes: 2 additions & 2 deletions backend/src/servers/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _plugin_state(jars: list[Jar], latest: Release, by_hash: dict[str, Release],

def plugin_identifier(name: str | None) -> str:
lowered = (name or "").lower()
return {"activity": "activitytf", "geiger_counter": "geigercounters"}.get(lowered, lowered)
return {"activity": "activitytf", "geiger_counter": "geigercounters", "tfmcweb": "tfmcwebbridge"}.get(lowered, lowered)


def _match(jar: Jar, by_hash: dict[str, Release], prefixes: list[tuple[str, str]]) -> str | None:
Expand All @@ -590,7 +590,7 @@ def _match(jar: Jar, by_hash: dict[str, Release], prefixes: list[tuple[str, str]
matched = next((repo for prefix, repo in prefixes if lowered.startswith(prefix + "-")), None)
if matched:
return matched
# Stable Bukkit identifiers differ from repository names for these two plugins.
# Stable Bukkit identifiers differ from repository names for these plugins.
name = plugin_identifier(jar.name)
return next((repo for _, repo in prefixes if repo.lower() == name), None)

Expand Down
12 changes: 12 additions & 0 deletions backend/src/servers/test_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
from src.servers import inventory


def test_bridge_repository_matches_unchanged_runtime_name():
latest = inventory.Release("TFMCWebBridge", "1.0", "2026-10-17", "", "tfmcweb-1.0.jar", "published")
jar = inventory.Jar("custom-test.jar", "unpublished", "TFMCWeb", "DEV", False)
plugins, others = inventory.compare(
{"TFMCWebBridge": [latest]},
{"dev": {"jars": [jar], "startup": None, "releases_only": False}},
)
assert others == []
assert plugins[0]["servers"]["dev"]["state"] == "test_build"
assert plugins[0]["servers"]["dev"]["files"] == ["custom-test.jar"]


def make_jar(folder, file, name, version, extra=b""):
folder.mkdir(parents=True, exist_ok=True)
path = folder / file
Expand Down
29 changes: 29 additions & 0 deletions backend/tests/test_compose_projects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Host project selection stays stable when deploying an older checkout."""
import json
import os
from pathlib import Path
import subprocess

import pytest


@pytest.mark.parametrize("target,project,checkout", [
("main", "tfmcweb-production", "ProvinceSystem"),
("dev", "tfmcweb-staging", "tfmc-staging"),
])
def test_host_wrapper_pins_project_independently_of_checkout(tmp_path, target, project, checkout):
source = Path(__file__).resolve().parents[2] / "scripts" / "ps-compose.sh"
script = tmp_path / "ps-compose"
script.write_text(source.read_text().replace("/home/tfmc", str(tmp_path)))
(tmp_path / checkout).mkdir()
site = "www" if target == "main" else target
overlay = tmp_path / f".site-images-{site}.json"
overlay.write_text("{}")
docker = tmp_path / "docker"
docker.write_text('#!/usr/bin/env python3\nimport json,sys\nprint(json.dumps(sys.argv[1:]))\n')
docker.chmod(0o755)
result = subprocess.run(["bash", str(script), target, "ps"], check=True, capture_output=True,
text=True, env={**os.environ, "PATH": f"{tmp_path}:{os.environ['PATH']}"})
args = json.loads(result.stdout)
assert args[:5] == ["compose", "--project-name", project, "--project-directory", str(tmp_path / checkout)]
assert args[-3:] == ["-f", str(overlay), "ps"]
2 changes: 1 addition & 1 deletion discord/minecraftban/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Same machine as AMP + ProvinceSystem stack (recommended):
# api_base_url: "http://127.0.0.1:8000"
# staff_key: "dev-staff-key"
# See TF-Minecraft/Docs: projects/ProvinceSystem/docs/integrations/discord-bot.md.
# See TF-Minecraft/Docs: projects/TFMCWeb/docs/integrations/discord-bot.md.

api_base_url: "http://127.0.0.1:8000"
staff_key: "dev-staff-key"
Expand Down
2 changes: 1 addition & 1 deletion discord/precedent/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Same machine as AMP + staging stack (recommended):
# api_base_url: "http://127.0.0.1:18001"
# staff_key: "dev-staff-key"
# See TF-Minecraft/Docs: projects/ProvinceSystem/docs/integrations/discord-bot.md
# See TF-Minecraft/Docs: projects/TFMCWeb/docs/integrations/discord-bot.md

api_base_url: "http://127.0.0.1:18001"
staff_key: "dev-staff-key"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tfmc-staging
name: tfmcweb-staging

services:
backend:
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: tfmcweb-production

services:
backend:
# Reaps the renderer's Chromium processes.
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/wiki/data/dowsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { M, T, V } from "./helpers";
import type { Recipe, WikiSection } from "./types";

// Source: plugins/Dowsing (config.yml, blocks.yml, types.yml, slots.yml, production_methods.yml),
// ItemsAdder ia_tfmc/contents/nodes.yml, and https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/wiki-research/a2-gems-dowsing-archaeo.md.
// ItemsAdder ia_tfmc/contents/nodes.yml, and https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/wiki-research/a2-gems-dowsing-archaeo.md.

const planks = { name: "Oak Planks", qty: 1, texture: V("oak_planks.png") };

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/wiki/data/gem-infusion.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { WikiCommandSet, WikiSection } from "./types";
// Source: https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/wiki-research/a2-gems-dowsing-archaeo.md, section 1.
// Source: https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/wiki-research/a2-gems-dowsing-archaeo.md, section 1.
export const gemRarities = {
columns: ["Rarity", "Display", "Weight", "Broadcast"],
rows: [
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/wiki/data/magic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Recipe, WikiCommandSet, WikiSection } from "./types";

// ---------- Magic (elements, shrines, spell runes, attunement) ----------
//
// Sources: https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/wiki-research/a-magic-knowledge.md section 1 (live Magic/*.yml,
// Sources: https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/wiki-research/a-magic-knowledge.md section 1 (live Magic/*.yml,
// MMOItems rune/charge definitions, the jar's plugin.yml). No source repository
// exists for the Magic plugin, so everything here is config-derived.

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/wiki/data/materials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const serverCraftedMaterials: CatalogMaterial[] = [

// Historical export name retained for the station recipe generator's catalogue scan.
// Gathered/loot materials may also have unpacking recipes. Acquisition evidence:
// https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/wiki-research/material-acquisition.md (cloned server config + local drop implementation).
// https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/wiki-research/material-acquisition.md (cloned server config + local drop implementation).
export const dropOnlyMaterials: DropOnlyMaterial[] = [
{
name: "Enchanted Dust",
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/wiki/data/thievery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CommandRow, WikiCommandSet, WikiSection } from "./types";

// ---------- Thievery ----------
//
// Sourced from https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/wiki-research/e-adventure.md, "Thievery" section.
// Sourced from https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/wiki-research/e-adventure.md, "Thievery" section.
// Jar: thievery-1.0.0.jar. No `permissions:` block exists in plugin.yml, so
// every command below is open to a normal player except where noted.

Expand Down
2 changes: 1 addition & 1 deletion frontend/app/wiki/data/vehicles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { constructionStations } from "./vehicle-construction";
import { T, V } from "./helpers";
import modelCatalogue from "../../../public/wiki/models/vehicles/catalogue.json";

// Source: https://github.com/TF-Minecraft/Docs/blob/main/projects/ProvinceSystem/docs/wiki-research/g-gadgets.md sections 0, 3 and 4.
// Source: https://github.com/TF-Minecraft/Docs/blob/main/projects/TFMCWeb/docs/wiki-research/g-gadgets.md sections 0, 3 and 4.
// Speeds are raw configuration rankings, not measured travel speeds.
export interface VehicleSkin {
id: string;
Expand Down
4 changes: 2 additions & 2 deletions scripts/patchnotes-update.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python3 -I
"""Install the patch note jobs' Python package from a commit on ProvinceSystem main.
"""Install the patch note jobs' Python package from a commit on TFMCWeb main.

The rewrite worker runs as root because the Codex login belongs to root, so the
worker and the watch jobs run a root-owned copy of backend/src/patchnotes, never
Expand All @@ -26,7 +26,7 @@
import urllib.request
from pathlib import Path

REPO = "TF-Minecraft/ProvinceSystem"
REPO = "TF-Minecraft/TFMCWeb"
PACKAGE = "backend/src/patchnotes"
ROOT = Path("/usr/local/lib/tfmc-patchnotes")
CURRENT = ROOT / "current"
Expand Down
6 changes: 4 additions & 2 deletions scripts/ps-compose.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Limited docker compose for the ProvinceSystem main and dev sites. Installed as root's
# Limited docker compose for the TFMCWeb main and dev sites. Installed as root's
# /usr/local/sbin/ps-compose and run as tfmc (docker group) through sudo, so people
# without docker access can manage the two sites but not mount the host.
set -euo pipefail
Expand All @@ -18,10 +18,12 @@ shift
case "$target" in
main)
dir=/home/tfmc/ProvinceSystem
project=tfmcweb-production
files=(-f "$dir/docker-compose.yml" -f "$dir/docker-compose.override.yml")
;;
dev)
dir=/home/tfmc/tfmc-staging
project=tfmcweb-staging
files=(-f "$dir/docker-compose.staging.yml" -f "$dir/docker-compose.override.yml")
;;
*)
Expand Down Expand Up @@ -55,4 +57,4 @@ image_overlay="/home/tfmc/.site-images-$image_site.json"
[[ ! -f $image_overlay ]] || files+=(-f "$image_overlay")

cd "$dir"
exec docker compose --project-directory "$dir" "${files[@]}" "$cmd" "$@"
exec docker compose --project-name "$project" --project-directory "$dir" "${files[@]}" "$cmd" "$@"
12 changes: 6 additions & 6 deletions scripts/ps-preview.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Per-branch ProvinceSystem website previews at https://<slug>.tfminecraft.net.
# Per-branch TFMCWeb website previews at https://<slug>.tfminecraft.net.
# Installed as root's /usr/local/sbin/ps-preview and run as tfmc (docker group), by the
# preview key on psdeploy (through ps-preview-ssh), by admins with sudo -u tfmc, and by
# ps-preview-reap.timer. Preview backends run as tfmc too, so tfmc owns every file.
Expand Down Expand Up @@ -69,9 +69,9 @@ remove_dir() {
staging_backend() {
local id
id=$(docker ps -a -q \
--filter label=com.docker.compose.project=tfmc-staging \
--filter label=com.docker.compose.project=tfmcweb-staging \
--filter label=com.docker.compose.service=backend | head -n1)
[[ -n "$id" ]] || die "cannot find the tfmc-staging backend container"
[[ -n "$id" ]] || die "cannot find the tfmcweb-staging backend container"
echo "$id"
}

Expand Down Expand Up @@ -108,7 +108,7 @@ native_ready() {
}

preview_db_container() {
docker ps -q --filter label=com.docker.compose.project=tfmc-staging \
docker ps -q --filter label=com.docker.compose.project=tfmcweb-staging \
--filter label=com.docker.compose.service=db | head -n1
}

Expand Down Expand Up @@ -276,7 +276,7 @@ cmd_up() {
low_prio docker pull -q "$IMAGE_PREFIX-backend:$slug" >/dev/null
low_prio docker pull -q "$IMAGE_PREFIX-frontend:$slug" >/dev/null
docker image prune -f \
--filter "label=org.opencontainers.image.source=https://github.com/TF-Minecraft/ProvinceSystem" >/dev/null
--filter "label=org.opencontainers.image.source=https://github.com/TF-Minecraft/TFMCWeb" >/dev/null

[[ $(docker image inspect -f '{{index .Config.Labels "net.tfminecraft.storage"}}' "$IMAGE_PREFIX-backend:$slug") == postgres ]] || die "branch image must include the native Postgres migration"
local service container
Expand Down Expand Up @@ -359,7 +359,7 @@ cmd_reap() {
done < <(docker ps -a --filter label=com.docker.compose.project \
--format '{{.Label "com.docker.compose.project"}}' | grep '^pv-' | sort -u)
docker image prune -f \
--filter "label=org.opencontainers.image.source=https://github.com/TF-Minecraft/ProvinceSystem" >/dev/null
--filter "label=org.opencontainers.image.source=https://github.com/TF-Minecraft/TFMCWeb" >/dev/null
}

cmd_list() {
Expand Down
4 changes: 2 additions & 2 deletions scripts/server-control-update.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python3 -I
"""Install the control helper's Python modules from a commit on ProvinceSystem main.
"""Install the control helper's Python modules from a commit on TFMCWeb main.

The host administrator installs this file once as root, and sudoers lets the
deployment account run it. It only replaces the modules that run as the
Expand All @@ -24,7 +24,7 @@
import urllib.request
from pathlib import Path

REPO = "TF-Minecraft/ProvinceSystem"
REPO = "TF-Minecraft/TFMCWeb"
SERVICE = "tfmc-server-control.service"
CODE = Path("/usr/local/lib/tfmc-server-control")
SERVERS = CODE / "backend/src/servers"
Expand Down
2 changes: 1 addition & 1 deletion scripts/staging-down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
set -euo pipefail
cd "$(dirname "$0")/.."
docker compose -f docker-compose.staging.yml down
echo "Staging stack stopped (tfmc-staging)."
echo "Staging stack stopped (tfmcweb-staging)."
Loading