From eda941d8893dc331b55cce05e003a9cac233e2ab Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Fri, 31 Jul 2026 01:50:51 +0200 Subject: [PATCH] feat: mark unsafe for R-18 posts on Pixiv Co-authored-by: Keo Cheung --- package.json | 6 ++++-- src/engines/Pixiv.ts | 3 +++ tsconfig.json | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 67da676..99793b7 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,10 @@ "typescript": "^4.9.5" }, "exports": { - ".": "./dist/index.js", - "./": "./dist/" + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } }, "jest": { "preset": "./jest.preset.cjs", diff --git a/src/engines/Pixiv.ts b/src/engines/Pixiv.ts index afdac74..f6a0230 100644 --- a/src/engines/Pixiv.ts +++ b/src/engines/Pixiv.ts @@ -70,6 +70,9 @@ export default class Pixiv extends ScrapeEngineBase { post.contentType = guessContentType(post.contentUrl); post.referrer = document.location.origin; result.tryAddPost(post); + if (document.querySelector('a[href*="/tags/R-18/artworks"]')) { + post.rating = "unsafe"; + } } return result; diff --git a/tsconfig.json b/tsconfig.json index 25a76c8..50acf7d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,12 +5,13 @@ "DOM", "DOM.Iterable" ], + "rootDir": "./src/", "outDir": "./dist/", "sourceMap": true, "strict": true, - "module": "ES2020", - "moduleResolution": "NodeNext", - "target": "ES2020", + "module": "node16", + "moduleResolution": "node16", + "target": "es2020", "skipLibCheck": true, "esModuleInterop": true, "removeComments": true,