Difegue / LANraragi

Web application for archival and reading of manga/doujinshi. Lightweight and Docker-ready for NAS/servers.
https://lrr.tvc-16.science
MIT License
2.22k stars 156 forks source link

Metadata Plugins not working? #256

Closed gth7754125 closed 4 years ago

gth7754125 commented 4 years ago

LRR Version and OS MAC Catalina 10.15.2 Use Homebrew to install LANraragi 0.6.7

①When i use Nhentai Plugin to search the tags, the console report these messages : "Use of uninitialized value $abspath in index at /usr/local/Cellar/lanraragi/0.6.7/script/../lib/LANraragi/Controller/Api.pm line 151." And Error :Connect timeout at /usr/local/Cellar/lanraragi/0.6.7/script/../lib/LANraragi/Plugin/nHentai.pm line 101.

② I change Ehentai plugin to repeat the operation, and it shows another exception: Use of uninitialized value $abspath in index at "/usr/local/Cellar/lanraragi/0.6.7/script/../lib/LANraragi/Controller/Api.pm line 151. [E-Hentai] [info] Cookies provided [https://exhentai.org] (""MY Ehentai Cookies id and password hash"" Information...)!" And Error : Connect timeout at /usr/local/Cellar/lanraragi/0.6.7/script/../lib/LANraragi/Plugin/EHentai.pm line 275.

ScreenShot: image

gth7754125 commented 4 years ago

sorry for some part of wrong report above. there are two problems in my case. One of it is lanraragi can't load my archieves abs_path. it leads to the viewer can not work correctly, it can't load the pictures, but LRR can cache them. I have tried print the $file and $abs_path. the $file is correct, however , $abs_path get null, it prints nothing. maybe some of problems for the Perl's abs_path() function on MacOS Catalina10.15 or above. I change lanraragi of docker version, and the problem is done.

The other is metadata plugins still not work Log Detail

ious] [35de4edc] Routing to controller "LANraragi::Controller::Login" and action "logged_in" [Mojolicious] [35de4edc] Routing to controller "LANraragi::Controller::Edit" and action "save_metadata" [Mojolicious] [35de4edc] 200 OK (0.005265s, 189.934/s) [Mojolicious] [da24bdf9] POST "/api/use_plugin" [Mojolicious] [da24bdf9] Routing to controller "LANraragi::Controller::Login" and action "logged_in_api" [Mojolicious] [da24bdf9] Routing to controller "LANraragi::Controller::Api" and action "use_plugin" [E-Hentai] [info] Cookies provided [https://exhentai.org] ("Here is my EH Account Cookies info" )! [E-Hentai] [debug] Skipping search and using gallery 1406636 / f035245602 from oneshot args [E-Hentai] [debug] EH API Tokens are 1406636 / f035245602 [Mojolicious] [da24bdf9] 200 OK (9.985019s, 0.100/s) [Mojolicious] [684e70b4] GET "/feed.xml" [Mojolicious] Template "not_found.development.html.tt2" not found [Mojolicious] Template "not_found.html.tt2" not found [Mojolicious] [684e70b4] Rendering cached template " 2020-02-01 05:36:18,869 DEBG 'lanraragi' stdout output: olicious] Rendering template "edit.html.tt2" [Mojolicious] [0a7ece55] 200 OK (0.011194s, 89.334/s) [Mojolicious] [4c74d2ea] GET "/css/webfonts/fa-solid-900.woff2" [Mojolicious] Template "not_found.development.html.tt2" not found [Mojolicious] Template "not_found.html.tt2" not found [Mojolicious] [4c74d2ea] Rendering cached template "mojo/debug.html.ep" [Mojolicious] [4c74d2ea] 404 Not Found (0.007176s, 139.353/s) [Mojolicious] [1eb9282c] GET "/feed" [Mojolicious] Template "not_found.development.html.tt2" not found [Mojolicious] Template "not_found.html.tt2" not found [Mojolicious] [1eb9282c] Rendering cached template "mojo/debug.html.ep" [Mojolicious] [1eb9282c] 404 Not Found (0.017741s, 56.367/s) [Mojolicious] [136552fe] GET "/rss" [Mojolicious] Template "not_found.development.html.tt2" not found [Mojolicious] Template "not_found.html.tt2" not found [Mojolicious] [136552fe] Rendering cached template "mojo/debug.html.ep" [Mojolicious] [136552fe] 404 Not Found (0.00919s, 108.814/s) [Mojolicious] [f0739fcd] POS

and the window popup shows : Connect timeout at /home/koyomi/lanraragi/script/../lib/LANraragi/Plugin/EHentai.pm line 275.

Difegue commented 4 years ago

abs_path not working is a bit worrying, my Mac test environment was still on Mojave so I haven't tried it on Catalina at all.

I'll try testing this on my end later, but mayhaps @Bl4Cc4t can help since he did most of the work on the homebrew version.

Bl4Cc4t commented 4 years ago

As for the abs_path, it’s not working for me either, but I found the culprit: https://github.com/Difegue/LANraragi/blob/7a5432b8d0c41cb98ccd24caf6b40705f12b7d83/lib/LANraragi/Controller/Api.pm#L135 already has the full path to the file.

So $file ends up like this:

/Users/kuro/Library/Application Support/LANraragi/temp/a33e5e9b43823db9f54ea0f056751409d7b3c47c//Users/kuro/Library/Application Support/LANraragi/temp/a33e5e9b43823db9f54ea0f056751409d7b3c47c/Sparrow_591874_Draining_Purity_Balls_part_one.jpg

I don’t know how perl works and stuff, but it seems like the command behind that line differs in return type from windows to mac or something. You could add an if to check if the platform is macOS and my $abspath = abs_path($path); in it and wrap the rest in an else.

As for the plugin issues, I have no idea. They are working for me when I used /batch.

gth7754125 commented 4 years ago

maybe another way to get the absolute path is neccessary on macOS ? image image abs_path() = fast_abs_path() on MacOS, and unformtunately the fast one gets wrong, maybe the problem is here ?

As for the metadata plugin, it always inform "Error :Connect timeout at /home/koyomi/lanraragi/script/../lib/LANraragi/Plugin/nHentai.pm line 101." or "Error :Connect timeout at /home/koyomi/lanraragi/script/../lib/LANraragi/Plugin/EHentai.pm line 226." But sometimes it works ಥ_ಥ. I use the plugins manually, not the batch way. I use vpn to control the global network connection, i don't know whether it is the cause.

Difegue commented 4 years ago

This note in the perldoc for Cwd actually refers to classic Mac OS, not OS X/macOS. (Yeah it is confusing, fell for it at first too.)

Catalina changed the built-in shell from bash to zsh, which I suspect is the cause of the breakage here.
If you run chsh -s /bin/bash to switch back to bash, does this fix the issue?

gth7754125 commented 4 years ago

I have uninstalled LLR homebrew version, when i reinstall it, it got wrong on redis and can't load the content folder. ಥ_ಥ @Bl4Cc4t would you like to fix it ? try the above suggestion from Difegue.

gth7754125 commented 4 years ago

As for the plugin problem, some users may come across the connect timeout problem who need VPN to surf the Internet. For the NH Plugin, The code here:

sub get_tags_from_NH {
........
    my $URL = "https://nhentai.net/g/$gID/";
    my $ua  = Mojo::UserAgent->new;    # this line !!!!!!!!
    my $textrep = $ua->get($URL)->result->body;

there are two ways to deal with the problem:

  1. (temporary) modify your hosts file on your computer add 104.27.205.92 nhentai.net
  2. provide proxy control. It seems LRR use Mojo to send the request, @Difegue could you like to add a proxy control function or another way to make mojo send request through VPN proxy , i make my VPN proxy to global control mode, but Mojo can escape the control.

As for the EH plugin, the Error came from here:

 #Execute the request
    my $rep = $ua->post(
        $uri => json => {
            method    => "gdata",
            gidlist   => [ [ $gID, $gToken ] ],
            namespace => 1
        }
    )->result;

i don't know why it can work now, when i add hosts for EH, it still not work. But when i add hosts for NH, it works at the same time.So weird ಥ_ಥ . If some one come across the same problem like me . Please add these lines 178.175.128.252 exhentai.org and 104.20.27.25 e-hentai.org to your hosts file. It can fix the problem temporarily.

Difegue commented 4 years ago

Adding full-on proxy control to the app is a bit out of scope, and I think it's very weird how Mojo can supposedly escape it. Since you're using Docker, isn't that actually escaping your VPN?

You can try declaring the MOJO_PROXY environment variable (value doesn't matter) to enable Mojo's automatic proxy detection, but I don't think it'll help in this case.

gth7754125 commented 4 years ago

Adding full-on proxy control to the app is a bit out of scope, and I think it's very weird how Mojo can supposedly escape it. Since you're using Docker, isn't that actually escaping your VPN?

You can try declaring the MOJO_PROXY environment variable (value doesn't matter) to enable Mojo's automatic proxy detection, but I don't think it'll help in this case.

think so. i want LRR to keep easy as well. I will try using other proxy control apps later. Thanks for help. 😄 @Difegue @Bl4Cc4t