http: Add base HTTP server implementation.

* Add HTTP server base implementation with some basic pages
* Add Jinja2 dependency
* Things are mostly working, except for static resources. Those will
  have to come next.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2023-07-31 18:04:53 -07:00
parent 5f34b353bb
commit c5e7080663
8 changed files with 562 additions and 10 deletions

View File

@@ -0,0 +1,179 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
{% endblock head %}
<title>
{% block title %}
{% endblock title %}
</title>
<style>
body {
background: #ffe linear-gradient(180deg, rgba(254,214,175,1) 0%, rgba(255,255,238,1) 200px) repeat-x;
font-family:helvetica neue,arial,sans-serif;
margin:5px 0;
padding:0 5px;
font-size:13px;
color: maroon;
text-align: center;
}
nav {
position: fixed;
top: 0;
width: 100%;
margin: 5px 0;
text-align: left;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.reply a {
text-decoration: none;
}
header {
text-align: center;
}
#search {
margin: auto;
width: 300px;
margin-bottom: 5px;
}
#search input {
width: 100%;
}
#bans-table {
border-top: 1px solid maroon;
border-left: 1px solid maroon;
border-right: 1px solid maroon;
vertical-align: top;
text-align: center;
margin: auto;
marin-top: 30px;
background-color: #fff;
color: black;
}
#bans-table td {
border-left: 1px solid maroon;
padding: 5px;
vertical-align: top;
}
#bans-table th {
width: auto;
border-left: 1px solid maroon;
background-color: #fca;
font-weight: 700;
padding: 2px;
text-align: center;
}
#bans-table tr {
border-bottom: 1px solid maroon;
}
.constructed-post td:nth-child(1) {
word-break: normal;
width: 50%;
}
.subject {
font-weight: 700;
}
.ws {
color: #000;
}
.ws.reply {
background-color: #d6daf0;
}
.nws.reply {
color: maroon;
background-color: #f0e0d6;
}
.reply {
padding: 5px;
}
.ws .subject {
color: #0f0c5d;
}
.nws .subject {
color: #cc1105;
}
.name-block {
display: inline-block;
}
.name {
color: #117743;
font-weight: 700;
}
.poster-trip {
color: #117743;
font-weight: 400 !important;
}
.file-info {
margin-left: 20px;
}
.file-thumb {
margin: 3px 20px 5px;
}
.file-thumb img {
border: none;
}
.post-message {
margin: 13px 40px;
}
.quote {
color: #789922;
}
</style>
{% block style %}
{% endblock style %}
</head>
<body>
{% block body %}
<header>
{% block header %}
<div id="header">
<h1>4chan bans archive</h1>
<p>
All data is retrieved from <a href="https://www.4chan.org/bans">https://www.4chan.org/bans</a>.
</p>
<p>
This is not a comprehensive list of all bans - only what the moderation team makes public.
</p>
</div>
{% endblock header %}
</header>
<nav>
[ <a href="/bans">Home</a> / <a href="/bans/faq">FAQ</a> ]
</nav>
<main>
{% block main %}
{% endblock main %}
</main>
{% endblock body %}
</body>
</html>

View File

@@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block title %}4chan bans archive FAQ - hiddenservice.cc{% endblock title %}
{% block style %}
<style>
.infobox {
background-color: #fff;
width: 33%;
margin: auto;
padding: 5px;
bottom: 0;
border: 1px solid maroon;
text-align: left;
}
</style>
{% endblock style %}
{% block main %}
<div class="infobox">
<h4>What is this place?</h4>
<p>
<a href="https://www.4chan.org">4chan</a> will periodically (every 15-60
minutes) publish a small list of bans that have been handed out on the
website for transparency. This website exists to archive those bans and
uphold that transparency.
</p>
<h4>What happened to 4bans?</h4>
<p>
4bans is still around. I'm not affiliated with them. Their DNS provider was
having "major issues" - I don't know the full situation. They are still
accessible through their IP address directly:
<a href="http://185.10.68.107:1776">http://185.10.68.107:1776</a>
</p>
</div>
{% endblock %}

View File

@@ -0,0 +1,69 @@
{% extends "base.html" %}
{% block title %}4chan bans archive - hiddenservice.cc{% endblock title %}
{% block main %}
<div id="search">
<form action="" method="get">
<input type="text" name="board" placeholder="Board" value="{{query['board']}}" />
<input type="text" name="reason" placeholder="Reason/rule" value="{{query['reason']}}" />
<input type="text" name="name" placeholder="Name" value="{{query['name']}}" />
<input type="text" name="trip" placeholder="Trip" value="{{query['trip']}}" />
<input type="text" name="com" placeholder="Comment" value="{{query['com']}}" />
<input type="text" name="sub" placeholder="Subject" value="{{query['sub']}}" />
<input type="text" name="md5" placeholder="MD5 Sum" value="{{query['md5']}}" />
<input type="submit" value="Search" />
</form>
</div>
<table id="bans-table">
<thead>
<tr>
<th>Post</th>
<th>Action</th>
<th>Length</th>
<th>Reason</th>
</tr>
</thead>
{% for post in posts %}
<tr class="constructed-post">
<td align="left">
<div class="post reply {% if post['nsfw'] %}nws{% else %}ws{% endif %}">
<div class="post-info">
<input type="checkbox" disabled>
<span class="board"><a href="?board={{post['board']}}">/{{post['board']}}/</a></span>
<span class="subject">{{post['sub']|safe}}</span>
<span class="name-block">
<span class="name">{{post['name']}}</span>
{% if post['trip'] %}
<span class="poster-trip">{{post['trip']}}</span>
{% endif %}
</span>
<span class="date-time">{{post['now']}}</span>
<span class="post-num">No. XXX</span>
</div>
{% if post['thumb_path'] %}
<div class="file">
<div class="file-info">
<span class="file-text">
File: {{post['tim']}}{{post['ext']}}
({{post['fsize']}}, {{post['w']}}x{{post['h']}}, {{post['filename']}}{{post['ext']}})
</span>
</div>
<span class="file-thumb">
<img src="{{post['thumb_path']}}" data-md5="{{post['md5']}}" loading="lazy">
</span>
</div>
{% endif %}
<blockquote class="post-message">
{{post['com']|safe}}
</blockquote>
</div>
</td>
<td>{{post['action']}}</td>
<td>{{post['length']}}</td>
<td>{{post['reason']}}</td>
</tr>
{% endfor %}
</table>
{# pagination #}
{% endblock main %}