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:
@@ -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); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user