chore: add docker infrastructure, gists feature, attachment system, and admin CLI tools
- Add .dockerignore, Dockerfile, and docker compose targets to Makefile for containerized deployment - Implement gists router with CRUD operations, database schema, and polymorphic comment/vote reuse - Create attachment upload system with thumbnail generation, MIME detection, and storage path management - Add attachments_prune CLI command to clean orphaned attachment records and files - Introduce rate limiting middleware with 60 requests per minute window - Add custom 404 and 500 error handlers with SEO-optimized template responses - Extend database initialization with gists and attachments indexes plus upload site settings defaults - Update load_comments to include attachment mapping for comment resources - Register gists and uploads routers in main application and update AGENTS.md documentation
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<h3>Comments</h3>
|
||||
|
||||
{% macro render_comment(item, depth=0) %}
|
||||
<div class="comment" style="margin-left: {{ depth * 1.5 }}rem;">
|
||||
<div class="comment" style="margin-left: {{ depth * 1.5 }}rem;" data-depth="{{ depth }}">
|
||||
<div class="comment-votes">
|
||||
<form method="POST" action="/votes/comment/{{ item.comment['uid'] }}">
|
||||
<input type="hidden" name="value" value="1">
|
||||
@@ -18,17 +18,21 @@
|
||||
<div class="comment-body" data-comment-uid="{{ item.comment['uid'] }}">
|
||||
<div class="comment-header">
|
||||
<a href="/profile/{{ item.author['username'] if item.author else '#' }}">
|
||||
<img src="{{ avatar_url('multiavatar', item.author['username'] if item.author else '?', 24) }}" class="avatar-img" style="width: 24px; height: 24px; border-radius: 50%;" alt="{{ item.author['username'] if item.author else '?' }}" loading="lazy">
|
||||
<img src="{{ avatar_url('multiavatar', item.author['username'] if item.author else '?', 24) }}" class="avatar-img avatar-24" alt="{{ item.author['username'] if item.author else '?' }}" loading="lazy">
|
||||
</a>
|
||||
<a href="/profile/{{ item.author['username'] if item.author else '#' }}" class="comment-author">{{ item.author['username'] if item.author else 'Unknown' }}</a>
|
||||
<span class="comment-time">{{ item.time_ago }}</span>
|
||||
</div>
|
||||
<div class="comment-text rendered-content" data-render>{{ item.comment['content'] }}</div>
|
||||
{% set attachments = item.get('attachments', []) %}
|
||||
{% if attachments %}
|
||||
{% include "_attachment_display.html" %}
|
||||
{% endif %}
|
||||
<div class="comment-actions">
|
||||
<button class="comment-action-btn">Reply</button>
|
||||
<button class="comment-action-btn"><span class="icon">💬</span>Reply</button>
|
||||
{% if user and item.comment['user_uid'] == user['uid'] %}
|
||||
<form method="POST" action="/comments/delete/{{ item.comment['uid'] }}" style="display:inline;">
|
||||
<button type="submit" class="comment-action-btn">Delete</button>
|
||||
<form method="POST" action="/comments/delete/{{ item.comment['uid'] }}" class="inline-form">
|
||||
<button type="submit" class="comment-action-btn"><span class="icon">🗑️</span>Delete</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -47,7 +51,7 @@
|
||||
{% for item in comments %}
|
||||
{{ render_comment(item, 0) }}
|
||||
{% else %}
|
||||
<p style="color: var(--text-muted); font-size: 0.875rem; text-align: center; padding: 2rem 0;">No comments yet. Start the discussion.</p>
|
||||
<p class="no-comments-msg">No comments yet. Start the discussion.</p>
|
||||
{% endfor %}
|
||||
|
||||
{% if user %}
|
||||
@@ -57,9 +61,13 @@
|
||||
<a href="/profile/{{ user['username'] }}">
|
||||
<img src="{{ avatar_url('multiavatar', user['username'], 32) }}" class="avatar-img avatar-sm" alt="{{ user['username'] }}" loading="lazy">
|
||||
</a>
|
||||
<textarea name="content" placeholder="Your opinion goes here..." required maxlength="1000" class="emoji-picker-target"></textarea>
|
||||
<textarea name="content" placeholder="Your opinion goes here..." required maxlength="1000" class="emoji-picker-target" data-mention></textarea>
|
||||
<div class="attachment-upload-container" data-attachment-upload
|
||||
data-max-size="{{ max_upload_size_mb() }}"
|
||||
data-max-files="{{ max_attachments_per_resource() }}"
|
||||
data-allowed-types="{{ allowed_file_types() }}"></div>
|
||||
<div class="comment-form-actions">
|
||||
<button type="submit" class="comment-form-submit">Post</button>
|
||||
<button type="submit" class="comment-form-submit"><span class="icon">📤</span>Post</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user