fixing bugs

This commit is contained in:
onysd 2026-09-08 18:59:58 +03:00
parent 979d27ec7a
commit 274bdc8bac
8 changed files with 111 additions and 42 deletions

View file

@ -23,8 +23,8 @@
})();
</script>
<script type="module" crossorigin src="/assets/index-B8l4nVOK.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DW3ERnl8.css">
<script type="module" crossorigin src="/assets/index-B7vjbJOs.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-P_k7ini0.css">
</head>
<body>
<div id="root"></div>

View file

@ -205,7 +205,7 @@ const NETWORK_FIELDS: { key: string; label: string; hint: string; placeholder: s
key: "TELESRV_PUBLIC_BASE_URL",
label: "Public base URL",
hint: "Used for links this server generates -- invites, sticker packs. e.g. https://example.com",
placeholder: "http://127.0.0.1"
placeholder: "http://127.0.0.1:2401"
},
{
key: "TELESRV_PUBLIC_APP_SCHEME",
@ -386,10 +386,10 @@ function DoneStep() {
</button>
</WizardActions>
{restartWatcher.waiting && (
<RestartOverlay label={"Restarting owpengram-server and the admin panel..."} timedOut={false} onDismiss={restartWatcher.dismiss} />
<RestartOverlay timedOut={false} onDismiss={restartWatcher.dismiss} />
)}
{restartWatcher.timedOut && (
<RestartOverlay label={"Restarting owpengram-server and the admin panel..."} timedOut={true} onDismiss={restartWatcher.dismiss} />
<RestartOverlay timedOut={true} onDismiss={restartWatcher.dismiss} />
)}
</div>
);

View file

@ -551,12 +551,20 @@ export function useAdminRestartWatcher() {
return { waiting, timedOut, watch, dismiss };
}
export function RestartOverlay({ label, timedOut, onDismiss }: { label: string; timedOut: boolean; onDismiss: () => void }) {
// No detail line under the heading on purpose -- "restarting owpengram-server
// and the admin panel" (or Update's commit count) told the operator nothing
// they didn't already know from having just clicked Restart/Update/Finish
// setup, and this is meant to be glanced at for a few seconds, not read.
export function RestartOverlay({ timedOut, onDismiss }: { timedOut: boolean; onDismiss: () => void }) {
return createPortal(
<div className="modal-backdrop" role="presentation">
<section className="modal command-modal restart-overlay" role="dialog" aria-modal="true" aria-label={label}>
<section className="modal command-modal restart-overlay" role="dialog" aria-modal="true" aria-label={timedOut ? "Restart is taking longer than expected" : "Restarting"}>
{timedOut ? (
<div className="command-body restart-overlay-body">
<div className="restart-overlay-badge warn">
<RefreshCw size={26} />
</div>
<h2 className="restart-overlay-heading">{"Still restarting..."}</h2>
<Alert>{"The admin panel did not come back within the expected time. It may still be building/restarting -- reload manually in a bit, or check the server logs."}</Alert>
<div className="gift-table-actions restart-overlay-actions">
<button className="btn" type="button" onClick={onDismiss}>{"Dismiss"}</button>
@ -565,8 +573,11 @@ export function RestartOverlay({ label, timedOut, onDismiss }: { label: string;
</div>
) : (
<div className="command-body restart-overlay-body">
<Loader2 className="spin" size={28} />
<p>{label}</p>
<div className="restart-overlay-badge">
<RefreshCw size={26} className="restart-overlay-spin" />
</div>
<h2 className="restart-overlay-heading">{"Restarting"}</h2>
<div className="loader-bar restart-overlay-progress" />
</div>
)}
</section>
@ -655,7 +666,7 @@ const LIVE_POLL_MS = 4000;
// else's commits and relaunching the deployment deserves the same recorded
// reason as every other action here. Auto-checks once on mount so the button
// reflects reality without an operator having to click twice.
function UpdateButton({ onUpdateStarted }: { onUpdateStarted: (overlayLabel: string) => void }) {
function UpdateButton({ onUpdateStarted }: { onUpdateStarted: () => void }) {
const [behind, setBehind] = useState<number | null>(null);
const [message, setMessage] = useState("");
const [busy, setBusy] = useState(false);
@ -692,9 +703,7 @@ function UpdateButton({ onUpdateStarted }: { onUpdateStarted: (overlayLabel: str
label={`Update (${commits})`}
path="/api/actions/update-server"
payload={() => ({})}
onDone={() => {
onUpdateStarted(`Pulled ${commits} commit${commits === 1 ? "" : "s"} -- rebuilding and restarting owpengram-server and the admin panel...`);
}}
onDone={onUpdateStarted}
/>
);
}
@ -718,7 +727,6 @@ function ServicesTab() {
const [statusError, setStatusError] = useState("");
const [docker, setDocker] = useState<DockerService[] | null>(null);
const [dockerError, setDockerError] = useState("");
const [overlayLabel, setOverlayLabel] = useState("");
const restartWatcher = useAdminRestartWatcher();
const pausedRef = useRef(false);
pausedRef.current = restartWatcher.waiting;
@ -754,22 +762,14 @@ function ServicesTab() {
title={"Services"}
action={
<div className="services-header-actions">
<UpdateButton
onUpdateStarted={(label) => {
setOverlayLabel(label);
void restartWatcher.watch();
}}
/>
<UpdateButton onUpdateStarted={() => void restartWatcher.watch()} />
<ActionButton
compact
tone="primary"
label={"Restart"}
path="/api/actions/restart-server"
payload={() => ({})}
onDone={() => {
setOverlayLabel("Restarting owpengram-server and the admin panel...");
void restartWatcher.watch();
}}
onDone={() => void restartWatcher.watch()}
/>
</div>
}
@ -811,8 +811,8 @@ function ServicesTab() {
</div>
)}
</section>
{restartWatcher.waiting && <RestartOverlay label={overlayLabel} timedOut={false} onDismiss={restartWatcher.dismiss} />}
{restartWatcher.timedOut && <RestartOverlay label={overlayLabel} timedOut={true} onDismiss={restartWatcher.dismiss} />}
{restartWatcher.waiting && <RestartOverlay timedOut={false} onDismiss={restartWatcher.dismiss} />}
{restartWatcher.timedOut && <RestartOverlay timedOut={true} onDismiss={restartWatcher.dismiss} />}
</>
);
}

View file

@ -1102,21 +1102,61 @@
}
.restart-overlay {
width: min(440px, 100%);
width: min(340px, 100%);
overflow: hidden;
background: var(--panel);
background-image: radial-gradient(220px 140px at 50% 0%, var(--brand-tint) 0%, rgba(0, 0, 0, 0) 75%);
}
.restart-overlay-body {
/* .restart-overlay-body qualified by its .restart-overlay parent so this
padding/gap wins over the bare .command-body rule in 04-modal-and-login
(equal specificity otherwise, and that file loads after this one). */
.restart-overlay .restart-overlay-body {
display: grid;
justify-items: center;
gap: 12px;
padding: 28px 20px;
gap: 6px;
padding: 36px 24px 32px;
text-align: center;
}
.restart-overlay-badge {
display: grid;
width: 56px;
height: 56px;
margin-bottom: 10px;
place-items: center;
color: var(--brand);
background: var(--brand-tint);
border: 1px solid var(--brand-tint-border);
border-radius: 999px;
box-shadow: 0 0 0 8px var(--brand-tint);
}
.restart-overlay-badge.warn {
color: var(--warn);
background: var(--warn-tint);
border-color: var(--warn-border);
box-shadow: 0 0 0 8px var(--warn-tint);
}
.restart-overlay-spin {
animation: spin 1.4s linear infinite;
}
.restart-overlay-heading {
margin: 0;
color: var(--heading);
font-size: 18px;
}
.restart-overlay-body p {
margin: 0;
color: var(--text-soft);
font-weight: 700;
color: var(--muted);
}
.restart-overlay-progress {
width: min(220px, 100%);
margin-top: 18px;
}
.restart-overlay-actions {