DOS font
This commit is contained in:
parent
43b9d9f47a
commit
8f8779fee1
4 changed files with 29 additions and 2 deletions
|
|
@ -10,6 +10,7 @@ COPY scripts/dos-shell /usr/local/bin/dos-shell
|
||||||
COPY scripts/dos-httpd /usr/local/bin/dos-httpd
|
COPY scripts/dos-httpd /usr/local/bin/dos-httpd
|
||||||
COPY scripts/prepare-svardos.sh /usr/local/bin/prepare-svardos
|
COPY scripts/prepare-svardos.sh /usr/local/bin/prepare-svardos
|
||||||
COPY scripts/start-services.sh /usr/local/bin/start-dos-services
|
COPY scripts/start-services.sh /usr/local/bin/start-dos-services
|
||||||
|
COPY WebPlus_IBM_VGA_8x16.woff /usr/local/share/dos-httpd/WebPlus_IBM_VGA_8x16.woff
|
||||||
RUN chmod +x /usr/local/bin/dos-shell /usr/local/bin/dos-httpd /usr/local/bin/start-dos-services /usr/local/bin/prepare-svardos && echo "/usr/local/bin/dos-shell" >> /etc/shells
|
RUN chmod +x /usr/local/bin/dos-shell /usr/local/bin/dos-httpd /usr/local/bin/start-dos-services /usr/local/bin/prepare-svardos && echo "/usr/local/bin/dos-shell" >> /etc/shells
|
||||||
|
|
||||||
# Create sshd runtime directory
|
# Create sshd runtime directory
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ You can override which binary is used for the Linux side by setting `DOS_LINUX_S
|
||||||
| `DOS_SSH_PORT` | `2222` | Host port forwarded to container port 22. |
|
| `DOS_SSH_PORT` | `2222` | Host port forwarded to container port 22. |
|
||||||
| `DOS_TELNET_PORT` | `2323` | Host port forwarded to container port 23. |
|
| `DOS_TELNET_PORT` | `2323` | Host port forwarded to container port 23. |
|
||||||
| `DOS_HTTP_PORT` | `8080` | Host port forwarded to the web console. |
|
| `DOS_HTTP_PORT` | `8080` | Host port forwarded to the web console. |
|
||||||
|
| `DOS_HTTP_FONT_PATH` | `/usr/local/share/dos-httpd/WebPlus_IBM_VGA_8x16.woff` | Override the font served to the web console. |
|
||||||
| `ENABLE_TELNET` | `1` | Toggle BusyBox telnetd. |
|
| `ENABLE_TELNET` | `1` | Toggle BusyBox telnetd. |
|
||||||
| `ENABLE_HTTP_CONSOLE` | `1` | Launch the built-in web terminal. |
|
| `ENABLE_HTTP_CONSOLE` | `1` | Launch the built-in web terminal. |
|
||||||
| `TELNET_PORT` | `23` | Port inside the container where telnetd listens. |
|
| `TELNET_PORT` | `23` | Port inside the container where telnetd listens. |
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,17 @@ HTML_PAGE = """<!DOCTYPE html>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css" />
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css" />
|
||||||
<style>
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: "DOSVGA";
|
||||||
|
src: url("/assets/WebPlus_IBM_VGA_8x16.woff") format("woff");
|
||||||
|
font-display: swap;
|
||||||
|
}
|
||||||
:root, body { background: #1e1e1e; color: #f0f0f0; height: 100%; }
|
:root, body { background: #1e1e1e; color: #f0f0f0; height: 100%; }
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-family: system-ui, sans-serif;
|
font-family: "DOSVGA", "Fira Code", "Cascadia Mono", "Hack", monospace;
|
||||||
}
|
}
|
||||||
header {
|
header {
|
||||||
padding: 0.6rem 1rem;
|
padding: 0.6rem 1rem;
|
||||||
|
|
@ -70,6 +75,8 @@ HTML_PAGE = """<!DOCTYPE html>
|
||||||
const term = new Terminal({
|
const term = new Terminal({
|
||||||
cursorBlink: true,
|
cursorBlink: true,
|
||||||
convertEol: true,
|
convertEol: true,
|
||||||
|
fontFamily: "DOSVGA, Fira Code, Cascadia Mono, Hack, monospace",
|
||||||
|
fontSize: 16,
|
||||||
theme: {
|
theme: {
|
||||||
background: "#000000",
|
background: "#000000",
|
||||||
foreground: "#f5f5f5"
|
foreground: "#f5f5f5"
|
||||||
|
|
@ -315,6 +322,13 @@ async def health_handler(_request: web.Request) -> web.Response:
|
||||||
return web.Response(text="ok\n", content_type="text/plain")
|
return web.Response(text="ok\n", content_type="text/plain")
|
||||||
|
|
||||||
|
|
||||||
|
async def font_handler(request: web.Request) -> web.StreamResponse:
|
||||||
|
cfg: "AppConfig" = request.app["config"]
|
||||||
|
if not cfg.font_path or not os.path.exists(cfg.font_path):
|
||||||
|
raise web.HTTPNotFound()
|
||||||
|
return web.FileResponse(path=cfg.font_path, headers={"Cache-Control": "public, max-age=86400"})
|
||||||
|
|
||||||
|
|
||||||
async def websocket_handler(request: web.Request) -> web.WebSocketResponse:
|
async def websocket_handler(request: web.Request) -> web.WebSocketResponse:
|
||||||
ws = web.WebSocketResponse(heartbeat=30)
|
ws = web.WebSocketResponse(heartbeat=30)
|
||||||
await ws.prepare(request)
|
await ws.prepare(request)
|
||||||
|
|
@ -347,13 +361,14 @@ async def websocket_handler(request: web.Request) -> web.WebSocketResponse:
|
||||||
|
|
||||||
|
|
||||||
class AppConfig:
|
class AppConfig:
|
||||||
def __init__(self, user: str, shell_path: str, host: str, port: int, rows: int, cols: int):
|
def __init__(self, user: str, shell_path: str, host: str, port: int, rows: int, cols: int, font_path: Optional[str]):
|
||||||
self.user = user
|
self.user = user
|
||||||
self.shell_path = shell_path
|
self.shell_path = shell_path
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.default_rows = rows
|
self.default_rows = rows
|
||||||
self.default_cols = cols
|
self.default_cols = cols
|
||||||
|
self.font_path = font_path
|
||||||
|
|
||||||
|
|
||||||
def build_argument_parser() -> argparse.ArgumentParser:
|
def build_argument_parser() -> argparse.ArgumentParser:
|
||||||
|
|
@ -378,6 +393,11 @@ def build_argument_parser() -> argparse.ArgumentParser:
|
||||||
choices=["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"],
|
choices=["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"],
|
||||||
help="Log verbosity",
|
help="Log verbosity",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--font-path",
|
||||||
|
default=os.environ.get("DOS_HTTP_FONT_PATH", "/usr/local/share/dos-httpd/WebPlus_IBM_VGA_8x16.woff"),
|
||||||
|
help="Path to the WOFF font used by the terminal UI",
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -392,6 +412,7 @@ async def create_app(cfg: AppConfig) -> web.Application:
|
||||||
[
|
[
|
||||||
web.get("/", index_handler),
|
web.get("/", index_handler),
|
||||||
web.get("/healthz", health_handler),
|
web.get("/healthz", health_handler),
|
||||||
|
web.get("/assets/WebPlus_IBM_VGA_8x16.woff", font_handler),
|
||||||
web.get("/ws", websocket_handler),
|
web.get("/ws", websocket_handler),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
@ -410,6 +431,7 @@ def main() -> None:
|
||||||
port=args.port,
|
port=args.port,
|
||||||
rows=args.rows,
|
rows=args.rows,
|
||||||
cols=args.cols,
|
cols=args.cols,
|
||||||
|
font_path=args.font_path if args.font_path else None,
|
||||||
)
|
)
|
||||||
|
|
||||||
app = asyncio.run(create_app(cfg))
|
app = asyncio.run(create_app(cfg))
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,9 @@ start_http_console() {
|
||||||
if [ -n "${DOS_HTTP_LOG_LEVEL:-}" ]; then
|
if [ -n "${DOS_HTTP_LOG_LEVEL:-}" ]; then
|
||||||
args+=(--log-level "${DOS_HTTP_LOG_LEVEL}")
|
args+=(--log-level "${DOS_HTTP_LOG_LEVEL}")
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${DOS_HTTP_FONT_PATH:-}" ]; then
|
||||||
|
args+=(--font-path "${DOS_HTTP_FONT_PATH}")
|
||||||
|
fi
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
"${DOS_HTTPD_BIN}" "${args[@]}" &
|
"${DOS_HTTPD_BIN}" "${args[@]}" &
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue