Not too janky
This commit is contained in:
parent
f0ab15e3e4
commit
07663b1e74
@ -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,
|
||||
]);
|
||||
});
|
||||
|
||||
|
33
views/pages/willychat/error.php
Normal file
33
views/pages/willychat/error.php
Normal 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>
|
@ -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;
|
||||
|
@ -14,6 +14,7 @@
|
||||
padding: .5rem;
|
||||
background: rgba(0, 0, 0, 0.75);
|
||||
color: white;
|
||||
word-break: break-all;
|
||||
}
|
||||
div > small {
|
||||
color: gray;
|
||||
|
Loading…
Reference in New Issue
Block a user