fixed info about api layer in admin page

This commit is contained in:
onysd 2026-09-01 19:12:32 +03:00
parent 62d8b53030
commit d2f4e11390
11 changed files with 78 additions and 30 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -23,8 +23,8 @@
})();
</script>
<script type="module" crossorigin src="/assets/index-D-ZS9t5z.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Bkel0mh-.css">
<script type="module" crossorigin src="/assets/index-D9dyWksN.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DUxLVnzO.css">
</head>
<body>
<div id="root"></div>

View file

@ -42,7 +42,7 @@ export function App() {
return (
<PermissionsProvider permissions={session.permissions ?? []} hideThirdPartyVerification={session.hide_third_party_verification ?? true}>
<Shell actor={session.actor} apiLayer={session.api_layer} build={session.build} route={route} navigate={navigate} onLogout={() => setSession(null)}>
<Shell actor={session.actor} apiLayers={session.api_layers} build={session.build} route={route} navigate={navigate} onLogout={() => setSession(null)}>
<Routes route={route} navigate={navigate} />
</Shell>
</PermissionsProvider>

View file

@ -24,6 +24,28 @@ import { type Navigate, type RouteState, routeTitle } from "../routing";
import { ThemeSwitch } from "../theme";
import { AppLink } from "./AppLink";
// Compresses a sorted (or unsorted) list of layer numbers into run-length
// ranges for the compact sidebar label, e.g. [225,226,227,228,229] -> "225-229",
// or [225,226,228] -> "225-226, 228" if the server ever supports a
// non-contiguous set. The full list is still always shown in the tooltip.
function formatLayerRanges(layers: number[]): string {
const sorted = [...layers].sort((a, b) => a - b);
const parts: string[] = [];
let start = sorted[0];
let prev = sorted[0];
for (let i = 1; i <= sorted.length; i++) {
const current = sorted[i];
if (current === prev + 1) {
prev = current;
continue;
}
parts.push(start === prev ? `${start}` : `${start}-${prev}`);
start = current;
prev = current;
}
return parts.join(", ");
}
export function BootScreen() {
return (
<div className="boot-screen">
@ -41,7 +63,7 @@ export function BootScreen() {
export function Shell({
actor,
apiLayer,
apiLayers,
build,
route,
navigate,
@ -49,7 +71,7 @@ export function Shell({
children
}: {
actor: string;
apiLayer?: number;
apiLayers?: number[];
build?: { commit: string; short_commit: string; dirty: boolean; build_time: string };
route: RouteState;
navigate: Navigate;
@ -223,8 +245,10 @@ export function Shell({
</nav>
<div className="sidebar-status">
<span className="sidebar-label">{"Version: O7"}</span>
{typeof apiLayer === "number" && (
<span className="sidebar-label sidebar-api-layer">{`API layer: ${apiLayer}`}</span>
{apiLayers && apiLayers.length > 0 && (
<span className="sidebar-label sidebar-api-layer" title={`Layers: ${apiLayers.join(", ")}`}>
{`API layers: ${formatLayerRanges(apiLayers)}`}
</span>
)}
{build?.short_commit && (
<span className="sidebar-label sidebar-build" title={build.commit + (build.dirty ? " (uncommitted changes)" : "")}>

View file

@ -265,6 +265,7 @@ a {
letter-spacing: 0.04em;
}
.sidebar-api-layer,
.sidebar-build {
font-weight: 500;
text-transform: none;

View file

@ -584,9 +584,11 @@ export type AdminSession = {
// comment. Used by Server Settings' Restart/Update flow to detect a
// genuinely new admin process after asking it to bounce.
boot_id?: string;
// The MTProto TL schema layer this server binary speaks -- shown in the
// sidebar footer above the build/commit line.
api_layer?: number;
// Every MTProto TL schema layer this server binary can admit and encode
// for (oldest first) -- the server is multi-layer, so this is the whole
// supported set, not just the newest one. Shown in the sidebar footer
// above the build/commit line.
api_layers?: number[];
// This admin binary's own build -- shown under "Version" in the sidebar
// footer so an operator can tell which build is actually running.
build?: {