mirror of
https://github.com/ld3z/new-manga.git
synced 2026-11-09 17:43:44 -07:00
update custom feed validatity
This commit is contained in:
parent
c81866e53b
commit
f66aa36890
4 changed files with 69 additions and 12 deletions
28
package-lock.json
generated
28
package-lock.json
generated
|
|
@ -15,6 +15,7 @@
|
|||
"@vercel/analytics": "^1.4.1",
|
||||
"@vercel/kv": "^1.0.1",
|
||||
"astro": "^5.1.6",
|
||||
"feed": "^4.2.2",
|
||||
"ioredis": "^5.4.2",
|
||||
"tailwindcss": "^3.4.1"
|
||||
}
|
||||
|
|
@ -2970,6 +2971,17 @@
|
|||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/feed": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/feed/-/feed-4.2.2.tgz",
|
||||
"integrity": "sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==",
|
||||
"dependencies": {
|
||||
"xml-js": "^1.6.11"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
|
|
@ -5558,6 +5570,11 @@
|
|||
"queue-microtask": "^1.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz",
|
||||
"integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg=="
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
|
||||
|
|
@ -7038,6 +7055,17 @@
|
|||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
},
|
||||
"node_modules/xml-js": {
|
||||
"version": "1.6.11",
|
||||
"resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz",
|
||||
"integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==",
|
||||
"dependencies": {
|
||||
"sax": "^1.2.4"
|
||||
},
|
||||
"bin": {
|
||||
"xml-js": "bin/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/xxhash-wasm": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.1.0.tgz",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
"@vercel/analytics": "^1.4.1",
|
||||
"@vercel/kv": "^1.0.1",
|
||||
"astro": "^5.1.6",
|
||||
"feed": "^4.2.2",
|
||||
"ioredis": "^5.4.2",
|
||||
"tailwindcss": "^3.4.1"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import rss from "@astrojs/rss";
|
||||
import { Feed } from 'feed';
|
||||
import { getChaptersForSlugs, isValidLanguage } from "../../lib/api";
|
||||
import { getFeedMapping } from "../../lib/db";
|
||||
import type { APIRoute } from "astro";
|
||||
|
|
@ -28,14 +28,21 @@ export const GET: APIRoute = async ({ params }) => {
|
|||
return new Response("No chapters found for the provided comics", { status: 404 });
|
||||
}
|
||||
|
||||
return rss({
|
||||
const feed = new Feed({
|
||||
title: `ComicK - Custom Feed (${lang.toUpperCase()})`,
|
||||
description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`,
|
||||
site: "https://github.com/ld3z/manga-rss",
|
||||
items: chapters.map((chapter) => ({
|
||||
id: "https://github.com/ld3z/manga-rss",
|
||||
link: "https://github.com/ld3z/manga-rss",
|
||||
language: lang,
|
||||
copyright: "All rights reserved",
|
||||
updated: new Date(),
|
||||
});
|
||||
|
||||
chapters.forEach((chapter) => {
|
||||
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}`,
|
||||
pubDate: new Date(chapter.updated_at),
|
||||
description: `
|
||||
<div>
|
||||
${
|
||||
|
|
@ -47,6 +54,13 @@ export const GET: APIRoute = async ({ params }) => {
|
|||
<p>New chapter available: Chapter ${chapter.chap}</p>
|
||||
</div>
|
||||
`,
|
||||
})),
|
||||
date: new Date(chapter.updated_at),
|
||||
});
|
||||
});
|
||||
|
||||
return new Response(feed.rss2(), {
|
||||
headers: {
|
||||
'Content-Type': 'application/xml; charset=utf-8',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import rss from "@astrojs/rss";
|
||||
import { Feed } from 'feed';
|
||||
import { getChaptersForSlugs, isValidLanguage } from "../../../lib/api";
|
||||
import type { APIRoute } from "astro";
|
||||
|
||||
|
|
@ -22,15 +22,29 @@ export const GET: APIRoute = async ({ params, url }) => {
|
|||
return new Response("No chapters found for the provided comics", { status: 404 });
|
||||
}
|
||||
|
||||
return rss({
|
||||
const feed = new Feed({
|
||||
title: `ComicK - Custom Feed (${lang.toUpperCase()})`,
|
||||
description: `Custom RSS feed for selected comics: ${slugs.join(', ')}`,
|
||||
site: "https://github.com/ld3z/manga-rss",
|
||||
items: chapters.map((chapter) => ({
|
||||
id: "https://github.com/ld3z/manga-rss",
|
||||
link: "https://github.com/ld3z/manga-rss",
|
||||
language: lang,
|
||||
copyright: "All rights reserved",
|
||||
updated: new Date(),
|
||||
});
|
||||
|
||||
chapters.forEach((chapter) => {
|
||||
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}`,
|
||||
pubDate: new Date(chapter.updated_at),
|
||||
description: `New chapter available: Chapter ${chapter.chap}`,
|
||||
})),
|
||||
date: new Date(chapter.updated_at),
|
||||
});
|
||||
});
|
||||
|
||||
return new Response(feed.rss2(), {
|
||||
headers: {
|
||||
'Content-Type': 'application/xml; charset=utf-8',
|
||||
},
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue