fix: remove redundant db import alias in index.ts

db was already imported as addonDb; the extra db named import was
unnecessary. Updated the one stray db.prepare call at line 155 to use
addonDb consistently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jubnl
2026-04-01 20:38:25 +02:00
parent e71bd6768e
commit fabf5a7e26

View File

@@ -152,7 +152,7 @@ app.get('/uploads/photos/:filename', (req: Request, res: Response) => {
jwt.verify(token, process.env.JWT_SECRET || require('./config').JWT_SECRET); jwt.verify(token, process.env.JWT_SECRET || require('./config').JWT_SECRET);
} catch { } catch {
// Check if it's a share token // Check if it's a share token
const shareRow = db.prepare('SELECT id FROM share_tokens WHERE token = ?').get(token); const shareRow = addonDb.prepare('SELECT id FROM share_tokens WHERE token = ?').get(token);
if (!shareRow) return res.status(401).send('Authentication required'); if (!shareRow) return res.status(401).send('Authentication required');
} }
res.sendFile(resolved); res.sendFile(resolved);
@@ -203,7 +203,7 @@ app.use('/api/admin', adminRoutes);
// Public addons endpoint (authenticated but not admin-only) // Public addons endpoint (authenticated but not admin-only)
import { authenticate as addonAuth } from './middleware/auth'; import { authenticate as addonAuth } from './middleware/auth';
import {db, db as addonDb} from './db/database'; import {db as addonDb} from './db/database';
import { Addon } from './types'; import { Addon } from './types';
app.get('/api/addons', addonAuth, (req: Request, res: Response) => { app.get('/api/addons', addonAuth, (req: Request, res: Response) => {
const addons = addonDb.prepare('SELECT id, name, type, icon, enabled FROM addons WHERE enabled = 1 ORDER BY sort_order').all() as Pick<Addon, 'id' | 'name' | 'type' | 'icon' | 'enabled'>[]; const addons = addonDb.prepare('SELECT id, name, type, icon, enabled FROM addons WHERE enabled = 1 ORDER BY sort_order').all() as Pick<Addon, 'id' | 'name' | 'type' | 'icon' | 'enabled'>[];