wip settings section

This commit is contained in:
2025-12-27 18:48:53 +01:00
parent 76391f74d2
commit cc0b0a891e
8 changed files with 604 additions and 23 deletions

View File

@@ -65,27 +65,6 @@ async function resolveEntryMetadata(entry: any, type: string) {
};
}
export async function getConfig(_request: FastifyRequest, reply: FastifyReply) {
try {
return loadConfig();
} catch {
return reply.status(500).send({ error: 'FAILED_TO_LOAD_CONFIG' });
}
}
export async function setConfig(request: FastifyRequest<{ Body: SetConfigBody }>, reply: FastifyReply) {
try {
const { body } = request;
if (!body || typeof body !== 'object') {
return reply.status(400).send({ error: 'INVALID_BODY' });
}
return saveConfig(body);
} catch {
return reply.status(500).send({ error: 'FAILED_TO_SAVE_CONFIG' });
}
}
export async function scanLibrary(request: FastifyRequest<{ Querystring: ScanQuery }>, reply: FastifyReply) {
try {
const mode = request.query.mode || 'incremental';

View File

@@ -2,8 +2,6 @@ import { FastifyInstance } from 'fastify';
import * as controller from './local.controller';
async function localRoutes(fastify: FastifyInstance) {
fastify.get('/library/config', controller.getConfig);
fastify.post('/library/config', controller.setConfig);
fastify.post('/library/scan', controller.scanLibrary);
fastify.get('/library/:type', controller.listEntries);
fastify.get('/library/:type/:id', controller.getEntry);