Skip to content

v0.5.0 — content quality of life + ops + perms + audit-driven hardening

Choose a tag to compare

@ayozetr ayozetr released this 28 May 01:27
· 11 commits to main since this release

Big batch release rolling up the entire ops-quality-of-life pass driven by
the external audit + several follow-up feature drops the operator asked for
during a single working session: granular permissions (mapActivate so a
non-admin user can change maps without inheriting full ServerConfig.toml
rights), one-click BeamMP-Server binary update from the dashboard banner,
a Cars catalogue mirroring Mapas, custom-map metadata + thumbnails read
from info.json (including info.json files BeamMP-Server's own parser
tolerates but JSON.parse rejects), CPU temperature on the Dashboard,
four new KPI tiles (mods-on-disk excluding Kunos vanilla, joins / laps /
total drivers), strictly admin-only mod deletion + ConfirmModal, the
Mods catalogue collapsed by default, a stable per-player id that doesn't
collapse two guests behind the same NAT into one entry, and the active-
map tile in the Dashboard now shows modder title + screenshot for custom
maps too. Plus the security / health / audit-export hardening from the
external audit and a fast unit-test layer in front of the existing smoke
run. Two coordinated panels — BeamMP + Assetto Corsa siblings — got the
shared Dashboard tiles (mods-on-disk, joins / laps / drivers, CPU temp)
identically, with the AC panel filtering Kunos vanilla out of the disk
total.

Changed

  • Mod deletion is now strictly admin-only. DELETE /api/mods/<loc>/<name>
    switched from the modUpload permission gate to checkAdminAuth.
    modUpload still controls who can push new archives in, but the
    destructive side moves up to admin — the wrong delete on a busy
    server (operator picks the wrong row, modder's hash mismatches
    mid-rotation, …) kicks every connected player and forces a manual
    reupload, and the panel's risk model treats that as a single-actor
    operation. Frontend mirrors the change: the Mods catalogue's delete
    button only renders when the viewer is admin (was: when they had
    upload rights), and the existing ConfirmModal continues to gate
    the click. Same approach as the assetto-server-panel sibling, where
    car / track delete has always required admin.
  • Mod classifier no longer tags vehicle-extension mods as "Coche".
    The previous heuristic flagged any zip containing vehicles/<X>/<Y>.jbeam
    as a car — which caught full-vehicle mods but also license-plate packs,
    body kits, bumpers and trim that ship plate / tuning .jbeam files
    for stock vehicles without an info.json of their own. EuroPlates_JorgePinto.zip
    was the prompting case: Mods page said "Coche", Cars catalogue
    (which requires vehicles/<X>/info.json) said "no car" — inconsistent.
    Strict criterion now: kind=car iff at least one vehicles/<X>/info.json
    exists. Vehicle-extension mods classify as other.

Added

  • Collapsible "Installed mods" card on the Mods page. Catalogue
    is informational; the uploader below is the action surface. Card
    starts collapsed; click the header to expand. Total-mods badge stays
    visible even when collapsed. Preference persisted in
    localStorage['bp-mods-installed-open']. Same idiom the Dashboard
    activity card already uses (chevron indicator, keyboard handler,
    aria-expanded).
  • Stable per-player id (no more "everyone is UUID 0"). PanelBridge
    consumer was using BeamMP-Server's per-session slot number (0, 1,
    2…) as the canonical player_id, collapsing every guest that ever
    held slot 0 into a single DB row. New _stableIdFor(p) returns
    bmp:<uid> for registered BeamMP users (forum UID — durable across
    sessions / IPs / name changes), guest:<name> for guests (BeamMP
    assigns each guest a session-unique handle like "guest8099544" so
    two guests behind the same NAT no longer collapse into one panel
    entry — the operator pointed this out as the genuine common case
    during BeamMP-auth maintenance windows when AllowGuests has to stay
    true), and named:<name> / slot:<n> as deeper fallbacks.
    _connectedPlayers is rekeyed by stableId; each entry carries
    slotId so MP.DropPlayer still works for kicks. Migration #13
    purges legacy slot-numeric rows from players / player_events / bans.
    apiPlayerKick + apiPlayerBan resolve the stableId → slotId via the
    live map. _publishBans writes each ban under both keys (prefixed +
    raw) so the in-tree PanelBridge keeps matching without a reload.
  • Player nickname rendered in Dashboard players-online list.
    Matches the Players page's "Nickname (in-game)" shape so the
    admin-set nickname is visible from both views at a glance. Falls
    back to the in-game name when no nickname is set. Single inline
    ternary; no new fetch.
  • Active-map Dashboard tile now shows modder title + thumbnail for
    custom maps.
    Vanilla maps were already rendering bundled
    screenshots — but the moment the operator switched to a Nürburgring
    mod the tile fell back to the raw directory name + the technical
    /levels/ks_nord/info.json path, with no image. apiDashboardExtra
    now resolves custom maps via enumerateCustomMaps and surfaces
    { source, levelName, hasPreview }. Frontend builds the preview
    URL from /api/maps/preview/<source>/<levelName> — same endpoint
    the Maps page card uses, so the active-map thumbnail and the
    catalogue thumbnail stay in sync.
  • mapActivate granular permission. The User role can now be
    granted access to the Maps + Cars pages and to changing the active
    map without inheriting full ServerConfig.toml editing rights. Closes
    the gap that "let a user pick the next map" required handing over
    the whole config editor (port, max players, AuthKey rotation
    scope, etc). ROLE_PERMISSIONS grows a mapActivate entry which
    is checked by apiMaps, apiMapsActivate, apiMapPreview,
    apiCars and apiCarPreview instead of serverConfig.
    Map rotation (apiMapsRotation + apiMapsRotationUpdate) keeps
    the serverConfig gate — the rotation timer rewrites the live
    config and restarts the server, so it's a config-level operation
    not an operator-level one. New _applyImplications helper makes
    serverConfig automatically grant mapActivate at runtime so an
    existing admin or any user already trusted with serverConfig keeps
    Maps + Cars access without the operator having to tick a second
    checkbox. UI: a new row in Users > Permissions explains the
    difference; the sidebar entries for Maps + Cars now hide via
    requires:'mapActivate'; the Map rotation card on the Maps page
    is only rendered when the viewer has full serverConfig. New i18n
    keys perm.mapActivate + perm.mapActivate_hint (en + es).
  • CPU temperature badge on the Dashboard's "Uso CPU" tile. Small
    number in the top-right corner of the existing CPU card, no layout
    changes. Sourced from /sys/class/thermal/thermal_zone*/temp — pure
    kernel surface, no extra package, no sudo, plug-and-play on every
    modern Linux host. _getCpuTempC walks each zone, prefers ones whose
    type matches a CPU sensor (x86_pkg_temp, coretemp,
    cpu[-_]thermal, core_N, package_N) and reports the highest
    reading among the preferred set so a multi-package box shows the
    hottest die. On hosts where the thermal tree doesn't exist (some VPS,
    LXC containers, FreeBSD, Windows) or every reading is out of plausible
    range, the helper returns null and the badge simply doesn't render —
    the tile looks exactly like before.
  • One-click BeamMP-Server binary update from the dashboard banner.
    POST /api/server/update-binary (gated on serverControl) downloads
    the asset matching the host's distro/arch from the latest GitHub
    release, makes a <bin>.bak of the running binary, atomically
    replaces it (after stopping the service), restarts, verifies
    --version on the new binary, and rolls back to the .bak if the
    new one is corrupted. Process-wide flag rejects concurrent calls with
    409. _detectLinuxAsset maps /etc/os-release + process.arch to
    BeamMP's BeamMP-Server.<id>.<version_id>.<arch> shape (Debian
    12/13, Ubuntu 22.04/24.04, x86_64 + arm64); other distros refuse
    with a 400 rather than ship a libc-mismatched binary. The Dashboard
    update banner grows an "Actualizar" button next to "Ver release"
    with a ConfirmModal that spells out the disruption.
  • Cars catalogue page. New Coches entry in the sidebar's
    Contenido group, mirroring the Mapas page UX but read-only — BeamMP
    auto-streams car mods to every connecting client, so there is no
    activate flow. enumerateCustomCars walks Resources/Client/*.zip
    pairing vehicles/<X>/info.json with vehicles/<X>/default.(png|jpg),
    emits one card per vehicle with brand / country / year / type
    badges, and surfaces authors + description in the modal. Vanilla
    BeamNG.drive cars are deliberately NOT enumerated — they ship with
    each player's local game install — and the page leads with an
    explanatory card making that explicit.
  • Custom maps now read their levels/<X>/info.json so the
    catalogue shows the modder's title, description, authors, country
    (last segment of the levels.common.country.* translation key),
    biome and features rather than the bare directory name. Per-level
    pairing means a track pack that ships multiple levels in one .zip
    gets one card with the correct thumbnail per level. _parseLooseJson
    tolerates the JSONC dialect BeamNG uses (trailing commas, occasional
    comments) so files like the Nordschleife mod's info.json don't
    reject under strict JSON.parse.
  • Per-level preview extractor. /api/maps/preview/<source>/<level>
    extracts the targeted levels/<level>/preview.(png|jpg|jpeg) from
    inside the zip — separate from the mods page's first-preview-found
    endpoint because a multi-level archive needs one thumbnail per
    level, not one for the whole archive.
  • Ban enforcement at join (PanelBridge v3). The plugin gains an
    onPlayerAuth handler that reads Resources/Server/PanelBridge/bans.json
    on every auth attempt and refuses the connection with the operator-provided
    reason as the kick string when any of the player's identifiers (beammp UID,
    IP, …) is in the ban table. The panel publishes the file atomically on
    every ban, every unban, every sweepExpiredBans tick that actually
    removed rows, and once at boot. Reading on every auth instead of caching
    means a ban issued seconds before a retry is effective without a plugin
    reload. The plugin tries every identifier so a UID ban still catches an IP
    rotation and vice versa. See docs/live-state.md
    for the bans.json wire format. [3d8dcb1]
  • GET /api/admin/health — clinical-style readiness probe for
    Uptime-Kuma / blackbox-exporter / Kubernetes. Aggregates DB + disk +
    process + BeamMP-Server checks into a healthy / degraded / unhealthy
    verdict; HTTP code mirrors the verdict (200 for the first two, 503 for
    the last) so the alert rule is a one-line non-2xx check. Admin-gated —
    the public /api/health still returns { ok: true } and intentionally
    leaks no fingerprintable signal. Thresholds: < 500 MB free disk →
    unhealthy, < 5 GB → degraded; RSS > 1 GB → degraded; BeamMP-Server down
    → degraded, not unhealthy (the panel keeps serving config edits + uploads
    • audit log when BeamMP isn't up). The server check reads cached
      _serverRunSince so the scrape stays fast — a fresh getServerInfo()
      would add ~1 s of TCP probing per call. [b09dd83]
  • GET /api/audit/export?format=csv|json — streams the audit log for
    offline analysis with optional since / until / actor / action
    filters. CSV uses better-sqlite3 .iterate() so a multi-year export
    stays flat on memory; JSON ships one well-formed document because jq /
    SIEM ingestion prefers that over NDJSON. RFC 4180 quoting handles
    commas, quotes and newlines inside reason / detail fields. The export
    action is itself audit-logged with the chosen filter so an operator
    scraping the table leaves a trace. [9a755f1]
  • Unit tests. npm run test:unit loads lib/pure.js directly and
    asserts on the CSV-quoting + BeamMP log-parsing invariants (strict
    documented format + heuristic fallback) without booting the HTTP server
    / DB / log watcher. Runs in ~5 ms; chained ahead of the existing smoke
    run by npm test so a broken invariant fails fast. [80119ff]

Fixed

  • Maps + Mods catalogues read info.json["previews"][0] when no
    canonical preview.png/.jpg exists.
    Some BeamNG map mods
    (2K-Sadamine, e.g.) ship their thumbnail under a non-canonical path
    like quickrace/TH.jpg and declare it in info.json rather than
    bundling a preview.jpg at the standard location. New
    _resolveLevelPreview helper does the two-step resolution
    (canonical → previews[0]) and is used by both enumerateCustomMaps
    (Maps catalogue) and apiMapPreview (preview endpoint), plus
    _classifyClientMod (Mods catalogue). Path-traversal-safe — rejects
    any previews entry with .. or a leading slash. Catalogue cards
    and the Dashboard active-map tile all light up consistently.
  • _parseLooseJson tolerates missing commas between properties.
    Sadamine's info.json had a literal missing comma between
    "features" and "suitablefor" — BeamNG.drive's lenient parser
    doesn't care, but JSON.parse rejected with "Expected ',' or '}'
    after property value at position 204", so the previews fallback
    branch never saw the meta object. Parser now also re-inserts the
    comma before parsing.
  • Sidebar brand "BeamNG Server Panel" stays on one line. The
    CSS rules for .brand / .brand-mark / .brand-name are
    byte-for-byte identical to the assetto-server-panel sibling, but
    the BeamMP panel was breaking the title into "BeamNG Server" /
    "Panel" while AC kept its 20-char "Assetto Server Panel" on a
    single line. Cause was typographic: "BeamNG" packs four uppercase
    glyphs (B + the wide-cap of M + N + G) which measure ~10 px wider
    than "Assetto"'s one uppercase, just enough to overflow the ~146 px
    text slot the 232 px sidebar leaves after icon + padding + gap.
    Fix is scoped to BeamMP's stylesheet: .brand tightens gap
    (10 → 6 px) and horizontal padding (8 → 4 px), .brand-name gets
    white-space: nowrap and a slightly tighter letter-spacing
    (-0.01em → -0.025em), .brand-sub matches with nowrap + ellipsis
    so a long OS string (e.g. "Linux Mint 22.1") doesn't push the
    layout downward. Font size stays at 14 px so the title reads at
    the same weight as the AC sibling side by side.
  • Update banner no longer reads vv3.9.3. GitHub publishes
    release tags with a leading v while _getLocalBmpVersion has
    always stripped it; the banner template then added its own v so
    the latest version showed two. Backend now normalises tag_name
    before handing it to the client, and the i18n templates that were
    missing the prefix on the "you are running …" subtitle and on the
    success / already-latest toasts now have it, so there is exactly
    one v in every place a version is shown.
  • Race condition in simultaneous mod uploads. The existing
    _uploadLocks map only serialised by uploadId, so two uploads from
    different admins (or the same admin in two browser tabs) that happened
    to resolve to the same safeName for a client mod, or the same
    modRoot for a server plugin, raced on O_TRUNC and could produce a
    corrupt zip that BeamMP-Server would then stream verbatim to every
    connecting player. New withDestPathLock wraps the open+write+close
    in the client-mod branch and the entire entry-loop in the server-plugin
    branch, keyed by the absolute destination path — different uploads
    still proceed in parallel, only those touching the same destination
    block on each other. [5564212]
  • Log parser retag for BeamMP-Server's documented output format. The
    heuristic regexes were inherited verbatim from the AC fork, where
    acServer emits unstructured English prose. Applied to BeamMP-Server's
    structured [DD/MM/YYYY HH:MM:SS] $CONTEXT [LEVEL] $MSG output they
    over-matched on the documented words inside log messages and
    under-matched on the actual level brackets, so [WARN] lines could end
    up tagged info and the SRV / HTTP / CFG fallback tags showed up on
    lines that had a perfectly good context like HeartbeatThread or
    (42) "Alice". New _BMP_LINE regex peels off the documented shape
    on the strict path, lifts the timestamp + context + level into
    structured fields, and only falls through to the AC-style heuristics
    when a line doesn't match — covering Lua plugin print() output, the
    panel's own injected lines and any log that lost its leading bracket
    through a pipe. Maps the six BeamMP levels (DEBUG / INFO / LUA / WARN
    / ERROR / FATAL) onto four UI buckets, giving LUA its own colour so
    plugin output (PanelBridge, MOTD loop, third-party plugins) is
    filterable directly. [9d1e837]
  • _enqueueBridgeCommand cleans up its .tmp on a failed rename. A
    failed fs.rename (cross-device link, ENOSPC mid-write, plugin dir
    wiped between mkdir and rename) used to leave commands.json.tmp
    behind on every retry. Now wrapped in try/finally with a best-effort
    unlink. Same pattern applied to the new bans.json writer. [3d8dcb1]

Changed

  • Boot banner surfaces silent TRUST_PROXY misconfigurations. Before,
    setting TRUST_PROXY=1 with a TRUST_PROXY_FROM that had typos or
    malformed CIDRs would silently drop the bad entries and could leave the
    trusted-proxy allowlist completely empty — clientIp() then ignored
    CF-Connecting-IP / X-Forwarded-For on every request, so per-IP rate
    limits, audit-log attribution and the checkOrigin X-Forwarded-Host
    fallback silently fell back to using the socket peer (typically the
    upstream proxy itself, one bucket for everyone). The defensive fallback
    was still correct (spoofs got ignored, not honoured), but there was no
    way for an operator to discover the misconfiguration short of grepping
    audit logs. The boot banner now prints the effective range count +
    source (TRUST_PROXY_FROM vs Cloudflare defaults), lists any
    unparseable entries by their original string, and warns again when the
    resulting allowlist is empty. See docs/troubleshooting.md for the
    remediation paths. [e23d1e9]