Skip to content

5e358f6

Choose a tag to compare

@github-actions github-actions released this 04 Oct 09:33
· 1 commit to master since this release
LXManga: chapters — download with OkHttp, never prompt for a login

Two problems reported from the device: the catalogue works now, but
opening a chapter popped the "Đăng nhập" screen — on a site that has no
accounts at all, where solving the Cloudflare challenge is the entire
gate.

  1. The prompt was ours. getPages threw AuthRequiredException for
     *any* failure, and that exception is the app's "ask the user to
     sign in" signal, so it opened SourceAuthActivity — which then
     closed itself immediately (isAuthorized() sees the clearance) and
     reappeared on the retry. `fail()` now only asks for
     authentication when there is genuinely no clearance; otherwise it
     raises a plain IOException with the reason.

  2. The chapter fetch did not fit the WebView's budget. A single
     `evaluateJs` call is capped at 4 s by the app, and the script was
     expected to download a ~900 kB page *and* run the page's
     obfuscated decryptor inside it. So the download now happens over
     OkHttp first (no such limit, and Cloudflare already accepts this
     client — the catalogue proves it), and the WebView only has to
     `document.write` the markup we hand it and wait up to 3 s for the
     decrypted `window["_0x…"]` array.

The render step still cannot be avoided: the page ships no image URLs,
it ships a script that decrypts them.

Tests: 36/36, including "challenge on the chapter fetch propagates to
the app", "failure with a clearance → IOException, never the login
screen", "failure without one → AuthRequiredException".