lanraragi: 0.9.60 -> 0.9.81 (#503164)

This commit is contained in:
Toma
2026-09-05 16:59:33 +00:00
committed by GitHub
5 changed files with 104 additions and 99 deletions

View File

@@ -1,15 +0,0 @@
diff --git a/tools/install.pl b/tools/install.pl
index fa99f5beb..b369b3b3e 100755
--- a/tools/install.pl
+++ b/tools/install.pl
@@ -242,7 +242,9 @@ sub install_package {
if ($@) {
say("$package not installed! Trying to install now using cpanm$cpanopt");
- system("cpanm --notest $package $cpanopt");
+ if ( system("cpanm --notest $package $cpanopt") != 0 ) {
+ die "Something went wrong while installing $package - Bailing out.";
+ }
} else {
say("$package package installed, proceeding...");
}

View File

@@ -1,30 +1,8 @@
diff --git a/lib/LANraragi.pm b/lib/LANraragi.pm
index 1342d66..600ccbe 100644
--- a/lib/LANraragi.pm
+++ b/lib/LANraragi.pm
@@ -25,6 +25,8 @@ use LANraragi::Model::Config;
use constant IS_UNIX => ( $Config{osname} ne 'MSWin32' );
+use FindBin;
+
# This method will run once at server start
sub startup {
my $self = shift;
@@ -34,7 +36,7 @@ sub startup {
say "キタ━━━━━━(゚∀゚)━━━━━━!!!!!";
# Load package.json to get version/vername/description
- my $packagejson = decode_json( Mojo::File->new('package.json')->slurp );
+ my $packagejson = decode_json( Mojo::File->new("$FindBin::Bin/../package.json")->slurp );
my $version = $packagejson->{version};
my $vername = $packagejson->{version_name};
diff --git a/lib/LANraragi/Model/Archive.pm b/lib/LANraragi/Model/Archive.pm
index 425f935..9483012 100644
index 2e93d05..777fe8c 100644
--- a/lib/LANraragi/Model/Archive.pm
+++ b/lib/LANraragi/Model/Archive.pm
@@ -14,6 +14,7 @@ use File::Path qw(remove_tree);
@@ -15,6 +15,7 @@ use File::Path qw(remove_tree);
use File::Basename;
use File::Copy "cp";
use File::Path qw(make_path);
@@ -32,7 +10,7 @@ index 425f935..9483012 100644
use LANraragi::Utils::Generic qw(render_api_response);
use LANraragi::Utils::String qw(trim trim_CRLF);
@@ -222,7 +223,7 @@ sub serve_thumbnail {
@@ -225,7 +226,7 @@ sub serve_thumbnail {
} else {
# If the thumbnail doesn't exist, serve the default thumbnail.
@@ -42,41 +20,49 @@ index 425f935..9483012 100644
return;
} else {
diff --git a/lib/LANraragi/Utils/Generic.pm b/lib/LANraragi/Utils/Generic.pm
index 1b1ffbd..c0f87d6 100644
index aa15cf1..50ed9b8 100644
--- a/lib/LANraragi/Utils/Generic.pm
+++ b/lib/LANraragi/Utils/Generic.pm
@@ -28,6 +28,8 @@ BEGIN {
}
}
@@ -15,6 +15,7 @@ use Mojo::JSON qw(decode_json);
use Proc::Simple;
use Sys::CpuAffinity;
use Config;
+use FindBin;
+
# Generic Utility Functions.
use Exporter 'import';
our @EXPORT_OK = qw(is_image is_archive render_api_response get_tag_with_namespace shasum_str start_shinobu
@@ -149,7 +151,7 @@ sub start_shinobu {
use LANraragi::Utils::TempFolder qw(get_temp);
use LANraragi::Utils::String qw(trim);
@@ -166,7 +167,7 @@ sub start_shinobu {
my $mojo = shift;
if ( IS_UNIX ) {
if (IS_UNIX) {
my $proc = Proc::Simple->new();
- $proc->start( $^X, "./lib/Shinobu.pm" );
+ $proc->start( $^X, "$FindBin::Bin/../lib/Shinobu.pm" );
$proc->kill_on_destroy(0);
$mojo->LRR_LOGGER->debug( "Shinobu Worker new PID is " . $proc->pid );
@@ -198,7 +200,7 @@ sub get_css_list {
@@ -215,7 +216,7 @@ sub get_css_list {
#Get all the available CSS sheets.
# Get all the available CSS sheets.
my @css;
- opendir( my $dir, "./public/themes" ) or die $!;
+ opendir( my $dir, "$FindBin::Bin/../public/themes" ) or die $!;
while ( my $file = readdir($dir) ) {
if ( $file =~ /.+\.css/ ) { push( @css, $file ); }
}
@@ -492,7 +493,7 @@ LUA
sub get_version {
# Load package.json to get version/vername/description
- $version_info = decode_json( Mojo::File->new('package.json')->slurp ), shift unless $version_info;
+ $version_info = decode_json( Mojo::File->new("$FindBin::Bin/../package.json")->slurp ), shift unless $version_info;
return $version_info;
}
diff --git a/lib/LANraragi/Utils/I18N.pm b/lib/LANraragi/Utils/I18N.pm
index b917c2c..bee242e 100644
index 97107e6..0a8879d 100644
--- a/lib/LANraragi/Utils/I18N.pm
+++ b/lib/LANraragi/Utils/I18N.pm
@@ -5,19 +5,22 @@ use warnings;
@@ -5,21 +5,24 @@ use warnings;
use utf8;
use base 'Locale::Maketext';
@@ -84,24 +70,28 @@ index b917c2c..bee242e 100644
+# would go through a lot of unnecessary effort to finally find the translations
+use FindBin;
use Locale::Maketext::Lexicon {
- de => [ Gettext => "../../locales/template/de.po" ],
- en => [ Gettext => "../../locales/template/en.po" ],
- es => [ Gettext => "../../locales/template/es.po" ],
- zh => [ Gettext => "../../locales/template/zh.po" ],
- "zh-cn" => [ Gettext => "../../locales/template/zh.po" ],
- fr => [ Gettext => "../../locales/template/fr.po" ],
- id => [ Gettext => "../../locales/template/id.po" ],
- ja => [ Gettext => "../../locales/template/ja.po" ],
- ko => [ Gettext => "../../locales/template/ko.po" ],
- no => [ Gettext => "../../locales/template/nb_NO.po" ],
- nb => [ Gettext => "../../locales/template/nb_NO.po" ],
- pt => [ Gettext => "../../locales/template/pt.po" ],
- "zh-tw" => [ Gettext => "../../locales/template/zh_Hant.po" ],
- vi => [ Gettext => "../../locales/template/vi.po" ],
+ de => [ Gettext => "$FindBin::Bin/../locales/template/de.po" ],
+ en => [ Gettext => "$FindBin::Bin/../locales/template/en.po" ],
+ es => [ Gettext => "$FindBin::Bin/../locales/template/es.po" ],
+ zh => [ Gettext => "$FindBin::Bin/../locales/template/zh.po" ],
+ "zh-cn" => [ Gettext => "$FindBin::Bin/../locales/template/zh.po" ],
+ fr => [ Gettext => "$FindBin::Bin/../locales/template/fr.po" ],
+ id => [ Gettext => "$FindBin::Bin/../locales/template/id.po" ],
+ ja => [ Gettext => "$FindBin::Bin/../locales/template/ja.po" ],
+ ko => [ Gettext => "$FindBin::Bin/../locales/template/ko.po" ],
+ no => [ Gettext => "$FindBin::Bin/../locales/template/nb_NO.po" ],
+ nb => [ Gettext => "$FindBin::Bin/../locales/template/nb_NO.po" ],
@@ -112,27 +102,27 @@ index b917c2c..bee242e 100644
};
diff --git a/lib/LANraragi/Utils/Logging.pm b/lib/LANraragi/Utils/Logging.pm
index 7acbd01..b73ce3e 100644
index 66dc4e0..10f2692 100644
--- a/lib/LANraragi/Utils/Logging.pm
+++ b/lib/LANraragi/Utils/Logging.pm
@@ -19,7 +19,7 @@ our @EXPORT_OK = qw(get_logger get_plugin_logger get_logdir get_lines_from_file)
@@ -33,7 +33,7 @@ our $RLOG_UNSUPPORTED_WARNED = 0;
# Get the Log folder.
sub get_logdir {
- my $log_folder = "$FindBin::Bin/../log";
- my $log_folder = dirname(__FILE__) . "/../../../log";
+ my $log_folder = "./log";
# Folder location can be overriden by LRR_LOG_DIRECTORY
if ( $ENV{LRR_LOG_DIRECTORY} ) {
diff --git a/lib/LANraragi/Utils/TempFolder.pm b/lib/LANraragi/Utils/TempFolder.pm
index a5ab8a8..64a5625 100644
index 5d7bf68..480a012 100644
--- a/lib/LANraragi/Utils/TempFolder.pm
+++ b/lib/LANraragi/Utils/TempFolder.pm
@@ -13,7 +13,7 @@ our @EXPORT_OK = qw(get_temp);
#Get the current tempfolder.
#This can be called from any process safely as it uses FindBin.
sub get_temp {
- my $temp_folder = "$FindBin::Bin/../temp";
- my $temp_folder = dirname(__FILE__) . "/../../../temp";
+ my $temp_folder = "./temp";
# Folder location can be overriden by LRR_TEMP_DIRECTORY

View File

@@ -1,8 +1,8 @@
diff --git a/tools/install.pl b/tools/install.pl
index 0931979..50745d7 100644
index 80b593e..f5c15b1 100644
--- a/tools/install.pl
+++ b/tools/install.pl
@@ -92,36 +92,6 @@ if ( $ENV{HOMEBREW_FORMULA_PREFIX} ) {
@@ -100,66 +100,6 @@ if ( $ENV{HOMEBREW_FORMULA_PREFIX} ) {
$cpanopt = " -l " . $ENV{HOMEBREW_FORMULA_PREFIX} . "/libexec";
}
@@ -12,23 +12,31 @@ index 0931979..50745d7 100644
-IPC::Cmd->import('can_run');
-require Config::AutoConf;
-
-
-say("\r\nWill now check if all LRR software dependencies are met. \r\n");
-
-#Fails on win even if redis is in the path
-if ( IS_UNIX ) {
- #Check for Redis
- say("Checking for Redis...");
- can_run('redis-server')
- or die 'NOT FOUND! Please install a Redis server before proceeding.';
-#Fails on win even if valkey or redis are in the path
-if (IS_UNIX) {
-
- #Check for Redis/Valkey
- say("Checking for Redis/Valkey...");
- can_run('valkey-server') || can_run('redis-server')
- or die 'NOT FOUND! Please install a Redis/Valkey server before proceeding.';
- say("OK!");
-}
-
-#Check for GhostScript
-say("Checking for GhostScript...");
-can_run('gs')
- or warn 'NOT FOUND! PDF support will not work properly. Please install the "gs" tool.';
-say("OK!");
-#Check for libvips
-#Note, this check is probably not perfect so it will only complain rather than stop the install
-say("Checking for libvips...");
-my $vips_found;
-if (can_check_lib()) {
- $vips_found = has_lib("vips") || has_lib("vips-42");
-} else {
- say("UNKNOWN - ExtUtils::Liblist is not available, so we can't check if libvips is installed. Will assume it is!");
- $vips_found = 1;
-}
-$vips_found
- ? say("OK!")
- : say("NOT FOUND - Install libvips for much faster image processing and PDF support.\nlibvips may end up a requirement in future versions!");
-
-#Check for libarchive
-say("Checking for libarchive...");
@@ -36,17 +44,38 @@ index 0931979..50745d7 100644
- or die 'NOT FOUND! Please install libarchive and ensure its headers are present.';
-say("OK!");
-
#Check for PerlMagick
say("Checking for ImageMagick/PerlMagick...");
my $imgk;
@@ -170,13 +140,6 @@ if ( $back || $full ) {
-if (!$vips_found) {
- #Check for PerlMagick if libvips isn't installed
- say("Checking for ImageMagick/PerlMagick...");
- my $imgk;
-
- eval {
- require Image::Magick;
- $imgk = Image::Magick->QuantumDepth;
- };
-
- if ($@) {
- say("NOT FOUND");
- say("Please install libvips (recommended) OR ImageMagick with Perl installed for thumbnail support.");
- say("libvips is probably available in your package manager if you run linux.");
- say("Further instructions for ImageMagick are available at https://www.imagemagick.org/script/perl-magick.php .");
- say("The ImageMagick detection command returned: $imgk -- $@");
- } else {
- say( "Returned QuantumDepth: " . $imgk );
- say("OK!");
- }
-}
-
#Build & Install CPAN Dependencies
if ( $back || $full ) {
say("\r\nInstalling Perl modules... This might take a while.\r\n");
@@ -196,12 +136,6 @@ if ( $back || $full ) {
#Clientside Dependencies with Provisioning
if ( $front || $full ) {
- say("\r\nObtaining remote Web dependencies...\r\n");
-
- my $npmcmd = $legacy ? "npm install" : "npm ci";
- if ( system($npmcmd) != 0 ) {
- if ( system( "npm ci" ) != 0 ) {
- die "Something went wrong while obtaining node modules - Bailing out.";
- }
-

View File

@@ -13,20 +13,16 @@
buildNpmPackage rec {
pname = "lanraragi";
version = "0.9.60";
version = "0.9.81";
src = fetchFromGitHub {
owner = "Difegue";
repo = "LANraragi";
tag = "v.${version}";
hash = "sha256-ieYil/3n8iSWdfO6MQ1sW8q/TnQekpCx24n/BDfeLNg=";
hash = "sha256-oXId9VrNNp/S1ZrNFba/9jMqE3/qZWB63dU3DpLiDDo=";
};
patches = [
# https://github.com/Difegue/LANraragi/pull/1340
# Note: the PR was reverted upstream because it broke on windows
./bail-if-cpanm-fails.patch
# Skip running `npm ci` and unnecessary build-time checks
./install.patch
@@ -46,7 +42,7 @@ buildNpmPackage rec {
./expose-password-hashing.patch
];
npmDepsHash = "sha256-9SuimhLvEuruvFXuFm62DzgldngfiJneV6MDedGy6LY=";
npmDepsHash = "sha256-SkKYRmVpMmvOBp6FkYOcaGQJ8BF0nUuAHpHQxpcqSIc=";
nativeBuildInputs = [
perl
@@ -77,6 +73,7 @@ buildNpmPackage rec {
Mojolicious
MojoliciousPluginTemplateToolkit
MojoliciousPluginRenderFile
MojoliciousPluginOpenAPI
IOSocketSocks
IOSocketSSL
CpanelJSONXS
@@ -141,18 +138,19 @@ buildNpmPackage rec {
installPhase = ''
runHook preInstall
mkdir -p $out/share/lanraragi
mkdir -p "$out/share/lanraragi" "$out/share/lanraragi/tools"
chmod +x script/launcher.pl
cp -r lib public script locales templates package.json lrr.conf $out/share/lanraragi
cp -r lib public script locales templates package.json lrr.conf "$out/share/lanraragi"
cp tools/openapi.yaml "$out/share/lanraragi/tools/openapi.yaml"
makeWrapper $out/share/lanraragi/script/launcher.pl $out/bin/lanraragi \
--prefix PERL5LIB : $PERL5LIB \
makeWrapper "$out/share/lanraragi/script/launcher.pl" "$out/bin/lanraragi" \
--prefix PERL5LIB : "$PERL5LIB" \
--prefix PATH : ${lib.makeBinPath [ ghostscript ]} \
--run "cp -n --no-preserve=all $out/share/lanraragi/lrr.conf ./lrr.conf 2>/dev/null || true" \
--add-flags "-f $out/share/lanraragi/script/lanraragi"
makeWrapper ${lib.getExe perl} $out/bin/helpers/lrr-make-password-hash \
--prefix PERL5LIB : $out/share/lanraragi/lib:$PERL5LIB \
--prefix PERL5LIB : "$out/share/lanraragi/lib:$PERL5LIB" \
--add-flags "-e 'use LANraragi::Controller::Config; print LANraragi::Controller::Config::make_password_hash(@ARGV[0])' 2>/dev/null"
runHook postInstall

View File

@@ -18462,14 +18462,17 @@ with self;
JSONValidator = buildPerlPackage {
pname = "JSON-Validator";
version = "5.14";
version = "5.19";
src = fetchurl {
url = "mirror://cpan/authors/id/J/JH/JHTHORSEN/JSON-Validator-5.14.tar.gz";
hash = "sha256-YISl1AdeQhqTj/su6XuFBPqjXoZtD3tbWBETr17ijhs=";
url = "mirror://cpan/authors/id/J/JH/JHTHORSEN/JSON-Validator-5.19.tar.gz";
hash = "sha256-nx2G9v72OKr2EOO+KNICeuxKSOLcDuulLvjNVkUV4AQ=";
};
buildInputs = [ TestDeep ];
propagatedBuildInputs = [
DataValidateDomain
DataValidateIP
Mojolicious
NetIDNEncode
YAMLLibYAML
];
meta = {
@@ -22824,10 +22827,10 @@ with self;
MojoliciousPluginOpenAPI = buildPerlPackage {
pname = "Mojolicious-Plugin-OpenAPI";
version = "5.09";
version = "5.12";
src = fetchurl {
url = "mirror://cpan/authors/id/J/JH/JHTHORSEN/Mojolicious-Plugin-OpenAPI-5.09.tar.gz";
hash = "sha256-BIJdfOIe20G80Ujrz6Gu+Ek258QOhKOdvyeGcdSaMQY=";
url = "mirror://cpan/authors/id/J/JH/JHTHORSEN/Mojolicious-Plugin-OpenAPI-5.12.tar.gz";
hash = "sha256-la4bC0NKq2FXhNEyjefBRX40CKZYOnlXA9X1W65psRA=";
};
propagatedBuildInputs = [
JSONValidator