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:
@@ -73,7 +73,10 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
$c['unread'] = $unread;
|
||||
$chans[] = $c;
|
||||
}
|
||||
echo json_encode(['ok' => true, 'me' => vv_nc_me(), 'channels' => $chans]);
|
||||
// Hostnames alongside the ids, so the card can show "unRAID-Jayred36" or "HOST2" without a
|
||||
// second request — the mapping is master.conf's and the page should not be guessing it.
|
||||
echo json_encode(['ok' => true, 'me' => vv_nc_me(), 'channels' => $chans,
|
||||
'hostnames' => vv_known_hosts()]);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -85,8 +88,12 @@ if ($action === 'send') {
|
||||
$text = (string)($_POST['text'] ?? '');
|
||||
if (trim($text) === '') { echo json_encode(['ok' => false, 'error' => 'Nothing to send']); exit; }
|
||||
$msg = vv_nc_send($ch, $text, [
|
||||
'color' => (string)($_POST['color'] ?? ''),
|
||||
'font' => (string)($_POST['font'] ?? ''),
|
||||
'color' => (string)($_POST['color'] ?? ''),
|
||||
'font' => (string)($_POST['font'] ?? ''),
|
||||
'size' => (string)($_POST['size'] ?? ''),
|
||||
'bold' => !empty($_POST['bold']),
|
||||
'italic' => !empty($_POST['italic']),
|
||||
'underline' => !empty($_POST['underline']),
|
||||
]);
|
||||
if (!$msg) { echo json_encode(['ok' => false, 'error' => 'Could not store message']); exit; }
|
||||
// Queued is not failed — say which, so a partner being asleep reads as pending rather than
|
||||
|
||||
Reference in New Issue
Block a user