Fix gamerule toggles for 26.x renames; add map/skins/pregen + admin favors
Minecraft 26.x renamed every gamerule to snake_case (keepInventory → keep_inventory, doDaylightCycle → advance_time, ...), so the panel's queries hit unknown rules: reads returned nothing, toggles always started from 'off', and sets silently failed. Rules are now defined by candidate names resolved against the live server (works on old and new versions), sets are verified by re-query, and failures surface the server's actual reply. Toggles render only for rules the server reports. Creative additions: - Featured mods on the Mods page: BlueMap (3D web map), SkinRestorer (real skins in offline mode), Chunky (pregen) — verified for 26.2 - BlueMap plumbing: MAP_PORT mapping in compose, in-network detection, 'Open the live world map' link on the Overview - Player modal favors: heal, teleport-to-player, give item - Broadcast box gained a full-screen title mode Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
deeeaf0042
commit
b2ff88b255
9 files changed
+344
-50
No files matched your search
@@ -4,10 +4,26 @@ import { db } from "@/server/db";
|
||||
import { env } from "@/server/env";
|
||||
import { getWorldSizeBytes } from "@/server/sampler";
|
||||
import { readWorldInfo } from "@/server/playerstats";
|
||||
import { readEnvFile } from "@/server/envfile";
|
||||
import { ok, handle } from "@/server/api";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// BlueMap detection (in-network probe of the mc container), cached 60 s.
|
||||
let mapCheck: { at: number; available: boolean } = { at: 0, available: false };
|
||||
|
||||
async function bluemapAvailable(running: boolean): Promise<boolean> {
|
||||
if (!running) return false;
|
||||
if (Date.now() - mapCheck.at < 60_000) return mapCheck.available;
|
||||
let available = false;
|
||||
try {
|
||||
const res = await fetch(`http://${env.mcContainer}:8100/`, { signal: AbortSignal.timeout(1500) });
|
||||
available = res.ok;
|
||||
} catch {}
|
||||
mapCheck = { at: Date.now(), available };
|
||||
return available;
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
return handle(async () => {
|
||||
let container;
|
||||
@@ -49,6 +65,10 @@ export async function GET() {
|
||||
serverType,
|
||||
metrics: latest ?? null,
|
||||
pendingApprovals: pendingCount,
|
||||
map: {
|
||||
available: await bluemapAvailable(container.running),
|
||||
port: Number(readEnvFile()["MAP_PORT"]) || 8100,
|
||||
},
|
||||
world: readWorldInfo(getWorldSizeBytes()),
|
||||
uptimeMs:
|
||||
container.running && "startedAt" in container && container.startedAt
|
||||
|
||||
Reference in new issue
Block a user