diff --git a/404.png b/404.png new file mode 100644 index 0000000..53d7869 Binary files /dev/null and b/404.png differ diff --git a/api.php b/api.php index c49604a..9444fab 100644 --- a/api.php +++ b/api.php @@ -1,8 +1,5 @@ - -{ - "posts": [ -intval($res["PostID"]), "username"=>$res["Username"], "time"=>$res["Time"], "message"=>str_replace("\r", "", $res["Message"]), "imageURL"=>test_input($res["ImageURL"]))); } + +echo json_encode(array("posts"=>$posts), JSON_PRETTY_PRINT); ?> - ] -} diff --git a/creds.php b/creds.php index 8ecdac6..45b0edc 100644 --- a/creds.php +++ b/creds.php @@ -1,9 +1,10 @@ diff --git a/css/style.css b/css/style.css index 7fc6a07..1b72da1 100644 --- a/css/style.css +++ b/css/style.css @@ -1,16 +1,57 @@ +/* colorscheme independent rules */ body { - background-color: #D0D0D0; font-family: monospace; + margin: 0; + padding: 0; + padding-bottom: 5px; + width: 70%; + margin: auto; + box-shadow: 0px 0px 15px #000000; +} +@media screen and (max-width: 1200px) { + body { + width: 80%; + } +} +@media screen and (max-width: 900px) { + body { + width: 100%; + } +} +img.image { + max-width: 100%; } table, th, td { - border: 1px solid #000000; - background-color: #EEEEEE; font-size: 10pt; margin: auto; } +input { + font-family: monospace; +} +.navbar { + padding: 3px; + font-size: 15pt; +} .logotable { border: 0px; - background-color: #D0D0D0; +} +span.message { + white-space: pre-line; + text-overflow: ellipsis; + overflow-wrap: break-word; + max-width: 100%; +} +hr { + border: 0px none #000000; + border-top: 1px solid #EEEEEE; + margin: 5px; +} +div.message { + margin: 5px; + padding: 5px; + width: fit-content; + max-width: 100%; + display: block; } .center { margin: auto; @@ -18,36 +59,167 @@ table, th, td { .text-center { text-align: center !important; } -.navbar { - border: 1px solid #000000; - background-color: #EEEEEE; - padding: 3px; -} a { text-decoration: none; + transition: 0.1s; +} +.navbar { + border: 0; + position: -webkit-sticky; /* safari */ + position: sticky; + top: 0; + box-shadow: 0px 0px 5px #000000; + height: fit-content; + padding: 0; +} +.navbutton { + border-top: 0px; + border-bottom: 0px; + height: 100%; + padding: 5px; + padding-top: 0px; + padding-bottom: 0px; + transition: 0.1s; + vertical-align: middle; } -span#id { - color: #2c49c9 !important; +/* light theme fallback */ +html { + background-color: #c0c0c0; } -span#name{ +body { + background-color: #D0D0D0; +} +table, th, td { + border: 1px solid #000000; + background-color: #EEEEEE; +} +.navbar { + border-bottom: 1px solid #000000; + background-color: #EEEEEE; +} +.navbutton { + color: #000000; + border: 1px solid #000000; +} +.navbutton:hover { + color: #ffffff; + background-color: #000000; +} +.navbutton:first-of-type:not(#floatright) { + border-left: 1px solid #000000; + border-right: 0px; +} +.navbutton:last-of-type#floatright { + border-left: 0px solid #000000; + border-right: 1px solid #000000; +} +.logotable { + background-color: #D0D0D0; +} + +span.id { + color: #2c49c9; +} +span.name{ color: #1c8757; } -span#date { +span.date { color: #727272; } -span#message { - color: #000000; - white-space: pre-line; - text-overflow: ellipsis; - overflow-wrap: break-word; - max-width: 100%; +a.sharebutton { + color: #727272; } -div#message { +a.sharebutton:hover { + color: #000000; +} +span.you { + color: #373737; +} +span.message { + color: #000000; +} +div.message { background-color: #EEEEEE; border: 1px solid #000000; - padding: 5px; - width: fit-content; - max-width: 100%; - display: block; +} +textarea, input { + background-color: #ffffff; + border: 1px solid #000000; + color: #000000; +} + +/* dark theme */ +@media (prefers-color-scheme: dark) { + html { + background-color: #101010; + } + body { + background-color: #141414; + color: #ffffff; + } + a { + color: #4fb1dc; + } + a:hover { + color: #89cff0; + } + table, th, td { + border: 1px solid #111111; + background-color: #1f1f1f; + } + .navbar { + border-bottom: 1px solid #111111; + background-color: #1f1f1f; + } + .navbutton { + color: #ffffff; + border: 1px solid #111111; + } + .navbutton:hover { + color: #000000; + background-color: #ffffff; + } + .navbutton:first-of-type:not(#floatright) { + border-left: 1px solid #111111; + border-right: 0px; + } + .navbutton:last-of-type#floatright { + border-left: 0px solid #111111; + border-right: 1px solid #111111; + } + .logotable { + background-color: #00000000; + } + + span.id { + color: #1f8fb9; + } + span.name{ + color: #55bb84; + } + span.date { + color: #727272; + } + a.sharebutton { + color: #727272; + } + a.sharebutton:hover { + color: #ffffff; + } + span.you { + color: #c0c0c0; + } + span.message { + color: #ffffff; + } + div.message { + background-color: #1f1f1f; + border: 1px solid #111111; + } + textarea, input { + background-color: #1f1f1f; + border: 1px solid #111111; + color: #ffffff; + } } diff --git a/image_proxy.php b/image_proxy.php new file mode 100644 index 0000000..5506aa1 --- /dev/null +++ b/image_proxy.php @@ -0,0 +1,54 @@ + $lh) return false; + return substr($haystack, 0, $ln) == $needle; +} + +$i = @$_GET["i"]; +if (!isset($_GET["i"])) { + http_response_code(400); + die("no image url"); +} +$c = curl_init($i); +curl_setopt($c, CURLOPT_FOLLOWLOCATION, false); + +$clear = false; +$buffer = array(); +curl_setopt($c, CURLOPT_HEADERFUNCTION, function($c, $h) { + global $clear, $buffer; + if (!$clear) { + if (str_starts_with(strtolower($h), "content-type:")) { + $i = explode(" ", str_replace("\r\n", "", $h)); + if (str_starts_with($i[count($i) - 1], "image/")) { + $clear = true; + for($j = 0; $j < count($buffer); $j++) { + header($buffer[$j]); + } + header($h); + } elseif (str_starts_with($i[count($i) - 1], "video/")) { + header("Location: /rautafarmi/video-file.png"); + die(); + } else { + http_response_code(302); + header("Location: /rautafarmi/404.png"); + die(); + } + } + else array_push($buffer, $h); + } + else header($h); + return strlen($h); +}); +curl_exec($c); +if (curl_error($c) != "") { + http_response_code(302); + header("Location: /rautafarmi/404.png"); +} +curl_close($c); diff --git a/index.php b/index.php index 548ec79..bdb32a7 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,20 @@ + + +