Add admin UI for ArtStation re-import

Expose import as a background admin job with status polling, dry-run
and optional publish; share logic with the CLI via a service module.
This commit is contained in:
2026-07-24 10:52:11 -04:00
parent ac7eb17854
commit cef5738044
5 changed files with 718 additions and 324 deletions
+35
View File
@@ -229,8 +229,43 @@ export const api = {
}),
reindex: () =>
request<{ ok: boolean; indexed: number }>("/api/v1/admin/reindex", { method: "POST" }),
importArtStation: (body: {
username?: string;
dryRun?: boolean;
publish?: boolean;
url?: string;
}) =>
request<{
ok: boolean;
message: string;
status: ArtStationImportStatus;
}>("/api/v1/admin/import/artstation", {
method: "POST",
body: JSON.stringify(body),
}),
importArtStationStatus: () =>
request<ArtStationImportStatus>("/api/v1/admin/import/artstation"),
};
export interface ArtStationImportStatus {
running: boolean;
startedAt?: string;
finishedAt?: string;
error?: string;
log: string[];
result?: {
username: string;
dryRun: boolean;
found: number;
imported: number;
skipped: number;
errors: number;
created: { title: string; slug: string }[];
};
}
export function mediaSrc(url?: string | null): string {
if (!url) return "";
if (url.startsWith("http") || url.startsWith("//")) return url;