Restructure frontend into templates/ and static/
- Move index.html → templates/index.html (Jinja2, uses url_for) - Extract CSS → static/css/app.css - Split JS into static/js/: utils.js, dashboard.js, shares.js, quotas.js, users.js, main.js - Switch app.py from send_file to render_template Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
822e6b3b87
commit
1118681fd2
10 files changed
+607
-642
No files matched your search
@@ -0,0 +1,28 @@
|
||||
function esc(s) {
|
||||
return String(s ?? '')
|
||||
.replace(/&/g, '&').replace(/</g, '<')
|
||||
.replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function showToast(msg, type = 'success') {
|
||||
const colors = { success: '#3fb950', danger: '#f85149', warning: '#d29922' };
|
||||
const id = 'toast-' + Date.now();
|
||||
document.getElementById('toastContainer').insertAdjacentHTML('beforeend', `
|
||||
<div id="${id}" class="toast align-items-center border-0 mb-2" role="alert"
|
||||
style="background:#161b22; border-left:3px solid ${colors[type] ?? colors.success} !important; color:#e6edf3;">
|
||||
<div class="d-flex">
|
||||
<div class="toast-body">${esc(msg)}</div>
|
||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
|
||||
</div>
|
||||
</div>`);
|
||||
const el = document.getElementById(id);
|
||||
const t = new bootstrap.Toast(el, { delay: 3500 });
|
||||
t.show();
|
||||
el.addEventListener('hidden.bs.toast', () => el.remove());
|
||||
}
|
||||
|
||||
async function apiFetch(url, opts) {
|
||||
const res = await fetch(url, opts);
|
||||
if (res.status === 401) { location.reload(); return null; }
|
||||
return res;
|
||||
}
|
||||
Reference in new issue
Block a user