From 30c7535ed5648a11b54e40eaed8e9348d0fb5e29 Mon Sep 17 00:00:00 2001 From: Difegue Date: Wed, 27 Jul 2022 00:46:39 +0200 Subject: [PATCH 01/20] Make release winbuilds also use alpine 3.12 --- .github/workflows/release-delivery.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-delivery.yml b/.github/workflows/release-delivery.yml index fcefa3e20..0c79cb355 100644 --- a/.github/workflows/release-delivery.yml +++ b/.github/workflows/release-delivery.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@master - name: Docker Build and export run: | - docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile . + docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile-legacy . docker create --name rootfs difegue/lanraragi docker export --output=package.tar rootfs - name: Upload rootfs @@ -19,6 +19,7 @@ jobs: with: name: package path: package.tar + buildReleaseWSL: name: Build Windows Installer needs: exportDockerRootFS From 56935c27084b91345d8231d52b6b59b75c25d913 Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 19 Aug 2022 18:41:21 +0200 Subject: [PATCH 02/20] (#665) Add tentative JPEGXL support --- lib/LANraragi/Utils/Generic.pm | 2 +- tools/Documentation/installing-lanraragi/source.md | 2 +- tools/build/docker/Dockerfile | 2 +- tools/build/docker/install-everything.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm index d3f9b5279..f15d8cc32 100644 --- a/lib/LANraragi/Utils/Generic.pm +++ b/lib/LANraragi/Utils/Generic.pm @@ -56,7 +56,7 @@ sub trim_url { # Checks if the provided file is an image. # Uses non-capturing groups (?:) to avoid modifying the incoming argument. sub is_image { - return $_[0] =~ /^.+\.(?:png|jpg|gif|bmp|jpeg|jfif|webp|avif|heif|heic)$/i; + return $_[0] =~ /^.+\.(?:png|jpg|gif|bmp|jpeg|jfif|webp|avif|heif|heic|jxl|)$/i; } # Checks if the provided file is an archive. diff --git a/tools/Documentation/installing-lanraragi/source.md b/tools/Documentation/installing-lanraragi/source.md index c89d82d6f..2dd5f594e 100644 --- a/tools/Documentation/installing-lanraragi/source.md +++ b/tools/Documentation/installing-lanraragi/source.md @@ -20,7 +20,7 @@ For information, my personal tests are done using Debian's vendor Perl. apt-get update apt-get upgrade -y apt-get install build-essential make gnupg pkg-config \ -cpanminus redis-server libarchive-dev imagemagick webp libssl-dev zlib1g-dev \ +cpanminus redis-server libarchive-dev imagemagick webp libssl-dev zlib1g-dev libjxl-dev \ perlmagick ghostscript npm ``` diff --git a/tools/build/docker/Dockerfile b/tools/build/docker/Dockerfile index 22b134a96..d7cae96c6 100644 --- a/tools/build/docker/Dockerfile +++ b/tools/build/docker/Dockerfile @@ -1,5 +1,5 @@ # DOCKER-VERSION 0.3.4 -FROM alpine:3.14 +FROM alpine:3.16 LABEL git="https://github.com/Difegue/LANraragi" ENV S6_KEEP_ENV 1 diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index 07b582fa5..c5fb5a14c 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -14,7 +14,7 @@ if [ -f /etc/alpine-release ]; then if [ "$alpine_version" = "3.12.12" ]; then apk add nodejs-npm else # Those packages don't exist on 3.12 - apk add nodejs npm s6-overlay s6-overlay-preinit + apk add nodejs npm s6-overlay s6-overlay-preinit libjxl fi fi From 41ddbe2a72535dd1a81853f92acef90174fd6aa7 Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 19 Aug 2022 18:59:07 +0200 Subject: [PATCH 03/20] (#678) Make URL downloads use unlimited response size --- lib/LANraragi/Model/Upload.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/LANraragi/Model/Upload.pm b/lib/LANraragi/Model/Upload.pm index 27f6a368f..5aa9bc30e 100644 --- a/lib/LANraragi/Model/Upload.pm +++ b/lib/LANraragi/Model/Upload.pm @@ -153,10 +153,12 @@ sub download_url { die "Not a proper URL" unless $url; $logger->info("Downloading URL $url...This will take some time."); - my $tempdir = tempdir(); - my $tx = $ua->max_redirects(5)->get($url); + my $tempdir = tempdir(); + + # Download the URL, with 5 maximum redirects and unlimited response size. + my $tx = $ua->max_response_size(0)->max_redirects(5)->get($url); my $content_disp = $tx->result->headers->content_disposition; - my $filename = "Not_an_archive"; #placeholder; + my $filename = "Not_an_archive"; #placeholder; $logger->debug("Content-Disposition Header: $content_disp"); if ( $content_disp =~ /.*filename=\"(.*)\".*/gim ) { From 990fc30cccdca511d73bf7382dc13483ebf805a9 Mon Sep 17 00:00:00 2001 From: Guerra24 Date: Sun, 21 Aug 2022 01:15:01 -0600 Subject: [PATCH 04/20] Rework s6-overlay config --- lib/LANraragi/Utils/Generic.pm | 6 ++++++ tools/build/docker/Dockerfile | 9 +++++---- tools/build/docker/install-everything.sh | 2 +- tools/build/docker/s6/cont-init.d/01-lrr-setup | 2 ++ tools/build/docker/s6/s6-rc.d/init/type | 1 + tools/build/docker/s6/s6-rc.d/init/up | 1 + .../docker/s6/s6-rc.d/lanraragi/dependencies.d/init | 0 .../docker/s6/s6-rc.d/lanraragi/dependencies.d/redis | 0 tools/build/docker/s6/s6-rc.d/lanraragi/finish | 4 ++++ tools/build/docker/s6/s6-rc.d/lanraragi/run | 4 ++++ tools/build/docker/s6/s6-rc.d/lanraragi/type | 1 + tools/build/docker/s6/s6-rc.d/redis/dependencies.d/init | 0 tools/build/docker/s6/s6-rc.d/redis/run | 2 ++ tools/build/docker/s6/s6-rc.d/redis/type | 1 + tools/build/docker/s6/s6-rc.d/user/contents.d/init | 0 tools/build/docker/s6/s6-rc.d/user/contents.d/lanraragi | 0 tools/build/docker/s6/s6-rc.d/user/contents.d/redis | 0 17 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 tools/build/docker/s6/s6-rc.d/init/type create mode 100644 tools/build/docker/s6/s6-rc.d/init/up create mode 100644 tools/build/docker/s6/s6-rc.d/lanraragi/dependencies.d/init create mode 100644 tools/build/docker/s6/s6-rc.d/lanraragi/dependencies.d/redis create mode 100644 tools/build/docker/s6/s6-rc.d/lanraragi/finish create mode 100644 tools/build/docker/s6/s6-rc.d/lanraragi/run create mode 100644 tools/build/docker/s6/s6-rc.d/lanraragi/type create mode 100644 tools/build/docker/s6/s6-rc.d/redis/dependencies.d/init create mode 100644 tools/build/docker/s6/s6-rc.d/redis/run create mode 100644 tools/build/docker/s6/s6-rc.d/redis/type create mode 100644 tools/build/docker/s6/s6-rc.d/user/contents.d/init create mode 100644 tools/build/docker/s6/s6-rc.d/user/contents.d/lanraragi create mode 100644 tools/build/docker/s6/s6-rc.d/user/contents.d/redis diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm index f15d8cc32..17d4fb183 100644 --- a/lib/LANraragi/Utils/Generic.pm +++ b/lib/LANraragi/Utils/Generic.pm @@ -142,6 +142,9 @@ sub start_minion { # Freeze the process object in the PID file store \$proc, get_temp . "/minion.pid"; + open(FH, ">", get_temp . "/minion.pid-s6"); + print FH $proc->pid; + close(FH); return $proc; } @@ -164,6 +167,9 @@ sub start_shinobu { # Freeze the process object in the PID file store \$proc, get_temp . "/shinobu.pid"; + open(FH, ">", get_temp . "/shinobu.pid-s6"); + print FH $proc->pid; + close(FH); return $proc; } diff --git a/tools/build/docker/Dockerfile b/tools/build/docker/Dockerfile index d7cae96c6..219a48e6f 100644 --- a/tools/build/docker/Dockerfile +++ b/tools/build/docker/Dockerfile @@ -9,10 +9,11 @@ ENV S6_BEHAVIOUR_IF_STAGE2_FAILS 1 # wait 10s before KILLing ENV S6_KILL_GRACETIME 10000 +ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME 0 -# s6: The init is provided by alpine's s6-overlay package, hence the double slash. +# s6: The init is provided by alpine's s6-overlay package, hence the double slash. # See https://pkgs.alpinelinux.org/contents?branch=v3.14&name=s6-overlay&arch=x86&repo=community -ENTRYPOINT ["//init"] +ENTRYPOINT ["//init"] # Check application health HEALTHCHECK --interval=1m --timeout=10s --retries=3 \ @@ -62,8 +63,8 @@ COPY --chown=koyomi:koyomi /tests tests COPY --chown=koyomi:koyomi /lrr.conf lrr.conf COPY --chown=koyomi:koyomi /tools/build/docker/redis.conf tools/build/docker/ COPY /tools/build/docker/wsl.conf /etc/wsl.conf -COPY /tools/build/docker/s6/cont-init.d/ /etc/cont-init.d/ -COPY /tools/build/docker/s6/services.d/ /etc/services.d/ +COPY /tools/build/docker/s6/s6-rc.d/ /etc/s6-overlay/s6-rc.d/ +COPY /tools/build/docker/s6/cont-init.d/01-lrr-setup /etc/s6-overlay/s6-rc.d/init/ #COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/ # Persistent volumes diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index c5fb5a14c..d419e1fbc 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -14,7 +14,7 @@ if [ -f /etc/alpine-release ]; then if [ "$alpine_version" = "3.12.12" ]; then apk add nodejs-npm else # Those packages don't exist on 3.12 - apk add nodejs npm s6-overlay s6-overlay-preinit libjxl + apk add nodejs npm s6-overlay libjxl fi fi diff --git a/tools/build/docker/s6/cont-init.d/01-lrr-setup b/tools/build/docker/s6/cont-init.d/01-lrr-setup index d7dca09a8..7d266df71 100644 --- a/tools/build/docker/s6/cont-init.d/01-lrr-setup +++ b/tools/build/docker/s6/cont-init.d/01-lrr-setup @@ -42,7 +42,9 @@ chmod u+rwx /home/koyomi/lanraragi/public/temp #Remove mojo, minion and shinobu pid files rm /home/koyomi/lanraragi/public/temp/server.pid rm /home/koyomi/lanraragi/public/temp/shinobu.pid +rm /home/koyomi/lanraragi/public/temp/shinobu.pid-s6 rm /home/koyomi/lanraragi/public/temp/minion.pid +rm /home/koyomi/lanraragi/public/temp/minion.pid-s6 # https://redis.io/topics/faq#background-saving-fails-with-a-fork-error-under-linux-even-if-i-have-a-lot-of-free-ram OVERCOMMIT=$(cat /proc/sys/vm/overcommit_memory) diff --git a/tools/build/docker/s6/s6-rc.d/init/type b/tools/build/docker/s6/s6-rc.d/init/type new file mode 100644 index 000000000..bdd22a185 --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/init/type @@ -0,0 +1 @@ +oneshot diff --git a/tools/build/docker/s6/s6-rc.d/init/up b/tools/build/docker/s6/s6-rc.d/init/up new file mode 100644 index 000000000..5a4a22898 --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/init/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init/01-lrr-setup diff --git a/tools/build/docker/s6/s6-rc.d/lanraragi/dependencies.d/init b/tools/build/docker/s6/s6-rc.d/lanraragi/dependencies.d/init new file mode 100644 index 000000000..e69de29bb diff --git a/tools/build/docker/s6/s6-rc.d/lanraragi/dependencies.d/redis b/tools/build/docker/s6/s6-rc.d/lanraragi/dependencies.d/redis new file mode 100644 index 000000000..e69de29bb diff --git a/tools/build/docker/s6/s6-rc.d/lanraragi/finish b/tools/build/docker/s6/s6-rc.d/lanraragi/finish new file mode 100644 index 000000000..c7f28d2bf --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/lanraragi/finish @@ -0,0 +1,4 @@ +#!/bin/sh +kill -15 `cat /home/koyomi/lanraragi/public/temp/shinobu.pid-s6` +kill -15 `cat /home/koyomi/lanraragi/public/temp/minion.pid-s6` +sleep 5 diff --git a/tools/build/docker/s6/s6-rc.d/lanraragi/run b/tools/build/docker/s6/s6-rc.d/lanraragi/run new file mode 100644 index 000000000..b621c100b --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/lanraragi/run @@ -0,0 +1,4 @@ +#!/bin/sh +cd /home/koyomi/lanraragi/ +export HOME=/home/koyomi +exec s6-setuidgid koyomi perl /home/koyomi/lanraragi/script/launcher.pl -f /home/koyomi/lanraragi/script/lanraragi diff --git a/tools/build/docker/s6/s6-rc.d/lanraragi/type b/tools/build/docker/s6/s6-rc.d/lanraragi/type new file mode 100644 index 000000000..5883cff0c --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/lanraragi/type @@ -0,0 +1 @@ +longrun diff --git a/tools/build/docker/s6/s6-rc.d/redis/dependencies.d/init b/tools/build/docker/s6/s6-rc.d/redis/dependencies.d/init new file mode 100644 index 000000000..e69de29bb diff --git a/tools/build/docker/s6/s6-rc.d/redis/run b/tools/build/docker/s6/s6-rc.d/redis/run new file mode 100644 index 000000000..881f385f0 --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/redis/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec s6-setuidgid koyomi /usr/bin/redis-server /home/koyomi/lanraragi/tools/build/docker/redis.conf diff --git a/tools/build/docker/s6/s6-rc.d/redis/type b/tools/build/docker/s6/s6-rc.d/redis/type new file mode 100644 index 000000000..5883cff0c --- /dev/null +++ b/tools/build/docker/s6/s6-rc.d/redis/type @@ -0,0 +1 @@ +longrun diff --git a/tools/build/docker/s6/s6-rc.d/user/contents.d/init b/tools/build/docker/s6/s6-rc.d/user/contents.d/init new file mode 100644 index 000000000..e69de29bb diff --git a/tools/build/docker/s6/s6-rc.d/user/contents.d/lanraragi b/tools/build/docker/s6/s6-rc.d/user/contents.d/lanraragi new file mode 100644 index 000000000..e69de29bb diff --git a/tools/build/docker/s6/s6-rc.d/user/contents.d/redis b/tools/build/docker/s6/s6-rc.d/user/contents.d/redis new file mode 100644 index 000000000..e69de29bb From 494a9ea6a5146d4f4d0b1b2d330f806b45659c6a Mon Sep 17 00:00:00 2001 From: Guerra24 Date: Sat, 27 Aug 2022 12:17:51 -0600 Subject: [PATCH 05/20] Update Dockerfile --- tools/build/docker/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/build/docker/Dockerfile b/tools/build/docker/Dockerfile index 219a48e6f..175ce27c0 100644 --- a/tools/build/docker/Dockerfile +++ b/tools/build/docker/Dockerfile @@ -63,7 +63,10 @@ COPY --chown=koyomi:koyomi /tests tests COPY --chown=koyomi:koyomi /lrr.conf lrr.conf COPY --chown=koyomi:koyomi /tools/build/docker/redis.conf tools/build/docker/ COPY /tools/build/docker/wsl.conf /etc/wsl.conf +#Copy s6-overlay 3.x services +#Uses a system-d like definition that can't be use in 2.x COPY /tools/build/docker/s6/s6-rc.d/ /etc/s6-overlay/s6-rc.d/ +#Copy setup script as-is since no changes are needed between 2.x and 3.x COPY /tools/build/docker/s6/cont-init.d/01-lrr-setup /etc/s6-overlay/s6-rc.d/init/ #COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/ From 675db106afa684c2ed87644038a99234fedbb7ec Mon Sep 17 00:00:00 2001 From: Guerra24 Date: Sun, 4 Sep 2022 17:49:49 -0600 Subject: [PATCH 06/20] Make script executable --- tools/build/docker/s6/cont-init.d/01-lrr-setup | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 tools/build/docker/s6/cont-init.d/01-lrr-setup diff --git a/tools/build/docker/s6/cont-init.d/01-lrr-setup b/tools/build/docker/s6/cont-init.d/01-lrr-setup old mode 100644 new mode 100755 From cd05611d17708a838c6b3395c84edc1948feeb1b Mon Sep 17 00:00:00 2001 From: Difegue Date: Mon, 10 Oct 2022 18:43:24 +0200 Subject: [PATCH 07/20] (#694) Update Karen ref to fix issue w/ DistroInstaller + some docs update --- package.json | 3 ++- tools/Documentation/installing-lanraragi/docker.md | 2 +- tools/Documentation/installing-lanraragi/macos.md | 2 +- tools/build/windows/Karen | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1d200d82c..03e9d9ac7 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "dev-server": "perl ./script/launcher.pl -m -v ./script/lanraragi", "docker-build": "docker build -t difegue/lanraragi -f ./tools/build/docker/Dockerfile .", "critic": "perlcritic ./lib/* ./script/* ./tools/install.pl", - "backup-db": "perl ./script/backup" + "backup-db": "perl ./script/backup", + "get-version": "perl -Mojo -E \"my \\$conf = j(f(qw(package.json))->slurp); say %\\$conf{version} .q/ - '/. %\\$conf{version_name} .q/'/ \"" }, "repository": { "type": "git", diff --git a/tools/Documentation/installing-lanraragi/docker.md b/tools/Documentation/installing-lanraragi/docker.md index 188d4e9ac..565bbe025 100644 --- a/tools/Documentation/installing-lanraragi/docker.md +++ b/tools/Documentation/installing-lanraragi/docker.md @@ -86,7 +86,7 @@ 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. -If you need something a bit more involved (like adding SSL), please check the Network Interfaces section for how to use thhe `LRR_NETWORK` environment variable. +If you need something a bit more involved (like adding SSL), please check the Network Interfaces section for how to use the `LRR_NETWORK` environment variable. {% content-ref url="../advanced-usage/network-interfaces.md" %} [network-interfaces.md](../advanced-usage/network-interfaces.md) diff --git a/tools/Documentation/installing-lanraragi/macos.md b/tools/Documentation/installing-lanraragi/macos.md index bdf2192a7..066813cdd 100644 --- a/tools/Documentation/installing-lanraragi/macos.md +++ b/tools/Documentation/installing-lanraragi/macos.md @@ -36,7 +36,7 @@ brew install lanraragi Your content folder is stored by default in `${HOME}/Library/Application Support/LANraragi`. (`${HOME}/LANraragi/content` on Linux.) The Redis database is stored in `${HOME}/Library/Application Support/LANraragi/database`. (`${HOME}/LANraragi/database` on Linux.) -The content folder can be moved to any folder you want through the in-app settings page. +While the in-app settings page won't allow you to change the location of the content folder, you can do so by overriding the `LRR_DATA_DIRECTORY` environment variable before launching. ## Usage diff --git a/tools/build/windows/Karen b/tools/build/windows/Karen index c6b8c6b80..3d398586d 160000 --- a/tools/build/windows/Karen +++ b/tools/build/windows/Karen @@ -1 +1 @@ -Subproject commit c6b8c6b80d01d486cba64d1730530f8584419387 +Subproject commit 3d398586d6f8886d3b58228c2b1ffca4dbe2ea5c From 17173b6147de4e5b9fc473aae3b3cc9e50889320 Mon Sep 17 00:00:00 2001 From: Difegue Date: Mon, 10 Oct 2022 19:49:56 +0200 Subject: [PATCH 08/20] fix pbp violation --- lib/LANraragi/Utils/Generic.pm | 12 ++++++------ tools/build/docker/Dockerfile-legacy | 2 +- .../lanraragi/finish | 0 .../{services.d => legacy-services.d}/lanraragi/run | 0 .../{services.d => legacy-services.d}/redis/finish | 0 .../s6/{services.d => legacy-services.d}/redis/run | 0 6 files changed, 7 insertions(+), 7 deletions(-) rename tools/build/docker/s6/{services.d => legacy-services.d}/lanraragi/finish (100%) mode change 100755 => 100644 rename tools/build/docker/s6/{services.d => legacy-services.d}/lanraragi/run (100%) mode change 100755 => 100644 rename tools/build/docker/s6/{services.d => legacy-services.d}/redis/finish (100%) mode change 100755 => 100644 rename tools/build/docker/s6/{services.d => legacy-services.d}/redis/run (100%) mode change 100755 => 100644 diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm index 17d4fb183..46119cfbe 100644 --- a/lib/LANraragi/Utils/Generic.pm +++ b/lib/LANraragi/Utils/Generic.pm @@ -142,9 +142,9 @@ sub start_minion { # Freeze the process object in the PID file store \$proc, get_temp . "/minion.pid"; - open(FH, ">", get_temp . "/minion.pid-s6"); - print FH $proc->pid; - close(FH); + open( my $fh, ">", get_temp . "/minion.pid-s6" ); + print $fh $proc->pid; + close($fh); return $proc; } @@ -167,9 +167,9 @@ sub start_shinobu { # Freeze the process object in the PID file store \$proc, get_temp . "/shinobu.pid"; - open(FH, ">", get_temp . "/shinobu.pid-s6"); - print FH $proc->pid; - close(FH); + open( $fh, ">", get_temp . "/shinobu.pid-s6" ); + print $fh $proc->pid; + close($fh); return $proc; } diff --git a/tools/build/docker/Dockerfile-legacy b/tools/build/docker/Dockerfile-legacy index f9fc05b8c..f6ab11b8f 100644 --- a/tools/build/docker/Dockerfile-legacy +++ b/tools/build/docker/Dockerfile-legacy @@ -67,7 +67,7 @@ COPY --chown=koyomi:koyomi /lrr.conf lrr.conf COPY --chown=koyomi:koyomi /tools/build/docker/redis.conf tools/build/docker/ COPY /tools/build/docker/wsl.conf /etc/wsl.conf COPY /tools/build/docker/s6/cont-init.d/ /etc/cont-init.d/ -COPY /tools/build/docker/s6/services.d/ /etc/services.d/ +COPY /tools/build/docker/s6/legacy-services.d/ /etc/services.d/ #COPY /tools/build/docker/s6/fix-attrs.d/ /etc/fix-attrs.d/ # Persistent volumes diff --git a/tools/build/docker/s6/services.d/lanraragi/finish b/tools/build/docker/s6/legacy-services.d/lanraragi/finish old mode 100755 new mode 100644 similarity index 100% rename from tools/build/docker/s6/services.d/lanraragi/finish rename to tools/build/docker/s6/legacy-services.d/lanraragi/finish diff --git a/tools/build/docker/s6/services.d/lanraragi/run b/tools/build/docker/s6/legacy-services.d/lanraragi/run old mode 100755 new mode 100644 similarity index 100% rename from tools/build/docker/s6/services.d/lanraragi/run rename to tools/build/docker/s6/legacy-services.d/lanraragi/run diff --git a/tools/build/docker/s6/services.d/redis/finish b/tools/build/docker/s6/legacy-services.d/redis/finish old mode 100755 new mode 100644 similarity index 100% rename from tools/build/docker/s6/services.d/redis/finish rename to tools/build/docker/s6/legacy-services.d/redis/finish diff --git a/tools/build/docker/s6/services.d/redis/run b/tools/build/docker/s6/legacy-services.d/redis/run old mode 100755 new mode 100644 similarity index 100% rename from tools/build/docker/s6/services.d/redis/run rename to tools/build/docker/s6/legacy-services.d/redis/run From 2bab4ad65acb5fdcd73c5267d579e7621c6b7416 Mon Sep 17 00:00:00 2001 From: Difegue Date: Mon, 10 Oct 2022 21:01:06 +0200 Subject: [PATCH 09/20] woops --- lib/LANraragi/Utils/Generic.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm index 46119cfbe..0fa089578 100644 --- a/lib/LANraragi/Utils/Generic.pm +++ b/lib/LANraragi/Utils/Generic.pm @@ -167,7 +167,7 @@ sub start_shinobu { # Freeze the process object in the PID file store \$proc, get_temp . "/shinobu.pid"; - open( $fh, ">", get_temp . "/shinobu.pid-s6" ); + open( my $fh, ">", get_temp . "/shinobu.pid-s6" ); print $fh $proc->pid; close($fh); return $proc; From 0888a9602c63cd4da98e1c7951a5514b9cea6d1c Mon Sep 17 00:00:00 2001 From: Difegue Date: Mon, 10 Oct 2022 21:35:38 +0200 Subject: [PATCH 10/20] Add linux-headers to fix the no-AVX libffi build thx alpine --- tools/build/docker/install-everything.sh | 2 +- tools/cpanfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index d419e1fbc..6d7802114 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -3,7 +3,7 @@ #Just do everything apk update apk add tzdata -apk add perl perl-io-socket-ssl perl-dev redis libarchive-dev libbz2 openssl-dev zlib-dev +apk add perl perl-io-socket-ssl perl-dev redis libarchive-dev libbz2 openssl-dev zlib-dev linux-headers apk add imagemagick imagemagick-perlmagick libwebp-tools libheif apk add g++ make pkgconf gnupg wget curl file apk add shadow s6 s6-portable-utils diff --git a/tools/cpanfile b/tools/cpanfile index f6eadc8f3..d9870ae35 100755 --- a/tools/cpanfile +++ b/tools/cpanfile @@ -6,7 +6,7 @@ requires 'local::lib', 2.000024; requires 'Redis', 1.995; requires 'Encode', 3.01; requires 'Archive::Libarchive::Extract', 0.03; -requires 'Archive::Libarchive::Peek', 0.03; +requires 'Archive::Libarchive::Peek', 0.04; requires 'Digest::SHA', 6.02; # Not required by LRR itself but needs this version for Alpine support From 039d4b5ec504879bca07a6feb4ae729044b25959 Mon Sep 17 00:00:00 2001 From: Difegue Date: Tue, 11 Oct 2022 22:45:03 +0200 Subject: [PATCH 11/20] Update actions and keep libarchive cpan package at 0.05 for now muh avx --- .github/workflows/push-continous-delivery.yml | 6 +++--- .github/workflows/release-delivery.yml | 6 +++--- tools/cpanfile | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/push-continous-delivery.yml b/.github/workflows/push-continous-delivery.yml index 0c5e7f4d0..7a5911c8b 100644 --- a/.github/workflows/push-continous-delivery.yml +++ b/.github/workflows/push-continous-delivery.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@master - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - uses: actions/cache@v2 + uses: docker/setup-buildx-action@v2 + - uses: actions/cache@v3 with: path: /tmp/buildxcache key: ${{ runner.os }}-docker-buildx-${{ github.sha }} diff --git a/.github/workflows/release-delivery.yml b/.github/workflows/release-delivery.yml index 0c79cb355..55a14cce5 100644 --- a/.github/workflows/release-delivery.yml +++ b/.github/workflows/release-delivery.yml @@ -75,10 +75,10 @@ jobs: steps: - uses: actions/checkout@master - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - uses: actions/cache@v2 + uses: docker/setup-buildx-action@v2 + - uses: actions/cache@v3 with: path: /tmp/buildxcache key: ${{ runner.os }}-docker-buildx-${{ github.sha }} diff --git a/tools/cpanfile b/tools/cpanfile index d9870ae35..3ec6e3655 100755 --- a/tools/cpanfile +++ b/tools/cpanfile @@ -3,8 +3,10 @@ requires 'perl', '5.20.2'; requires 'local::lib', 2.000024; # LRR Core -requires 'Redis', 1.995; -requires 'Encode', 3.01; +requires 'Redis', 1.995; +requires 'Encode', 3.01; +requires 'Archive::Libarchive', + 0.05; # Hold back to this version as later ones bring in an updated FFI::Platypus (2.x instead of 1.58) which uses AVX requires 'Archive::Libarchive::Extract', 0.03; requires 'Archive::Libarchive::Peek', 0.04; requires 'Digest::SHA', 6.02; From 87d715c7ca6fe472cdfc4da25506025b119215d6 Mon Sep 17 00:00:00 2001 From: Difegue Date: Wed, 12 Oct 2022 10:32:33 +0200 Subject: [PATCH 12/20] Fix cpanfile syntax --- tools/cpanfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cpanfile b/tools/cpanfile index 3ec6e3655..0881798ea 100755 --- a/tools/cpanfile +++ b/tools/cpanfile @@ -6,7 +6,7 @@ requires 'local::lib', 2.000024; requires 'Redis', 1.995; requires 'Encode', 3.01; requires 'Archive::Libarchive', - 0.05; # Hold back to this version as later ones bring in an updated FFI::Platypus (2.x instead of 1.58) which uses AVX + '>= 0.05, < 0.06'; # Hold back to 0.05 as later ones bring in an updated FFI::Platypus (2.x instead of 1.58) which uses AVX requires 'Archive::Libarchive::Extract', 0.03; requires 'Archive::Libarchive::Peek', 0.04; requires 'Digest::SHA', 6.02; From 589a38008b19991ff054ce60bda6a8c8a9fc302a Mon Sep 17 00:00:00 2001 From: Difegue Date: Wed, 12 Oct 2022 13:12:04 +0200 Subject: [PATCH 13/20] Update cpanfile again --- tools/build/docker/install-everything.sh | 5 +++++ tools/cpanfile | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index 6d7802114..07b34d079 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -35,6 +35,11 @@ if [ $(uname -m) == 'x86_64' ]; then fi #Install the LRR dependencies proper + +# Install held back versions as FFI::Platypus 2.x seems to use AVX +cpanm FFI::Platypus@1.58 +cpanm Archive::Libarchive@0.05 + cd tools && cpanm --notest --installdeps . -M https://cpan.metacpan.org && cd .. npm run lanraragi-installer install-full diff --git a/tools/cpanfile b/tools/cpanfile index 0881798ea..7a54afecc 100755 --- a/tools/cpanfile +++ b/tools/cpanfile @@ -3,10 +3,10 @@ requires 'perl', '5.20.2'; requires 'local::lib', 2.000024; # LRR Core -requires 'Redis', 1.995; -requires 'Encode', 3.01; -requires 'Archive::Libarchive', - '>= 0.05, < 0.06'; # Hold back to 0.05 as later ones bring in an updated FFI::Platypus (2.x instead of 1.58) which uses AVX +requires 'Redis', 1.995; +requires 'Encode', 3.01; +requires 'FFI::Platypus', '== 1.58'; +requires 'Archive::Libarchive', '== 0.05'; requires 'Archive::Libarchive::Extract', 0.03; requires 'Archive::Libarchive::Peek', 0.04; requires 'Digest::SHA', 6.02; From 136cc06efefc37c6f8d1fd7faa4002303c21cf39 Mon Sep 17 00:00:00 2001 From: Difegue <8237712+Difegue@users.noreply.github.com> Date: Thu, 13 Oct 2022 18:14:26 +0200 Subject: [PATCH 14/20] (#673) More Windows installer fixes (#699) * gah * Bump Karen ref * Update Karen ref + revert avx test changes --- tools/build/docker/install-everything.sh | 6 +----- tools/build/windows/Karen | 2 +- tools/cpanfile | 6 ++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index 07b34d079..7446dd57d 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -24,6 +24,7 @@ curl -L https://cpanmin.us | perl - App::cpanminus #Alpine's libffi build comes with AVX instructions enabled #Rebuild our own libffi with those disabled if [ $(uname -m) == 'x86_64' ]; then + #Install deps only cpanm --notest --installdeps Alien::FFI curl -L -s https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Alien-FFI-0.25.tar.gz | tar -xz @@ -35,11 +36,6 @@ if [ $(uname -m) == 'x86_64' ]; then fi #Install the LRR dependencies proper - -# Install held back versions as FFI::Platypus 2.x seems to use AVX -cpanm FFI::Platypus@1.58 -cpanm Archive::Libarchive@0.05 - cd tools && cpanm --notest --installdeps . -M https://cpan.metacpan.org && cd .. npm run lanraragi-installer install-full diff --git a/tools/build/windows/Karen b/tools/build/windows/Karen index 3d398586d..eb529fc43 160000 --- a/tools/build/windows/Karen +++ b/tools/build/windows/Karen @@ -1 +1 @@ -Subproject commit 3d398586d6f8886d3b58228c2b1ffca4dbe2ea5c +Subproject commit eb529fc43b3ef6b8d46b0b2447c05eef09b01df8 diff --git a/tools/cpanfile b/tools/cpanfile index 7a54afecc..ff53d9658 100755 --- a/tools/cpanfile +++ b/tools/cpanfile @@ -5,8 +5,6 @@ requires 'local::lib', 2.000024; # LRR Core requires 'Redis', 1.995; requires 'Encode', 3.01; -requires 'FFI::Platypus', '== 1.58'; -requires 'Archive::Libarchive', '== 0.05'; requires 'Archive::Libarchive::Extract', 0.03; requires 'Archive::Libarchive::Peek', 0.04; requires 'Digest::SHA', 6.02; @@ -38,7 +36,7 @@ requires 'Test::Trap', 0.3.4; requires 'Test::Deep', 1.130; # Mojo stuff -requires 'Mojolicious', 9.19; +requires 'Mojolicious', 9.27; requires 'Mojolicious::Plugin::TemplateToolkit', 0.005; requires 'Mojolicious::Plugin::RenderFile', 0.12; requires 'Mojolicious::Plugin::Status', 1.15; @@ -46,7 +44,7 @@ requires 'IO::Socket::SSL', 2.067; requires 'Cpanel::JSON::XS', 4.06; # Job Queue (Minion) -requires 'Minion', 10.20; +requires 'Minion', 10.25; requires 'Minion::Backend::Redis', 0.002; # Background Worker (Shinobu) From ce9a1d9abbe9c91949acf26fe30d6ca2c1b210c9 Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 14 Oct 2022 00:10:24 +0200 Subject: [PATCH 15/20] (#672) Add category operation to batch tagging --- lib/LANraragi/Controller/Batch.pm | 34 ++++++++++++++++----- lib/LANraragi/Controller/Index.pm | 3 +- lib/LANraragi/Controller/Reader.pm | 7 ++--- lib/LANraragi/Controller/Upload.pm | 5 +-- lib/LANraragi/Model/Category.pm | 16 ++++++++-- lib/LANraragi/Plugin/Scripts/FolderToCat.pm | 10 +++--- public/js/batch.js | 6 ++++ templates/batch.html.tt2 | 14 ++++++++- 8 files changed, 68 insertions(+), 27 deletions(-) diff --git a/lib/LANraragi/Controller/Batch.pm b/lib/LANraragi/Controller/Batch.pm index f9cf55626..0ca42a912 100644 --- a/lib/LANraragi/Controller/Batch.pm +++ b/lib/LANraragi/Controller/Batch.pm @@ -18,14 +18,18 @@ sub index { #Build plugin listing my @pluginlist = get_plugins("metadata"); + # Get static category list + my @categories = LANraragi::Model::Category->get_static_category_list; + $self->render( - template => "batch", - plugins => \@pluginlist, - title => $self->LRR_CONF->get_htmltitle, - descstr => $self->LRR_DESC, - csshead => generate_themes_header($self), - tagrules => restore_CRLF( $self->LRR_CONF->get_tagrules ), - version => $self->LRR_VERSION + template => "batch", + plugins => \@pluginlist, + title => $self->LRR_CONF->get_htmltitle, + descstr => $self->LRR_DESC, + csshead => generate_themes_header($self), + tagrules => restore_CRLF( $self->LRR_CONF->get_tagrules ), + categories => \@categories, + version => $self->LRR_VERSION ); } @@ -96,6 +100,22 @@ sub socket { return; } + if ( $operation eq "addcat" ) { + my $catid = $command->{"category"}; + my ( $catsucc, $caterr ) = LANraragi::Model::Category::add_to_category( $catid, $id ); + + $client->send( + { json => { + id => $id, + category => $catid, + success => $catsucc, + message => $caterr + } + } + ); + return; + } + if ( $operation eq "tagrules" ) { $logger->debug("Applying tag rules to $id..."); diff --git a/lib/LANraragi/Controller/Index.pm b/lib/LANraragi/Controller/Index.pm index b81a5dded..8d4999010 100644 --- a/lib/LANraragi/Controller/Index.pm +++ b/lib/LANraragi/Controller/Index.pm @@ -54,8 +54,7 @@ sub index { my $userlogged = $self->LRR_CONF->enable_pass == 0 || $self->session('is_logged'); # Get static category list to populate the right-click menu - my @categories = LANraragi::Model::Category->get_category_list; - @categories = grep { %$_{"search"} eq "" } @categories; + my @categories = LANraragi::Model::Category->get_static_category_list; $self->render( template => "index", diff --git a/lib/LANraragi/Controller/Reader.pm b/lib/LANraragi/Controller/Reader.pm index f96516f7e..28bb84550 100644 --- a/lib/LANraragi/Controller/Reader.pm +++ b/lib/LANraragi/Controller/Reader.pm @@ -14,11 +14,8 @@ sub index { if ( $self->req->param('id') ) { - # Allow adding to category - my @categories = LANraragi::Model::Category->get_category_list; - - # But only to static categories - @categories = grep { %$_{"search"} eq "" } @categories; + # Allow adding to static categories + my @categories = LANraragi::Model::Category->get_static_category_list; # Get query string from referrer URL, if there's one my $referrer = $self->req->headers->referrer; diff --git a/lib/LANraragi/Controller/Upload.pm b/lib/LANraragi/Controller/Upload.pm index c473a65cb..1c86414ea 100644 --- a/lib/LANraragi/Controller/Upload.pm +++ b/lib/LANraragi/Controller/Upload.pm @@ -84,10 +84,7 @@ sub index { my $self = shift; # Allow adding to category on direct uploads - my @categories = LANraragi::Model::Category->get_category_list; - - # But only to static categories - @categories = grep { %$_{"search"} eq "" } @categories; + my @categories = LANraragi::Model::Category->get_static_category_list; $self->render( template => "upload", diff --git a/lib/LANraragi/Model/Category.pm b/lib/LANraragi/Model/Category.pm index 71c8f1766..0e4b6d563 100644 --- a/lib/LANraragi/Model/Category.pm +++ b/lib/LANraragi/Model/Category.pm @@ -29,6 +29,17 @@ sub get_category_list { return @result; } +# get_static_category_list() +# Returns a list of all the static category objects. +sub get_static_category_list() { + + my @categories = get_category_list; + + # Filter out dynamic categories + @categories = grep { %$_{"search"} eq "" } @categories; + return @categories; +} + # get_categories_containing_archive(id) # Returns a list of all the categories that contain the given archive. sub get_categories_containing_archive { @@ -178,7 +189,7 @@ sub add_to_category { if ( $redis->exists($cat_id) ) { unless ( $redis->hget( $cat_id, "search" ) eq "" ) { - $err = "$cat_id is a favorite search, can't add archives to it."; + $err = "$cat_id is a favorite search/dynamic category, can't add archives to it."; $logger->error($err); $redis->quit; return ( 0, $err ); @@ -203,7 +214,8 @@ sub add_to_category { } if ( "@cat_archives" =~ m/$arc_id/ ) { - $logger->warn("$arc_id already present in category $cat_id, doing nothing."); + $err = "$arc_id already present in category $cat_id, doing nothing."; + $logger->warn($err); $redis->quit; return ( 1, $err ); } diff --git a/lib/LANraragi/Plugin/Scripts/FolderToCat.pm b/lib/LANraragi/Plugin/Scripts/FolderToCat.pm index b4c45faa5..86f966006 100644 --- a/lib/LANraragi/Plugin/Scripts/FolderToCat.pm +++ b/lib/LANraragi/Plugin/Scripts/FolderToCat.pm @@ -45,13 +45,11 @@ sub run_script { if ($delete_old_cats) { $logger->info("Deleting all Static Categories before folder walking as instructed."); - my @categories = LANraragi::Model::Category->get_category_list; + my @categories = LANraragi::Model::Category->get_static_category_list; for my $category (@categories) { - if ( %{$category}{"search"} eq "" ) { - my $cat_id = %{$category}{"id"}; - $logger->debug("Deleting '$cat_id'"); - LANraragi::Model::Category::delete_category($cat_id); - } + my $cat_id = %{$category}{"id"}; + $logger->debug("Deleting '$cat_id'"); + LANraragi::Model::Category::delete_category($cat_id); } } diff --git a/public/js/batch.js b/public/js/batch.js index 6fc898981..29af42fe4 100644 --- a/public/js/batch.js +++ b/public/js/batch.js @@ -157,6 +157,7 @@ Batch.startBatch = function () { const commandBase = { operation: Batch.currentOperation, plugin: Batch.currentPlugin, + category: $("#category").val(), args, }; @@ -223,6 +224,11 @@ Batch.updateBatchStatus = function (event) { case "tagrules": $("#log-container").append(`Replaced tags for ID ${msg.id} (New tags: ${msg.tags})\n\n`); break; + case "addcat": + // Append the message at the end of this log, + // as it can contain the warning about the ID already being in the category + $("#log-container").append(`Added ID ${msg.id} to category ${msg.category}! ${msg.message} \n\n`); + break; case "clearnew": { $("#log-container").append(`Cleared new flag for ID ${msg.id}\n\n`); // Remove last character from matching row diff --git a/templates/batch.html.tt2 b/templates/batch.html.tt2 index 2b053b4c8..3d4bc6cb4 100644 --- a/templates/batch.html.tt2 +++ b/templates/batch.html.tt2 @@ -19,7 +19,7 @@ - + @@ -54,6 +54,7 @@ + @@ -123,6 +124,17 @@ + + Add to Category : + + + + + From df92696999535a524a6b8d2c64d776b9eae0cbed Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 14 Oct 2022 12:35:59 +0200 Subject: [PATCH 16/20] step down to x86-64 level 1 for the ffi docker build wew --- tools/build/docker/install-everything.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index 7446dd57d..14cdaacf5 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -29,8 +29,8 @@ if [ $(uname -m) == 'x86_64' ]; then cpanm --notest --installdeps Alien::FFI curl -L -s https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Alien-FFI-0.25.tar.gz | tar -xz cd Alien-FFI-0.25 - #Patch build script to disable AVX - sed -i 's/--disable-builddir/--disable-builddir --with-gcc-arch=x86-64-v2/' alienfile + #Patch build script to disable AVX - and SSE4 for real old CPUs + sed -i 's/--disable-builddir/--disable-builddir --with-gcc-arch=x86-64/' alienfile perl Makefile.PL && make install cd ../ && rm -rf Alien-FFI-0.25 fi From ff776fd03abb522b38d862c3f30ac980ea0a1b46 Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 14 Oct 2022 14:12:15 +0200 Subject: [PATCH 17/20] Add extra comment to the libffi build --- package.json | 4 ++-- tools/build/docker/install-everything.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 03e9d9ac7..b8503b950 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "lanraragi", - "version": "0.8.6", - "version_name": "Buddha of Suburbia", + "version": "0.8.7", + "version_name": "Outside", "description": "I'm under Japanese influence and my honor's at stake!", "scripts": { "test": "prove -r -l -v tests/", diff --git a/tools/build/docker/install-everything.sh b/tools/build/docker/install-everything.sh index 14cdaacf5..a0b8fcc41 100755 --- a/tools/build/docker/install-everything.sh +++ b/tools/build/docker/install-everything.sh @@ -29,7 +29,8 @@ if [ $(uname -m) == 'x86_64' ]; then cpanm --notest --installdeps Alien::FFI curl -L -s https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/Alien-FFI-0.25.tar.gz | tar -xz cd Alien-FFI-0.25 - #Patch build script to disable AVX - and SSE4 for real old CPUs + # Patch build script to disable AVX - and SSE4 for real old CPUs + # See https://developers.redhat.com/blog/2021/01/05/building-red-hat-enterprise-linux-9-for-the-x86-64-v2-microarchitecture-level sed -i 's/--disable-builddir/--disable-builddir --with-gcc-arch=x86-64/' alienfile perl Makefile.PL && make install cd ../ && rm -rf Alien-FFI-0.25 From 6a4147645e6316d55291da25366f859d22987566 Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 14 Oct 2022 16:31:44 +0200 Subject: [PATCH 18/20] (#662) Add some extra filtering to F! search --- lib/LANraragi/Plugin/Metadata/Fakku.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/LANraragi/Plugin/Metadata/Fakku.pm b/lib/LANraragi/Plugin/Metadata/Fakku.pm index 0ed1440cb..8879650d8 100644 --- a/lib/LANraragi/Plugin/Metadata/Fakku.pm +++ b/lib/LANraragi/Plugin/Metadata/Fakku.pm @@ -122,6 +122,12 @@ sub get_search_result_dom { # * Added a space ahead of the - (hyphen) filter, to only remove hyphens directly prepended to something else (those are the only ones that break searches, probably because the search engine treats them as exclusions as most engines would). $title =~ s/ -|'\w*|~|!|@//g; + # Removes everything inside [ ] as well as the brackets themselves + $title =~ s/\[([^\[\]]|(?0))*]//g; + + # Removes everything inside () as well as the parentheses themselves + $title =~ s/\(.*$//g; + # Visit the base host once to set cloudflare cookies and jank $ua->max_redirects(5)->get($fakku_host); From 07afbb5514bfff423e569a83d5c0747b5016476b Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 14 Oct 2022 16:41:04 +0200 Subject: [PATCH 19/20] (#698) Remove the maxlength parameter on tagrules --- templates/templates_config/config_tags.html.tt2 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/templates/templates_config/config_tags.html.tt2 b/templates/templates_config/config_tags.html.tt2 index 4c03d2746..d2fd636db 100644 --- a/templates/templates_config/config_tags.html.tt2 +++ b/templates/templates_config/config_tags.html.tt2 @@ -85,8 +85,7 @@
- +
When tagging archives using Plugins, the rules specified here will be applied to the tags before saving them to the database.
Split rules with linebreaks. From f80b3f666acca312038bc99f29ac2eacacc4135d Mon Sep 17 00:00:00 2001 From: Difegue Date: Fri, 14 Oct 2022 17:12:06 +0200 Subject: [PATCH 20/20] (#671) Update the filemap whenever an ID gets modified --- lib/LANraragi/Utils/Database.pm | 1 + lib/Shinobu.pm | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/LANraragi/Utils/Database.pm b/lib/LANraragi/Utils/Database.pm index dbf3664b0..bc0ea07ea 100644 --- a/lib/LANraragi/Utils/Database.pm +++ b/lib/LANraragi/Utils/Database.pm @@ -295,6 +295,7 @@ sub clean_database { $redis->hset( $id, "file", "" ); } else { change_archive_id( $id, $newid, $redis ); + $redis->hset( "LRR_FILEMAP", $file, $newid ); } } else { diff --git a/lib/Shinobu.pm b/lib/Shinobu.pm index fa3c29aea..b7b84bffc 100644 --- a/lib/Shinobu.pm +++ b/lib/Shinobu.pm @@ -227,6 +227,8 @@ sub add_to_filemap { LANraragi::Utils::Database::change_archive_id( $filemap_id, $id, $redis ); + # Don't forget to update the filemap, later operations will behave incorrectly otherwise + $redis->hset( "LRR_FILEMAP", $file, $id ); } else { $logger->debug( "$file has the same ID as the one in the filemap. Duplicate inotify events? Cleaning cache just to make sure");