修复若干问题

This commit is contained in:
zqlit committed 2026-05-21 13:35:18 +08:00
1 parent be695cc742
commit 42eac84bb4
12 files changed
+581 -40

No files matched your search

+15 -3
View File
@@ -64,6 +64,17 @@ export async function addFeed(url: string, feedTitle: string): Promise<void> {
});
}
export async function updateFeed(oldUrl: string, newUrl: string, feedTitle: string): Promise<void> {
const qs = withToken();
const body: Record<string, string> = { url: newUrl, feedTitle };
if (oldUrl && oldUrl !== newUrl) body.oldUrl = oldUrl;
await rssFetch(`/api/feeds?${qs}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
}
export async function deleteFeed(url: string): Promise<void> {
const qs = withToken(new URLSearchParams({ url, token: RSS_API_TOKEN }));
await rssFetch(`/api/feeds?${qs}`, { method: "DELETE" });
@@ -94,13 +105,14 @@ export async function addLink(link: { name: string; url: string; description?: s
});
}
export async function updateLink(url: string, data: { name?: string; description?: string; hidden?: boolean }): Promise<void> {
// RSS API uses POST as upsert
export async function updateLink(oldUrl: string, data: { name?: string; url?: string; description?: string; hidden?: boolean }): Promise<void> {
const qs = withToken();
const body: Record<string, unknown> = { ...data };
if (data.url && data.url !== oldUrl) body.oldUrl = oldUrl;
await rssFetch(`/api/links?${qs}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url, ...data }),
body: JSON.stringify(body),
});
}