Commit graph

61 commits

Author SHA1 Message Date
Mehakdeep Singh
bbc7fa04f5 fix(downloads): unstall anime downloads on sources that return URLs with query strings or HTTP 206
Two related bugs left anime downloads stuck at 0% with no error visible to
the user. Manga downloads from clean HTTPS sources were unaffected.

1) lib/utils/extensions/string_extensions.dart

   isMediaVideo() did a plain endsWith on the full URL string, so URLs
   shaped like https://host/play/{id}/video.mp4?for={token} (used by
   AnimeGG and several other sources) failed the filter because of the
   trailing `?for=...` query string. With both m3u8Urls and nonM3u8Urls
   empty in downloadChapter, the surrounding
   Future.doWhile(() => isOk == true) poll never sets isOk and waits
   forever -- MDownloader is never constructed.

   Fix: match against Uri.tryParse(this)?.path instead of the full
   string, and use a leading "." in the suffix so e.g. "flashmp4" cannot
   accidentally match.

2) lib/services/download_manager/download_isolate_pool.dart

   Once the URL passes the filter, _downloadFile (anime branch) opens a
   streaming request. When the source extension sets Range: bytes=0-,
   the server correctly responds with HTTP 206 Partial Content. The
   previous "if (response.statusCode != 200)" check rejected that,
   retried 3x, and threw. The throw was masked by an outer catch(_) in
   downloadChapter, so the user only saw a forever-spinner.

   Fix: accept any 2xx (>= 200 && < 300). Same fix applied to
   _downloadSegment for HLS segment fetches.

Repro
- Source: AnimeGG (en) -- install via Mangayomi extensions
- Pick any episode (tested with Toriko Ep 147, Gintama Ep 39, Grand Blue
  Ep 12)
- Tap the download icon

Before: an empty
".../AnimeGG (EN)/<series>/<episode>.mp4"-named folder is created, the
download icon stays in the spinner state, no error toast.

After: the .mp4 is written to disk at the size declared in Content-Length
(65,026,283 bytes for Toriko Ep 147), plays in the system video player.

Tested on macOS 26.3 / Apple Silicon with AnimeGG (multiple episodes,
multiple series, including a 180 MB 720p) and a manga control
(Asura Scans, 9 pages) on the same build to confirm no regression on the
manga path.
2026-05-09 19:10:35 -07:00
Moustapha Kodjo Amadou
8c416563d4
Merge pull request #714 from NBA2K1/main
Rewrite chapter update & sorting; Preserve read state & improve ChapterRecognition & adapt EndOfMangaCard to reading mode & Clean Code
2026-04-30 11:19:11 +01:00
NBA2K1
3051c0ab97 Fix bug
Fix a rare bug in the chapter list.
2026-04-27 22:58:38 +02:00
NBA2K1
0c46b88002 Remove isMobile and isDesktop Extension
Platform checks shouldn't be dependent on BuildContext.
2026-04-26 19:39:14 +02:00
NBA2K1
a9e307b2a4 Add multi-season support and split parse methods
Changes:
- Add season-keyword regex (staffel, season, saison, temporada) and
  episode-keyword regex (folge, episode, ep.) to reliably extract
  the correct number regardless of name format
- parseChapterNumber() now encodes season context into the sort key
  (season * 100000 + episode) so multi-season anime sort correctly
  across seasons without mixing episode numbers
- Add parseEpisodeNumber() which strips season context and returns
  only the episode number within a season; use this for tracker
  updates (MAL/AniList/Kitsu) and AniSkip lookups, where the tracker
  entry is already season-specific
- Switch updateTrackChapterRead and getAniSkipResults to
  parseEpisodeNumber to fix incorrect episode reporting for
  multi-season anime
- Compile all RegExp objects as static finals instead of per-call
  instantiation
- Refactor duplicated parse logic into a single private _parse()
  method with an applySeason flag
2026-04-26 03:32:28 +02:00
NBA2K1
085c731bce Make chapter UI list descending by default
- remove the reverse parameter because false is already the model default, so passing it is redundant.
- flip the reverse bool, to keep the chapter sorting of already added manga the same.
  Otherwise the user would have to change the sorting orientation for the chapters in the library.
2026-04-26 03:29:27 +02:00
NBA2K1
8ac25750a2 Why reverse the reading list and then calculate -1 2026-04-25 00:15:13 +02:00
NBA2K1
4077511022 Improve chapter sorting & update logic
- Add ChapterRecognition for numeric chapter parsing
- Replace old comparators with chapter‑number–aware sorting
- Unify sort modes and simplify list handling
- Rewrite updateMangaDetail with URL‑based dedupe
- Preserve read state across scanlators
- Update existing chapters instead of recreating
- Only create Update entries for new unread chapters
- Recompute smartUpdateDays using combined chapter list
- Remove outdated reversed/index‑based logic
2026-04-24 19:00:10 +02:00
NBA2K1
0a2c8e2649 rename files manga.dart and chapter.dart 2026-04-23 18:53:25 +02:00
NBA2K1
148943093f Move String Extension to correct place 2026-04-21 22:59:12 +02:00
Moustapha Kodjo Amadou
6fe1b8e844 Refactor chapter navigation and improve page indicator responsiveness 2026-04-21 16:52:43 +01:00
NBA2K1
47ed3cbef9 Update manga.dart
implement suggestion by Copilot.

https://github.com/kodjodevf/mangayomi/pull/703#discussion_r3093233947
2026-04-16 16:43:06 +02:00
NBA2K1
45a6633344 Update manga.dart
implement suggestion by Copilot.

https://github.com/kodjodevf/mangayomi/pull/703#discussion_r3093233926
2026-04-16 16:36:45 +02:00
NBA2K1
6aef999fd1 move extensions to correct files 2026-04-15 23:41:19 +02:00
NBA2K1
09a4517d33 Fix reader 2026-04-15 22:08:54 +02:00
Moustapha Kodjo Amadou
566da0ae06 feat: implement multiple bug fixes and feature requests\n\n- #339: Remember window size/position on desktop (WindowGeometry utility)\n- #256: Add S key shortcut to skip intro in desktop anime player\n- #372: Auto-delete downloaded chapters after reading (new setting + toggle)\n- #402: Fix manhwa reader scroll jumps by caching image dimensions for placeholders\n- #608: Fix 'Fit width' scale type cropping pages in paged reader mode\n- #572: Add mouse back button navigation support on desktop" 2026-03-17 14:31:21 +01:00
Moustapha Kodjo Amadou
95a55d5f81 feat: Implement upcoming manga calendar feature
- Added UpcomingUIModel for managing upcoming manga list items with headers and items.
- Introduced CalendarDay widget to display individual days with event indicators.
- Created CalendarHeader widget for navigating between months.
- Developed CalendarIndicator for visualizing events on specific days.
- Implemented UpcomingCalendar to manage the calendar view and event loading.
- Added UpcomingItem widget for displaying individual upcoming manga with cover images.
- Introduced FetchInterval utility to calculate fetch intervals based on chapter upload dates.
- Refactored updateMangaDetail to utilize FetchInterval for smart update days.
- Enhanced MedianExtension to ensure correct median calculation.
- Removed unused imports and commented-out code for cleaner implementation.
2026-03-05 12:05:29 +01:00
Moustapha Kodjo Amadou
b9f9a8398f Refactor download management with shared isolate pool and optimize concurrent downloads 2026-01-08 13:01:15 +01:00
NBA2K1
0f83899bac remove unnecessary calls
.trimLeft().trimRight() after trim() is unnecessary.
2025-12-17 21:34:45 +01:00
NBA2K1
a078b59678 Use floor() instead of round()
- Using round() will push values up too early.
Example: log(999) / log(1024) = 0.999
.round() = 1.
Result: 0.98 kB instead of 999 B

- Use correct units, as base1024 = KiB, MiB, etc. and base1000 = kB, MB, GB, ...
2025-12-17 21:24:26 +01:00
NBA2K1
0ed8ee2cd2 Move cacheDir creation to storage_provider
- Move the cacheDir creation to storage_provider from `others.dart`, `custom_extended_image_provider.dart` and `storage_usage.dart`.

- Use the correct directory, `getApplicationCacheDirectory()` instead of the `getTemporaryDirectory()` (which is being deleted by the OS regularly) for cache files.

- remove the `_cacheDownloadPath` from `storage_usage.dart` as the path is never being created in the first place, so using that path in `clearCache()` and `_getTotalDiskSpace()` is unnecessary.
2025-12-17 20:55:41 +01:00
Moustapha Kodjo Amadou
93a17cc797 Enhance DOM extension methods with additional pseudo-selector handlers and improve nth-child logic 2025-10-30 14:24:43 +01:00
Schnitzel5
05d0ddf0d6 reworked local source
- allow multiple local folders
- added support for scanning .epub novels
- added metadata,json support
- scanned entries now appear in browse screen instead of the default library category (can be added to library)
2025-09-04 23:02:27 +02:00
Moustapha Kodjo Amadou
600a699708 feat: Add use sourceId property if not null to get source model 2025-08-28 12:12:23 +01:00
Schnitzel5
6be2775fee added filler, thumbnail and description info to chapter list 2025-07-25 20:08:51 +02:00
Schnitzel5
1450641f16 added mpv config for Anime4K 2025-07-24 22:25:14 +02:00
Schnitzel5
5b56578029 separated some classes from reader_view 2025-07-23 03:16:24 +02:00
Moustapha Kodjo Amadou
debbb26dbf Refactor UChapDataPreloadExtensions to improve image byte retrieval logic 2025-07-09 14:49:42 +01:00
Moustapha Kodjo Amadou
0f430f80d9 Fix indexing and path for downloaded chapter images and update padding logic 2025-06-04 17:28:31 +01:00
Moustapha Kodjo Amadou
80efee40d1 dart format 2025-05-30 17:43:42 +01:00
Moustapha Kodjo Amadou
c3ac07fa97 feat(reader): implement chapter transition view
- Introduced `TransitionViewPaged` and `TransitionViewVertical` widgets to handle chapter transitions.
- Created `ChapterTransitionPage` widget to display transition information between chapters.
- Updated reader view logic to incorporate transition pages when navigating chapters.
- Enhanced `UChapDataPreload` model to support transition states and next chapter information.

feat(localization): add chapter transition messages in multiple languages

fix(dependencies): update Dart SDK and dependencies

- Updated Dart SDK constraint to ^3.8.0.
- Changed `epubx` dependency to use the latest version from GitHub.
2025-05-27 17:30:31 +01:00
Moustapha Kodjo Amadou
3e401c8af2 dart format 2025-02-23 15:31:49 +01:00
Moustapha Kodjo Amadou
3eeb4777a6 feat: improve chapter download 2025-01-30 15:09:47 +01:00
kodjomoustapha
36fd6d2709 fix getCachedImageFile 2024-12-24 12:46:12 +01:00
kodjomoustapha
a41ccaff22 fix & reformat 2024-12-20 10:15:15 +01:00
Moustapha Kodjo Amadou
9d712654a9
Merge branch 'main' into refactor/refactor-extensions-service 2024-12-20 09:15:26 +01:00
kodjomoustapha
f99bc996b1 fix 2024-12-19 17:52:47 +01:00
Yegor Shovkun
adbd1529f7 fix: cs fix (reformat with 120 line length) 2024-12-14 12:38:56 +02:00
kodjomoustapha
4748f3c699 fix 2024-12-13 10:31:57 +01:00
kodjomoustapha
65414a98ca fix #309 2024-11-27 15:15:16 +01:00
kodjomoustapha
c10f7d120a control where to show cloudflare error message 2024-10-29 13:28:16 +01:00
kodjomoustapha
e7eb3166ef - 2024-09-11 12:04:55 +01:00
kodjomoustapha
e2c7398903 refactor 2024-09-04 11:41:19 +01:00
kodjomoustapha
6c4e2eaeee + 2024-09-03 12:02:25 +01:00
kodjomoustapha
7d5640e2b0 feat: add a custom request headers for getPageList #235 2024-08-02 14:51:39 +01:00
kodjomoustapha
2ff3c0ebcc + 2024-08-02 11:21:42 +01:00
kodjomoustapha
c75b3bb5aa + 2024-06-27 09:41:53 +01:00
kodjomoustapha
59ed4da8de Add a wonderfull css package(pseudom) with custom pseudo selectors 2024-06-15 13:27:44 +01:00
kodjomoustapha
49bae6d143 + 2024-05-30 14:03:13 +01:00
kodjomoustapha
5f8344b2b3 fix cropBorders 2024-05-29 17:55:05 +01:00