Files
bbs/internal/api/web/index.html
T
Claude f832430916 Add a web terminal page: the BBS in a browser
[http] serves /terminal (and / goes there): a page with xterm.js 5.5 and
its fit addon, built into the binary (MIT licensed, license included),
joined by a WebSocket (/terminal/ws, subprotocol bbs.terminal, binary
frames) to the text BBS, run in-process as for a telnet caller: a node
shown as "web terminal", the BBS's own login, ANSI and UTF-8, the size
the page fitted.

The page has a strict Content Security Policy (scripts only from the
BBS, no inline scripts, no framing); the WebSocket is taken only from
the BBS's own pages (or the cors origin), under the HTTP server's TLS,
connection and rate limits.  terminal = no turns it off.

The WebSocket's own stream closes the connection when a read deadline
passes, which the text BBS uses for idle time and notices: the line
adapter SSH sessions had (reads with deadlines that only end the read)
now serves both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
2026-10-12 08:26:24 +00:00

22 lines
662 B
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Name}}</title>
<link rel="stylesheet" href="/terminal/xterm.css">
<link rel="stylesheet" href="/terminal/terminal.css">
</head>
<body>
<header>
<span class="name">{{.Name}}</span>
<span id="status" role="status">Connecting…</span>
<button id="again" type="button" hidden>Connect again</button>
</header>
<main id="term" aria-label="{{.Name}} terminal"></main>
<script src="/terminal/xterm.js"></script>
<script src="/terminal/addon-fit.js"></script>
<script src="/terminal/terminal.js"></script>
</body>
</html>