Complete LinkSyncServer and LinkSyncExtension implementation

LinkSyncServer:
- Fix app.py imports, add CORS middleware, lifespan events
- Create api/routes.py router aggregator
- Create config/settings.py for centralized configuration
- Rewrite models/base.py with proper relationships and serialization
- Rewrite all API endpoints with real DB integration (auth, links, collections, sync, queries, tags)
- Add admin endpoints (user management, stats, audit log)
- Complete query parser with recursive descent and proper precedence
- Complete query executor with set operations and field filters
- Set up Alembic migrations with initial schema
- Create web interface (templates, CSS, JS)
- Add 42 passing tests (auth, links, collections, queries)
- Add deploy.ps1 and deploy.sh scripts
- Update README with deployment workflow

LinkSyncExtension:
- Create utils/api.js (REST client with retries, auth, error handling)
- Create utils/sync.js (3 sync modes + conflict detection)
- Create utils/collection.js (collection management)
- Create utils/query-engine.js (client-side query parser)
- Rewrite background.js (sync loop, bookmark events, message routing)
- Rewrite popup.js (tabs, settings modal, notifications, CRUD)
- Update popup.html (tabbed interface, query builder, modal)
- Update popup.css (full redesign)
- Create content/content.js (page metadata extraction)
- Create options.html/js (dedicated settings page)
- Generate icons (48x48, 96x96)
- Update manifest.json (host permissions, content scripts, options)
- Create AGENTS.md
This commit is contained in:
DavidSaylor
2026-05-19 13:21:26 -05:00
parent c5d3912070
commit 09d30427f4
54 changed files with 5918 additions and 3177 deletions

View File

@@ -0,0 +1,74 @@
document.addEventListener("DOMContentLoaded", function () {
const apiBase = "/api";
async function apiFetch(endpoint, options = {}) {
const token = localStorage.getItem("token");
const headers = {
"Content-Type": "application/json",
...options.headers,
};
if (token) {
headers["Authorization"] = `Bearer ${token}`;
}
const response = await fetch(`${apiBase}${endpoint}`, {
...options,
headers,
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
return response.json();
}
window.LinkSync = {
apiFetch,
async getLinks(params = {}) {
const qs = new URLSearchParams(params).toString();
return apiFetch(`/links/?${qs}`);
},
async createLink(data) {
return apiFetch("/links/", {
method: "POST",
body: JSON.stringify(data),
});
},
async updateLink(id, data) {
return apiFetch(`/links/${id}`, {
method: "PUT",
body: JSON.stringify(data),
});
},
async deleteLink(id) {
return apiFetch(`/links/${id}`, { method: "DELETE" });
},
async getCollections() {
return apiFetch("/collections/");
},
async createCollection(data) {
return apiFetch("/collections/", {
method: "POST",
body: JSON.stringify(data),
});
},
async executeQuery(expression, limit = 20) {
return apiFetch(`/queries/execute?expression=${encodeURIComponent(expression)}&limit=${limit}`);
},
async login(username, password) {
const formData = new URLSearchParams();
formData.append("username", username);
formData.append("password", password);
const response = await fetch(`${apiBase}/auth/login`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: formData.toString(),
});
if (!response.ok) throw new Error("Login failed");
const data = await response.json();
localStorage.setItem("token", data.access_token);
return data;
},
logout() {
localStorage.removeItem("token");
},
};
});