mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 20:23:45 -07:00
fix feed?
This commit is contained in:
parent
f66aa36890
commit
40552e471c
2 changed files with 23 additions and 9 deletions
|
|
@ -3,7 +3,7 @@ import { getChaptersForSlugs, isValidLanguage } from "../../lib/api";
|
||||||
import { getFeedMapping } from "../../lib/db";
|
import { getFeedMapping } from "../../lib/db";
|
||||||
import type { APIRoute } from "astro";
|
import type { APIRoute } from "astro";
|
||||||
|
|
||||||
export const GET: APIRoute = async ({ params }) => {
|
export const GET: APIRoute = async ({ params, request }) => {
|
||||||
const feedId = params.feedId?.replace('.xml', '');
|
const feedId = params.feedId?.replace('.xml', '');
|
||||||
|
|
||||||
if (!feedId) {
|
if (!feedId) {
|
||||||
|
|
@ -28,21 +28,28 @@ export const GET: APIRoute = async ({ params }) => {
|
||||||
return new Response("No chapters found for the provided comics", { status: 404 });
|
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({
|
const feed = new Feed({
|
||||||
title: `ComicK - Custom Feed (${lang.toUpperCase()})`,
|
title: `ComicK - Custom Feed (${lang.toUpperCase()})`,
|
||||||
description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`,
|
description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`,
|
||||||
id: "https://github.com/ld3z/manga-rss",
|
id: feedUrl,
|
||||||
link: "https://github.com/ld3z/manga-rss",
|
link: siteUrl,
|
||||||
|
feedLinks: {
|
||||||
|
rss2: feedUrl
|
||||||
|
},
|
||||||
language: lang,
|
language: lang,
|
||||||
copyright: "All rights reserved",
|
copyright: "All rights reserved",
|
||||||
updated: new Date(),
|
updated: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
chapters.forEach((chapter) => {
|
chapters.forEach((chapter) => {
|
||||||
|
const chapterUrl = `https://comick.io/comic/${chapter.md_comics.slug}`;
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
title: `${chapter.md_comics.title} - Chapter ${chapter.chap}`,
|
title: `${chapter.md_comics.title} - Chapter ${chapter.chap}`,
|
||||||
id: `${chapter.md_comics.slug}-${chapter.chap}`,
|
id: `urn:comick:${chapter.md_comics.slug}:${chapter.chap}`,
|
||||||
link: `https://comick.io/comic/${chapter.md_comics.slug}`,
|
link: chapterUrl,
|
||||||
description: `
|
description: `
|
||||||
<div>
|
<div>
|
||||||
${
|
${
|
||||||
|
|
|
||||||
|
|
@ -22,21 +22,28 @@ export const GET: APIRoute = async ({ params, url }) => {
|
||||||
return new Response("No chapters found for the provided comics", { status: 404 });
|
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({
|
const feed = new Feed({
|
||||||
title: `ComicK - Custom Feed (${lang.toUpperCase()})`,
|
title: `ComicK - Custom Feed (${lang.toUpperCase()})`,
|
||||||
description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`,
|
description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`,
|
||||||
id: "https://github.com/ld3z/manga-rss",
|
id: feedUrl,
|
||||||
link: "https://github.com/ld3z/manga-rss",
|
link: siteUrl,
|
||||||
|
feedLinks: {
|
||||||
|
rss2: feedUrl
|
||||||
|
},
|
||||||
language: lang,
|
language: lang,
|
||||||
copyright: "All rights reserved",
|
copyright: "All rights reserved",
|
||||||
updated: new Date(),
|
updated: new Date(),
|
||||||
});
|
});
|
||||||
|
|
||||||
chapters.forEach((chapter) => {
|
chapters.forEach((chapter) => {
|
||||||
|
const chapterUrl = `https://comick.io/comic/${chapter.md_comics.slug}`;
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
title: `${chapter.md_comics.title} - Chapter ${chapter.chap}`,
|
title: `${chapter.md_comics.title} - Chapter ${chapter.chap}`,
|
||||||
id: `${chapter.md_comics.slug}-${chapter.chap}`,
|
id: `urn:comick:${chapter.md_comics.slug}:${chapter.chap}`,
|
||||||
link: `https://comick.io/comic/${chapter.md_comics.slug}`,
|
link: chapterUrl,
|
||||||
description: `New chapter available: Chapter ${chapter.chap}`,
|
description: `New chapter available: Chapter ${chapter.chap}`,
|
||||||
date: new Date(chapter.updated_at),
|
date: new Date(chapter.updated_at),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue