Moderation: Bilder hinter einen Hinweis legen

Manche Bilder verstoßen gegen keine Regel, müssen aber nicht jedem
ungefragt begegnen. kver cover-image <pid> <hinweis> legt eine stark
verpixelte Variante an (12 Blöcke an der langen Kante) und speichert den
Hinweis am Beitrag; das Frontend zeigt dann die Variante mit Hinweis und
"Inhalt anzeigen" und lädt das Bild selbst erst nach dem Klick.
kver uncover-image nimmt beides zurück.

Löschen von Beitrag oder Konto räumt die Variante mit ab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 21:07:49 +01:00
co-authored by Claude Opus 5.5
parent 532a2ba276
commit d08d16f7a0
14 changed files with 325 additions and 15 deletions
+11 -7
View File
@@ -16,11 +16,15 @@ import (
)
type Entry struct {
PID int64 `json:"pid"`
UID int64 `json:"uid"`
CreatedAt int64 `json:"created_at"`
Content string `json:"content"`
Filepath string `json:"filepath"`
PID int64 `json:"pid"`
UID int64 `json:"uid"`
CreatedAt int64 `json:"created_at"`
Content string `json:"content"`
Filepath string `json:"filepath"`
// ImageWarning steht vor dem Bild; ImageCover ist dann seine verpixelte
// Variante, die das Frontend zuerst zeigt.
ImageWarning string `json:"image_warning,omitempty"`
ImageCover string `json:"image_cover,omitempty"`
ReplyTo int64 `json:"reply_to"`
ReplyCount int64 `json:"reply_count"`
LastActivity int64 `json:"last_activity"`
@@ -72,7 +76,7 @@ var (
// [deleted]-Platzhalter erhalten bleiben und Threads nicht verwaisen.
const entrySelect = `
SELECT e.pid, e.uid, e.created_at, e.content, e.filepath,
e.reply_to, e.reply_count, e.last_activity, e.deleted,
e.image_warning, e.image_cover, e.reply_to, e.reply_count, e.last_activity, e.deleted,
e.bump_count, e.last_bump,
COALESCE(u.handle, ''), COALESCE(u.display_name, ''), COALESCE(u.avatar, ''),
COALESCE(lp.url, ''), COALESCE(lp.kind, ''), COALESCE(lp.title, ''),
@@ -92,7 +96,7 @@ func scanEntry(row interface{ Scan(...any) error }) (Entry, error) {
var status string
var mentions []byte
err := row.Scan(&e.PID, &e.UID, &e.CreatedAt, &e.Content, &e.Filepath,
&e.ReplyTo, &e.ReplyCount, &e.LastActivity, &e.Deleted,
&e.ImageWarning, &e.ImageCover, &e.ReplyTo, &e.ReplyCount, &e.LastActivity, &e.Deleted,
&e.BumpCount, &e.LastBump, &e.Handle, &e.DisplayName, &e.Avatar,
&p.URL, &p.Kind, &p.Title, &p.Site, &p.Thumb, &status, &mentions)
if err == nil && mentions != nil {