feat: add project file system with CRUD, upload, inline editing, and video attachment support

- Add new `/projects/{slug}/files` endpoint group for per-project filesystem operations including directory and file CRUD, upload, and inline editing with public read and owner write access
- Extend attachment system to support video formats (webm, ogv, mov, m4v) with proper file icons and MIME types
- Implement configurable allowed file types via `allowed_file_types` site setting, replacing hardcoded `ALLOWED_UPLOAD_TYPES` with dynamic `allowed_extensions()` and `is_extension_allowed()` functions
- Add `delete_all_project_files()` call in `delete_content_item()` to clean up project files when a project is deleted
- Create database indexes on `project_files` table for `(project_uid, path)` and `(project_uid, parent_path)` to optimize file lookups
- Introduce `docs_prose.py` module with `render_prose()` function that renders Markdown content inside `data-render` divs using mistune, enabling dynamic prose rendering in documentation pages
- Enhance docs search with Markdown-aware text stripping (`_demarkdown()`) and improved HTML/script/style sanitization for better search indexing
- Update documentation API samples to reflect new attachment response fields (`is_image`, `is_video`, `mime_type`) and note video format support
- Update README to document the new project files endpoint and clarify AI gateway attribution for guest Devii sessions
This commit is contained in:
2026-06-08 20:51:09 +00:00
parent e0535bb7c5
commit 97eb58fc19
110 changed files with 5534 additions and 603 deletions
+41
View File
@@ -188,6 +188,47 @@
</div>
</div>
{% if is_admin(user) %}
<div class="ai-usage-card" data-ai-usage data-uid="{{ profile_user['uid'] }}">
<div class="ai-usage-head">
<h3 class="ai-usage-title">AI usage (last 24h)</h3>
<span class="ai-usage-updated" data-ai-usage-updated></span>
</div>
{% if ai_quota %}
<div class="ai-quota" data-ai-quota>
<div class="ai-quota-bar">
<span class="ai-quota-fill {% if ai_quota.used_pct >= 90 %}ai-quota-danger{% endif %}" style="width: {{ ai_quota.used_pct }}%"></span>
</div>
<div class="ai-quota-meta">
<span class="ai-quota-pct">{{ ai_quota.used_pct }}% of daily quota used</span>
<span class="ai-quota-detail">${{ '%.4f'|format(ai_quota.spent_usd) }} / ${{ '%.2f'|format(ai_quota.limit_usd) }} &middot; {{ ai_quota.turns }} turns</span>
</div>
</div>
{% endif %}
<div class="ai-usage-body" data-ai-usage-body>
<p class="ai-usage-empty">Loading...</p>
</div>
</div>
{% elif is_self(user, profile_user['uid']) %}
<div class="ai-usage-card ai-quota-only">
<div class="ai-usage-head">
<h3 class="ai-usage-title">AI quota</h3>
</div>
{% if ai_quota %}
<div class="ai-quota" data-ai-quota>
<div class="ai-quota-bar">
<span class="ai-quota-fill {% if ai_quota.used_pct >= 90 %}ai-quota-danger{% endif %}" style="width: {{ ai_quota.used_pct }}%"></span>
</div>
<div class="ai-quota-meta">
<span class="ai-quota-pct">{{ ai_quota.used_pct }}% of your daily AI quota used</span>
</div>
</div>
{% else %}
<p class="ai-usage-empty">Quota unavailable.</p>
{% endif %}
</div>
{% endif %}
<div class="profile-tabs">
<a href="/profile/{{ profile_user['username'] }}?tab=posts" class="profile-tab {% if current_tab == 'posts' %}active{% endif %}"><span class="icon">&#x1F4DD;</span> Posts</a>
<a href="/profile/{{ profile_user['username'] }}?tab=projects" class="profile-tab {% if current_tab == 'projects' %}active{% endif %}"><span class="icon">&#x1F680;</span> Projects</a>