feat: add optional dev mode and analyzer tool upload role

This commit is contained in:
Luftmensch
2026-09-03 16:27:05 +07:00
parent e528419f9a
commit 0249b9eda9
5 changed files with 68 additions and 13 deletions
+16 -5
View File
@@ -290,7 +290,7 @@
style="padding: 10px 20px; background: var(--card-bg); color: var(--text-main); text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.3s ease; border: 1px solid var(--border-color); box-shadow: 0 2px 5px rgba(0,0,0,0.05);">🏠 Trang chủ</a>
<a href="{{ url_for('my_files') }}" class="nav-tab"
style="padding: 10px 20px; background: var(--card-bg); color: var(--text-main); text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.3s ease; border: 1px solid var(--border-color); box-shadow: 0 2px 5px rgba(0,0,0,0.05);">📁 File của tôi</a>
{% if user_info and user_info.role == 'admin' %}
{% if user_info and user_info.role in ['admin', 'analyzer'] %}
<a href="{{ url_for('admin_tools') }}" class="nav-tab"
style="padding: 10px 20px; background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%); color: white; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(25, 118, 210, 0.3);">⚙️ Quản trị</a>
{% endif %}
@@ -403,11 +403,13 @@
<div style="display: inline-flex; gap: 6px; align-items: center;">
<a href="{{ url_for('download_tool', version_key=tool.version_key) }}"
class="btn btn-secondary" style="padding: 5px 10px; font-size: 12px; white-space: nowrap;">⬇️ Tải</a>
{% if user_info and user_info.role == 'admin' %}
<form action="tools/delete/{{ tool.version_key }}" method="post" style="display: inline; margin: 0;"
onsubmit="return confirm('Bạn có chắc muốn xóa công cụ này?')">
<button type="submit" class="btn btn-danger"
style="padding: 5px 10px; font-size: 12px; white-space: nowrap;">🗑️ Xóa</button>
</form>
{% endif %}
</div>
{% else %}
<span style="color: var(--text-muted);">-</span>
@@ -425,6 +427,7 @@
{% endif %}
</div>
{% if user_info and user_info.role == 'admin' %}
<!-- Upload Documentation Form -->
<div class="card">
<div class="card-header">
@@ -516,6 +519,9 @@
{% endif %}
</div>
{% endif %}
{% if user_info and user_info.role == 'admin' %}
<!-- Email Notification Settings -->
<div class="card">
<div class="card-header">
@@ -583,6 +589,9 @@
</div>
</div>
{% endif %}
{% if user_info and user_info.role == 'admin' %}
<!-- User Email Stats -->
<div class="card">
<div class="card-header">
@@ -623,15 +632,17 @@
</div>
{% endif %}
</div>
{% endif %}
</div>
<script>
// Drag and drop support
const uploadForm = document.getElementById('uploadForm');
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
uploadForm.addEventListener(eventName, preventDefaults, false);
});
if (uploadForm) {
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
uploadForm.addEventListener(eventName, preventDefaults, false);
});
}
function preventDefaults(e) {
e.preventDefault();
+1 -1
View File
@@ -980,7 +980,7 @@
style="padding: 10px 20px; background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%); color: white; text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(25, 118, 210, 0.3);">🏠 Trang chủ</a>
<a href="{{ url_for('my_files') }}" class="nav-tab"
style="padding: 10px 20px; background: var(--card-bg); color: var(--text-main); text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.3s ease; border: 1px solid var(--border-color); box-shadow: 0 2px 5px rgba(0,0,0,0.05);">📁 File của tôi</a>
{% if user_info and user_info.role == 'admin' %}
{% if user_info and user_info.role in ['admin', 'analyzer'] %}
<a href="{{ url_for('admin_tools') }}" class="nav-tab"
style="padding: 10px 20px; background: var(--card-bg); color: var(--text-main); text-decoration: none; border-radius: 8px; font-weight: 600; font-size: 14px; transition: all 0.3s ease; border: 1px solid var(--border-color); box-shadow: 0 2px 5px rgba(0,0,0,0.05);">⚙️ Quản trị</a>
{% endif %}