Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReLibrary: Fix loading scraping+loading covers when a novel is parsed #1353

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Maix0
Copy link
Contributor

@Maix0 Maix0 commented Dec 3, 2024

This is a small fix that makes it possible to load covers from a parsed novel.
There is also a small fix that will trim / from the urls when storing them. this should be a utilty function to prevent code duplication in my optinion (my version is not good though);

I don't know if this is a site specific thing, but all the img tags had the src attribute non-existant by default (aka when transmitted over the wire), but an attribute named data-cfsrc was present with the same value as the loaded website on a browser.

Currently my solution is to check both and prefer img.src if it exits

bumped version to 1.1.0, maybe a smaller bump should be used but I don't know :)

To note: the plugin does work normally now.


imageRequestInit: Plugin.ImageRequestInit = {
headers: {
Referer: ReLibraryPlugin.site,
Copy link
Member

Choose a reason for hiding this comment

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

Should be this.site instead? I dont think site is a static attribute

@@ -316,10 +344,10 @@ class ReLibraryPlugin implements Plugin.PluginBase {
}
chapters.push({
name: loadedCheerio(chap_el).text(),
path: chap_path,
path: ReLibraryPlugin.trim_slashes(chap_path),
Copy link
Member

Choose a reason for hiding this comment

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

should be this.trim_slashes instead

Comment on lines +175 to +179
private static trim_slashes(url: string): string {
while (url.startsWith('/')) url = url.slice(1);
while (url.endsWith('/')) url = url.slice(0, url.length - 1);
return url;
}
Copy link
Member

Choose a reason for hiding this comment

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

be careful, after this changes, novels in popular and search would be treated as new novels (though they were installed) because the path is not same as in the database

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.

2 participants