feat(english): add We Tried TLS source plugin - #2588
Conversation
|
| const blocks = body.match( | ||
| /<p[\s\S]*?<\/p>|<h[1-6][\s\S]*?<\/h[1-6]>|<figure[\s\S]*?<\/figure>|<img[^>]*>/gi, | ||
| ) || [body]; |
There was a problem hiding this comment.
Unsafe chapter HTML reaches reader
If a remote chapter contains an event handler, such as an image with an onerror attribute, these blocks preserve it and the reader inserts the HTML without sanitizing it. That allows code from the chapter page to run in the reader. Sanitize the retained HTML before returning it.
How this was verified: Remote chapter markup retains its attributes and reaches the reader’s unsanitized HTML insertion point.
| while (start < end && isEdgeJunk(blocks[start])) start++; | ||
| while (end > start && isEdgeJunk(blocks[end - 1])) end--; | ||
| const cleaned = blocks.slice(start, end).join('\n'); | ||
| if (!paragraphText(cleaned)) return { status: 'empty' }; |
There was a problem hiding this comment.
Image-only chapters appear unavailable
For a chapter made entirely of illustrations, paragraphText strips the image tags and finds no text. This check marks the chapter empty, so readers see “Could not load this chapter” instead of its images. Treat retained images as nonempty content.
| if (!paragraphText(cleaned)) return { status: 'empty' }; | |
| if (!paragraphText(cleaned) && !/<img[\s>]/i.test(cleaned)) | |
| return { status: 'empty' }; |
| '&perPage=500&order=asc', | ||
| ), | ||
| ); | ||
| lastPage = page.lastPage; |
There was a problem hiding this comment.
Failed requests truncate chapter lists
If a free-chapter page request fails, fetchText returns an empty string. The parser then defaults lastPage to 1, and this assignment stops pagination. parseNovel returns an incomplete chapter list as though it were complete; the request failure needs to be handled separately.
| return ( | ||
| 'https://images.weserv.nl/?url=' + | ||
| encodeURIComponent(bare) + | ||
| '&w=400&q=80&output=webp' | ||
| ); |
There was a problem hiding this comment.
Covers depend on external proxy
Every HTTP cover URL is replaced with an images.weserv.nl URL, with no fallback to the original image. If that proxy is blocked or unavailable while the source CDN still works, all covers for this plugin fail to load. Keeping a direct-image fallback would avoid that dependency.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Addressed all four review findings:
No test files added to this PR, per your note on #2575. |
Adds the We Tried TLS (wetriedtls.com) source plugin for English-translated Korean web novels.
Implementation notes:
Verified: popularNovels, searchNovels, parseNovel and parseChapter all pass against the live site; ESLint and Prettier are clean.