generated from Dicken/dickendock
Reset-Button, Service-Reorder, Port/HTTPS-Spalten, Healthcheck in Sidebar, Kategorien-Sync
This commit is contained in:
@@ -9,7 +9,10 @@ import { categoryRoutes } from "./routes/categories.js";
|
||||
import { scanRoutes } from "./routes/scan.js";
|
||||
import { logRoutes } from "./routes/logs.js";
|
||||
import { pluginRoutes } from "./routes/plugins.js";
|
||||
import { resetRoutes } from "./routes/reset.js";
|
||||
import { loadPlugins } from "./plugins/loader.js";
|
||||
import * as serviceRepo from "./db/repositories/services.js";
|
||||
import * as categoryRepo from "./db/repositories/categories.js";
|
||||
|
||||
const PORT = Number(process.env.PORT ?? 3001);
|
||||
const HOST = process.env.HOST ?? "0.0.0.0";
|
||||
@@ -31,6 +34,23 @@ async function main() {
|
||||
|
||||
ensureSchema();
|
||||
|
||||
// Kategorien, die bereits auf Diensten stehen (z. B. aus Scans vor diesem
|
||||
// Fix, oder von Plugins), aber noch nicht in der categories-Tabelle sind,
|
||||
// hier nachtragen. Damit zeigt Admin -> Kategorien immer das, was auch in
|
||||
// der Suche als Kategorie auftaucht.
|
||||
const existingCategoryNames = Array.from(
|
||||
new Set(
|
||||
serviceRepo
|
||||
.listServices()
|
||||
.map((s) => s.category)
|
||||
.filter((c): c is string => !!c)
|
||||
)
|
||||
);
|
||||
const syncedCount = categoryRepo.syncCategoriesFromServiceValues(existingCategoryNames);
|
||||
if (syncedCount > 0) {
|
||||
app.log.info(`${syncedCount} Kategorie(n) aus bestehenden Diensten nachgetragen`);
|
||||
}
|
||||
|
||||
const plugins = await loadPlugins();
|
||||
app.log.info(`${plugins.length} Plugin(s) geladen`);
|
||||
|
||||
@@ -41,6 +61,7 @@ async function main() {
|
||||
await app.register(scanRoutes);
|
||||
await app.register(logRoutes);
|
||||
await app.register(pluginRoutes);
|
||||
await app.register(resetRoutes);
|
||||
|
||||
app.get("/", async () => {
|
||||
return { name: "LaunchPad API", status: "running" };
|
||||
|
||||
Reference in New Issue
Block a user