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: `
${ diff --git a/src/pages/rss/custom/[slugs].xml.ts b/src/pages/rss/custom/[slugs].xml.ts index 7aafc15..dd94d9f 100644 --- a/src/pages/rss/custom/[slugs].xml.ts +++ b/src/pages/rss/custom/[slugs].xml.ts @@ -22,21 +22,28 @@ export const GET: APIRoute = async ({ params, url }) => { return new Response("No chapters found for the provided comics", { status: 404 }); } + const siteUrl = new URL(url).origin; + const feedUrl = new URL(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: `New chapter available: Chapter ${chapter.chap}`, date: new Date(chapter.updated_at), });