Mesh chat: autoscroll toggle, hostname/slot toggle, and a formatting row behind one button

Style validation moves to one shared function so the sender and receiver cannot drift on what a style is.
This commit is contained in:
Gmer4Lfe
2026-08-17 16:51:17 -04:00
parent ecded4a8a7
commit d88fe381db
4 changed files with 161 additions and 35 deletions
+1 -4
View File
@@ -59,10 +59,7 @@ $clean = [
'from' => preg_replace('/[^a-z0-9]/i', '', strtolower((string)($msg['from'] ?? ''))),
'kind' => in_array($msg['kind'] ?? 'msg', ['msg', 'question', 'notice'], true) ? $msg['kind'] : 'msg',
'text' => mb_substr((string)$msg['text'], 0, 4000),
'style' => [
'color' => preg_match('/^#[0-9a-f]{6}$/i', $msg['style']['color'] ?? '') ? $msg['style']['color'] : '',
'font' => in_array($msg['style']['font'] ?? '', ['mono','sans','serif'], true) ? $msg['style']['font'] : '',
],
'style' => vv_nc_clean_style(is_array($msg['style'] ?? null) ? $msg['style'] : []),
];
if ($clean['id'] === '' || $clean['from'] === '') { fwrite(STDERR, "malformed message\n"); exit(2); }