Files
ReSkate/Server/server_release.h
AyeZeeBB 101e1af6e4 Official, staff and friends in the server browser; server tokens; Linux self-update
Server browser
- Official servers (the backend's "official_servers") sort first and are
  drawn in ReSkate blue
- Servers Steam friends are skating in sort next, drawn in green with the
  friends' names; searching a friend's name finds their server
- A player in a session they joined can join another server straight from
  the list; hosts still end their session first, and a Steam friend's join
  offer never replaces a session
- Joining a dedicated server from the list records it as the player's
  public session, so friends see it and the row shows HERE
- Blocked servers (the backend's "blocked_servers") are hidden and cannot
  be joined, by code either
- When the backend sets "server_tokens_required", dedicated servers that
  signed in without a login token are hidden, except on the player's own
  network
- A search that gets no internet list from Steam keeps the last list for
  two minutes, and waits six seconds before treating it as empty
Roles
- New Staff tag from the backend's "staff" list: green name, badge and
  item animation, ranked after Dev
- Staff can pick a rainbow for their items on the Special page; it is sent
  as a solid colour older builds can show, so the protocol is unchanged
Dedicated server
- steam_token: sign in with a Steam game server login token and keep the
  same Steam ID every start; empty signs in anonymously as before
- A listed server without a token says so at startup, and when the token
  rule starts or stops hiding it
- Linux servers update themselves from the release's "server_linux"
  tarball, with the machine's curl and tar, pinned by SHA-256, and carry
  on in the same process
Launcher
- Only create the MiniDumpWriteDump API-set shim under Wine/Proton
2026-10-07 00:19:56 -05:00

34 lines
1.9 KiB
C++

#pragma once
#include <cstdint>
#include <map>
#include <optional>
#include <string>
#include <string_view>
// What the Linux server's self-update reads from a release, apart from how it is fetched
// (server_update.cpp): the release's launcher.json entry for the Linux server, and the checks
// on the tarball before anything is unpacked. Portable, so the tests run on Windows too.
namespace dingosdk::server {
// launcher.json's "server_linux": the tarball (pinned by size and SHA-256) and the SHA-256 of
// the ReSkateServer inside it, which a running server compares with its own.
struct LinuxRelease {
std::string version, url, sha256, exe_sha256;
std::uint64_t size{};
};
// The largest tarball a server will download.
inline constexpr std::uint64_t max_linux_release_bytes = 512ull * 1024 * 1024;
// GitHub's answer for a release, as the names of its assets and where each downloads from.
// Throws when the answer is not a release.
std::map<std::string, std::string, std::less<>> release_assets(std::string_view release_json);
// Nothing when the release was made before Linux servers updated themselves (no
// "server_linux"). An "asset:<name>" URL becomes that asset's download link. Throws on an
// entry that is there but wrong: no HTTPS link, a hash that is not one, a size out of range.
std::optional<LinuxRelease> parse_linux_release(std::string_view launcher_json,
const std::map<std::string, std::string, std::less<>> &assets);
// `tar -t`'s list of a release tarball: every entry under the one top folder the package has,
// none absolute or with a ".." in it. Returns that folder's name; throws otherwise.
std::string checked_archive_listing(std::string_view listing);
// A link curl may be handed: https, with nothing but URL characters in it.
bool https_url(std::string_view url) noexcept;
} // namespace dingosdk::server