generated from Dicken/dickendock
Bugfixes (Dark Mode, Dropdown-Kontrast, IP-Suche), Lesezeichen-Ausbau (Farbe, Beschreibung, Favicon), Zuletzt-besucht, Spaeter-lesen, kombinierter Import-Export, Scanner-Reconciliation, Admin-Ueberarbeitung
This commit is contained in:
@@ -26,15 +26,19 @@ export async function bookmarkRoutes(app: FastifyInstance): Promise<void> {
|
||||
|
||||
let displayName = parsed.data.displayName;
|
||||
let favicon: string | null = null;
|
||||
let description = parsed.data.description;
|
||||
|
||||
// Titel/Favicon automatisch ziehen, falls kein Name angegeben wurde oder
|
||||
// schlicht um ein Favicon zu bekommen (derselbe Mechanismus wie beim
|
||||
// Netzwerk-Scanner, siehe apps/backend/src/scanner/http.ts).
|
||||
// Titel/Favicon/Beschreibung automatisch ziehen, falls nicht angegeben
|
||||
// (derselbe Mechanismus wie beim Netzwerk-Scanner, siehe
|
||||
// apps/backend/src/scanner/http.ts).
|
||||
try {
|
||||
const probe = await probeHttp(parsed.data.url, 5000);
|
||||
if (!displayName) {
|
||||
displayName = probe.title ?? bookmarkRepo.extractHostname(parsed.data.url);
|
||||
}
|
||||
if (!description) {
|
||||
description = probe.description;
|
||||
}
|
||||
favicon = probe.faviconUrl ?? null;
|
||||
} catch {
|
||||
if (!displayName) {
|
||||
@@ -46,7 +50,10 @@ export async function bookmarkRoutes(app: FastifyInstance): Promise<void> {
|
||||
categoryRepo.ensureCategory(parsed.data.category);
|
||||
}
|
||||
|
||||
const bookmark = bookmarkRepo.createBookmark(parsed.data, { displayName, favicon });
|
||||
const bookmark = bookmarkRepo.createBookmark(
|
||||
{ ...parsed.data, description },
|
||||
{ displayName, favicon }
|
||||
);
|
||||
return reply.code(201).send(bookmark);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user