forked from retoor/devplacepy
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:
@@ -3,6 +3,7 @@
|
||||
<link rel="stylesheet" href="/static/css/feed.css">
|
||||
<link rel="stylesheet" href="/static/css/profile.css">
|
||||
<link rel="stylesheet" href="/static/css/projects.css">
|
||||
<link rel="stylesheet" href="/static/css/gists.css">
|
||||
<style>
|
||||
.hidden { display: none !important; }
|
||||
</style>
|
||||
@@ -40,7 +41,7 @@
|
||||
<span>{{ profile_user.get('xp', 0) % 100 }}%</span>
|
||||
</div>
|
||||
<div class="bar">
|
||||
<div class="bar-fill" style="width: {{ profile_user.get('xp', 0) % 100 }}%"></div>
|
||||
<div class="bar-fill" style="width: {{ profile_user.get('xp', 0) % 100 }}%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -54,15 +55,15 @@
|
||||
</div>
|
||||
|
||||
{% if user and user['uid'] != profile_user['uid'] %}
|
||||
<div style="margin-top: 1rem; display: flex; flex-direction: column; gap: 0.5rem;">
|
||||
<a href="/messages?with_uid={{ profile_user['uid'] }}" class="btn btn-secondary btn-sm" style="width: 100%; justify-content: center;">Send Message</a>
|
||||
<div class="profile-actions">
|
||||
<a href="/messages?with_uid={{ profile_user['uid'] }}" class="btn btn-secondary btn-sm full-width justify-center"><span class="icon">✉️</span>Send Message</a>
|
||||
{% if is_following %}
|
||||
<form method="POST" action="/follow/unfollow/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-secondary btn-sm" style="width: 100%;">Unfollow</button>
|
||||
<button type="submit" class="btn btn-secondary btn-sm full-width"><span class="icon">➖</span>Unfollow</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form method="POST" action="/follow/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-primary btn-sm" style="width: 100%;">Follow</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm full-width"><span class="icon">➕</span>Follow</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -73,49 +74,49 @@
|
||||
<form method="POST" action="/profile/update">
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Bio</span>
|
||||
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value bio-display" id="display-bio">{{ profile_user.get('bio', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="bio">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden" id="input-bio" style="margin-bottom: 0.5rem;">
|
||||
<textarea name="bio" maxlength="500" rows="2" style="font-size: 0.8125rem;">{{ profile_user.get('bio', '') }}</textarea>
|
||||
<div class="auth-field hidden input-edit-field" id="input-bio">
|
||||
<textarea name="bio" maxlength="500" rows="2" class="input-sm">{{ profile_user.get('bio', '') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Location</span>
|
||||
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value" id="display-location">{{ profile_user.get('location', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="location">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden" id="input-location" style="margin-bottom: 0.5rem;">
|
||||
<input type="text" name="location" maxlength="200" value="{{ profile_user.get('location', '') }}" style="font-size: 0.8125rem;">
|
||||
<div class="auth-field hidden input-edit-field" id="input-location">
|
||||
<input type="text" name="location" maxlength="200" value="{{ profile_user.get('location', '') }}" class="input-sm">
|
||||
</div>
|
||||
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Git Link</span>
|
||||
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value" id="display-git_link">{{ profile_user.get('git_link', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="git_link">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden" id="input-git_link" style="margin-bottom: 0.5rem;">
|
||||
<input type="url" name="git_link" maxlength="500" value="{{ profile_user.get('git_link', '') }}" style="font-size: 0.8125rem;">
|
||||
<div class="auth-field hidden input-edit-field" id="input-git_link">
|
||||
<input type="url" name="git_link" maxlength="500" value="{{ profile_user.get('git_link', '') }}" class="input-sm">
|
||||
</div>
|
||||
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Website</span>
|
||||
<div style="display: flex; align-items: center; gap: 0.5rem;">
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value" id="display-website">{{ profile_user.get('website', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="website">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden" id="input-website" style="margin-bottom: 0.5rem;">
|
||||
<input type="url" name="website" maxlength="500" value="{{ profile_user.get('website', '') }}" style="font-size: 0.8125rem;">
|
||||
<div class="auth-field hidden input-edit-field" id="input-website">
|
||||
<input type="url" name="website" maxlength="500" value="{{ profile_user.get('website', '') }}" class="input-sm">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-sm" style="width: 100%; margin-top: 0.5rem;">Save Changes</button>
|
||||
<button type="submit" class="btn btn-primary btn-sm full-width save-btn-top">Save Changes</button>
|
||||
</form>
|
||||
</div>
|
||||
{% else %}
|
||||
@@ -144,10 +145,11 @@
|
||||
<a href="/feed" class="back-link">← Back</a>
|
||||
|
||||
<div class="profile-tabs">
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=posts" class="profile-tab {% if current_tab == 'posts' %}active{% endif %}">Posts</a>
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=projects" class="profile-tab {% if current_tab == 'projects' %}active{% endif %}">Projects</a>
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=activity" class="profile-tab {% if current_tab == 'activity' %}active{% endif %}">Activity</a>
|
||||
<button class="btn-ghost btn-icon" style="margin-left: auto; font-size: 0.8125rem;">△</button>
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=posts" class="profile-tab {% if current_tab == 'posts' %}active{% endif %}"><span class="icon">📝</span>Posts</a>
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=projects" class="profile-tab {% if current_tab == 'projects' %}active{% endif %}"><span class="icon">🚀</span>Projects</a>
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=gists" class="profile-tab {% if current_tab == 'gists' %}active{% endif %}"><span class="icon">📝</span>Gists</a>
|
||||
<a href="/profile/{{ profile_user['username'] }}?tab=activity" class="profile-tab {% if current_tab == 'activity' %}active{% endif %}"><span class="icon">📊</span>Activity</a>
|
||||
<button class="btn-ghost btn-icon profile-tab-btn">△</button>
|
||||
</div>
|
||||
|
||||
<div class="profile-posts">
|
||||
@@ -174,8 +176,8 @@
|
||||
{% endif %}
|
||||
<div class="post-content rendered-content" data-render>{{ item.post['content'][:300] }}{% if item.post['content']|length > 300 %}...{% endif %}</div>
|
||||
<div class="post-actions">
|
||||
<span class="post-action-btn" style="cursor: default;">+{{ item.post.get('stars', 0) }}</span>
|
||||
<span class="post-action-btn" style="cursor: default;">💬 {{ item.comment_count }}</span>
|
||||
<span class="post-action-btn post-action-static">+{{ item.post.get('stars', 0) }}</span>
|
||||
<span class="post-action-btn post-action-static">💬 {{ item.comment_count }}</span>
|
||||
<a href="/posts/{{ item.post['slug'] or item.post['uid'] }}" class="post-action-btn share">↗︎ Open</a>
|
||||
</div>
|
||||
</article>
|
||||
@@ -184,7 +186,7 @@
|
||||
{% endfor %}
|
||||
{% elif current_tab == 'projects' %}
|
||||
{% for p in projects %}
|
||||
<a href="/projects/{{ p['slug'] or p['uid'] }}" class="project-card fade-in" style="display: block; text-decoration: none; color: inherit;">
|
||||
<a href="/projects/{{ p['slug'] or p['uid'] }}" class="project-card fade-in">
|
||||
<div class="project-card-header">
|
||||
<h3 class="project-card-title">{{ p['title'] }}</h3>
|
||||
</div>
|
||||
@@ -206,19 +208,36 @@
|
||||
{% else %}
|
||||
<div class="empty-state">No projects yet.</div>
|
||||
{% endfor %}
|
||||
{% elif current_tab == 'gists' %}
|
||||
{% for g in gists %}
|
||||
<a href="/gists/{{ g['slug'] or g['uid'] }}" class="gist-card fade-in">
|
||||
<div class="gist-card-header">
|
||||
<h3 class="gist-card-title">{{ g['title'] }}</h3>
|
||||
<span class="gist-card-star">☆ {{ g.get('stars', 0) }}</span>
|
||||
</div>
|
||||
<div class="gist-card-meta">
|
||||
<span class="gist-language-badge">📝 {{ g['language']|capitalize }}</span>
|
||||
</div>
|
||||
{% if g.get('description') %}
|
||||
<div class="gist-card-desc">{{ g['description'][:200] }}{% if g['description']|length > 200 %}...{% endif %}</div>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<div class="empty-state">No gists yet.</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for act in activities %}
|
||||
<div class="post-card fade-in" style="padding: 0.75rem 1rem;">
|
||||
<div style="display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem;">
|
||||
<span style="color: var(--text-muted);">
|
||||
<div class="post-card fade-in activity-card">
|
||||
<div class="activity-row">
|
||||
<span class="activity-icon">
|
||||
{% if act['type'] == 'post' %}📝{% else %}💬{% endif %}
|
||||
</span>
|
||||
<span style="color: var(--text-secondary);">
|
||||
<span class="activity-type">
|
||||
{% if act['type'] == 'post' %}Posted{% else %}Commented{% endif %}
|
||||
</span>
|
||||
<span style="color: var(--text-muted);">{{ act['time_ago'] }}</span>
|
||||
<span class="activity-time">{{ act['time_ago'] }}</span>
|
||||
</div>
|
||||
<p style="font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.25rem;">{{ act['content'] }}</p>
|
||||
<p class="activity-content">{{ act['content'] }}</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty-state">No activity yet.</div>
|
||||
|
||||
Reference in New Issue
Block a user