From 40552e471c3b6dc3a577dcfe8833a5169577a3f2 Mon Sep 17 00:00:00 2001 From: ld3zian <42660576+ld3z@users.noreply.github.com> Date: Tue, 28 Jan 2025 17:48:05 -0700 Subject: [PATCH] fix feed? --- src/pages/rss/[feedId].xml.ts | 17 ++++++++++++----- src/pages/rss/custom/[slugs].xml.ts | 15 +++++++++++---- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/pages/rss/[feedId].xml.ts b/src/pages/rss/[feedId].xml.ts index 37c1c49..4fcb502 100644 --- a/src/pages/rss/[feedId].xml.ts +++ b/src/pages/rss/[feedId].xml.ts @@ -3,7 +3,7 @@ import { getChaptersForSlugs, isValidLanguage } from "../../lib/api"; import { getFeedMapping } from "../../lib/db"; import type { APIRoute } from "astro"; -export const GET: APIRoute = async ({ params }) => { +export const GET: APIRoute = async ({ params, request }) => { const feedId = params.feedId?.replace('.xml', ''); if (!feedId) { @@ -28,21 +28,28 @@ export const GET: APIRoute = async ({ params }) => { return new Response("No chapters found for the provided comics", { status: 404 }); } + const siteUrl = new URL(request.url).origin; + const feedUrl = new URL(request.url).href; + const feed = new Feed({ title: `ComicK - Custom Feed (${lang.toUpperCase()})`, description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`, - id: "https://github.com/ld3z/manga-rss", - link: "https://github.com/ld3z/manga-rss", + id: feedUrl, + link: siteUrl, + feedLinks: { + rss2: feedUrl + }, language: lang, copyright: "All rights reserved", updated: new Date(), }); chapters.forEach((chapter) => { + const chapterUrl = `https://comick.io/comic/${chapter.md_comics.slug}`; feed.addItem({ title: `${chapter.md_comics.title} - Chapter ${chapter.chap}`, - id: `${chapter.md_comics.slug}-${chapter.chap}`, - link: `https://comick.io/comic/${chapter.md_comics.slug}`, + id: `urn:comick:${chapter.md_comics.slug}:${chapter.chap}`, + link: chapterUrl, description: `