Not too janky

This commit is contained in:
William 2023-01-22 13:17:50 +01:00
parent f0ab15e3e4
commit 07663b1e74
4 changed files with 50 additions and 4 deletions

View File

@ -36,6 +36,20 @@ Route::match('get|post','/willychat/', function() {
$nick = $default_nick;
}
if (strlen($nick) > 128) {
view('pages/willychat/error', [
'error' => 'You nickname is too long.'
]);
die();
}
if (strlen($text) > 4096) {
view('pages/willychat/error', [
'error' => 'Do not send extremely long messages.'
]);
die();
}
if (count(WillyChat::$messages) > 10) {
array_pop(WillyChat::$messages);
}
@ -60,7 +74,7 @@ Route::match('get|post','/willychat/', function() {
view('pages/willychat/index', [
'nick' => $nick,
'just_sent_message' => $just_sent_message
'just_sent_message' => $just_sent_message,
]);
});

View File

@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>What are you doing?</title>
<link rel="stylesheet" href="<?=url('/static/style/fonts.css')?>">
</head>
<body>
<style>
#errordialog {
background: tomato;
color: white;
background: rgba(0, 0, 0, 0.75);
padding: .75rem;
border: 1px solid #aaa;
}
a {
color: #0f0;
}
</style>
<div id="errordialog">
<h2><?=$error?></h2>
<a href="">I understand.</a>
</div>
</body>
</html>

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="<?=url('/static/style/fonts.css')?>">
<title>WillyChat</title>
</head>
<body>
@ -16,9 +17,6 @@
display: flex;
flex-flow: column;
color: white;
font-size: 1rem;
font-family: Iowan Old Style, Apple Garamond, Baskerville, Times New Roman, Droid Serif, Times, Source Serif Pro, serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
}
body .messages {
flex: 1 1 auto;

View File

@ -14,6 +14,7 @@
padding: .5rem;
background: rgba(0, 0, 0, 0.75);
color: white;
word-break: break-all;
}
div > small {
color: gray;