Skip to content

feat: introduce novel reading module with multi-source and offline support#71

Merged
pushpender-singh-ap merged 9 commits intomainfrom
feature/novel-module
Mar 28, 2026
Merged

feat: introduce novel reading module with multi-source and offline support#71
pushpender-singh-ap merged 9 commits intomainfrom
feature/novel-module

Conversation

@pushpender-singh-ap
Copy link
Copy Markdown
Member

This PR introduces the highly anticipated Novel Reading Module to InkNest, enabling users to discover, read, and download novels. It also includes comprehensive source status tracking, multi-source integrations (including WTR-Lab), and various UI/UX improvements across the app.

Key Changes & Features:

  • Novel Reading Module: Added full support for discovering and reading novels (src/Screens/Novel). Includes a clean reader interface with customizable settings (TextReader, WebReader, ReaderSettings).
  • Multi-Source & WTR-Lab Integration: Implemented a multi-source architecture for novels. Added specific integration modes for WTR-Lab (WTRLabModeSelector.js, SourceSelector.js).
  • Offline Reading Support: Added partial offline support allowing users to download chapters for offline viewing (OfflineStorage.js, DownloadManager.js, DownloadButton.js).
  • Source Status & Notifications: Introduced a new system to track and notify users about source availability/downtime (SourceStatusBanner.js, SourceStatusNotification.js, useSourceStatus.js).
  • UI/UX Enhancements:
    • Improved layout, updated background color, and centered the header title in the Search component.
    • Cleaned up code formatting and readability in the NovelDetails and Search components.
  • Maintenance & Chores:
    • Removed unnecessary .catch() blocks on synchronous notification persists.
    • Updated the support contact email to inknest@capacity.rocks.
    • Added the v1.4.9 release announcement in the docusaurus blog.

Add comprehensive novel reading functionality:

Features:
- Novel home, details, reader, search, and library screens
- Text and WebView reader modes with customizable settings (theme, font, line height)
- Chapter progress tracking and reading history
- Novel bookmarks management
- Integration with existing search (comics, manga, novels unified)
- Novel tab added to Bookmarks and Library screens

Navigation:
- 6 new navigation routes for novel screens

Redux state:
- NovelBookMarks, NovelHistory for bookmarks and reading progress
- Novel reader settings (mode, theme, fontSize, lineHeight, fontFamily)

Components:
- NovelCard, NovelList, ChapterList, GenreTags, NovelInfo
- ReaderSettings, TextReader, WebReader
- DownloadButton (UI only - Redux actions pending)

Utils:
- DownloadManager and OfflineStorage for offline reading
- Novel parser and API modules

Note: Novel offline download Redux actions (DownloadNovelChapter,
RemoveNovelChapter, clearNovelDownloads) and NovelDownloads state
are referenced but not yet implemented in reducers.
Implement a comprehensive source health monitoring system that tracks and notifies users when content sources (comics, anime, manga) experience errors.

New Features:
- Source status tracking utility () with MMKV persistence
- Distinguishes between Cloudflare protection (403) and server down (500+) errors
- Custom React hooks for source status management ()
- UI components for status display:
  -  - inline banners, badges, and toasts
  -  - notification list component

Redux Integration:
- Added  state with deduplication (5-min window)
- New actions: set, mark read, remove, and clear notifications
- Limits to 20 notifications max

Error Handling Updates:
-  and  now accept  parameter
- Automatic notification dispatch for 403/500+ errors
- Added Cloudflare-specific error message

API Updates:
- , , ,  now pass source context
- , ,  include source tracking

UI Updates:
- Notifications screen shows combined source status and community notifications
- Library screen tracks unread source status notifications
- New  component with dismiss functionality

Other:
- Updated InkNest-Externals submodule
Update email address from inknest@mail.p2devs.engineer to inknest@capacity.rocks
across README and documentation pages.
The persistNotificationList function is synchronous and returns undefined,
not a Promise. Calling .catch() on undefined caused catch error. Removed the .catch() since MMKV storage
operations are synchronous.
- Change background color from #0F0F1A to #14142A to match Library screen
- Fix header title centering using absolute positioning for proper alignment
Refactor Novel APIs to support multiple sources via hostKey parameter,
enabling the app to fetch content from both NovelFire and WTR-Lab.

APIs:
- Refactor Reader.js, Search.js, Details.js, Home.js to accept optional
  hostKey parameter (default: 'novelfire')
- Add getHostKeyFromLink() for auto-detecting source from URLs
- Add WTR-Lab reader API integration with POST-based chapter fetching
- Add reading mode fallback logic (web → ai) for WTR-Lab chapters
- Add source-specific CSS selector configs in new constance.js
- Update index.js exports to include source configs and new functions

Components:
- Add SourceSelector component for switching between novel sources
  with status indicators (working/protected/down)
- Add WTRLabModeSelector component for selecting reading mode
  (web, webplus, ai) with persistence via Redux
- Refactor TextReader to split content into paragraphs with spacing
- Refactor WebReader with HTML document builder, URL builder,
  origin whitelisting, and WTR-Lab cookie/session support

Novel Reader:
- Add WTR-Lab text extraction via hidden WebView with injected JS
- Add fallback metadata builder for non-AI reading modes
- Fix scroll restoration to account for async content loading
- Add loading overlay during text extraction
- Add language mode button in header for WTR-Lab chapters

Source Status:
- Add recordSourceSuccess/recordSourceError tracking for novel APIs
- Register novel sources (novelfire, wtrlab) in sourceStatus.js
- Add NovelHostName config in APIs.js

Parsers:
- Add novelChapterParser.js with WTR-Lab chapter parsing
- Add novelDetailParser.js for source-agnostic detail parsing
- Add novelHomeParser.js for source-agnostic home page parsing
- Add NovelActions.js with switchNovelSource action
- Update Redux reducer to handle novel source state

Tests:
- Add novelChapterParser.test.js for parser validation

iOS:
- Update Podfile and Podfile.lock for new dependencies
- Update Xcode project.pbxproj for new resource files
@pushpender-singh-ap pushpender-singh-ap self-assigned this Mar 28, 2026
@pushpender-singh-ap pushpender-singh-ap marked this pull request as ready for review March 28, 2026 16:16
@pushpender-singh-ap pushpender-singh-ap merged commit c3ea1a5 into main Mar 28, 2026
1 check passed
@pushpender-singh-ap pushpender-singh-ap deleted the feature/novel-module branch March 28, 2026 16:17
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Introduce Novel Reading Module with Multi-Source Support and Offline Capabilities

✨ Enhancement

Grey Divider

Walkthroughs

Description
• **Novel Reading Module**: Comprehensive novel discovery, reading, and management system with
  support for multiple sources (NovelFire, WTR-Lab)
• **Multi-Source Architecture**: Implemented parsers and APIs for novel metadata extraction, chapter
  fetching, and content rendering from multiple sources
• **WTR-Lab Integration**: Added specific support for WTR-Lab including encrypted content
  decryption, multiple reading modes (web/webplus/ai), and host key detection
• **Offline Reading Support**: Implemented download manager and offline storage utilities enabling
  users to download chapters for offline viewing
• **Source Status Tracking**: Introduced comprehensive system to monitor and notify users about
  source availability, downtime, and health status via notifications and status indicators
• **Novel Reader Component**: Full-featured reader with text and webview modes, theme customization
  (dark/light/sepia), scroll position restoration, and reading progress tracking
• **Search & Discovery**: Multi-category search interface supporting Comics, Manga, and Novels with
  unified result rendering and novel-specific search functionality
• **Library Integration**: Added novel tab to library with bookmarks, reading history, continue
  reading functionality, and source selector
• **Reader Customization**: Settings modal for font size, line height, font family, theme, and
  reading mode preferences
• **UI/UX Improvements**: Enhanced Search component layout with centered header, updated background
  color, and improved category/source tab design
• **Redux State Management**: Added novel-specific state for bookmarks, reading history, chapter
  progress, and reader preferences
• **Error Handling**: Enhanced error tracking with source context and improved API error handling
  with hostkey parameter
Diagram
flowchart LR
  A["Novel Sources<br/>NovelFire, WTR-Lab"] -->|"Parse & Extract"| B["Novel Parsers<br/>novelChapterParser,<br/>novelDetailParser"]
  B -->|"Fetch Data"| C["Novel APIs<br/>Home, Details,<br/>Reader, Search"]
  C -->|"Render UI"| D["Novel Screens<br/>Home, Details,<br/>Reader, Search"]
  D -->|"Manage State"| E["Redux Store<br/>Bookmarks, History,<br/>Preferences"]
  E -->|"Persist"| F["Offline Storage<br/>Download Manager"]
  D -->|"Track Status"| G["Source Status<br/>Notifications,<br/>Indicators"]
  H["Search Module"] -->|"Integrate"| D
  I["Library"] -->|"Include"| D
Loading

Grey Divider

File Changes

1. src/Redux/Actions/parsers/novelChapterParser.js ✨ Enhancement +1377/-0

Novel chapter parser with multi-source and encryption support

• Introduces comprehensive novel chapter content parsing utilities with support for multiple novel
 sources
• Implements WTR-Lab specific decryption and parsing logic for arr: encrypted content format
• Provides generic parsing functions (parseNovelChapter, parsePaginatedChapter,
 parseChapterWithHtml) for standard HTML-based novel sites
• Includes source-specific parsers for NovelFire and ReadLightNovel with customizable selectors and
 content extraction

src/Redux/Actions/parsers/novelChapterParser.js


2. src/Screens/Search/Search.js ✨ Enhancement +490/-331

Multi-category search with novel integration and UI redesign

• Refactors search UI to support three content categories (Comics, Manga, Novels) with
 category-based filtering
• Replaces tab-based source selection with a dual-mode interface showing categories before search
 and sources after search
• Integrates novel search functionality via searchNovels API and unified result rendering with
 type badges
• Updates styling with new background color (#14142A), improved header centering, and enhanced
 category/source tab design
• Consolidates multiple render functions into single renderCombinedItem function handling Comics,
 Manga, and Novels uniformly

src/Screens/Search/Search.js


3. src/Screens/Novel/APIs/novelParser.js ✨ Enhancement +586/-0

NovelFire.net HTML parser with comprehensive metadata extraction

• Implements HTML parser for NovelFire.net with functions to extract novel metadata (title, author,
 rating, chapters, status)
• Provides parsers for home page sections, novel details, chapter lists, chapter content, and search
 results
• Includes helper functions for text cleaning, HTML entity decoding, and pattern-based content
 extraction
• Handles lazy-loaded images, relative URLs, and pagination information extraction

src/Screens/Novel/APIs/novelParser.js


View more (60)
4. src/Screens/Novel/Reader/NovelReader.js ✨ Enhancement +919/-0

Novel Reader Component with Multi-Mode Support

• Implements a comprehensive novel reader component with support for both text and webview modes
• Includes scroll position restoration, reading progress tracking, and theme customization
 (dark/light/sepia)
• Adds WTR-Lab specific text extraction via hidden WebView with JavaScript injection
• Provides chapter navigation, reader settings, and reading mode selection for multi-source support

src/Screens/Novel/Reader/NovelReader.js


5. src/Screens/Novel/APIs/Home.js ✨ Enhancement +768/-0

Novel Home API with Multi-Source Integration

• Implements home page fetching for multiple novel sources (NovelFire and WTR-Lab)
• Adds WTR-Lab specific parsers for novel-list, trending, and ranking pages with image mapping
• Includes genre, latest, and completed novel fetching with pagination support
• Integrates source status tracking for error monitoring and availability detection

src/Screens/Novel/APIs/Home.js


6. src/Screens/Novel/Details/NovelDetails.js ✨ Enhancement +814/-0

Novel Details Screen with Chapter Management

• Creates novel details screen displaying comprehensive information and chapter listings
• Implements chapter pagination, sorting (ascending/descending), and reading progress indicators
• Adds bookmark functionality and reading history tracking with last-read chapter resumption
• Provides chapter progress visualization with completion status and scroll position tracking

src/Screens/Novel/Details/NovelDetails.js


7. src/Redux/Actions/parsers/novelDetailParser.js ✨ Enhancement +613/-0

Novel Detail Parser with WTR-Lab Support

• Provides parsing utilities for novel details from HTML using Cheerio
• Implements WTR-Lab specific parser handling unique HTML structure and metadata extraction
• Includes chapter list parsing with pagination detection via DOM and regex methods
• Supports genre, rating, status, and summary extraction from multiple source formats

src/Redux/Actions/parsers/novelDetailParser.js


8. src/Screens/Novel/APIs/Reader.js ✨ Enhancement +374/-0

Novel Reader API with WTR-Lab Integration

• Implements chapter content fetching with multi-source support and reading mode selection
• Adds WTR-Lab reader API integration with fallback modes (web/webplus/ai) and encrypted content
 handling
• Includes host key detection from URLs and multi-chapter batch fetching for offline reading
• Provides source error tracking and validation for chapter content quality

src/Screens/Novel/APIs/Reader.js


9. src/Redux/Actions/GlobalActions.js 🐞 Bug fix +7/-6

Enhanced Error Handling with Source Tracking

• Updates handleAPIError calls to include hostkey parameter for better error tracking
• Modifies checkDownTime dispatch calls to pass source identifier for source-specific status
 monitoring
• Improves error handling in comic-related API functions with source context

src/Redux/Actions/GlobalActions.js


10. src/Constants/Navigation.js ⚙️ Configuration changes +7/-0

Novel Module Navigation Constants

• Adds six new navigation constants for novel module screens
• Includes routes for novelHome, novelDetails, novelReader, novelSearch, novelLibrary, and
 novelViewAll

src/Constants/Navigation.js


11. src/Screens/Novel/APIs/constance.js ⚙️ Configuration changes +570/-0

Novel source HTML parsing selectors and constants

• Introduces comprehensive CSS selector constants for parsing novel pages from multiple sources
 (novelfire and wtrlab)
• Defines selectors for home pages, detail pages, chapter pages, search pages, chapter lists, and
 ranking pages
• Includes image URL patterns and status mappings for novel metadata extraction
• Provides fallback selectors and alternative parsing strategies for different page layouts

src/Screens/Novel/APIs/constance.js


12. src/Screens/Novel/APIs/Details.js ✨ Enhancement +441/-0

Novel details and chapter list fetching API

• Implements getNovelDetails() function to fetch and parse novel information from multiple sources
• Implements getChapterList() with support for WTR-Lab API and HTML fallback parsing
• Includes auto-detection of source host key from novel links
• Records source success/error status for monitoring source availability

src/Screens/Novel/APIs/Details.js


13. src/Screens/Novel/Search/NovelSearch.js ✨ Enhancement +378/-0

Novel search interface with history and genres

• Creates a complete novel search screen with search history and genre browsing
• Implements pagination for search results with infinite scroll
• Includes genre tags for browsing novels by category
• Integrates with Crashlytics for error tracking and analytics

src/Screens/Novel/Search/NovelSearch.js


14. src/Screens/Comic/Library/index.js ✨ Enhancement +217/-9

Library integration with novel reading module

• Adds novel tab to the library alongside comics and manga tabs
• Integrates novel home sections, continue reading history, and source selector
• Adds novel bookmark count to total bookmark badge
• Includes source status notifications in unread notification logic

src/Screens/Comic/Library/index.js


15. src/Screens/Notifications/NotificationsScreen.js ✨ Enhancement +240/-15

Source status notifications in notification center

• Introduces SourceStatusCard component for displaying source health notifications
• Combines regular notifications with source status notifications in unified list
• Adds handlers for dismissing and marking source status notifications as read
• Displays status indicators for Cloudflare protection, server down, and other errors

src/Screens/Notifications/NotificationsScreen.js


16. src/Screens/Novel/Components/SourceSelector.js ✨ Enhancement +389/-0

Novel source selector with status indicators

• Creates SourceSelector component for switching between novel sources
• Includes StatusIndicator component showing real-time source health status
• Displays modal with available sources and their current status
• Integrates with Redux for source switching and status tracking

src/Screens/Novel/Components/SourceSelector.js


17. src/Screens/Novel/Reader/Components/ReaderSettings.js ✨ Enhancement +326/-0

Novel reader customization settings modal

• Implements reader settings modal for customizing reading experience
• Provides controls for reading mode (text/webview), theme (dark/light/sepia), font size, line
 height, and font family
• Dispatches Redux actions to persist user preferences
• Uses responsive sizing with percentage-based dimensions

src/Screens/Novel/Reader/Components/ReaderSettings.js


18. src/Redux/Reducers/index.js ✨ Enhancement +193/-0

Redux state management for novel module

• Adds novel state management including bookmarks, reading history, and reader preferences
• Implements reducers for novel bookmarks, history tracking, and chapter progress
• Adds source status notification reducers for tracking source health
• Includes novel source switching and WTR-Lab reading mode preferences

src/Redux/Reducers/index.js


19. src/Screens/Novel/Details/Components/NovelInfo.js ✨ Enhancement +353/-0

Novel information display components

• Creates NovelInfo component displaying novel cover, title, author, rating, and stats
• Implements expandable synopsis with "Read More" functionality
• Includes bookmark button with visual feedback for bookmarked state
• Provides compact variant (NovelInfoCompact) for header display

src/Screens/Novel/Details/Components/NovelInfo.js


20. src/Screens/Novel/Reader/Components/TextReader.js ✨ Enhancement +99/-0

Text-based novel chapter reader component

• Implements TextReader component for rendering chapter content in plain text mode
• Supports customizable font size, line height, font family, and theme
• Parses content into paragraphs with proper spacing and formatting
• Provides theme-specific color schemes (dark, light, sepia)

src/Screens/Novel/Reader/Components/TextReader.js


21. README.md Additional files +1/-1

...

README.md


22. __tests__/novelChapterParser.test.js Additional files +62/-0

...

tests/novelChapterParser.test.js


23. docs/blog/2026-03-28-release-v1.4.9.md Additional files +34/-0

...

docs/blog/2026-03-28-release-v1.4.9.md


24. docs/src/pages/faq.js Additional files +3/-3

...

docs/src/pages/faq.js


25. docs/src/pages/index.js Additional files +2/-2

...

docs/src/pages/index.js


26. ios/InkNest.xcodeproj/project.pbxproj Additional files +8/-24

...

ios/InkNest.xcodeproj/project.pbxproj


27. ios/Podfile Additional files +15/-0

...

ios/Podfile


28. src/Components/Func/HomeFunc.js Additional files +7/-7

...

src/Components/Func/HomeFunc.js


29. src/Components/UIComp/DownTime.js Additional files +2/-2

...

src/Components/UIComp/DownTime.js


30. src/Components/UIComp/SourceStatusBanner.js Additional files +283/-0

...

src/Components/UIComp/SourceStatusBanner.js


31. src/Components/UIComp/SourceStatusNotification.js Additional files +287/-0

...

src/Components/UIComp/SourceStatusNotification.js


32. src/InkNest-Externals Additional files +1/-1

...

src/InkNest-Externals


33. src/Navigation/AppNavigation.js Additional files +15/-0

...

src/Navigation/AppNavigation.js


34. src/Navigation/index.js Additional files +1/-1

...

src/Navigation/index.js


35. src/Redux/Actions/NovelActions.js Additional files +263/-0

...

src/Redux/Actions/NovelActions.js


36. src/Redux/Actions/parsers/novelHomeParser.js Additional files +323/-0

...

src/Redux/Actions/parsers/novelHomeParser.js


37. src/Redux/Actions/utils/errorHandlers.js Additional files +36/-6

...

src/Redux/Actions/utils/errorHandlers.js


38. src/Screens/Comic/APIs/Home.js Additional files +56/-11

...

src/Screens/Comic/APIs/Home.js


39. src/Screens/Comic/Bookmarks/NovelBookmarks.js Additional files +285/-0

...

src/Screens/Comic/Bookmarks/NovelBookmarks.js


40. src/Screens/Comic/Bookmarks/index.js Additional files +73/-7

...

src/Screens/Comic/Bookmarks/index.js


41. src/Screens/Novel/APIs/Search.js Additional files +144/-0

...

src/Screens/Novel/APIs/Search.js


42. src/Screens/Novel/APIs/index.js Additional files +34/-0

...

src/Screens/Novel/APIs/index.js


43. src/Screens/Novel/Components/DownloadButton.js Additional files +165/-0

...

src/Screens/Novel/Components/DownloadButton.js


44. src/Screens/Novel/Components/NovelCard.js Additional files +359/-0

...

src/Screens/Novel/Components/NovelCard.js


45. src/Screens/Novel/Components/NovelList.js Additional files +152/-0

...

src/Screens/Novel/Components/NovelList.js


46. src/Screens/Novel/Components/SectionHeader.js Additional files +91/-0

...

src/Screens/Novel/Components/SectionHeader.js


47. src/Screens/Novel/Details/Components/ChapterList.js Additional files +296/-0

...

src/Screens/Novel/Details/Components/ChapterList.js


48. src/Screens/Novel/Details/Components/GenreTags.js Additional files +179/-0

...

src/Screens/Novel/Details/Components/GenreTags.js


49. src/Screens/Novel/Details/index.js Additional files +1/-0

...

src/Screens/Novel/Details/index.js


50. src/Screens/Novel/Home/index.tsx Additional files +143/-0

...

src/Screens/Novel/Home/index.tsx


51. src/Screens/Novel/Library/NovelLibrary.js Additional files +232/-0

...

src/Screens/Novel/Library/NovelLibrary.js


52. src/Screens/Novel/Library/index.js Additional files +1/-0

...

src/Screens/Novel/Library/index.js


53. src/Screens/Novel/Reader/Components/WTRLabModeSelector.js Additional files +263/-0

...

src/Screens/Novel/Reader/Components/WTRLabModeSelector.js


54. src/Screens/Novel/Reader/Components/WebReader.js Additional files +324/-0

...

src/Screens/Novel/Reader/Components/WebReader.js


55. src/Screens/Novel/Reader/index.js Additional files +1/-0

...

src/Screens/Novel/Reader/index.js


56. src/Screens/Novel/Search/index.js Additional files +1/-0

...

src/Screens/Novel/Search/index.js


57. src/Screens/Novel/SeeAll/index.js Additional files +212/-0

...

src/Screens/Novel/SeeAll/index.js


58. src/Screens/Novel/Utils/DownloadManager.js Additional files +251/-0

...

src/Screens/Novel/Utils/DownloadManager.js


59. src/Screens/Novel/Utils/OfflineStorage.js Additional files +336/-0

...

src/Screens/Novel/Utils/OfflineStorage.js


60. src/Screens/Novel/index.js Additional files +10/-0

...

src/Screens/Novel/index.js


61. src/Utils/APIs.js Additional files +4/-0

...

src/Utils/APIs.js


62. src/Utils/hooks/useSourceStatus.js Additional files +157/-0

...

src/Utils/hooks/useSourceStatus.js


63. src/Utils/sourceStatus.js Additional files +321/-0

...

src/Utils/sourceStatus.js


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 28, 2026

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. Broken hook import paths 🐞 Bug ✓ Correctness
Description
src/Utils/hooks/useSourceStatus.js imports ../Redux/Reducers and ../Utils/sourceStatus, which
do not exist relative to src/Utils/hooks, causing a module-resolution failure when the hook is
imported.
Code

src/Utils/hooks/useSourceStatus.js[R1-14]

+import {useSelector, useDispatch} from 'react-redux';
+import {useCallback, useEffect, useState} from 'react';
+import {
+  markSourceStatusNotificationRead,
+  removeSourceStatusNotification,
+  clearSourceStatusNotifications,
+} from '../Redux/Reducers';
+import {
+  getSourceStatus,
+  getAllSourceStatuses,
+  SOURCE_STATUS,
+  formatLastChecked,
+  getSourceLabel,
+} from '../Utils/sourceStatus';
Evidence
The hook is located at src/Utils/hooks/useSourceStatus.js, but it tries to import Redux reducers
and sourceStatus using paths that would resolve under src/Utils/... rather than src/.... Other
components import the same modules using correct relative paths, demonstrating the intended
locations.

src/Utils/hooks/useSourceStatus.js[1-14]
src/Components/UIComp/SourceStatusNotification.js[4-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`src/Utils/hooks/useSourceStatus.js` uses incorrect relative import paths (`../Redux/Reducers` and `../Utils/sourceStatus`) that cannot resolve from inside `src/Utils/hooks/`, leading to bundler/runtime "module not found" failures.

## Issue Context
The correct modules live under `src/Redux/Reducers` and `src/Utils/sourceStatus`.

## Fix Focus Areas
- src/Utils/hooks/useSourceStatus.js[1-14]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Downtime never clears 🐞 Bug ⛯ Reliability
Description
Several success paths pass an Axios response object (or a non-error object) into checkDownTime,
but checkDownTime only reads error.response.status, so DownTime(false) and
recordSourceSuccess() are skipped and downtime/source-status can remain stuck after failures.
Code

src/Components/Func/HomeFunc.js[80]

+    dispatch(checkDownTime(response, baseUrl));
Evidence
On successful requests, code dispatches checkDownTime(response, ...) and even logs
response.status, implying the status is on the response object. However, checkDownTime looks
only at error?.response?.status, so passing a response object yields statusCode === undefined
and the function does not reset downtime (it only resets when !error). GlobalActions also passes
{filters} on success, which is truthy and similarly prevents the reset branch.

src/Components/Func/HomeFunc.js[80-86]
src/Components/Func/HomeFunc.js[167-179]
src/Redux/Actions/utils/errorHandlers.js[38-50]
src/Redux/Actions/GlobalActions.js[280-288]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`checkDownTime()` is used with both Axios error objects and Axios success response objects. After the change, it only inspects `error.response.status`, so when callers pass a success `response` (with `response.status`) or other truthy placeholders, downtime/source-status is not cleared.

## Issue Context
Call sites in `HomeFunc` and `GlobalActions` dispatch `checkDownTime(response, sourceKey)` / `checkDownTime({filters}, source)` on success, but `checkDownTime` only clears downtime when the first argument is falsy.

## Fix Focus Areas
- src/Redux/Actions/utils/errorHandlers.js[38-95]
- src/Components/Func/HomeFunc.js[80-86]
- src/Components/Func/HomeFunc.js[167-179]
- src/Redux/Actions/GlobalActions.js[280-288]

## Suggested direction
Either:
- Update all success-path callers to dispatch `checkDownTime(null, sourceKey)` (and stop passing response/placeholder objects), OR
- Make `checkDownTime(result, sourceKey)` handle both shapes by deriving `statusCode` from `result.response?.status ?? result.status` and treating 2xx/3xx as success (dispatch `DownTime(false)` + `recordSourceSuccess(sourceKey)`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Offline novel path collision 🐞 Bug ✓ Correctness
Description
OfflineStorage.getNovelPath() derives the novel directory using only
novelLink.split('/book/')[1] and falls back to 'unknown', but WTR-Lab novel URLs use /novel/,
so WTR-Lab downloads will collide in the same directory and overwrite metadata/chapters.
Code

src/Screens/Novel/Utils/OfflineStorage.js[R29-32]

+export function getNovelPath(novelLink) {
+  const slug = novelLink.split('/book/')[1]?.replace(/\//g, '-') || 'unknown';
+  return `${NOVELS_ROOT}/${slug}`;
+}
Evidence
Offline storage expects /book/ in the novel URL; when absent it uses 'unknown'. WTR-Lab config
and API code show WTR-Lab novel links are /novel/..., so they will not match /book/ and will
therefore all share the 'unknown' storage folder, causing cross-novel overwrites.

src/Screens/Novel/Utils/OfflineStorage.js[29-32]
src/Screens/Novel/APIs/constance.js[109-116]
src/Screens/Novel/APIs/Details.js[226-244]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Offline novel storage path generation assumes URLs contain `/book/`. For WTR-Lab (which uses `/novel/`), `getNovelPath()` falls back to `'unknown'`, so all WTR-Lab novels share the same directory and overwrite each other.

## Issue Context
This impacts offline downloads (chapters + metadata) and can cause user data loss/corruption.

## Fix Focus Areas
- src/Screens/Novel/Utils/OfflineStorage.js[29-32]
- src/Screens/Novel/APIs/constance.js[109-116]

## Suggested direction
Derive a stable, filesystem-safe, unique directory name from the full URL (e.g., host + pathname) using `new URL(novelLink)` and then sanitize, or use a hash (e.g., SHA1/MD5) of `novelLink`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

4. Notification timing inverted 🐞 Bug ✓ Correctness
Description
shouldShowNotification() says it notifies again if an error persists for more than 1 hour, but it
returns stored.lastError > oneHourAgo, which is true only within the last hour and false after an
hour.
Code

src/Utils/sourceStatus.js[R276-280]

+  // If error persists for more than 1 hour, notify again
+  if (stored.lastError) {
+    const oneHourAgo = Date.now() - 3600000;
+    return stored.lastError > oneHourAgo;
+  }
Evidence
The implementation contradicts its own comment: oneHourAgo is a timestamp in the past, so
lastError > oneHourAgo means the error happened more recently than an hour ago. This prevents
re-notification after an hour and can cause repeated notifications within the first hour if the
function is called repeatedly.

src/Utils/sourceStatus.js[254-283]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`shouldShowNotification()` implements the opposite of its documented behavior for the 1-hour retry notification window.

## Issue Context
The code uses `return stored.lastError > oneHourAgo;` but the comment says "more than 1 hour".

## Fix Focus Areas
- src/Utils/sourceStatus.js[254-283]

## Suggested direction
Change the condition to trigger when the last error is older than 1 hour, e.g. `stored.lastError < oneHourAgo` or `Date.now() - stored.lastError > 3600000`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment on lines +1 to +14
import {useSelector, useDispatch} from 'react-redux';
import {useCallback, useEffect, useState} from 'react';
import {
markSourceStatusNotificationRead,
removeSourceStatusNotification,
clearSourceStatusNotifications,
} from '../Redux/Reducers';
import {
getSourceStatus,
getAllSourceStatuses,
SOURCE_STATUS,
formatLastChecked,
getSourceLabel,
} from '../Utils/sourceStatus';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Broken hook import paths 🐞 Bug ✓ Correctness

src/Utils/hooks/useSourceStatus.js imports ../Redux/Reducers and ../Utils/sourceStatus, which
do not exist relative to src/Utils/hooks, causing a module-resolution failure when the hook is
imported.
Agent Prompt
## Issue description
`src/Utils/hooks/useSourceStatus.js` uses incorrect relative import paths (`../Redux/Reducers` and `../Utils/sourceStatus`) that cannot resolve from inside `src/Utils/hooks/`, leading to bundler/runtime "module not found" failures.

## Issue Context
The correct modules live under `src/Redux/Reducers` and `src/Utils/sourceStatus`.

## Fix Focus Areas
- src/Utils/hooks/useSourceStatus.js[1-14]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

}
}
dispatch(checkDownTime(response));
dispatch(checkDownTime(response, baseUrl));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Downtime never clears 🐞 Bug ⛯ Reliability

Several success paths pass an Axios response object (or a non-error object) into checkDownTime,
but checkDownTime only reads error.response.status, so DownTime(false) and
recordSourceSuccess() are skipped and downtime/source-status can remain stuck after failures.
Agent Prompt
## Issue description
`checkDownTime()` is used with both Axios error objects and Axios success response objects. After the change, it only inspects `error.response.status`, so when callers pass a success `response` (with `response.status`) or other truthy placeholders, downtime/source-status is not cleared.

## Issue Context
Call sites in `HomeFunc` and `GlobalActions` dispatch `checkDownTime(response, sourceKey)` / `checkDownTime({filters}, source)` on success, but `checkDownTime` only clears downtime when the first argument is falsy.

## Fix Focus Areas
- src/Redux/Actions/utils/errorHandlers.js[38-95]
- src/Components/Func/HomeFunc.js[80-86]
- src/Components/Func/HomeFunc.js[167-179]
- src/Redux/Actions/GlobalActions.js[280-288]

## Suggested direction
Either:
- Update all success-path callers to dispatch `checkDownTime(null, sourceKey)` (and stop passing response/placeholder objects), OR
- Make `checkDownTime(result, sourceKey)` handle both shapes by deriving `statusCode` from `result.response?.status ?? result.status` and treating 2xx/3xx as success (dispatch `DownTime(false)` + `recordSourceSuccess(sourceKey)`).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +29 to +32
export function getNovelPath(novelLink) {
const slug = novelLink.split('/book/')[1]?.replace(/\//g, '-') || 'unknown';
return `${NOVELS_ROOT}/${slug}`;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Offline novel path collision 🐞 Bug ✓ Correctness

OfflineStorage.getNovelPath() derives the novel directory using only
novelLink.split('/book/')[1] and falls back to 'unknown', but WTR-Lab novel URLs use /novel/,
so WTR-Lab downloads will collide in the same directory and overwrite metadata/chapters.
Agent Prompt
## Issue description
Offline novel storage path generation assumes URLs contain `/book/`. For WTR-Lab (which uses `/novel/`), `getNovelPath()` falls back to `'unknown'`, so all WTR-Lab novels share the same directory and overwrite each other.

## Issue Context
This impacts offline downloads (chapters + metadata) and can cause user data loss/corruption.

## Fix Focus Areas
- src/Screens/Novel/Utils/OfflineStorage.js[29-32]
- src/Screens/Novel/APIs/constance.js[109-116]

## Suggested direction
Derive a stable, filesystem-safe, unique directory name from the full URL (e.g., host + pathname) using `new URL(novelLink)` and then sanitize, or use a hash (e.g., SHA1/MD5) of `novelLink`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant