ProjectsMangaDex for Paperback
The MangaDex extension icon centered in a soft orange glow

iOS extension

MangaDex for Paperback

MangaDex sign in, search, and chapters inside the Paperback reader on iOS

Inkdex extensions
4pull requests merged
5sign in refresh outcomes
6search prefixes, such as id, ch, and author

MangaDex for Paperback is an extension that lets Paperback, an iOS manga reader, sign in to MangaDex, search it, and open its titles and chapters. It lives in the Inkdex extensions repo, where I maintain it, and builds on the Inkdex project's own MangaDex code.

How it works

The extension is TypeScript against the Paperback SDK, and every request goes through one network layer. That layer checks whether the access token is within 60 seconds of expiring and refreshes it first, so a screen full of requests doesn't each try to sign in again.

A flowchart showing that an expiring token is refreshed once and shared, and that the refresh ends in one of five outcomes, only two of which allow a retry after a 401
The five outcomes of a refresh. Refreshed sends the request with the new token, and Already done sends it with the newer tokens a parallel refresh saved. The other three send it without a token, and a rejected sign in also clears the session while a failed refresh logs an error. After a 401, a request is retried once, and only when the refresh saved new tokens or found that a parallel refresh already had.

Four of my pull requests have been merged there. They cover letting chapters be removed, clearing the read queue, title priority with romanized titles, and a restructuring with bug fixes.

A related project is Paperback2Aidoku, a tool I wrote for moving a library from Paperback to Aidoku.

Highlights

  1. Tokens in the wrong slotsThe access and refresh tokens can arrive in swapped slots. The extension reads each token's type and puts them back, instead of trusting the slot.
  2. Requests share one refreshSeveral requests can find the sign in token about to expire at once. One refresh runs and they share it. If the API rejects a request with a 401, the extension tries a refresh and retries the request once. It retries only when that refresh saved new tokens or found that a parallel refresh already had.
  3. Search that takes a pasted IDPrefixes such as id, ch, grp, usr, author, and list take a MangaDex ID, and a pasted MangaDex link works too. The search then finds the title, the title a chapter belongs to, or the titles from a group, author, user, or list. Choosing Best Match ranks title results by relevance.

Built with

  • TypeScript
  • The Paperback SDK
  • OAuth

Details

Started
Status
Maintained
License
GPL 3.0 or later
Source
Public
Built on
Inkdex general extensions