Add DBGate opener for scrape database

This commit is contained in:
2026-08-05 21:49:03 +02:00
parent 10672a6be3
commit 2106201f9c
11 changed files with 90 additions and 3 deletions
+8
View File
@@ -42,6 +42,10 @@ export function loadConfig({ configPath = "config/local.json", dryRun } = {}) {
scrapeName: env.SCRAPE_DB_NAME || config.database?.scrapeName || "catalog_scrape",
connectionLimit: Number(env.DB_CONNECTION_LIMIT || config.database?.connectionLimit || 5),
},
databaseGate: {
url: env.DBGATE_URL || config.databaseGate?.url || "http://127.0.0.1:3000",
browserEngine: String(env.DBGATE_BROWSER_ENGINE || config.databaseGate?.browserEngine || "chromium").toLowerCase(),
},
};
}
@@ -89,5 +93,9 @@ function mergeConfig(base, override) {
...base.database,
...override.database,
},
databaseGate: {
...base.databaseGate,
...override.databaseGate,
},
};
}
+11
View File
@@ -17,6 +17,7 @@ import {
getProductPictures,
openProductSource,
} from "./services/catalog-products.ts";
import { openInBrowser } from "./services/browser-adapter.ts";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const publicDir = path.resolve(__dirname, "../public");
@@ -135,6 +136,16 @@ const server = http.createServer(async (request, response) => {
return;
}
if (url.pathname === "/api/tools/open-dbgate") {
await openInBrowser(config.databaseGate.url, { engine: config.databaseGate.browserEngine });
await sendJson(response, {
opened: true,
url: config.databaseGate.url,
browserEngine: config.databaseGate.browserEngine,
});
return;
}
if (url.pathname === "/api/catalog-maker/product-info") {
await sendJson(
response,
+4 -2
View File
@@ -188,13 +188,14 @@
.settings-dialog { @apply max-w-md; }
.suggested-header { @apply flex items-center justify-between border-b border-slate-300 bg-slate-200 px-3 py-2; }
.suggested-header h2 { @apply m-0 text-sm font-semibold text-slate-800; }
.modal-close, .settings-test-button { @apply inline-flex items-center justify-center gap-1.5 rounded border border-slate-300 bg-white px-2 py-1 text-[11px] text-slate-800 shadow-sm hover:bg-slate-100; }
.modal-close .sidebar-icon, .settings-test-button .sidebar-icon { @apply h-3.5 w-3.5 text-slate-500; }
.modal-close, .settings-test-button, .settings-inline-button { @apply inline-flex items-center justify-center gap-1.5 rounded border border-slate-300 bg-white px-2 py-1 text-[11px] text-slate-800 shadow-sm hover:bg-slate-100; }
.modal-close .sidebar-icon, .settings-test-button .sidebar-icon, .settings-inline-button .sidebar-icon { @apply h-3.5 w-3.5 text-slate-500; }
.suggested-list, .source-list, .settings-content { @apply max-h-[calc(90vh-48px)] overflow-y-auto p-2; }
.settings-content { @apply grid gap-2; }
.settings-group { @apply m-0 rounded border border-slate-300 p-2; }
.settings-group legend { @apply px-1 text-xs font-semibold text-slate-700; }
.settings-option { @apply flex items-center gap-1 py-0.5 text-[11px] text-slate-700; }
.settings-option .settings-inline-button { @apply ml-auto py-0.5 text-[10px]; }
.settings-option input { @apply accent-catalog-focus; }
.settings-option input:disabled + span { @apply text-slate-400; }
.local-db-fields { @apply grid gap-1; }
@@ -341,6 +342,7 @@
html.dark .settings-field input { @apply border-slate-600 bg-slate-800 text-slate-100; }
html.dark .modal-close,
html.dark .settings-test-button,
html.dark .settings-inline-button,
html.dark .suggested-pick,
html.dark .source-row-action,
html.dark .source-picture-action { @apply border-slate-600 bg-slate-800 text-slate-100 hover:bg-slate-700; }