mirror of
https://github.com/p1neappleXpress/OpenFlux.git
synced 2026-10-21 06:20:22 +08:00
The exit is a small PHP program on an ordinary web hosting, reached through cups.online or Mail.ru. See the PR for the list.
22 lines
880 B
PHP
22 lines
880 B
PHP
<?php
|
|
// Renders the phpbox status page from lib/page.html. All state in the page
|
|
// comes from the status/log endpoints of node.php; the only thing injected
|
|
// here is the page's own configuration (never the token's secret material
|
|
// beyond the ?k= the visitor already has).
|
|
|
|
final class PhpboxUi
|
|
{
|
|
public static function render(array $cfg): string
|
|
{
|
|
$tpl = (string)file_get_contents(__DIR__ . '/page.html');
|
|
$wasmExec = $cfg['wasmExec'] ?? '';
|
|
unset($cfg['wasmExec']);
|
|
$json = json_encode($cfg, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP);
|
|
return strtr($tpl, [
|
|
'%%CONFIG%%' => $json,
|
|
'%%WASMEXEC%%' => str_replace('</script', '<\/script', $wasmExec),
|
|
'%%TITLE%%' => htmlspecialchars((string)($cfg['title'] ?? 'phpbox'), ENT_QUOTES),
|
|
]);
|
|
}
|
|
}
|