feat: add web UI with login, CRUD, admin, and API key management
- Add login page with JWT authentication - Add dashboard with stats and quick actions - Add links management page (full CRUD with search) - Add collections management page - Add API key management page with copy-to-clipboard - Add admin user management page (admin only) - Fix UUID type mismatches across all endpoints - Add updated_at column to api_keys and audit_log in schema.sql - Fix DB_PASSWORD default in docker-compose.yml - Add PyJWT to requirements.txt - Fix API docs URL (/docs instead of /api/docs) - Improve JS error handling (show actual messages) - Rewrite conftest.py with proper DB lifecycle management - Add 42 new integration tests (84 total, all passing) - test_admin.py: 15 tests for admin endpoints - test_auth_extended.py: 9 tests for API key CRUD - test_tags.py: 12 tests for tag endpoints - test_sync.py: 6 tests for sync endpoints
This commit is contained in:
@@ -10,13 +10,19 @@
|
||||
<body>
|
||||
<nav class="navbar">
|
||||
<div class="nav-brand">
|
||||
<a href="/">LinkSync</a>
|
||||
<a href="/dashboard">LinkSync</a>
|
||||
</div>
|
||||
<div class="nav-links">
|
||||
<a href="/#links">Links</a>
|
||||
<a href="/#collections">Collections</a>
|
||||
<a href="/#queries">Queries</a>
|
||||
<a href="/api/docs" target="_blank">API Docs</a>
|
||||
<div class="nav-links" id="nav-links">
|
||||
<a href="/dashboard">Dashboard</a>
|
||||
<a href="/links">Links</a>
|
||||
<a href="/collections">Collections</a>
|
||||
<a href="/api-keys">API Keys</a>
|
||||
<a href="/admin" id="admin-nav" style="display: none;">Admin</a>
|
||||
<a href="/docs" target="_blank">API</a>
|
||||
</div>
|
||||
<div class="nav-user">
|
||||
<span id="nav-username"></span>
|
||||
<button class="btn btn-sm btn-outline" id="logout-btn">Logout</button>
|
||||
</div>
|
||||
</nav>
|
||||
<main class="container">
|
||||
@@ -26,6 +32,27 @@
|
||||
<p>LinkSyncServer © 2026</p>
|
||||
</footer>
|
||||
<script src="/static/js/main.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const token = localStorage.getItem('token');
|
||||
const user = JSON.parse(localStorage.getItem('user') || 'null');
|
||||
if (!token) {
|
||||
window.location.href = '/login';
|
||||
return;
|
||||
}
|
||||
if (user) {
|
||||
document.getElementById('nav-username').textContent = user.username;
|
||||
if (user.role === 'admin') {
|
||||
document.getElementById('admin-nav').style.display = '';
|
||||
}
|
||||
}
|
||||
document.getElementById('logout-btn').addEventListener('click', function() {
|
||||
localStorage.removeItem('token');
|
||||
localStorage.removeItem('user');
|
||||
window.location.href = '/login';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user