Skip to content

fix(multisrc/readnovelfull): report real errors via @libs/pluginError and add Novel Ping hide locked toggle - #2950

Open
7ui77 wants to merge 5 commits into
lnreader:masterfrom
7ui77:fix/multisrc-readnovelfull-plugin-error
Open

7ui77 wants to merge 5 commits into
lnreader:masterfrom
7ui77:fix/multisrc-readnovelfull-plugin-error

Conversation

@7ui77

@7ui77 7ui77 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Checklist

  • Update version code if an existing plugin was modified
  • Test changes in Plugin Playground or the app
  • Reference related issues in the PR body (e.g. Closes #xyz)
  • Commit messages follow type(scope): description (e.g. feat(<generator>): add new source)

Related to #2946 (readnovelfull.com itself is currently returning HTTP 521), #2422 / #2819 / #2179 (novelfull.com itself is currently returning HTTP 404), #2335 (Latest Novels added as a filter option while keeping the Latest tab on sort/latest-release per #2332), and #2952 (100/100 covers verified valid in HTML across pages 1–5; intermittent blanks on Android are Cloudflare image request concurrency). Implements #2953 and resolves #2349, #2303, #2917, and #2359.

Summary

popularNovels / parseNovel / parseChapter / searchNovels
  └── fetchText(url, { fetchInit, notFoundCode, allowNotFound })
        ├── fetchApi -> checkResponse (401/403/404/429/5xx -> PluginError)
        ├── checkAppStoreRedirect (play.google.com / apps.apple.com -> InvalidResponse)
        └── assertNoChallenge (challenge titles / off-domain -> Captcha 403)

parseNovel (AJAX) & fetchChapterPageWithRetry (paginated JSON)
  ├── fast-fail on 401/403/404; wrap network rejections as PluginError.NetworkError
  └── parseJsonObject (reject invalid JSON / non-object / []; soft-404 / 429 check)
        ├── parseChapterOptionJson (chapterFormat: "json" -> marks/hides premium/platinum chapters)
        └── parseAjaxJson (enforce { html: string })

parseChapter
  ├── streaming stripClasses ("app-promo" / "reader-ad-skip", "fnw-content-state", "pubadx-slot") + unified depthHide + parser.pause() on chapter root close
  └── hasReadableContent (strips <script>, <style>, comments, tags, &nbsp;; keeps <img>)
        └── throws ChapterNotFound / RateLimited / EmptyContent instead of ""

searchNovels
  ├── page > 1 + 404 -> []
  ├── alert(...) -> RateLimited (status 429) or InvalidResponse
  └── 0 novels -> throwIfErrorPage (NotFound on page 1, RateLimited 429)
  • Error reporting (@libs/pluginError): Surface real HTTP/challenge/rate-limit/empty-content failures instead of generic strings or empty results.
  • Novel Ping paid chapter toggle (hasLocked + chapterFormat: 'json'):
    • Adds opt-in hasLocked (hideLocked Switch setting read dynamically via storage.get('hideLocked')) and chapterFormat: 'json' to plugins/multisrc/readnovelfull/template.ts.
    • Configures novelping in plugins/multisrc/readnovelfull/sources.json to fetch ajax/chapter-option?novelId=<id>&format=json, detecting premium / platinum flags, prefixing locked chapters with 🔒 by default, and omitting them when hideLocked is enabled.
  • FreeWebNovel ad-loading strip & ranking filters (FWN.com):
    • Adds stripClasses: ["reader-ad-skip", "fnw-content-state", "pubadx-slot"] to FWN.com in plugins/multisrc/readnovelfull/sources.json to remove inline ad scripts (platform.pubadx.one) and "Almost there! Your next chapter is loading" fallback images (wait-*.webp) during streaming chapter parsing.
    • Expands plugins/multisrc/readnovelfull/filters/FWN.com.json Novel Type picker with all live-verified Most Popular rankings (All Visit, Day Visit, Week Visit, Month Visit, Recommended, Collected, Completed), Latest Novels (sort/latest-novel), and Completed Novels (sort/completed-novel).
  • Performance optimizations:
    • Replaces Novel Ping's Cheerio customJs pass with streaming stripClasses: ['app-promo'] inside parseChapter and calls parser.pause() once the chapter root <div> closes.
    • Replaces new URL(...) in resolvePath with query/hash-bounded indexOf/slice parsing, hoists module-level regexes/lookup tables/pickCoverAttr, adds parser ontext early returns, avoids redundant { ...temp } clones, and skips the 150ms sleep after the final paginated chapter page.
  • Bumps template minor version 2.3.${4 + versionIncrements} → 2.4.${versionIncrements} across all 8 plugins/multisrc/readnovelfull sources.

Evidence

  • Before:
    • popularNovels, parseNovel, parseChapter, searchNovels threw plain Errors without .code/.status or missed challenge/soft-404/rate-limit HTML pages.
    • parseNovel AJAX logged non-OK statuses and returned chapters = []; fetchChapterPageWithRetry returned null → [] after retries; invalid JSON payloads ({"error":...}, []) silently yielded 0 chapters.
    • parseChapter returned an empty #chr-content wrapper (or <script>/<style>-only ad markup) instead of PluginError.EmptyContent, Novel Ping ran a full Cheerio DOM parse/serialize on every chapter, and FreeWebNovel chapters leaked <div class="reader-ad-skip ..."> / <div class="fnw-content-state ..."> ad/loading placeholders.
    • novelping had no hideLocked setting and did not filter or mark paid chapters; FWN.com lacked the Most Popular sub-rankings (dayvisit, weekvisit, monthvisit, recommended, collected, completed), sort/latest-novel, and sort/completed-novel filters.
  • After:
    • Un-mocked local node:http suites (35 base cases + 19 review-edge cases): 54/54 PASS.
    • NovelPing locked-chapter, JSON endpoint & streaming optimization suite (11 cases, including cached Cultivation Online parseNovel, parseChapter with 200KB trailing HTML in 2.3ms, resolvePath query/hash edge cases, and @libs/pluginError non-JSON rejection checks): ALL TESTS PASSED.
    • FreeWebNovel red-first un-mocked node:http suite (against cached The Mech Touch chapter 5483, synthetic fnw-content-state + reader-ad-skip ad-loading markup, and cached sort/latest-release HTML across sort/most-popular/dayvisit & sort/latest-novel pages 1–2): ALL TESTS PASSED (12,369 chars, 0 <script>, 0 <ins>, 0 reader-ad-skip/fnw-content-state, 14 Novel Type options).
    • Live Chromium-verified FreeWebNovel routes: 200 OK (20 novels/page, including page-2 pagination) across /sort/latest-novel, /sort/completed-novel, /sort/most-popular/{dayvisit,weekvisit,monthvisit,recommended,collected,completed}, and /novel/the-mech-touch/chapter-5483 (4,451 text chars, 0 <script>, 0 <img> inside cleaned .txt).
    • node --test scripts/plugin-error.test.js: 4/4 PASS.
    • prettier --check, eslint --max-warnings 0, npm run build:multisrc, npm run build:compile: all exit 0.
    • Live npm run check:plugin:
Plugin Result Details
plugins/english/AllNovelFull[readnovelfull].ts (novgo.net) ✅ PASS popularNovels 20 novels, searchNovels 7 results, parseNovel 2166 chapters, parseChapter 4912 chars
plugins/english/NovelPing[readnovelfull].ts (novelping.com) ⚠️ INCONCLUSIVE siteReachability: HTTP 403 (Cloudflare)
plugins/english/ReadNovelFull[readnovelfull].ts (readnovelfull.com) ⚠️ INCONCLUSIVE siteReachability: HTTP 521
plugins/english/FreeWebNovel[readnovelfull].ts (freewebnovel.com) ⚠️ INCONCLUSIVE siteReachability: HTTP 403 (Cloudflare); verified live in Chromium X11 after Turnstile

Merge Danger

Door: Two-way

Three files inside the readnovelfull multisrc generator (plugins/multisrc/readnovelfull/template.ts, plugins/multisrc/readnovelfull/sources.json, and plugins/multisrc/readnovelfull/filters/FWN.com.json); trivial to revert.

Blast Radius: Medium

Applies to all 8 readnovelfull multisrc plugins (readnovelfull, allnovel, lightnovelplus, novelfull, libread, anf.net, novelping, FWN.com); hasLocked and chapterFormat are enabled only for novelping, stripClasses is enabled only for novelping and FWN.com, and filters/FWN.com.json applies only to FWN.com; live-verified on novgo.net and freewebnovel.com with no regressions.

Closes #2953
Closes #2349
Closes #2303
Closes #2917
Closes #2359

AI-assisted via Antigravity.

@greptile-apps

greptile-apps Bot commented Nov 29, 2026

Copy link
Copy Markdown

Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance and include this reference: 9aeb3309-d019-4999-b945-6b216d4aacb0.

…el Ping

Add opt-in `hasLocked` (`hideLocked` Switch setting) and `chapterFormat: "json"`
support in `readnovelfull/template.ts`, and enable them for Novel Ping so paid
(`premium` / `platinum`) chapters are marked with a lock icon or hidden when
the toggle is enabled.

Closes lnreader#2953
Co-Authored-By: Antigravity <noreply@google.com>
@7ui77 7ui77 changed the title fix(multisrc/readnovelfull): report real website errors via @libs/pluginError fix(multisrc/readnovelfull): report real errors via @libs/pluginError and add Novel Ping hide locked toggle Nov 30, 2026
7ui77 and others added 2 commits November 30, 2026 21:57
…and promo stripping

- Replace Novel Ping's Cheerio `customJs` pass with streaming `stripClasses: ["app-promo"]` inside `parseChapter` and pause `htmlparser2` when the chapter root closes.
- Replace `new URL(...)` in `resolvePath` with allocation-free `indexOf`/`slice` parsing.
- Hoist module-level regexes/maps/cover picker, add early exits in parser text handlers, remove redundant spread copies, and skip the final-page sleep in `fetchChapterPageWithRetry`.

Co-Authored-By: Antigravity <noreply@google.com>
…mp minor to 2.4.x

- Bump base template version from `2.3.${5 + versionIncrements}` to `2.4.${versionIncrements}` to reflect the new `hideLocked` feature.
- Fix `resolvePath` to bound `/` search against `?` and `#` so pathless URLs with slashes in query/hash return `""`.
- Rename `fetchHtml` to `fetchText` (`{ body, url, notFound }`) and deduplicate JSON parsing via `parseJsonObject`.
- Require JSON directly when `chapterFormat === 'json'` and remove unused HTML locked-badge fallback from `ajaxParser`.

Co-Authored-By: Antigravity <noreply@google.com>
@rajarsheechatterjee

Copy link
Copy Markdown
Member

Let’s hold off on merging until LNReader ships a release that exports @libs/pluginError, since the updated plugins will fail to load on the current release.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants