From 83d0c9ba9af272fff4297837107b15141ee55f35 Mon Sep 17 00:00:00 2001 From: difegue Date: Mon, 25 Apr 2022 21:20:45 +0200 Subject: [PATCH 01/88] DIsable live nH tests due to cloudflare. Too bad! --- lib/LANraragi/Plugin/Metadata/nHentai.pm | 57 +++++++++++-------- tests/plugins.t | 20 +++---- .../installing-lanraragi/windows.md | 22 ------- 3 files changed, 42 insertions(+), 57 deletions(-) diff --git a/lib/LANraragi/Plugin/Metadata/nHentai.pm b/lib/LANraragi/Plugin/Metadata/nHentai.pm index 861cd37be..e8db69cad 100644 --- a/lib/LANraragi/Plugin/Metadata/nHentai.pm +++ b/lib/LANraragi/Plugin/Metadata/nHentai.pm @@ -18,12 +18,13 @@ sub plugin_info { return ( #Standard metadata - name => "nHentai", - type => "metadata", - namespace => "nhplugin", - author => "Difegue", - version => "1.7.1", - description => "Searches nHentai for tags matching your archive.
Supports reading the ID from files formatted as \"{Id} Title\" and if not, tries to search for a matching gallery.", + name => "nHentai", + type => "metadata", + namespace => "nhplugin", + author => "Difegue", + version => "1.7.1", + description => + "Searches nHentai for tags matching your archive.
Supports reading the ID from files formatted as \"{Id} Title\" and if not, tries to search for a matching gallery.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\nB3RJTUUH4wYCFA8s1yKFJwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUH\nAAACL0lEQVQ4y6XTz0tUURQH8O+59773nLFcaGWTk4UUVCBFiJs27VxEQRH0AyRo4x8Q/Qtt2rhr\nU6soaCG0KYKSwIhMa9Ah+yEhZM/5oZMG88N59717T4sxM8eZCM/ycD6Xwznn0pWhG34mh/+PA8mk\n8jO5heziP0sFYwfgMDFQJg4IUjmquSFGG+OIlb1G9li5kykgTgvzSoUCaIYlo8/Igcjpj5wOkARp\n8AupP0uzJLijCY4zzoXOxdBLshAgABr8VOp7bpAXDEI7IBrhdksnjNr3WzI4LaIRV9fk2iAaYV/y\nA1dPiYjBAALgpQxnhV2XzTCAGWGeq7ACBvCdzKQyTH+voAm2hGlpcmQt2Bc2K+ymAhWPxTzPDQLt\nOKo1FiNBQaArq9WNRQwEgKl7XQ1duzSRSn/88vX0qf7DPQddx1nI5UfHxt+m0sLYPiP3shRAG8MD\nok1XEEXR/EI2ly94nrNYWG6Nx0/2Hp2b94dv34mlZge1e4hVCJ4jc6tl9ZP803n3/i4lpdyzq2N0\n7M3DkSeF5ZVYS8v1qxcGz5+5eey4nPDbmGdE9FpGeWErVNe2tTabX3r0+Nk3PwOgXFkdfz99+exA\nMtFZITEt9F23mpLG0hYTVQCKpfKPlZ/rqWKpYoAPcTmpginW76QBbb0OBaBaDdjaDbNlJmQE3/d0\nMYoaybU9126oPkrEhpr+U2wjtoVVGBowkslEsVSupRKdu0Mduq7q7kqExjSS3V2dvwDLavx0eczM\neAAAAABJRU5ErkJggg==", parameters => [ { type => "bool", desc => "Save archive title" } ], @@ -49,10 +50,12 @@ sub get_tags { $galleryID = $1; $logger->debug("Skipping search and using gallery $galleryID from oneshot args"); } elsif ( $lrr_info->{existing_tags} =~ /.*source:\s*(?:https?:\/\/)?nhentai\.net\/g\/([0-9]*).*/gi ) { + # Matching URL Scheme like 'https://' is only for backward compatible purpose. $galleryID = $1; - $logger->debug("Skipping search and using gallery $galleryID from source tag") + $logger->debug("Skipping search and using gallery $galleryID from source tag"); } else { + #Get Gallery ID by hand if the user didn't specify a URL $galleryID = get_gallery_id_from_title( $lrr_info->{archive_title} ); } @@ -74,7 +77,7 @@ sub get_tags { my %hashdata = get_tags_from_NH( $galleryID, $savetitle ); - $logger->info("Sending the following tags to LRR: " . $hashdata{tags}); + $logger->info( "Sending the following tags to LRR: " . $hashdata{tags} ); #Return a hash containing the new metadata - it will be integrated in LRR. return %hashdata; @@ -87,7 +90,7 @@ sub get_tags { #Uses the website's search to find a gallery and returns its content. sub get_gallery_dom_by_title { - my ( $title ) = @_; + my ($title) = @_; my $logger = get_plugin_logger(); @@ -100,8 +103,9 @@ sub get_gallery_dom_by_title { my $ua = Mojo::UserAgent->new; my $res = $ua->get($URL)->result; + $logger->debug( "Got response " . $res->body ); - if ($res->is_error) { + if ( $res->is_error ) { return; } @@ -110,7 +114,7 @@ sub get_gallery_dom_by_title { sub get_gallery_id_from_title { - my ( $title ) = @_; + my ($title) = @_; my $logger = get_plugin_logger(); @@ -122,11 +126,14 @@ sub get_gallery_id_from_title { my $dom = get_gallery_dom_by_title($title); if ($dom) { + # Get the first gallery url of the search results - my $gURL = ( $dom->at('.cover') ) - ? $dom->at('.cover')->attr('href') - : ""; + my $gURL = + ( $dom->at('.cover') ) + ? $dom->at('.cover')->attr('href') + : ""; + $logger->debug("Got $gURL from parsing."); if ( $gURL =~ /\/g\/(\d*)\//gm ) { return $1; } @@ -138,14 +145,14 @@ sub get_gallery_id_from_title { # retrieves html page from NH sub get_html_from_NH { - my ( $gID ) = @_; + my ($gID) = @_; my $URL = "https://nhentai.net/g/$gID/"; my $ua = Mojo::UserAgent->new; my $res = $ua->get($URL)->result; - if ($res->is_error) { + if ( $res->is_error ) { return; } @@ -156,7 +163,7 @@ sub get_html_from_NH { #It's located under a N.gallery JS object. sub get_json_from_html { - my ( $html ) = @_; + my ($html) = @_; my $logger = get_plugin_logger(); @@ -178,20 +185,20 @@ sub get_json_from_html { sub get_tags_from_json { - my ( $json ) = @_; + my ($json) = @_; my @json_tags = @{ $json->{"tags"} }; - my @tags = (); + my @tags = (); foreach my $tag (@json_tags) { my $namespace = $tag->{"type"}; - my $name = $tag->{"name"}; + my $name = $tag->{"name"}; if ( $namespace eq "tag" ) { - push ( @tags, $name ); + push( @tags, $name ); } else { - push ( @tags, "$namespace:$name" ); + push( @tags, "$namespace:$name" ); } } @@ -199,7 +206,7 @@ sub get_tags_from_json { } sub get_title_from_json { - my ( $json ) = @_; + my ($json) = @_; return $json->{"title"}{"pretty"}; } @@ -212,12 +219,12 @@ sub get_tags_from_NH { my $html = get_html_from_NH($gID); my $json = get_json_from_html($html); - if ( $json ) { + if ($json) { my @tags = get_tags_from_json($json); push( @tags, "source:nhentai.net/g/$gID" ) if ( @tags > 0 ); # Use NH's "pretty" names (romaji titles without extraneous data we already have like (Event)[Artist], etc) - $hashdata{tags} = join(', ', @tags); + $hashdata{tags} = join( ', ', @tags ); $hashdata{title} = get_title_from_json($json) if ($savetitle); } diff --git a/tests/plugins.t b/tests/plugins.t index 6e5f7c99f..9e8f46a5e 100644 --- a/tests/plugins.t +++ b/tests/plugins.t @@ -47,19 +47,19 @@ note("E-Hentai Tests"); isa_ok( $test_eH_json->{gmetadata}[0]{tags}, 'ARRAY', 'type of tags' ); } -note("nHentai Tests"); +note("nHentai Tests : Disabled due to cloudflare being used on nH"); -{ - my $nH_gID = "52249"; - my $test_nH_gID = trap { LANraragi::Plugin::Metadata::nHentai::get_gallery_id_from_title("\"Pieces 1\" shirow"); }; - - is( $test_nH_gID, $nH_gID, 'nHentai search test' ); +# { +# my $nH_gID = "52249"; +# my $test_nH_gID = LANraragi::Plugin::Metadata::nHentai::get_gallery_id_from_title("\"Pieces 1\" shirow"); +# +# is( $test_nH_gID, $nH_gID, 'nHentai search test' ); - my %nH_hashdata = trap { LANraragi::Plugin::Metadata::nHentai::get_tags_from_NH( $nH_gID, 1 ) }; +# my %nH_hashdata = trap { LANraragi::Plugin::Metadata::nHentai::get_tags_from_NH( $nH_gID, 1 ) }; - ok( length $nH_hashdata{tags} > 0, 'nHentai API Tag retrieval test' ); - ok( length $nH_hashdata{title} > 0, 'nHentai title test' ); -} +# ok( length $nH_hashdata{tags} > 0, 'nHentai API Tag retrieval test' ); +# ok( length $nH_hashdata{title} > 0, 'nHentai title test' ); +# } note("Chaika Tests"); diff --git a/tools/Documentation/installing-lanraragi/windows.md b/tools/Documentation/installing-lanraragi/windows.md index 920490af5..6c715fe1d 100644 --- a/tools/Documentation/installing-lanraragi/windows.md +++ b/tools/Documentation/installing-lanraragi/windows.md @@ -39,28 +39,6 @@ Once the install completes properly, you'll be able to launch the GUI from the s ![](../.screenshots/karen-startmenu.png) -## Installation on Windows 10 1809 (LTSC) - -Recent MSI packages don't install on 1809 anymore due to underlying changes to make the installer lighter, but you can still sideload the latest server version on top of an old 0.7.9 install. - -{% hint style="warning" %} -This method shouldn't break in the foreseeable future, but as the Win32 bootstrapper will still be the 0.7.9 version, you might lose out on future functionalities later on. -You might want to consider switching to a [source install](./source.md) on top of a Debian WSL distro you'd maintain yourself. -{% endhint %} - -1. Install 0.7.9 like normal, this is mostly done to get the Win32 UI application installed on to your taskbar, we'll install the updated Linux image next. -2. If you started the service and the Windows application, make sure to close BOTH. -3. Download the [MSI installer for the latest version](https://github.com/Difegue/LANraragi/releases/latest) -4. Open the MSI file in 7zip, and extract the "package.tar" file, which is the underlying Linux image -5. Download [LxRunOffline](https://github.com/DDoSolitary/LxRunOffline/releases) and put it in the same directory as the "package.tar" file you just extracted -6. Uninstall the old Linux image from 0.7.9 with the following command, make sure to have your command window opened as administrator: - `lxrunoffline ui -n lanraragi` -7. install the new image: - `lxrunoffline i -n lanraragi -d "C:\Users\*your user name*\AppData\Roaming\LANraragi\Distro\rootfs" -f LANraragi.tar` -Note: the name of the install HAS to be "lanraragi", do not change this on the -n argument -8. Start the application again, and you should see that it now shows the newest version of the server - - ## Configuration Starting the GUI for the first time will prompt you to setup your content folder and the port you want the server to listen on. The main GUI is always available from your Taskbar. From 71229942006797ddc7785f87b5b27d614e51f72f Mon Sep 17 00:00:00 2001 From: difegue Date: Mon, 25 Apr 2022 22:46:40 +0200 Subject: [PATCH 02/88] Update docker docs with info for Pi users --- .../installing-lanraragi/docker.md | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/tools/Documentation/installing-lanraragi/docker.md b/tools/Documentation/installing-lanraragi/docker.md index 0afc01921..188d4e9ac 100644 --- a/tools/Documentation/installing-lanraragi/docker.md +++ b/tools/Documentation/installing-lanraragi/docker.md @@ -12,43 +12,24 @@ Docker is the best way to install the software on remote servers. I don't recomm ## Cloning the base LRR image -Download [the Docker setup](https://www.docker.com/products/docker) and install it. Once you're done, execute: - -```bash -docker run --name=lanraragi -p 3000:3000 \ ---mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \ ---mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/home/koyomi/lanraragi/database \ -difegue/lanraragi -``` +Download [the Docker setup](https://www.docker.com/products/docker) and install it. {% hint style="warning" %} -If your Docker version is [_below 17.06_](https://docs.docker.com/storage/bind-mounts/) and you use the --mount option as listed above, you will get the following error: - -```bash -unknown flag: --mount -See 'docker run --help'. -``` - -You can bypass this issue by using the --volume option for bind-mounting like so: +The LRR Docker container uses a fairly recent ([3.14](https://alpinelinux.org/posts/Alpine-3.14.0-released.html)) version of Alpine Linux as its base. I recommend you use at least Docker version **20.10.0** to avoid issues with the `faccessat2` syscall. +You can check your Docker version by executing `docker version`. +{% endhint %} +Once you're done, execute: ```bash docker run --name=lanraragi -p 3000:3000 \ ---volume [YOUR_CONTENT_DIRECTORY]:/home/koyomi/lanraragi/content \ ---volume [YOUR_CONTENT_DIRECTORY]:/home/koyomi/lanraragi/database \ +--mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \ +--mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/home/koyomi/lanraragi/database \ difegue/lanraragi ``` -{% endhint %} - {% hint style="info" %} You can tell Docker to auto-restart the LRR container on boot by adding the `--restart always` flag to this command. {% endhint %} -{% hint style="warning" %} -If you're running on Windows, please check the syntax for mapping your content directory [here](https://docs.docker.com/docker-for-windows/#shared-drives). - -Windows 7/8 users running the Legacy Docker toolbox will have to explicitly forward port 127.0.0.1:3000 from the host to the container in order to be able to access the app. -{% endhint %} - The content directory you have to specify in the command above will contain archives you either upload through the software or directly drop in, alongside generated thumbnails. The database directory houses the LANraragi database(As database.rdb), allowing you to hotswap containers without losing any data. @@ -84,6 +65,24 @@ If you're feeling **extra dangerous**, you can run the last files directly from `docker run [zoinks] difegue/lanraragi:nightly` {% endhint %} +## Platform-specific caveats + +### Windows +If you're running on Windows, please check the syntax for mapping your content directory [here](https://docs.docker.com/docker-for-windows/#shared-drives). + +Windows 7/8 users running the Legacy Docker toolbox will have to explicitly forward port 127.0.0.1:3000 from the host to the container in order to be able to access the app. +### Raspbian + +If you're using **Raspbian**, it's likely you'll encounter installation issues like `s6-svscan: warning: unable to iopause: Operation not permitted` due to their outdated version of `libseccomp`. +You can fix this by either adding `--security-opt seccomp=unconfined` to your Docker arguments(discouraged, allows LRR wider access to underlying OS), or by installing an up-to-date version of `libseccomp`: + +```bash +wget http://ftp.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1~bpo10+1_armhf.deb +sudo dpkg -i libseccomp2_2.5.1-1~bpo10+1_armhf.deb +``` + +Regular versions of Debian shouldn't have this issue. + ## Changing the port Since Docker allows for port mapping, you can most of times map the default port of 3000 to another port on your host quickly. @@ -116,10 +115,13 @@ As Docker containers are immutable, you need to destroy your existing container docker pull difegue/lanraragi docker stop lanraragi docker rm lanraragi -docker run --name=lanraragi -p 3000:3000 --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content difegue/lanraragi +docker run --name=lanraragi -p 3000:3000 \ + --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \ + --mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/home/koyomi/lanraragi/database \ + difegue/lanraragi ``` -As long as you use the same content directory as the mount source, your data will still be there. +As long as you use the same content/database directories as before, your data will still be there. {% hint style="info" %} If you update often, you might want to consider using docker-compose or [Portainer](https://portainer.io) to redeploy containers without entering the entire configuration every time. From 34ab0f9b7790f6935b0b4ba895905f7fd8d349bf Mon Sep 17 00:00:00 2001 From: difegue Date: Mon, 25 Apr 2022 22:47:31 +0200 Subject: [PATCH 03/88] Remove all the vagrant stuff, it's long outdated at this point --- .dockerignore | 3 +- tools/Documentation/SUMMARY.md | 1 - .../extending-lanraragi/architecture.md | 1 - .../installing-lanraragi/methods.md | 13 +---- .../installing-lanraragi/vagrant.md | 52 ------------------- tools/Documentation/plugin-docs/index.md | 2 +- tools/build/vagrant/.gitignore | 2 - tools/build/vagrant/Vagrantfile | 22 -------- tools/build/vagrant/Vagrantfile_nightly | 22 -------- 9 files changed, 4 insertions(+), 114 deletions(-) delete mode 100644 tools/Documentation/installing-lanraragi/vagrant.md delete mode 100644 tools/build/vagrant/.gitignore delete mode 100644 tools/build/vagrant/Vagrantfile delete mode 100644 tools/build/vagrant/Vagrantfile_nightly diff --git a/.dockerignore b/.dockerignore index ae1a43137..5e4312d9c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,4 @@ tools/_screenshots tools/Documentation tools/build/windows -tools/build/homebrew -tools/build/vagrant +tools/build/homebrew \ No newline at end of file diff --git a/tools/Documentation/SUMMARY.md b/tools/Documentation/SUMMARY.md index f10d7a9cd..a38519b9b 100644 --- a/tools/Documentation/SUMMARY.md +++ b/tools/Documentation/SUMMARY.md @@ -11,7 +11,6 @@ * [πŸ›  Source Code (Linux/macOS)](installing-lanraragi/source.md) * [🐧 Community (Linux)](installing-lanraragi/community.md) * [πŸ‘Ώ Jail (FreeBSD)](installing-lanraragi/jail.md) -* [πŸ•Έ Vagrant (Deprecated)](installing-lanraragi/vagrant.md) ## Basic Operations diff --git a/tools/Documentation/extending-lanraragi/architecture.md b/tools/Documentation/extending-lanraragi/architecture.md index da73ba6ae..44989e556 100644 --- a/tools/Documentation/extending-lanraragi/architecture.md +++ b/tools/Documentation/extending-lanraragi/architecture.md @@ -117,7 +117,6 @@ root/ | |- windows <- Windows build script and submodule link to the Karen WPF Bootstrapper | |- docker <- Dockerfile and configuration files for LRR Docker Container | |- homebrew <- Script and configuration files for the LRR Homebrew cask -| |- vagrant <- Vagrantfile for LRR Vagrant Machine | |- cpanfile <- Perl dependencies description | |- install.pl <- LANraragi Installer | +- lanraragi-systemd.service <- Example SystemD service diff --git a/tools/Documentation/installing-lanraragi/methods.md b/tools/Documentation/installing-lanraragi/methods.md index 4942e9508..7e8d43aac 100644 --- a/tools/Documentation/installing-lanraragi/methods.md +++ b/tools/Documentation/installing-lanraragi/methods.md @@ -23,9 +23,6 @@ Look at the methods below for something that fits your OS and usage. {% hint style="warning" %} This method works on **64-bit** editions of Windows 10 only. - -Since LRR 0.8.0, you need Windows 10 version _1903_ at least. 0.7.9 will work with version _1809_ if you're on an LTSC channel. -If you still want to use further server versions on 1809, a step-by-step workaround is available on the Windows documentation page below. {% endhint %} ![win10](../.screenshots/karen.jpg) @@ -69,17 +66,11 @@ Similar to installing from source with an altered process for FreeBSD compatabil [jail.md](jail.md) {% endcontent-ref %} -## Older Windows: _Legacy Docker Toolbox or Vagrant_ +## Windows 7 or 8: don't ![I really hope you guys don't do this](../.screenshots/shiggy.png) -At this point the only solutions I have to give you are basically glorified VMs. - -You can either download the [Legacy Docker Toolbox](https://docs.docker.com/toolbox/toolbox\_install\_windows/) and follow the Docker tutorial linked above, or try Vagrant. I provide **no support** for either of these methods. - -{% content-ref url="vagrant.md" %} -[vagrant.md](vagrant.md) -{% endcontent-ref %} +Switch to 10 or Linux. ## WARNING: Reverse Proxies diff --git a/tools/Documentation/installing-lanraragi/vagrant.md b/tools/Documentation/installing-lanraragi/vagrant.md deleted file mode 100644 index 8ff94bf00..000000000 --- a/tools/Documentation/installing-lanraragi/vagrant.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -description: >- - For computers that are unable to easily use Docker or WSL(Basically just - Windows 7 and 8), Vagrant allows you to quickly get started nonetheless. ---- - -# πŸ•Έ Vagrant (Deprecated) - -{% hint style="danger" %} -Vagrant installs are **deprecated** as of 0.6.0. They'll work, but come with enough potential issues and slowdowns that I don't recommend you use them at all! -{% endhint %} - -## Using the Vagrantfile - -You can use the available Vagrantfile with [Vagrant](https://www.vagrantup.com/downloads.html) to deploy a virtual machine on your computer with LANraragi preinstalled. - -{% hint style="info" %} -This method requires [VirtualBox](https://www.virtualbox.org) to be installed on your machine! -{% endhint %} - -Download the [Vagrantfile](https://github.com/Difegue/LANraragi/tree/dev/tools/build/vagrant) that's relevant to the version of LANraragi that you want to install, then move it to your future LANraragi folder. If you downloaded the nightly Vagrantfile, be sure to remove `_nightly` from the end of the filename. Once you've done that, open a terminal in that folder and enter the following commands: - -``` -vagrant plugin install vagrant-vbguest -vagrant up -``` - -Once the Vagrant machine is up and provisioned, you can access LANraragi at [http://localhost:3000](http://localhost:3000). -Archives you upload will be placed in the directory of the Vagrantfile. - -The Vagrant machine is a simple Docker wrapper, so the database will also be stored in this directory. (As database.rdb) - -You can use `vagrant halt` to stop the VM when you're done. -To start it up again, use the following commands: - -``` -vagrant up -vagrant provision -``` - -Keep in mind that the Vagrant setup, just like Docker, will always use the latest release. - -## Updating - -From the directory where the Vagrantfile is located: - -```bash -vagrant up -vagrant provision -``` - -Those two commands will update the wrapped Docker image to the latest one(basically automatically doing the commands written up there on the Docker section). No other operations are needed. diff --git a/tools/Documentation/plugin-docs/index.md b/tools/Documentation/plugin-docs/index.md index d5fc23e31..f3375f28f 100644 --- a/tools/Documentation/plugin-docs/index.md +++ b/tools/Documentation/plugin-docs/index.md @@ -24,7 +24,7 @@ Basically, _as long as it can run, it will run_. {% hint style="danger" %} As you might've guessed, Plugins run with the same permissions as the main application. This means they can modify the application database at will, delete files, and execute system commands. -None of this is obviously an issue if the application is installed in a proper fashion.(Docker/Vagrant, or non-root user on Linux _I seriously hope you guys don't run this as root_) +None of this is obviously an issue if the application is installed in a proper fashion.(Docker/VM, or non-root user on Linux _I seriously hope you guys don't run this as root_) Still, as said in the User Documentation, be careful of what you do with Plugins. {% endhint %} diff --git a/tools/build/vagrant/.gitignore b/tools/build/vagrant/.gitignore deleted file mode 100644 index 34c277cca..000000000 --- a/tools/build/vagrant/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vagrant -database.rdb \ No newline at end of file diff --git a/tools/build/vagrant/Vagrantfile b/tools/build/vagrant/Vagrantfile deleted file mode 100644 index 596b0f173..000000000 --- a/tools/build/vagrant/Vagrantfile +++ /dev/null @@ -1,22 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure(2) do |config| - - config.vm.box = "debian/jessie64" - config.vm.network :forwarded_port, guest: 3000, host: 3000 - config.vm.synced_folder ".", "/vagrant", type: "virtualbox" - config.vm.provision "shell", - inline: "docker stop lanraragi || true && docker rm lanraragi || true" - config.vm.provision "docker" do |d| - d.pull_images "difegue/lanraragi:latest" - d.run "difegue/lanraragi:latest", - args: "--name=lanraragi -e LRR_UID=1000 -p 3000:3000 --restart=always --mount type=bind,source=/vagrant,target=/home/koyomi/lanraragi/content " - end - config.vm.post_up_message = "LANraragi Vagrant Machine Started, App should be available at http://localhost:3000." - -end diff --git a/tools/build/vagrant/Vagrantfile_nightly b/tools/build/vagrant/Vagrantfile_nightly deleted file mode 100644 index b3f72be23..000000000 --- a/tools/build/vagrant/Vagrantfile_nightly +++ /dev/null @@ -1,22 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. -Vagrant.configure(2) do |config| - - config.vm.box = "debian/jessie64" - config.vm.network :forwarded_port, guest: 3000, host: 3000 - config.vm.synced_folder ".", "/vagrant", type: "virtualbox" - config.vm.provision "shell", - inline: "docker stop lanraragi || true && docker rm lanraragi || true" - config.vm.provision "docker" do |d| - d.pull_images "difegue/lanraragi" - d.run "difegue/lanraragi:nightly", - args: "--name=lanraragi -e LRR_UID=1000 -p 3000:3000 --restart=always --mount type=bind,source=/vagrant,target=/home/koyomi/lanraragi/content " - end - config.vm.post_up_message = "LANraragi Vagrant Machine Started, App should be available at http://localhost:3000." - -end From f4a62dcc1737eeb72310ed4f8f3db3d537f8cac1 Mon Sep 17 00:00:00 2001 From: difegue Date: Mon, 25 Apr 2022 22:57:39 +0200 Subject: [PATCH 04/88] Add documentation about which plugins support pulling URL from the source: tag commit dedicated to twinaero --- lib/LANraragi/Plugin/Metadata/EHentai.pm | 15 ++++++++------- lib/LANraragi/Plugin/Metadata/nHentai.pm | 15 ++++++++------- tools/Documentation/advanced-usage/downloading.md | 5 +++++ tools/Documentation/basic-operations/metadata.md | 6 ++++++ 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/lib/LANraragi/Plugin/Metadata/EHentai.pm b/lib/LANraragi/Plugin/Metadata/EHentai.pm index 77d2dba2e..a15625317 100644 --- a/lib/LANraragi/Plugin/Metadata/EHentai.pm +++ b/lib/LANraragi/Plugin/Metadata/EHentai.pm @@ -20,13 +20,14 @@ sub plugin_info { return ( #Standard metadata - name => "E-Hentai", - type => "metadata", - namespace => "ehplugin", - login_from => "ehlogin", - author => "Difegue and others", - version => "2.5.1", - description => "Searches g.e-hentai for tags matching your archive.", + name => "E-Hentai", + type => "metadata", + namespace => "ehplugin", + login_from => "ehlogin", + author => "Difegue and others", + version => "2.5.1", + description => + "Searches g.e-hentai for tags matching your archive.
ℹ️ This plugin will use the source: tag of the archive if it exists.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI\nWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4wYBFg0JvyFIYgAAAB1pVFh0Q29tbWVudAAAAAAAQ3Jl\nYXRlZCB3aXRoIEdJTVBkLmUHAAAEo0lEQVQ4y02UPWhT7RvGf8/5yMkxMU2NKaYIFtKAHxWloYNU\ncRDeQTsUFPwAFwUHByu4ODq4Oghdiri8UIrooCC0Lx01ONSKfYOioi1WpWmaxtTm5PTkfNzv0H/D\n/9oeePjdPNd13Y8aHR2VR48eEUURpmmiaRqmaXbOAK7r4vs+IsLk5CSTk5P4vo9hGIgIsViMra0t\nCoUCRi6XY8+ePVSrVTRN61yybZuXL1/y7t078vk8mUyGvXv3cuLECWZnZ1lbW6PdbpNIJHAcB8uy\nePr0KYZlWTSbTRKJBLquo5TCMAwmJia4f/8+Sini8Ti1Wo0oikin09i2TbPZJJPJUK/XefDgAefO\nnWNlZQVD0zSUUvi+TxAE6LqOrut8/fqVTCaDbdvkcjk0TSOdTrOysoLrujiOw+bmJmEYMjAwQLVa\nJZVKYXR1ddFut/F9H9M0MU0T3/dZXV3FdV36+/vp7u7m6NGj7Nq1i0qlwuLiIqVSib6+Pubn5wGw\nbZtYLIaxMymVSuH7PpZlEUURSina7TZBEOD7Pp8/fyYMQ3zfZ25ujv3795NOp3n48CE9PT3ouk4Q\nBBi/fv3Ctm0cx6Grq4utrS26u7sREQzDIIoifv78SU9PD5VKhTAMGRoaYnV1leHhYa5evUoQBIRh\niIigiQhRFKHrOs1mE9u2iaKIkydPYhgGAKZp8v79e+LxOPl8Htd1uXbtGrdv3yYMQ3ZyAODFixeb\nrVZLvn//Lq7rSqVSkfX1dREROXz4sBw/flyUUjI6OipXrlyRQ4cOSbPZlCiKxHVdCcNQHMcRz/PE\ndV0BGL53756sra1JrVaT9fV1cRxHRESGhoakr69PUqmUvHr1SsrlsuzI931ptVriuq78+fNHPM+T\nVqslhoikjh075p09e9ba6aKu6/T39zM4OMjS0hIzMzM0Gg12794N0LEIwPd9YrEYrusShiEK4Nmz\nZ41yudyVy+XI5/MMDAyQzWap1+tks1lEhIWFBQqFArZto5QiCAJc1+14t7m5STweRwOo1WoSBAEj\nIyMUi0WSySQiQiqV6lRoYWGhY3673e7sfRAEiAjZbBbHcbaBb9++5cCBA2SzWZLJJLZt43kesViM\nHX379g1d1wnDsNNVEQEgCAIajQZ3797dBi4tLWGaJq7rYpompVKJmZkZ2u12B3j58mWUUmiahoiw\nsbFBEASdD2VsbIwnT55gACil+PHjB7Ozs0xPT/P7929u3ryJZVmEYUgYhhQKBZRSiAie52EYBkop\nLMvi8ePHTE1NUSwWt0OZn5/3hoeHzRs3bqhcLseXL1+YmJjowGzbRtO07RT/F8jO09+8ecP58+dJ\nJBKcPn0abW5uThWLRevOnTv/Li4u8vr1a3p7e9E0jXg8zsePHymVSnz69Kmzr7quY9s2U1NTXLp0\nCc/zOHLkCPv27UPxf6rX63+NjIz8IyKMj48zPT3NwYMHGRwcpLe3FwARodVqcf36dS5evMj4+DhB\nEHDmzBkymQz6DqxSqZDNZr8tLy//DYzdunWL5eVlqtUqHz58IJVKkUwmaTQalMtlLly4gIjw/Plz\nTp06RT6fZ2Njg/8AqMV7tO07rnsAAAAASUVORK5CYII=", parameters => [ diff --git a/lib/LANraragi/Plugin/Metadata/nHentai.pm b/lib/LANraragi/Plugin/Metadata/nHentai.pm index e8db69cad..5d55fb7bd 100644 --- a/lib/LANraragi/Plugin/Metadata/nHentai.pm +++ b/lib/LANraragi/Plugin/Metadata/nHentai.pm @@ -18,13 +18,14 @@ sub plugin_info { return ( #Standard metadata - name => "nHentai", - type => "metadata", - namespace => "nhplugin", - author => "Difegue", - version => "1.7.1", - description => - "Searches nHentai for tags matching your archive.
Supports reading the ID from files formatted as \"{Id} Title\" and if not, tries to search for a matching gallery.", + name => "nHentai", + type => "metadata", + namespace => "nhplugin", + author => "Difegue", + version => "1.7.1", + description => "Searches nHentai for tags matching your archive. +
Supports reading the ID from files formatted as \"{Id} Title\" and if not, tries to search for a matching gallery. +
ℹ️ This plugin will use the source: tag of the archive if it exists.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\nB3RJTUUH4wYCFA8s1yKFJwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUH\nAAACL0lEQVQ4y6XTz0tUURQH8O+59773nLFcaGWTk4UUVCBFiJs27VxEQRH0AyRo4x8Q/Qtt2rhr\nU6soaCG0KYKSwIhMa9Ah+yEhZM/5oZMG88N59717T4sxM8eZCM/ycD6Xwznn0pWhG34mh/+PA8mk\n8jO5heziP0sFYwfgMDFQJg4IUjmquSFGG+OIlb1G9li5kykgTgvzSoUCaIYlo8/Igcjpj5wOkARp\n8AupP0uzJLijCY4zzoXOxdBLshAgABr8VOp7bpAXDEI7IBrhdksnjNr3WzI4LaIRV9fk2iAaYV/y\nA1dPiYjBAALgpQxnhV2XzTCAGWGeq7ACBvCdzKQyTH+voAm2hGlpcmQt2Bc2K+ymAhWPxTzPDQLt\nOKo1FiNBQaArq9WNRQwEgKl7XQ1duzSRSn/88vX0qf7DPQddx1nI5UfHxt+m0sLYPiP3shRAG8MD\nok1XEEXR/EI2ly94nrNYWG6Nx0/2Hp2b94dv34mlZge1e4hVCJ4jc6tl9ZP803n3/i4lpdyzq2N0\n7M3DkSeF5ZVYS8v1qxcGz5+5eey4nPDbmGdE9FpGeWErVNe2tTabX3r0+Nk3PwOgXFkdfz99+exA\nMtFZITEt9F23mpLG0hYTVQCKpfKPlZ/rqWKpYoAPcTmpginW76QBbb0OBaBaDdjaDbNlJmQE3/d0\nMYoaybU9126oPkrEhpr+U2wjtoVVGBowkslEsVSupRKdu0Mduq7q7kqExjSS3V2dvwDLavx0eczM\neAAAAABJRU5ErkJggg==", parameters => [ { type => "bool", desc => "Save archive title" } ], diff --git a/tools/Documentation/advanced-usage/downloading.md b/tools/Documentation/advanced-usage/downloading.md index 60142a371..7983afeb4 100644 --- a/tools/Documentation/advanced-usage/downloading.md +++ b/tools/Documentation/advanced-usage/downloading.md @@ -12,6 +12,11 @@ This allows you to seamlessly add archives from the Internet to your LRR instanc By default, we will try to download any URL you chuck at us! This will mostly work for simple URLs that point directly to a file we support. (For example, something like this very nice Quake booklet: `https://archive.org/download/quake-essays-sep-15-fin-4-graco-l-cl/QUAKE_essays_SEP15_FIN4_GRACoL_CL.pdf` will download without a fuss.) +{% hint style="info" %} +Downloaded archives will automatically get a `source:` tag with the URL they were downloaded from. +Said source tags can often be used with compatible Metadata plugins to fetch metadata precisely. (Supported by E-H and nH) +{% endhint %} + For non-direct links, you will need to have a matching **Downloader Plugin** configured. LANraragi currently ships with Downloaders handling E-H and Chaika links. diff --git a/tools/Documentation/basic-operations/metadata.md b/tools/Documentation/basic-operations/metadata.md index 4cf89a639..d6835276e 100644 --- a/tools/Documentation/basic-operations/metadata.md +++ b/tools/Documentation/basic-operations/metadata.md @@ -40,3 +40,9 @@ Plugins have as much control over your system as the main LANraragi application When installing Plugins from unknown sources, do a little research first. {% endhint %} + +## About source: tags + +If your archive has a `source:` tag (likely from the use of the [built-in downloading feature](../advanced-usage/downloading.md)), many plugins will use said tag to directly fetch metadata from it without having to use heuristics of any kind to guess what your archive is. + +If you have the URL on hand directly, you can either add it as a `source:` tag to your archive, or use it as a one-shot parameter on most downloader plugins. \ No newline at end of file From 01ec22c24a35bd6d09bcacb3495751cc8330511e Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Wed, 27 Apr 2022 17:37:19 +0800 Subject: [PATCH 05/88] change .click() to .trigger("click") .click is deprecated. --- public/js/index.js | 2 +- public/js/reader.js | 2 +- templates/config.html.tt2 | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 2d5f547e4..124b78e09 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -59,7 +59,7 @@ Index.initializeAll = function () { // Force-open the collapsible if carouselOpen = true if (localStorage.carouselOpen === "1") { localStorage.carouselOpen = "0"; // Bad hack since clicking collapsible-title will trigger toggleCarousel and modify this - $(".collapsible-title").click(); + $(".collapsible-title").trigger("click"); } Index.updateCarousel(); diff --git a/public/js/reader.js b/public/js/reader.js index bcbcf4695..30b7d0c7d 100644 --- a/public/js/reader.js +++ b/public/js/reader.js @@ -315,7 +315,7 @@ Reader.toggleHelp = function () { const existingToast = $(".navigation-help-toast:visible"); if (existingToast.length) { // ugly hack: this is an abandoned plugin, we should be using something like toastr - existingToast.closest(".jq-toast-wrap").find(".close-jq-toast-single").click(); + existingToast.closest(".jq-toast-wrap").find(".close-jq-toast-single").trigger("click"); return false; } diff --git a/templates/config.html.tt2 b/templates/config.html.tt2 index 189a17af2..94fa99882 100644 --- a/templates/config.html.tt2 +++ b/templates/config.html.tt2 @@ -134,9 +134,9 @@ enable_timemodified(); shinobuStatus(); setInterval(shinobuStatus, 5000); - $("#enablepass").click(enable_pass); - $("#enableresize").click(enable_resize); - $("#usedateadded").click(enable_timemodified); + $("#enablepass").on("click", enable_pass); + $("#enableresize").on("click", enable_resize); + $("#usedateadded").on("click", enable_timemodified); }); function rebootShinobu() { From ea6891b9fda4016d993648c4982f96d037d13a5a Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Wed, 27 Apr 2022 19:54:04 +0800 Subject: [PATCH 06/88] make updateCarousel an atomic operation This can avoid duplication of carousel content --- public/js/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 124b78e09..97ede8173 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -268,8 +268,6 @@ Index.handleCustomSort = function () { Index.updateCarousel = function (e) { e?.preventDefault(); - const carousel = $(".swiper-wrapper"); - carousel.empty(); $("#carousel-loading").show(); // Hit a different API endpoint depending on the requested localStorage carousel type @@ -301,6 +299,8 @@ Index.updateCarousel = function (e) { Server.callAPI(endpoint, "GET", null, "Error getting carousel data!", (results) => { + const carousel = $(".swiper-wrapper"); + carousel.empty(); results.data.forEach((archive) => { carousel.append(LRR.buildThumbnailDiv(archive)); }); From a272cb8a2531d4feaed657b6f98a7baf0d889abb Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Wed, 27 Apr 2022 19:58:02 +0800 Subject: [PATCH 07/88] updateCarousel only need to be executed once --- public/js/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 97ede8173..4403e2017 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -59,9 +59,10 @@ Index.initializeAll = function () { // Force-open the collapsible if carouselOpen = true if (localStorage.carouselOpen === "1") { localStorage.carouselOpen = "0"; // Bad hack since clicking collapsible-title will trigger toggleCarousel and modify this - $(".collapsible-title").trigger("click"); + $(".collapsible-title").trigger("click"); // updateCarousel will be executed by toggleCarousel + } else { + Index.updateCarousel(); } - Index.updateCarousel(); // Initialize carousel mode menu $.contextMenu({ From f92e17b2f18b167c95076a4366b403aa4a8ef608 Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Wed, 27 Apr 2022 20:04:24 +0800 Subject: [PATCH 08/88] solve hack of firstrun toggleCarousel --- public/js/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/public/js/index.js b/public/js/index.js index 4403e2017..190fbb093 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -58,8 +58,8 @@ Index.initializeAll = function () { // Force-open the collapsible if carouselOpen = true if (localStorage.carouselOpen === "1") { - localStorage.carouselOpen = "0"; // Bad hack since clicking collapsible-title will trigger toggleCarousel and modify this - $(".collapsible-title").trigger("click"); // updateCarousel will be executed by toggleCarousel + $(".collapsible-title").trigger("click", [true]); + // Index.updateCarousel(); will be executed by toggleCarousel } else { Index.updateCarousel(); } @@ -132,8 +132,9 @@ Index.toggleMode = function () { IndexTable.dataTable.draw(); }; -Index.toggleCarousel = function () { - localStorage.carouselOpen = (localStorage.carouselOpen === "1") ? "0" : "1"; +Index.toggleCarousel = function (e, firstrun = false) { + if (!firstrun) + localStorage.carouselOpen = (localStorage.carouselOpen === "1") ? "0" : "1"; if (!Index.carouselInitialized) { Index.carouselInitialized = true; From 76db075ba042482a3f965283638b4f9ed1f278de Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Thu, 28 Apr 2022 11:24:01 +0800 Subject: [PATCH 09/88] Use Virtual Slides to fix #614 .swiper-wrapper won't appear together with #carousel-loading swiper upgraded to 8.1.4, no break change --- package.json | 2 +- public/js/index.js | 44 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index cfc6ade76..744379de3 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "marked": "^4.0.10", "open-sans-fontface": "^1.4.0", "roboto-fontface": "^0.8.0", - "swiper": "^7.2.0", + "swiper": "^8.1.4", "tippy.js": "^6.3.1" }, "devDependencies": { diff --git a/public/js/index.js b/public/js/index.js index 190fbb093..9519cb5f4 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -141,14 +141,38 @@ Index.toggleCarousel = function (e, firstrun = false) { $("#reload-carousel").show(); Index.swiper = new Swiper(".index-carousel-container", { - slidesPerView: "auto", - spaceBetween: 8, + breakpoints: (() => { // Virtual Slides realization doesn't work with slidesPerView: 'auto' + const breakpoints = { + 0: { + slidesPerView: 1, + }, + 210: { + slidesPerView: 2, + }, + 360: { + slidesPerView: 2.5, + }, + }; + for (let width = 690, sides = 3; width <= 2760; width += 115, sides += 0.5) { + breakpoints[width] = { + slidesPerView: sides, + }; + }; + return breakpoints; + })(), + breakpointsBase: "container", + centerInsufficientSlides: true, + mousewheel: true, navigation: { nextEl: ".carousel-next", prevEl: ".carousel-prev", }, - mousewheel: true, - freeMode: true, + slidesPerView: 7, + virtual: { + enabled: true, + addSlidesAfter: 2, + addSlidesBefore: 2, + }, }); Index.updateCarousel(); @@ -271,6 +295,7 @@ Index.updateCarousel = function (e) { e?.preventDefault(); $("#carousel-loading").show(); + $(".swiper-wrapper").hide(); // Hit a different API endpoint depending on the requested localStorage carousel type let endpoint; @@ -301,14 +326,15 @@ Index.updateCarousel = function (e) { Server.callAPI(endpoint, "GET", null, "Error getting carousel data!", (results) => { - const carousel = $(".swiper-wrapper"); - carousel.empty(); - results.data.forEach((archive) => { - carousel.append(LRR.buildThumbnailDiv(archive)); + Index.swiper.virtual.removeAllSlides(); + const slides = results.data.map((archive) => { + return LRR.buildThumbnailDiv(archive); }); + Index.swiper.virtual.appendSlide(slides); + Index.swiper.virtual.update(); - Index.swiper.update(); $("#carousel-loading").hide(); + $(".swiper-wrapper").show(); }); } }; From ff013c2b97bc4c910c9421be36daa06302f70bf1 Mon Sep 17 00:00:00 2001 From: xiazeyu Date: Thu, 28 Apr 2022 11:25:26 +0800 Subject: [PATCH 10/88] use flex to solve overflow on small width device .collapsible-right is now align with .collapsible-title on iOS devices --- public/css/lrr.css | 15 +++++++++++++-- templates/index.html.tt2 | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/public/css/lrr.css b/public/css/lrr.css index 4ef206ca5..5dfe64a49 100644 --- a/public/css/lrr.css +++ b/public/css/lrr.css @@ -153,7 +153,7 @@ table thead .sorting_disabled a:after { } .index-carousel-container { - margin-top: -20px; + margin-top: -10px; } .carousel-prev { @@ -320,17 +320,28 @@ p#nb { } .collapsible-right { - float: right; padding: 1.2rem 1.2rem 0 0; } .collapsible-body { + flex: 1 0 100%; + overflow: hidden; + box-sizing: border-box; border: none !important; } +.option-flyout { + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + .option-flyout>.collapsible-title { font-size: 18px; font-weight: bold; + display: flex; + flex: 1 1 0; + overflow: hidden; } .option-flyout>.collapsible-body { diff --git a/templates/index.html.tt2 b/templates/index.html.tt2 index a06473b2c..b82bf0317 100644 --- a/templates/index.html.tt2 +++ b/templates/index.html.tt2 @@ -83,9 +83,9 @@