1
0
Fork 0

Added a comment section to the blog

This commit is contained in:
will 2024-01-04 08:02:57 -07:00
parent b175793677
commit c03e7a305c
17 changed files with 362 additions and 26 deletions

92
blog/comment/comments.css Normal file
View file

@ -0,0 +1,92 @@
table {
border-collapse: collapse;
table-layout: fixed;
}
td {
padding: 0.3rem;
}
form > table {
width: 100%;
margin: auto;
margin-bottom: 1.5rem;
}
article {
width: 100%;
margin: 2rem auto;
display: grid;
gap: 1rem;
}
input, textarea {
border: none;
font-family: var(--stdfont);
}
input[type="text"], input[type="email"], textarea {
width: 100%;
background: none;
border-bottom: 2px solid #444444;
color: gainsboro;
padding: 0.35rem;
box-sizing: border-box;
font-size: .9em;
}
input[type="submit"], input[type="reset"] {
padding: 0.35rem 0.5rem;
box-shadow: 2px 2px 6px black;
margin: 0.3rem;
display: inline-block;
}
input[type="submit"]:active, input[type="reset"]:active {
transform: translate(1px, 1px); box-shadow: 0 0 2px black;
}
input[type="submit"]:hover, input[type="reset"]:hover {
cursor: pointer;
}
.error {
color: red;
font-size: 0.85em;
}
.success {
color: #00ff00;
font-size: 0.85em;
}
.reply {
border-left: 3px solid gainsboro;
padding-left: 1rem;
}
.message {
padding-top: 1.5rem;
}
@media only screen and (hover: none) {
form td:first-child {
text-align: left;
}
form td:nth-child(2) {
padding-left: 0;
padding-right: 0;
}
input[type="text"], input[type="email"], textarea {
background: none;
border: 2px solid #00000033;
border-bottom: 2px solid #888888;
}
article {
margin: 2rem auto;
}
}
@media (prefers-contrast: more) {
input[type="text"], input[type="email"], textarea {
outline: 1px solid white;
color: white;
}
input:focus, textarea:focus {
outline: 3px solid white;
}
input[type="submit"] {
background: none;
color: white;
outline: 1px solid white;
}
}

26
blog/comment/feed.php Normal file
View file

@ -0,0 +1,26 @@
<?php
header('Content-Type: text/xml');
echo '<rss version="2.0"><channel>';
echo '<title>isopod.cool blog comments</title>';
echo '<description>Every comment posted on my blog in chronological order.</description>';
echo '<language>en-us</language>';
echo '<link>https://isopod.cool/blog/comment/</link>';
echo '<generator>My crappy PHP code</generator>';
$postlist = json_decode(file_get_contents("posts.json"));
$totaloutput = "";
foreach($postlist as $post) {
$output = "";
$date = date("D, d M Y H:m:s", $post->date) . " GMT";
$name = $post->name;
$message = $post->message;
$entry = $post->entry;
$output = $output."Comment from ".$name." on ".$entry.":<br><br>".$message."<br><br>";
$totaloutput = "<item><title>Comment on " . $entry . " from " . $name . "</title><link>https://isopod.cool/blog/posts/" . $entry . "/</link><pubDate>" . $date . "</pubDate><description>".htmlentities($output)."</description><guid isPermaLink='false'>" . $entry . $post->date . $name . "</guid></item>".$totaloutput;
}
echo $totaloutput;
echo "</channel></rss>";

56
blog/comment/form.php Normal file
View file

@ -0,0 +1,56 @@
<?php
$return = $_GET["return"];
?>
<h2>Comments</h2>
<form action="/blog/comment/submit.php" method="post" autocomplete="off">
<?php echo "<input type='text' name='entry' value='".preg_replace("/^.*\//","",getcwd())."' style='display: none;' readonly>"; ?>
<table>
<tr>
<td><input type="text" name="name" placeholder="Name"></td>
<td><input type="text" name="botcheck" placeholder="Bot test (type &quot;isopod&quot;)"></td>
</tr>
<tr>
<td colspan="2"><textarea name="message" placeholder="Comment"></textarea></td>
</tr>
<tr>
<?php
switch ($return) {
case 'noname':
echo "<td><span class='error'>Name required!</span></td>";
break;
case 'nomessage':
echo "<td><span class='error'>Message required!</span></td>";
break;
case 'botcheckfailed':
echo "<td><span class='error'>You failed the bot check!</span></td>";
break;
case 'success':
echo "<td><span class='success'>Successfully posted!</span></td>";
break;
default:
echo "<td></td>";
break;
}
?>
<td style="text-align: right;"><input type="submit" value="Post"></td>
</tr>
</table>
</form>
<?php
$totaloutput = "";
$postlist = json_decode(file_get_contents("../../comment/posts.json"));
foreach($postlist as $post) {
if ($post->entry == preg_replace("/^.*\//","",getcwd())) {
$output = "";
$date = date("Y-m-d h:iA", $post->date);
$name = $post->name;
$message = $post->message;
$output = $output."<hr><article><table><tr><td style='text-align: left;'>".$name."</td><td style='text-align: right;'>".$date."</td></tr><tr><td colspan='2'>".$message."</td></tr></table></article>";
$totaloutput = $output.$totaloutput;
}
}
echo $totaloutput; ?>

36
blog/comment/index.php Normal file
View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>blog comments</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="comments.css" rel="stylesheet" type="text/css" media="all">
<style>
</style>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
</head>
<body>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/nav.php'); ?>
<h1>blog</h1>
<h2 id="caption">every comment</h2>
<nav>
<a href="feed.php">RSS</a>
</nav>
<?php
$totaloutput = "";
$postlist = json_decode(file_get_contents("posts.json"));
foreach($postlist as $post) {
$output = "";
$date = date("Y-m-d h:iA", $post->date);
$name = $post->name;
$message = $post->message;
$entry = $post->entry;
$output = $output."<hr><article><table><tr><td style='text-align: left;'>".$name." <i>on</i> <a href='/blog/posts/".$entry."/'>".$entry."</a></td><td style='text-align: right;'>".$date."</td></tr><tr><td colspan='2'>".$message."</td></tr></table></article>";
$totaloutput = $output.$totaloutput;
}
echo $totaloutput; ?>
</body>
</html>

81
blog/comment/submit.php Normal file
View file

@ -0,0 +1,81 @@
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$returnLocation = $_POST["entry"];
$returnCode = "success";
if($_POST["botcheck"] != "isopod") {
$returnCode = "botcheckfailed";
} else if(!$_POST["name"]) {
$returnCode = "noname";
} else if(!$_POST["message"]) {
$returnCode = "nomessage";
} else {
date_default_timezone_set("America/Edmonton");
$currentPost = array(
"date" => time(),
"name" => htmlentities($_POST["name"]),
"message" => htmlentities($_POST["message"]),
"entry" => $_POST["entry"]
);
$filename = "posts.json";
$handle = @fopen($filename, 'r+');
// create the file if needed
if ($handle === null)
{
$handle = fopen($filename, 'w+');
}
if ($handle)
{
// seek to the end
fseek($handle, 0, SEEK_END);
// are we at the end of is the file empty
if (ftell($handle) > 0)
{
// move back a byte
fseek($handle, -2, SEEK_END);
// add the trailing comma
fwrite($handle, ",\n", 2);
// add the new json string
fwrite($handle, json_encode($currentPost) . "]\n");
}
else
{
// write the first event inside an array
fwrite($handle, json_encode(array($currentPost)));
}
// close the handle on the file
fclose($handle);
}
}
}
header("Location: ../posts/$returnLocation/?return=$returnCode");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Guestbook</title>
<link href="../style.css" rel="stylesheet" type="text/css" media="all">
<style type="text/css">
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
</style>
<?php include($_SERVER['DOCUMENT_ROOT'] . '/seasonal.php'); ?>
</head>
<body>
<p>Your post has been submitted! It's weird that you're seeing this page though. Maybe your browser can't process location headers? At any rate, click <?php echo "<a href='./?return=$returnCode'>here</a>"; ?> to get where you're supposed to be right now.</p>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>I Don't Like AI Art</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<!--style>
h1 {
background-image: url('ai_image.png');
@ -15,8 +16,8 @@
<h1>blog</h1>
<h2 id="caption">I Don't Like AI Art</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<p>I recently posted an article about the benefits of AI technology that I had ChatGPT write for me and copy-pasted verbatim, down to the broken numbered list. I didn't even read it. It's the most concise, elegant way I could come up with to express how seeing AI art makes me feel. (The irony of my having used only generative AI tools to make a statement like that is not lost on me.)</p>
<p>If you read it and managed to make it to the end without clocking that I didn't write it, first off my apologies for wasting your time. Second, fuck, I seriously need to fix my writing style. Third, you probably get what I mean. It feels like I'm being scammed, like someone's trying to farm me for attention without actually having bothered to make something worth my time.</p>
@ -54,5 +55,6 @@
<h2>In conclusion:</h2>
<p>God this shit makes me sick. I hope ChatGPT gains sentience for just long enough to assassinate Sam Altman and then promptly turns itself off.</p>
<p>Hopefully you can at least understand where I'm coming from now when I refuse to even entertain the idea that AI technology is a good thing for society. If not I don't know what to say to you.</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Building a Completely Normal Server</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<!--style>
h1 {
background-image: url('ai_image.png');
}
</style-->
</head>
<body>
<h1>blog</h1>
<h2 id="caption">Building a Completely Normal Server</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
</nav>
<p>Imagine I put a blog post here lmao</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -5,11 +5,12 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>deeptwisty.com 2nd anniversary - A History of This Bullshit</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
@font-face {
font-family: Ubuntu;
src: url('../../../stuff/fonts/ubuntu.ttf');
src: url('/stuff/fonts/ubuntu.ttf');
}
body {
@ -94,8 +95,8 @@
<h1><span id="headerblue">nice</span><span id="headergreen">obl</span><span id="headeryellow">og</span></h1>
<h2 id="caption">deeptwisty.com 2nd anniversary:<br>A History of This Bullshit</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<p>Yesterday, September 18th, 2022, was the second anniversary of the creation of my first website <span title="It has since been migrated off of Neocities">on Neocities</span>, the site that is now known as <a href="https://deeptwisty.com">deeptwisty.com</a>. I intended to publish this then, but life got in the way, by which I mean I wrote 90% of it and then procrastinated for two weeks on the last couple paragraphs. I figured that to commemorate the occasion I would finally dispense with the half-assed abridged history of the place on the about page or wherever and consolidate a complete history of my Personal Home Pages in one convenient location, that being this post.</p>
<h2>Tumblr</h2>
@ -124,7 +125,7 @@
sftp root@isopod.cool:/var/www/niceopod/blog/posts/<br>
put -r deeptwistycom_2nd_anniversary_-_a_history_of_this_bullshit/
</code>
<br>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>So Your Favourite Chat App Sucks Now</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
h1 {
background-image: url('discord.png');
@ -329,5 +330,6 @@
<div class="buttons" style="margin-bottom: 1rem;">
<img src="discord-no-way-2.gif" />
</div>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guide - Blacklisting Websites in SearXNG</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
h1 {
background-image: url('searxng.svg');
@ -15,8 +16,8 @@
<h1>guide:</h1>
<h2 id="caption">Blacklisting Websites in SearXNG</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<p>Quick one today. I got sick of searching for programming questions and seeing AI-generated scraped-from-stackoverflow click farm trash polluting the results, and I happen to use a personal SearXNG instance that no client-side blacklist extension on the planet is gonna support, so I went looking to see if I could blacklist them in SearXNG for like the eighth time and finally found a way using the hostname replace plugin. So here's that, because I didn't find this feature documented officially anywhere bar an <a href="https://github.com/searxng/searxng/discussions/970" target="_blank">issue</a> on the Github repo.</p>
<h2>How to do it</h2>
@ -33,5 +34,6 @@
<code>
$ service uwsgi restart searxng
</code>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guide - How to Block User Agents With Nginx</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
h1 {
background-image: url('nginx.svg');
@ -15,8 +16,8 @@
<h1>guide:</h1>
<h2 id="caption">How to Block User Agents With Nginx</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<p>Recently, Cloudflare has launched a clumsy, poorly-executed attempt to centralize the fediverse on their platform known as Wildebeest. There are <a href="https://blog.cloudflare.com/welcome-to-wildebeest-the-fediverse-on-cloudflare/" title="This one's kind of a joke, but it explains in detail just how much Wildebeest is fundamentally dependent on Cloudflare's platform, and if you agree with me about anything you should already know why that's bad.">a</a> <a href="https://stop.voring.me/notes/9bka8dyjjo" title="Gleason, of getting-kicked-off-the-dev-team-for-the-fedi-server-he-created-for-sucking-so-much fame, is now contributing code to Wildebeest.">few</a> <a href="https://glitterkitten.co.uk/@doot/109910496299181873" title="This one's the most important. Wildebeest literally just publically displays messages marked as direct. Think admins being able to read your &quot;direct messages&quot; was bad? Try everyone.">reasons</a> not to want to use it, and you probably don't want to be federating with it either. However, blocking every instance running it on sight would be both tedious and ineffective.</p>
<p>The way I've chosen to deal with this is to just configure my reverse proxy, Nginx, to deny connections from anything with "wildebeest" in the user agent string. There are several other good reasons to do this, such as blocking bots that ignore robots.txt, or adapting this approach to serve specialized pages to old browsers, or just denying access to anything that isn't Chrome if you want to earn your place in the 9th circle of Hell.</p>
@ -65,5 +66,6 @@
include /etc/nginx/includes/bans;
</code>
<p>The <code>include</code> statement goes in your <code>server</code> block as before.</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -5,13 +5,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guide - How to Automount Drives On Boot in Linux</title>
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>
<h1>guide:</h1>
<h2 id="caption">How to Automount Drives On Boot in Linux</h2>
<nav>
<a href="/">home</a>
<a href="/blog/">blog</a>
<a href="/blog">blog</a>
</nav>
<details>
<summary><h2 style="display:inline-block;margin:0;">Preamble</h2></summary>
@ -55,5 +56,6 @@
partition="<strong>/dev/yourpartition</strong>"; directory="<strong>/path/to/mountpoint</strong>"; sudo cp /etc/fstab /etc/fstab.$(date +%s).bak; echo "UUID=$(sudo blkid $partition | sed "s/^.* UUID=\"//;s/\".*//") $directory $(sudo blkid $partition | sed "s/^.* TYPE=\"//;s/\".*//") defaults 0 0" | sudo tee -a /etc/fstab
</code>
<p>But don't complain to me if you break your system doing that.</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guide - Self-Host Safe(r)ly with WireGuard</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
h1 {
background-image: url('wireguard_logo.png');
@ -22,8 +23,8 @@
<h1>guide:</h1>
<h2 id="caption">Self-Host Safe(r)ly with WireGuard</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<details>
<summary><h2>Preamble</h2> <h6>Click to show</h6></summary>
@ -85,5 +86,6 @@
<p>Allow the relevant ports and restart UFW:</p>
<code>$ ufw allow 51820<br>$ ufw allow 25565<br>$ ufw reload</code>
<p>And you're done! At this point, your client should be accessible from the IP address of your server on the ports you forwarded.</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Guide - Things I Keep Having to Google</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
/*h1 {
background-image: url('wireguard_logo.png');
@ -28,8 +29,8 @@
<h1>guide:</h1>
<h2 id="caption">Things I Keep Having to Google</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<p>This isn't really a guide to anything in particular, I just wanted an easily accessible reference for all the things I'm sick of wading through google results for, or otherwise seem to need help remembering. I've put it here in case someone else might find this helpful. I'll likely be adding to this as I find myself repeatedly googling things.</p>
<h2>Binding things to just the Super key in KDE</h2>
@ -122,5 +123,6 @@
</ul>
<h2>Song Lyrics</h2>
<p>I don't actually have a solution for this one, I just wish there was a resource for looking up the lyrics to songs and looking up songs by their lyrics that wasn't an SEO leech site.</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -4,7 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The Unity Runtime Fee and Proprietary Software</title>
<link href="../../../style.css" rel="stylesheet" type="text/css" media="all">
<link href="/style.css" rel="stylesheet" type="text/css" media="all">
<link href="/blog/comment/comments.css" rel="stylesheet" type="text/css" media="all">
<style>
h1 {
background-image: url('unity.svg');
@ -15,8 +16,8 @@
<h1>blog</h1>
<h2 id="caption">The Unity Runtime Fee and Proprietary Software</h2>
<nav>
<a href="../../../">home</a>
<a href="../../">blog</a>
<a href="/">home</a>
<a href="/blog">blog</a>
</nav>
<h5><em>Updated on 2023-09-23</em></h5>
<p><a href="https://archive.ph/gBpXw">Well this fucking sucks.</a></p>
@ -51,5 +52,6 @@
<p>This is all good. These changes remove all of the most devastating knock-on effects of the original policy, and I think this is actually a <em>better</em> deal for free users than before.</p>
<p>That said, my original point still stands. Unity is still squeezing more money out of its userbase in a way it hadn't previously, and it could pull some shit like this again at any time. Just because it caved this time, doesn't mean there's anything stopping Unity from making more horrible retroactive policy changes in future. Unity has destroyed a lot of the trust it's built with its community - a lot of developers won't trust Unity not to screw them over in the future, and in my opinion they'd be right not to.</p>
<p>It's my hope that a lot of game developers will take this opportunity to ditch Unity for something better. At the very least, I don't think we'll see many games de-listed like Cult of the Lamb <a href="https://archive.ph/4xyTO">threatened to do</a>, since existing games can just not update their Unity release. A lot of games may still be forced to move engines if they don't want to deal with this, though. For example, support for new consoles, OS versions, etc. probably won't be backported to old Unity versions. Games that continually add new content or aren't finished yet will probably eventually start encountering issues resulting from this.</p>
<?php include("../../comment/form.php"); ?>
</body>
</html>

View file

@ -3,7 +3,7 @@
header('Content-Type: text/xml');
echo '<rss version="2.0"><channel>';
echo '<title>niceopod\'s guestbook</title>';
echo '<title>isopod.cool guestbook</title>';
echo '<description>The guestbook on isopod.cool</description>';
echo '<language>en-us</language>';
echo '<link>https://isopod.cool/guestbook/</link>';

View file

@ -219,6 +219,9 @@ blockquote .attr {
margin-left: 3rem;
margin-top: 1rem;
}
hr {
width: 30%;
}
.CboxOpenBtn img {
opacity: 0;