diff --git a/public/static/img/tower.gif b/public/static/img/tower.gif new file mode 100644 index 0000000..6683b0a Binary files /dev/null and b/public/static/img/tower.gif differ diff --git a/public/static/style/main.css b/public/static/style/main.css index 63ac1d4..2708257 100644 --- a/public/static/style/main.css +++ b/public/static/style/main.css @@ -22,7 +22,7 @@ a { } h1 { - border-bottom: 4px double yellow; + border-bottom: .25rem double yellow; color: yellow; } @@ -31,14 +31,14 @@ img { max-width: 100%; } -pre, code { +code { + display: block; + max-width: min-content; margin: auto; font-family: monospace; background: black; color: greenyellow; - padding: 8px; - max-width: min-content; - display: block; + padding: .75rem; overflow-x: auto; overflow-y: hidden; } \ No newline at end of file diff --git a/routes/start.php b/routes/start.php index 72ed9e3..d958b94 100644 --- a/routes/start.php +++ b/routes/start.php @@ -9,6 +9,10 @@ ErrorHandler::register(function($error_messages) { Route::get('/', fn() => view('pages/home')); +Route::group(function() { + require __DIR__ . '/willychat.php'; +}); + Route::get('/test/$whatever?', function($whatever = 'Default Value') { echo htmlspecialchars($whatever); }); diff --git a/routes/willychat.php b/routes/willychat.php new file mode 100644 index 0000000..0e53dc2 --- /dev/null +++ b/routes/willychat.php @@ -0,0 +1,77 @@ + 10) { + array_pop(WillyChat::$messages); + } + + if (!empty(trim($text, ' '))) { + + array_unshift(WillyChat::$messages, [ + 'nick' => $nick, + 'date' => time(), + 'text' => $text + ]); + + file_put_contents(WillyChat::$data_path, + json_encode( + WillyChat::$messages + ) + ); + } + + $just_sent_message = true; + } + + view('pages/willychat/index', [ + 'nick' => $nick, + 'just_sent_message' => $just_sent_message + ]); +}); + +Route::get('/willychat/messages', function() { + view('pages/willychat/messages', [ + 'messages' => WillyChat::$messages + ]); +}); + +Route::get('/willychat/sync', function() { + json_response( + hash('crc32', serialize(WillyChat::$messages)) + ); +}); \ No newline at end of file diff --git a/views/pages/home.php b/views/pages/home.php index ec3b59e..29be2ae 100644 --- a/views/pages/home.php +++ b/views/pages/home.php @@ -40,8 +40,12 @@ +
Having a problem?
+Send me a nice and positive message on matrix: @william:willy.club
+We love you! xoxo
+=htmlspecialchars($message['text'])?>
+Racism not allowed