feat(caddy): route edit, system log entries, fix routes load timing
Add inline edit for custom routes (Pencil icon → inline form with all fields). Log route add/update/delete/import to the logs table (type: system) so operations appear in the Logbook. Fix loadCaddyRoutes() called without await after settings save, causing a race between the success message and route list.
This commit is contained in:
10
server-db.ts
10
server-db.ts
@ -153,8 +153,18 @@ export function addCaddyRoute(hostname: string, upstream: string, tls: boolean,
|
||||
return db.prepare('SELECT * FROM caddy WHERE id = ?').get(lastInsertRowid) as CaddyRoute;
|
||||
}
|
||||
|
||||
export function updateCaddyRoute(id: number, hostname: string, upstream: string, tls: boolean, compress: boolean): CaddyRoute {
|
||||
db.prepare('UPDATE caddy SET hostname = ?, upstream = ?, tls = ?, compress = ? WHERE id = ?')
|
||||
.run(hostname, upstream, tls ? 1 : 0, compress ? 1 : 0, id);
|
||||
return db.prepare('SELECT * FROM caddy WHERE id = ?').get(id) as CaddyRoute;
|
||||
}
|
||||
|
||||
export function deleteCaddyRoute(id: number): void {
|
||||
db.prepare('DELETE FROM caddy WHERE id = ?').run(id);
|
||||
}
|
||||
|
||||
export function getCaddyRouteById(id: number): CaddyRoute | undefined {
|
||||
return db.prepare('SELECT * FROM caddy WHERE id = ?').get(id) as CaddyRoute | undefined;
|
||||
}
|
||||
|
||||
export default db;
|
||||
|
||||
Reference in New Issue
Block a user