Port 4ducky to Rust (Axum + SQLite)

Same design, layout, URLs and features as the PHP version: browse grid,
image view with AJAX comments, BBCode, likes, uploads (file, URL and
bookmarklet), quicktagger, profile, block list, inbox, invites, Hall of
Ducks, Truhe, abuse reports and the admin tools.

- Parameterized SQL, escaped templates (askama), argon2 passwords,
  server-side sessions, CSRF tokens on every write, strict script CSP
- SSRF-safe remote image fetching, magic-byte upload checks
- Self-hosted captcha replaces reCAPTCHA v1; analytics/social widgets removed
- Vanilla JS replaces jQuery and its plugins with the same DOM behaviour
- Reverse proxy support (frontend_path, trust_proxy, secure_cookies)
- Admin CLI: admin, settings, invites

See README.md for running it and the full list of changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 02:15:05 +02:00
co-authored by Claude Opus 5.5
parent 664d8c6117
commit d0f2d526df
56 changed files with 11133 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
<p>
To use the remote upload just drag the following link somewhere to your bookmarks (or in Opera right click it
and choose <em>Bookmark link</em>):
&raquo; <a data-bookmarklet="1" href="javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','{{ frontend_path }}media/post.js.php');document.body.appendChild(e)})());"><u>Post to {{ site_name }}</u></a> &laquo;
</p>
<p>
Now, if you're on a website where you see an image you want to post, just click on your newly created bookmark
and then on the image you want to post. Thats all. Really!
</p>
+31
View File
@@ -0,0 +1,31 @@
{%- if !likes.is_empty() %}
<div class="comment" style="border: 1px solid #FFD600;">
<div style="color: #FFD600;font-size: 30px;width:32px;height:32px; float: left; padding-left: 7px;">&hearts;</div>
{%- for lk in likes %}
<a title="ID: {{ lk.user_id }}" href="/user/{{ lk.name_enc }}"><img class="avatarSmall" width="32" height="32" src="/{{ lk.avatar }}"/></a>
{%- endfor %}
</div>
{%- endif %}
{%- for c in comments %}
{%- if c.blocked %}
<br/><a class="quote" style="margin-left: 5px;" href="#" data-toggle="comment{{ c.id }}"><img style="margin-right: 10px; vertical-align:middle;" height="28" width="28" src="/media/xd.png" alt="blocked"/>Comment blocked ({{ c.name }})</a>
<div style="display: none;" id="comment{{ c.id }}">
{%- endif %}
<div id="comment{{ c.id }}" class="comment"{% if c.upload.is_some() %} style="min-height:86px;"{% endif %}>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" valign="top"><a style="{{ c.style }}" title="ID: {{ c.user_id }}" href="/user/{{ c.name_enc }}"><img class="avatarSmall" width="32" height="32" src="/{{ c.avatar }}"/></a></td>
<td valign="top" >
<div class="info" id="unmark" style="float:right;padding-right:5px;"><a href="#content_comment" class="quote" data-requote="{{ c.id }}" data-name="{{ c.name }}">{{ c.howlong }}</a> {% if admin %}<a href="#" data-delcomment="{{ c.id }}">[x]</a>{% endif %}</div><div><a style="{{ c.style }}" title="ID: {{ c.user_id }}" href="/user/{{ c.name_enc }}">{{ c.name }}</a></div>
{%- if let Some(up) = c.upload %}
<div style="float:left;margin-right:10px;"><a href="/{{ up.0 }}" rel="lightbox[more]" title="{{ c.text }}"><img src="/{{ up.1 }}"/></a>
</div>
{%- endif %}
<div id="{{ c.id }}">{{ c.html|safe }}</div></td>
</tr>
</table>
</div>
{%- if c.blocked %}
</div>
{%- endif %}
{%- endfor %}
+14
View File
@@ -0,0 +1,14 @@
{%- for c in items %}
<div id="commentbar">
<a href="/all/view/{{ c.keyword }}">
<div id="commentimg">
<img width="28" height="28" src="/{{ c.avatar }}" />
</div>
<div id="commenttext">
<strong>{{ c.name }}: </strong>{{ c.content }}
</div>
</a>
</div>
{%- endfor %}
+39
View File
@@ -0,0 +1,39 @@
{%- if !errors.is_empty() %}
<ul>
{%- for e in errors %}
<li>{{ e|safe }}</li>
{%- endfor %}
</ul>
{%- else %}
<form id="UForm" action="/upload" method="post" enctype="multipart/form-data" >
<input type="hidden" name="_csrf" value="{{ csrf }}" />
<table width="80%" border="0" cellspacing="1px" cellpadding="0">
<tr>
<td valign="top"><strong>Rules:</strong></td>
<td style="padding-left:3px;" valign="top">Gore, CP, Spam, Nazi, Porn = Ban <br /><br />
</td>
</tr>
<tr>
<td valign="top"><strong>Image:</strong></td>
<td valign="top"><input type="file" name="image" accept="image/jpeg,image/png,image/gif" style="color: #000; background-color: #fff;"/><br /></td>
</tr>
<tr>
<td valign="top"><strong>or Url:</strong></td>
<td valign="top"><input type="text" name="url" value=""/><br /></td>
</tr>
<tr>
<td valign="top"><strong>Comment:</strong></td>
<td valign="top"><textarea id="content_comment" name="ucomment" rows="3" cols="30"></textarea><br /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td align="right"><input type="submit" name="upload" value="Upload" /></td>
</tr>
</table>
<input type="hidden" id="q" value="upload" />
</form>
{%- endif %}