# Table of Contents - [LANraragi Documentation | LANraragi](#lanraragi-documentation-lanraragi) - [Homebrew (macOS) | Nightly Release | LANraragi](#homebrew-macos-nightly-release-lanraragi) - [LANraragi Documentation | Nightly Release | LANraragi](#lanraragi-documentation-nightly-release-lanraragi) - [Which installation method is best for me? | Nightly Release | LANraragi](#which-installation-method-is-best-for-me-nightly-release-lanraragi) - [Source Code (Linux/macOS) | Nightly Release | LANraragi](#source-code-linux-macos-nightly-release-lanraragi) - [Community (Linux) | Nightly Release | LANraragi](#community-linux-nightly-release-lanraragi) - [Docker (All platforms) | Nightly Release | LANraragi](#docker-all-platforms-nightly-release-lanraragi) - [Jail (FreeBSD) | Nightly Release | LANraragi](#jail-freebsd-nightly-release-lanraragi) - [Searching the Archive Index | Nightly Release | LANraragi](#searching-the-archive-index-nightly-release-lanraragi) - [Adding Metadata | Nightly Release | LANraragi](#adding-metadata-nightly-release-lanraragi) - [Statistics and Logs | Nightly Release | LANraragi](#statistics-and-logs-nightly-release-lanraragi) - [Reading Archives | Nightly Release | LANraragi](#reading-archives-nightly-release-lanraragi) - [Categories | Nightly Release | LANraragi](#categories-nightly-release-lanraragi) - [Batch Operations | Nightly Release | LANraragi](#batch-operations-nightly-release-lanraragi) - [Themes | Nightly Release | LANraragi](#themes-nightly-release-lanraragi) - [LRR for Windows (Win10) | Nightly Release | LANraragi](#lrr-for-windows-win10-nightly-release-lanraragi) - [Downloading Archives | Nightly Release | LANraragi](#downloading-archives-nightly-release-lanraragi) - [Getting Started | Nightly Release | LANraragi](#getting-started-nightly-release-lanraragi) - [Proxy Setup | Nightly Release | LANraragi](#proxy-setup-nightly-release-lanraragi) - [Backup and Restore | Nightly Release | LANraragi](#backup-and-restore-nightly-release-lanraragi) - [Tag Rules | Nightly Release | LANraragi](#tag-rules-nightly-release-lanraragi) - [Network Interface Setup | Nightly Release | LANraragi](#network-interface-setup-nightly-release-lanraragi) - [Using External Readers | Nightly Release | LANraragi](#using-external-readers-nightly-release-lanraragi) - [Themes | LANraragi](#themes-lanraragi) - [Translating LANraragi to other languages | Nightly Release | LANraragi](#translating-lanraragi-to-other-languages-nightly-release-lanraragi) - [Getting started | Nightly Release | LANraragi](#getting-started-nightly-release-lanraragi) - [Search API | Nightly Release | LANraragi](#search-api-nightly-release-lanraragi) - [Reading Archives | LANraragi](#reading-archives-lanraragi) - [Getting started | Nightly Release | LANraragi](#getting-started-nightly-release-lanraragi) - [Community (Linux) | LANraragi](#community-linux-lanraragi) - [Statistics and Logs | LANraragi](#statistics-and-logs-lanraragi) - [Downloader Plugins | Nightly Release | LANraragi](#downloader-plugins-nightly-release-lanraragi) - [Generic Plugins ("Scripts") | Nightly Release | LANraragi](#generic-plugins-scripts-nightly-release-lanraragi) - [Adding Metadata | LANraragi](#adding-metadata-lanraragi) - [Source Code (Linux/macOS) | LANraragi](#source-code-linux-macos-lanraragi) - [Homebrew (macOS) | LANraragi](#homebrew-macos-lanraragi) - [Metadata Plugins | Nightly Release | LANraragi](#metadata-plugins-nightly-release-lanraragi) - [Plugin API | Nightly Release | LANraragi](#plugin-api-nightly-release-lanraragi) - [Setup a Development Environment | Nightly Release | LANraragi](#setup-a-development-environment-nightly-release-lanraragi) - [Searching the Archive Index | LANraragi](#searching-the-archive-index-lanraragi) - [Code Examples | Nightly Release | LANraragi](#code-examples-nightly-release-lanraragi) - [Database API | Nightly Release | LANraragi](#database-api-nightly-release-lanraragi) - [Which installation method is best for me? | LANraragi](#which-installation-method-is-best-for-me-lanraragi) - [Shinobu API | Nightly Release | LANraragi](#shinobu-api-nightly-release-lanraragi) - [OPDS Catalog | Nightly Release | LANraragi](#opds-catalog-nightly-release-lanraragi) - [Login Plugins | Nightly Release | LANraragi](#login-plugins-nightly-release-lanraragi) - [Minion API | Nightly Release | LANraragi](#minion-api-nightly-release-lanraragi) - [LRR for Windows (Win10) | LANraragi](#lrr-for-windows-win10-lanraragi) - [Architecture & Style | Nightly Release | LANraragi](#architecture-style-nightly-release-lanraragi) - [Getting Started | LANraragi](#getting-started-lanraragi) - [Jail (FreeBSD) | LANraragi](#jail-freebsd-lanraragi) - [Batch Operations | LANraragi](#batch-operations-lanraragi) - [Miscellaneous other API | Nightly Release | LANraragi](#miscellaneous-other-api-nightly-release-lanraragi) - [Backup and Restore | LANraragi](#backup-and-restore-lanraragi) - [Downloading Archives | LANraragi](#downloading-archives-lanraragi) - [Categories | LANraragi](#categories-lanraragi) - [Proxy Setup | LANraragi](#proxy-setup-lanraragi) - [Docker (All platforms) | LANraragi](#docker-all-platforms-lanraragi) - [Tag Rules | LANraragi](#tag-rules-lanraragi) - [Network Interface Setup | LANraragi](#network-interface-setup-lanraragi) - [Category API | Nightly Release | LANraragi](#category-api-nightly-release-lanraragi) - [Getting started | LANraragi](#getting-started-lanraragi) - [Tankoubon API | Nightly Release | LANraragi](#tankoubon-api-nightly-release-lanraragi) - [Using External Readers | LANraragi](#using-external-readers-lanraragi) - [Translating LANraragi to other languages | LANraragi](#translating-lanraragi-to-other-languages-lanraragi) - [Search API | LANraragi](#search-api-lanraragi) - [Setup a Development Environment | LANraragi](#setup-a-development-environment-lanraragi) - [Database API | LANraragi](#database-api-lanraragi) - [Login Plugins | LANraragi](#login-plugins-lanraragi) - [Plugin API | LANraragi](#plugin-api-lanraragi) - [Downloader Plugins | LANraragi](#downloader-plugins-lanraragi) - [Generic Plugins ("Scripts") | LANraragi](#generic-plugins-scripts-lanraragi) - [Code Examples | LANraragi](#code-examples-lanraragi) - [Shinobu API | LANraragi](#shinobu-api-lanraragi) - [Minion API | LANraragi](#minion-api-lanraragi) - [Architecture & Style | LANraragi](#architecture-style-lanraragi) - [Metadata Plugins | LANraragi](#metadata-plugins-lanraragi) - [Getting started | LANraragi](#getting-started-lanraragi) - [OPDS Catalog | LANraragi](#opds-catalog-lanraragi) - [Miscellaneous other API | LANraragi](#miscellaneous-other-api-lanraragi) - [Tankoubon API | LANraragi](#tankoubon-api-lanraragi) - [Category API | LANraragi](#category-api-lanraragi) - [Archive API | Nightly Release | LANraragi](#archive-api-nightly-release-lanraragi) - [Archive API | LANraragi](#archive-api-lanraragi) --- # LANraragi Documentation | LANraragi ![Page cover](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-b6a512a7b383dcd6acb77158cb8b262d464dfffb%252Farchive_list.png%3Falt%3Dmedia&width=1248&dpr=3&quality=100&sign=e5ceab8e&sv=2) _I know when to go out_ &#xNAN;_Know when to stay in_ &#xNAN;_Get things done_ Thank you for showing interest in this networked chinese comic reading software. Just getting started? Check out how to install the software: [❓Which installation method is best for me?chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods) Or how to use your freshly installed instance: [🚀Getting Startedchevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps) [NextWhich installation method is best for me?chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods) Last updated 1 day ago --- # Homebrew (macOS) | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos#migration) Migration ----------------------------------------------------------------------------------------------------- To use all your existing files within a brewed LRR, you can issue the following commands: Copy lrr="${HOME}/Library/Application Support/LANraragi/" # if you’re on Linux, use the next line instead: #lrr="${HOME}/LANraragi/" cd mkdir -p "${lrr}" mv content "${lrr}/content" mv log "${lrr}/log" mv temp "${lrr}/temp" mv database.rdb "${lrr}/database/database.rdb" circle-info This simply moves all your files to the default location where LRR looks for them when installed with Homebrew. You can do that manually too, if you chose so. If you succeeded in moving, you can proceed to the next step! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos#installation) Installation ----------------------------------------------------------------------------------------------------------- If you do not have Homebrew installed yet, simply use the command on [their pagearrow-up-right](https://brew.sh/) . The next step is to then install LRR. Copy brew install lanraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos#configuration) Configuration ------------------------------------------------------------------------------------------------------------- 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.) 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. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos#usage) Usage --------------------------------------------------------------------------------------------- Once installed, you can get started by running `lanraragi` and opening [http://localhost:3000arrow-up-right](http://localhost:3000/) . To change the default port or add SSL support, see this page: [🌐Network Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces) circle-info By default, LRR listens on all IPv4 Interfaces on port 3000, unsecured HTTP. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos#updating) Updating --------------------------------------------------------------------------------------------------- Simply run `brew install lanraragi --HEAD` again to update to the latest version. circle-exclamation The same warning as in the Installation step applies. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos#uninstallation) Uninstallation --------------------------------------------------------------------------------------------------------------- Run `brew remove lanraragi` to uninstall the app. Data in the `${HOME}/Library/Application Support/LANraragi`/`${HOME}/LANraragi/` folder is not deleted. [PreviousLRR for Windows (Win10)chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows) [NextDocker (All platforms)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker) Last updated 2 months ago --- # LANraragi Documentation | Nightly Release | LANraragi ![Page cover](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-b6a512a7b383dcd6acb77158cb8b262d464dfffb%252Farchive_list.png%3Falt%3Dmedia&width=1248&dpr=3&quality=100&sign=41c05767&sv=2) _I know when to go out_ &#xNAN;_Know when to stay in_ &#xNAN;_Get things done_ Thank you for showing interest in this networked chinese comic reading software. Just getting started? Check out how to install the software: [❓Which installation method is best for me?chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods) Or how to use your freshly installed instance: [🚀Getting Startedchevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps) [NextWhich installation method is best for me?chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods) Last updated 2 months ago --- # Which installation method is best for me? | Nightly Release | LANraragi As LRR is a server app first and foremost, its setup is a bit more complex than your usual Desktop application. However, a lot of work as been done behind the scenes to make it easy! Look at the methods below for something that fits your OS and usage. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-macos-homebrew) Linux/macOS: _Homebrew_ -------------------------------------------------------------------------------------------------------------------------------- [Homebrewarrow-up-right](https://brew.sh/) allows you to quickly setup LRR on macOS and Linux without relying on containers or modifying your preinstalled system libaries. [🍎Homebrew (macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos) circle-info While not a part of the main repo, you can check out the [Nix](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community) package as well if brew isn't to your taste. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#windows-10-11-lrr-for-windows) Windows 10/11: _LRR for Windows_ -------------------------------------------------------------------------------------------------------------------------------------------------- circle-exclamation This method works on **64-bit** editions of Windows 10 only. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-51b137f57b9d19b464400f3fb289b571c2f6217e%252Fkaren.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=4ce243a3&sv=2) win10 I provide a dedicated installer for Windows machines as of 0.6.0, complete with a GUI and autostart. [🪟LRR for Windows (Win10)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-macos-windows-10-docker) Linux/macOS/Windows 10: _Docker_ -------------------------------------------------------------------------------------------------------------------------------------------------- Taking a page from sysadmin books, you can easily install LRR as a **container** with Docker. They're lightweight, easy to update, and automatically built/tested. I recommend this for NAS setups! [🐳Docker (All platforms)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-macos-installing-from-source) Linux/macOS: _Installing from Source_ ------------------------------------------------------------------------------------------------------------------------------------------------------------ Installing from **source** is a more involved procedure, but it does put you in full control and able to hack up the app's files as you wish. [🛠️Source Code (Linux/macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-community-community-provided-install-packages) Linux/Community: _Community provided install packages_ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Ready-to-install packages provided by voluntary maintainers or by a linux distribution itself. [🐧Community (Linux)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#freebsd-jail) FreeBSD/Jail ------------------------------------------------------------------------------------------------------------- Similar to installing from source with an altered process for FreeBSD compatability. [👿Jail (FreeBSD)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#windows-7-or-8-dont) Windows 7 or 8: don't ----------------------------------------------------------------------------------------------------------------------------- Switch to 10 or Linux. [PreviousLANraragi Documentationchevron-left](https://sugoi.gitbook.io/lanraragi/dev) [NextLRR for Windows (Win10)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows) Last updated 2 months ago * [Linux/macOS: Homebrew](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-macos-homebrew) * [Windows 10/11: LRR for Windows](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#windows-10-11-lrr-for-windows) * [Linux/macOS/Windows 10: Docker](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-macos-windows-10-docker) * [Linux/macOS: Installing from Source](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-macos-installing-from-source) * [Linux/Community: Community provided install packages](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#linux-community-community-provided-install-packages) * [FreeBSD/Jail](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#freebsd-jail) * [Windows 7 or 8: don't](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods#windows-7-or-8-dont) --- # Source Code (Linux/macOS) | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#a-small-fyi-about-vendor-perl) A small FYI about Vendor Perl ---------------------------------------------------------------------------------------------------------------------------------------------- As you might have noticed, LANraragi entirely depends on the Perl programming language. A version of Perl ships already compiled on most Linux distributions(and macOS). It's usually called "Vendor Perl". Using vendor Perl is [generally discouragedarrow-up-right](http://www.modernperlbooks.com/mt/2012/01/avoiding-the-vendor-perl-fad-diet.html) due to possible fuck-ups by the Linux distribution creator. As such, you might want to install LANraragi with your own compiled Perl, using a tool such as [Perlbrewarrow-up-right](https://perlbrew.pl/) . For information, my personal tests are done using Debian's vendor Perl. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#needed-dependencies) Needed dependencies -------------------------------------------------------------------------------------------------------------------------- Copy 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 libjxl-dev \ perlmagick ghostscript npm libvips-dev _Base software dependencies._ circle-info ImageMagick and libvips are optional, but you need to install at least one to get thumbnail support. libvips is faster than ImageMagick and will be used automatically if both are installed. circle-info If your package manager requires you to specify which ImageMagick version to install, choose version 7. If you're using perlbrew, you'll have to install `Alien::ImageMagick` with CPAN in perlbrew's perl lib, which will handle downloading and building the `perlmagick` API bindings for you. (LRR can work without ImageMagick running, but you'll lose out on any thumbnail support) circle-info For macOS, you should be able to install the dependencies using Homebrew. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#installing-lrr) Installing LRR ---------------------------------------------------------------------------------------------------------------- All you need to do is clone the git repo somewhere (or download one of [the releasesarrow-up-right](https://github.com/Difegue/LANraragi/releases) ) and run the installer. I recommend doing this with a brand new Linux user account. (I'm using "koyomi" here): {% hint style="info"} Do not use `sudo` in the above command if you are using `perlbrew`. Arch users might need to install `perl-config-autoconf` and use env variable `export PERL5LIB=~/perl5/lib/perl5` before running the installer. Once this is done, you can get started by running `npm start` and opening [http://localhost:3000arrow-up-right](http://localhost:3000/) . To change the default port or add SSL support, see this page: [🌐Network Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces) circle-info By default, LRR listens on all IPv4 Interfaces on port 3000, unsecured HTTP. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#updating) Updating Getting all the files from the latest release and pasting them in the directory of the application should give you a painless update 95% of the time. To be on the safe side, make sure to rerun the installer once this is done: [PreviousDocker (All platforms)chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker) [NextCommunity (Linux)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community) Last updated 5 months ago * [A small FYI about Vendor Perl](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#a-small-fyi-about-vendor-perl) * [Needed dependencies](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#needed-dependencies) * [Installing LRR](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#installing-lrr) * [Updating](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source#updating) Copy git clone -b master http://github.com/Difegue/LANraragi /home/koyomi/lanraragi cd /home/koyomi/lanraragi && sudo npm run lanraragi-installer install-full Copy npm run lanraragi-installer install-full --- # Community (Linux) | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community#unraid) UnRAID --------------------------------------------------------------------------------------------------- An UnRAID package based on the Docker images is available [here.arrow-up-right](https://github.com/naipilk/LANraragi-unraid-template/) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community#nix-nixos) Nix/NixOS --------------------------------------------------------------------------------------------------------- If you're using [NixOSarrow-up-right](https://nixos.org/) or the Nix package manager, a [LANraragiarrow-up-right](https://search.nixos.org/packages?channel=unstable&show=lanraragi&from=0&size=50&sort=relevance&type=packages&query=lanraragi) package is available. Unlike the other options here, this one is also available for Darwin/macOS! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community#arch-linux) Arch Linux ----------------------------------------------------------------------------------------------------------- An installation package is provided [in the AURarrow-up-right](https://aur.archlinux.org/packages/lanraragi/) (Arch User Repository). Using the AUR package the installation process in Arch Linux should be as easy as entering `pikaur -S lanraragi` in the command line (if using pikaur). Using other AUR managers should be just as easy. To install lanraragi without an AUR package manager the installation process would be something like: Copy wget https://aur.archlinux.org/cgit/aur.git/snapshot/lanraragi.tar.gz -O - | tar -xz cd lanraragi makepkg -rsi That would take care of installing LRR together with build and normal dependencies and deleting build dependencies after successful building and installing. The installer also creates a lanraragi.service unit file for starting, restarting and stopping LRR with systemd's `systemctl`. If Redis is down it will get it up. `systemctl start lanraragi.service` `systemctl restart lanraragi.service` `systemctl stop lanraragi.service` `systemctl status lanraragi.service` Systemd integration also gives an easy way to read the log (if necessary). `journalctl -u lanraragi -f` [PreviousSource Code (Linux/macOS)chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source) [NextJail (FreeBSD)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail) Last updated 2 years ago * [UnRAID](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community#unraid) * [Nix/NixOS](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community#nix-nixos) * [Arch Linux](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community#arch-linux) --- # Docker (All platforms) | Nightly Release | LANraragi A Docker image exists for deploying LANraragi installs to your machine easily without disrupting your already-existing web server setup. Docker is the best way to install the software on remote servers. I don't recommand it for Desktop machines and casual users due to it being a bit complex to wield. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#cloning-the-base-lrr-image) Cloning the base LRR image ---------------------------------------------------------------------------------------------------------------------------------------- Download [the Docker setuparrow-up-right](https://www.docker.com/products/docker) and install it. circle-exclamation The LRR Docker container uses a fairly recent ([3.14arrow-up-right](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`. Once you're done, execute: Copy 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 \ --mount type=bind,source=[YOUR_THUMBNAIL_DIRECTORY],target=/home/koyomi/lanraragi/thumb difegue/lanraragi circle-info You can tell Docker to auto-restart the LRR container on boot by adding the `--restart always` flag to this command. If you need to sideload plugins, consider adding an additional bind mount for the `/home/koyomi/lanraragi/lib/LANraragi/Plugin/Sideloaded` folder. circle-info Alternatively, if you prefer a `docker-compose.yml` file, use: Copy --- services: lanraragi: image: difegue/lanraragi container_name: lanraragi ports: - "3000:3000" volumes: - [YOUR_CONTENT_DIRECTORY]:/home/koyomi/lanraragi/content - [YOUR_THUMBNAIL_DIRECTORY]:/home/koyomi/lanraragi/thumb - [YOUR_DATABASE_DIRECTORY]:/home/koyomi/lanraragi/database restart: unless-stopped 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. circle-info You can also mount the database/thumbnail directories to dedicated Docker volumes: The volume can be reused when updating, so your database will still follow along even if the container is destroyed. You can always backup the database using LANraragi's internal tool. Once your LANraragi container is loaded, you can access it at [http://localhost:3000arrow-up-right](http://localhost:3000/) . You can use the following commands to stop/start/remove the container(Removing it won't delete the archive directory you specified) : [Tagsarrow-up-right](https://hub.docker.com/r/difegue/lanraragi/tags/) exist for major releases, so you can use those if you want to run another version: `docker run [yadda yadda] difegue/lanraragi:0.4.0` triangle-exclamation If you're feeling **extra dangerous**, you can run the last files directly from the _dev_ branch of the Git repo through the _nightly_ tag: `docker run [zoinks] difegue/lanraragi:nightly` [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#platform-specific-caveats) Platform-specific caveats -------------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#windows) Windows If you're running on Windows, please check the syntax for mapping your content directory [herearrow-up-right](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. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#raspbian) 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`: Regular versions of Debian shouldn't have this issue. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#changing-the-port) 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 the `LRR_NETWORK` environment variable. [🌐Network Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces) circle-info The default healthchecks of the Docker container base themselves on port 3000. If you use the LRR\_NETWORK variable to change the outgoing port instead of Docker's port mapping, said healthchecks will fail. If you have to use the variable for SSL or the like, I recommend leaving the port in it to 3000 and doing your port mapping on the Docker side. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#changing-the-user-id-in-case-of-permission-issues) Changing the user ID in case of permission issues -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The container runs the software by default using the uid/gid provided by the LRR\_UID/LRR\_GID variables. If you don't specify said variables, the container will run under uid/gid 9001/9001. This is good enough for most scenarios, but in case you need to run it as the current user, you can do the following: `docker run [wassup] -e LRR_UID=``id -u $USER`` -e LRR_GID=``id -g $USER`` difegue/lanraragi` This uses `id` to automatically fetch your userid/groupid. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#skip-permission-fixing) Skip permission fixing -------------------------------------------------------------------------------------------------------------------------------- By default, LANraragi will change the permissions for all files and folders in the thumbnail and content folder during startup: * Everything in the thumbnail folder will be owned by the provided UID/GID (9001/9001 by default) * Files and folders in the thumbnail folder can be read and written by the owner * Files and folders in the content folder are readable by the owner * Folders in the thumbnail/content folder can be executed by the owner While this can resolve some permission issues, but it will result in a longer start-up time for large library and may even prevent the container from starting on Docker Swarm. To disable this behaviour, you can set the environment variable `LRR_AUTOFIX_PERMISSIONS=-1`, but make sure you have manually set the permissions beforehand. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#updating) Updating ---------------------------------------------------------------------------------------------------- As Docker containers are immutable, you need to destroy your existing container and build a new one. As long as you use the same content/database directories(or volumes) as before, your data will still be there. circle-info If you update often, you might want to consider using docker-compose or [Portainerarrow-up-right](https://portainer.io/) to redeploy containers without entering the entire configuration every time. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#building-your-own) Building your own ---------------------------------------------------------------------------------------------------------------------- The previous setup gets a working LANraragi container from the Docker Hub, but you can build your own bleeding edge version by executing `npm run docker-build` from a cloned Git repo. This will use your cloned Git repo to build the image, modifications you might have made included. Of course, this requires a Docker installation. If you're running WSL1, which can't run Docker natively, you can directly use the Docker for Windows executable with a simple symlink: [PreviousHomebrew (macOS)chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos) [NextSource Code (Linux/macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/source) Last updated 9 months ago * [Cloning the base LRR image](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#cloning-the-base-lrr-image) * [Platform-specific caveats](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#platform-specific-caveats) * [Windows](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#windows) * [Raspbian](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#raspbian) * [Changing the port](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#changing-the-port) * [Changing the user ID in case of permission issues](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#changing-the-user-id-in-case-of-permission-issues) * [Skip permission fixing](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#skip-permission-fixing) * [Updating](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#updating) * [Building your own](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/docker#building-your-own) Copy docker volume create lrr-database docker volume create lrr-thumbnails docker run --name=lanraragi -p 3000:3000 \ --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \ --mount source=lrr-database,target=/home/koyomi/lanraragi/database \ --mount source=lrr-thumbnails,target=/home/koyomi/lanraragi/thumb \ difegue/lanraragi Copy docker stop lanraragi docker start lanraragi docker rm lanraragi Copy 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 Copy 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 \ --mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/home/koyomi/lanraragi/database \ --mount type=bind,source=[YOUR_THUMBNAIL_DIRECTORY],target=/home/koyomi/lanraragi/thumb difegue/lanraragi Copy sudo ln -s '/mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe' \ /usr/local/bin/docker --- # Jail (FreeBSD) | Nightly Release | LANraragi Installing LANraragi on FreeBSD or in a jail is similar to [installing it from sourcearrow-up-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) with slighly altered dependecies and some extra steps. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#jail-creation) Jail creation ------------------------------------------------------------------------------------------------------------ For creating the jail on a regular FreeBSD installation, refer to its [documentationarrow-up-right](https://docs.freebsd.org/doc/7.3-RELEASE/usr/share/doc/handbook/jails-build.html) . For creating the jail on FreeNAS, simply navigate to the jails tab in the webui and click on 'add'. After creating the jail enter it, type `pkg` and confirm the next prompt. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-d1996090681b5d397dff606ec2beacc66fdc6a42%252Fshell.jpg%3Falt%3Dmedia%26token%3Deacd2f89-a454-4c2d-895b-e70f0fd5b9da&width=768&dpr=3&quality=100&sign=176c37e4&sv=2) Entering a jail If you want to install it on the main system itself (which in most cases is not recommended) you can simply skip this step. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#installing-dependencies) Installing dependencies -------------------------------------------------------------------------------------------------------------------------------- It is recommended that you first check/install all neccessary dependecies. Although you can also go along with the installation and fix any critical dependency errors along the way. This will decrease installation size, but most likely result in issues later on. circle-info If you want to configure your jail a little bit leaner you can install the noX11 version of ImageMagick and other dependencies if available. Afterwards, you need to add redis\_enable="YES" to your `rc.conf` with your text editor of choice. The preinstalled one is Easy Editor (`ee`), but you can install `nano` as well. `ee /etc/rc.conf` circle-info You need to restart the jail now so that the changes can take effect (Keep in mind to cd back into your LANraragi folder afterwards or you will have to use the full filepath for the following commands). [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#installing-lanraragi) Installing LANraragi -------------------------------------------------------------------------------------------------------------------------- This step is effectively the same as when [installing from sourcearrow-up-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) . Depending on how you have built your jail you might already have a place to put your installation, else I recommend conforming to Unix standards. After the installer completed you can go ahead and `npm start` You might get an error thrown in on your first startup. It does not appear to affect LANraragi and does not appear on subsequent startups, so do not worry too much about that one too much. Now you can switch over to any device in your network and test if LANraragi is working properly by accessing your\_configured\_ip:3000 You will need to keep the console open during that. If you close it now LANraragi stops as well. We will take care of that in the next step. After checking if everything works you can close down LANraragi either by pressing crtl+C in your console or simply closing the console window. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#setting-up-lanraragi-as-daemon) Setting up LANraragi as Daemon ---------------------------------------------------------------------------------------------------------------------------------------------- Now we are setting up LANraragi to autostart when starting the jail. That way it will also keep running until you stop the jail entirely. Now LANraragi should run as a service. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#mountpoints) Mountpoints -------------------------------------------------------------------------------------------------------- In many setups, jails are running on fast but small drives while the bulk of data is offloaded somewhere else. If you are running a similar config you might want to consider offloading your content and tmp folders from your SSD to your HDDs with the help of mountpoints. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-184fb23794fbf2873dc5111155a7790cc0ae90a0%252Fmountpoints.jpg%3Falt%3Dmedia%26token%3D34e6a4e4-9c0a-4a7e-b350-021b23d6fbfe&width=768&dpr=3&quality=100&sign=d2e2d85e&sv=2) Mountpoints [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#updating) Updating -------------------------------------------------------------------------------------------------- Updating works the same as when installing from source [installing from sourcearrow-up-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#updating) . circle-info By default, LRR listens on all IPv4 Interfaces on port 3000, unsecured HTTP. [PreviousCommunity (Linux)chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/community) [NextGetting Startedchevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps) Last updated 2 months ago * [Jail creation](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#jail-creation) * [Installing dependencies](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#installing-dependencies) * [Installing LANraragi](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#installing-lanraragi) * [Setting up LANraragi as Daemon](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#setting-up-lanraragi-as-daemon) * [Mountpoints](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#mountpoints) * [Updating](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail#updating) Copy pkg update pkg upgrade pkg install gnupg pkg install p5-App-cpanminus pkg install redis pkg install libarchive pkg install ImageMagick7 pkg install libressl pkg install npm pkg install p5-mojolicious pkg install git cpan Parallel::Loops Copy mkdir /usr/local/etc/LANraragi cd /usr/local/etc/LANraragi git clone -b master http://github.com/Difegue/LANraragi /usr/local/etc/LANraragi npm run lanraragi-installer install-full Copy ee /usr/local/etc/LANraragi/lrr Copy #!/bin/share/doc/handbook/jails-build lrr_start() { user='root' cd /usr/local/etc/LANraragi su ${user} -c "/usr/local/bin/npm start /usr/local/etc/LANraragi/" } lrr_start Copy ee /etc/rc.d/lrrd Copy #!/bin/sh . /etc/rc.subr name="lrr" rcvar=`lrrd_enable` command="/usr/local/etc/LANraragi/${name}" run_rc_command "$1" --- # Searching the Archive Index | Nightly Release | LANraragi The search bar in LANraragi tries to not be too dumb and will actively suggest tags to you as you type. If you want to queue multiple terms/tags, you have to use **commas** to separate them, much like how tags are entered in the metadata field when editing an archive. You can mix both tags and a specific title in a search if you want. You can search for galleries with a specific number of pages with `pages:20`, or with a page range: `pages:>20, pages:<=30`. You can also search for galleries with a specific number of pages read with similar syntax, `read:20`, or with a range: `read:>20, read:<=30`. You can also use the following special characters in a search: **Quotation Marks ("...")** Exact string search. Everything placed inside a pair of quotation marks is treated as a singular term. Wildcard characters are still interpreted as wildcards. **Question Mark (?), Underscore (\_)** Wildcard. Can match any single character. **Asterisk (\*), Percentage Sign (%)** Wildcard. Can match any sequence of characters (including none). **Subtraction Sign (-)** Exclusion. When placed before a term, prevents search results from including that term. **Dollar Sign ($)** Add at the end of a tag to perform an exact tag search rather than displaying all elements that start with the term. Can be used as an exclusion to ignore misc tags in the search query. [PreviousAdding Metadatachevron-left](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata) [NextStatistics and Logschevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats) Last updated 2 months ago --- # Adding Metadata | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata#editing-an-archive-manually) Editing an Archive manually ---------------------------------------------------------------------------------------------------------------------------------------- To use a plugin on a single archive, you need to access its **editing** page by clicking the pencil icon on the main view. From here, you can modify all metadata manually. Don't forget to save! triangle-exclamation The "Delete Archive" button will permanently wipe the Archive from your filesystem! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata#using-plugins) Using Plugins ------------------------------------------------------------------------------------------------------------ LANraragi supports the use of **Plugins** to fetch tags for your archives Said Plugins can be used in three different ways: * On a per-archive basis through the standard Edit dialog * Automatically on every newly added archive. * During a Batch Tagging session. For more info on Batch Tagging, check the following article: [🦇Batch Operationschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/batch-tagging) To use plugins automatically, you have to first use the **Plugin Configuration** page to choose which plugins will be automatically executed, and set their options if they need any. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-d2e36942d3139ffcb526767032d5e432d405d03e%252Fcfg_plugin.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=584b4e01&sv=2) Plugin Configuration (on this screenshot, eze and regex parsing will be executed automatically.) LRR ships with a few plugins out of the box, in the _/lib/LANraragi/Plugins_ folder. To install other Plugins (in .pm format), drag them to this folder and they'll appear in Plugin Configuration. You can also install Plugins through the "Install Plugin" button in Plugin Configuration. This feature requires Debug Mode to be enabled for security purposes. Debug Mode can be disabled once you're done installing Plugins. circle-exclamation Plugins have as much control over your system as the main LANraragi application does! When installing Plugins from unknown sources, do a little research first. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata#about-source-tags) About source: tags --------------------------------------------------------------------------------------------------------------------- If your archive has a `source:` tag (likely from the use of the [built-in downloading feature](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/downloading) ), 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. [PreviousReading Archiveschevron-left](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives) [NextSearching the Archive Indexchevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/searching) Last updated 2 months ago * [Editing an Archive manually](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata#editing-an-archive-manually) * [Using Plugins](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata#using-plugins) * [About source: tags](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata#about-source-tags) --- # Statistics and Logs | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats#statistics) Statistics --------------------------------------------------------------------------------------------------- This page shows basic stats about your content folder, as well as your most used tags. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats#logs) Logs --------------------------------------------------------------------------------------- This page allows you to quickly see logs from the app, in case something went wrong. If you enable _Debug Mode_ in Configuration, more logs will be displayed. circle-exclamation If you enable Debug Mode for troubleshooting purposes, make sure to disable it once you're done! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats#metrics) Metrics --------------------------------------------------------------------------------------------- LANraragi supports exporting server metrics via the `/api/info/metrics` endpoint in the text-based Prometheus exposition format, allowing you to see server analytics and trendlines using a Prometheus/Grafana stack. The `/api/info/metrics` endpoint is disabled by default. To enable this feature, go to the "Global Settings" configuration and toggle on "Enable Metrics". Then, restart the server. Supported metrics include: * Number of total archives and workers * Number of requests handled and total request handling duration for a given endpoint and worker * CPU, memory and file-descriptor statistics * Miscellaneous server info (version, version name) circle-exclamation Due to the metrics exporter relying on Redis as its shared memory store, the collection process may apply a high write pressure to the database which can overwhelm its [default persistence configurationsarrow-up-right](https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/#snapshotting) . [PreviousSearching the Archive Indexchevron-left](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/searching) [NextThemeschevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/themes) Last updated 3 days ago * [Statistics](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats#statistics) * [Logs](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats#logs) * [Metrics](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats#metrics) --- # Reading Archives | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives#using-the-archive-index) Using the Archive Index -------------------------------------------------------------------------------------------------------------------------------- The main page will show all the Archives loaded into the application, sorted by name. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-33bbb0ebe6051050047d4add7f363634b2618739%252Farchive_thumb.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=aecd4e01&sv=2) Archive Index in Thumbnail mode You can customize display options to show the index in compact mode, as well as add extra namespaces and select which namespaces to show in said columns. The topmost **carousel** view will show random archives from your current search in both thumbnail and compact modes -- It can also be configured to show New or Untagged archives instead. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-b6a512a7b383dcd6acb77158cb8b262d464dfffb%252Farchive_list.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=41c05767&sv=2) Index page of a regular LRR install in compact mode circle-info Don't forget you can **right-click** archives to show a context menu, allowing you to edit/download/delete them, or to add them to a category. When reading an archive, it is automatically extracted to a temporary folder. This folder is then simply loaded into the built-in Web Reader. The temporary folder will clean up on its own when it reaches a large enough size, so there's no need to worry about your disk filling up over time. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives#web-reader-options) Web Reader Options ---------------------------------------------------------------------------------------------------------------------- In the reader, you can use the keyboard arrows or the built-in arrow icons to move from page to page. You can also simply click the right or left side of the image. When reading an archive, various features are available to you with the side button controls — Feel free to hover over them to see what options are available. You can click the help icon on the left side of the Reader to get a quick refresher about its controls. The cog/Reader Options button shows the various options you can toggle to change the reading experience. (Double page, Japanese read order, etc.) The Page Overlay button (also actionable by pressing **CTRL**) will show all the pages of the current archive, allowing for quick navigation and preview. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-e3652d2827375590c4514312437b6a7dc0dad9ff%252Freader_overlay.jpg%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=1b415ac8&sv=2) Reader with overlay The Reader comes with its own set of clientside options to customize the reading experience as you want. If "Progression Tracking" is enabled, when you close and reopen the archive, it'll show you the page you last stopped at. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives#non-web-reader-third-party-applications) Non-Web Reader (Third-Party applications) ------------------------------------------------------------------------------------------------------------------------------------------------------------------ If you want to use a third-party application to read your archives, you can use the software listed in the following page: [📱Using External Readerschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers) [PreviousGetting Startedchevron-left](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps) [NextAdding Metadatachevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata) Last updated 2 months ago * [Using the Archive Index](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives#using-the-archive-index) * [Web Reader Options](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives#web-reader-options) * [Non-Web Reader (Third-Party applications)](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives#non-web-reader-third-party-applications) --- # Categories | Nightly Release | LANraragi Categories appear in the archive index as shortcut buttons. There are two distinct kinds: * 📁 Static Categories are arbitrary collections of Archives, where you can add as many items as you want. * ⚡ Dynamic Categories contain all archives matching a given predicate, and automatically update alongside your library. Toggling a category in the index will restrict all your searches to that category, for as long as it is toggled. If you have a lot of categories, the most recently used will appear first in the list. **📌Pinned** Categories will always show first. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-ec2c938b3cfc4d2fd8d3539e00412f18610cf091%252Fcategory_filtered.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=f7395d3e&sv=2) filtered To create categories, you can use the dedicated setting page in the app: circle-info If you have an existing folder hierarchy for your Archives, LRR can automatically create categories from said hierarchy through the dedicated utility Script. Look for it in Plugin Configuration. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/categories#bookmark-feature) 🔖 Bookmark Feature --------------------------------------------------------------------------------------------------------------------- LANraragi includes a bookmark feature that provides a quick way to add or remove archives from a designated static category. In new installations, a "Favorites" static category is automatically created and linked to this feature. When enabled, a bookmark icon appears next to all archive thumbnails on the homepage and in the reader interface. Clicking this icon instantly adds or removes the archive from the linked category, making content curation faster and more convenient. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-4a257c2958e682d7990b52341472a2bdb6e27e9f%252Fbookmark_button.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=d0a6888d&sv=2) Bookmark icon You can link the bookmark feature to any static category of your choice. To change which category is used, navigate to the Category Management page, select the desired static category, and enable the "Store Bookmarks in this Category" toggle. circle-info Only static categories can be linked to the bookmark feature. Dynamic categories (those based on search predicates) cannot be used with this feature. To disable the bookmark feature entirely, simply toggle off the "Store Bookmarks in this Category" option for the currently linked category. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-3e5aabbe5ff1f532dfc44af0eb7b44066b9429e0%252Fbookmark_config.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=c0f712e5&sv=2) Bookmark configuration toggle circle-info If you delete a category that is currently linked to the bookmark feature, the bookmark functionality will be automatically disabled. [PreviousBatch Operationschevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/batch-tagging) [NextDownloading Archiveschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/downloading) Last updated 2 months ago --- # Batch Operations | Nightly Release | LANraragi It's a pretty common occurence: You imported archives without enabling automatic tagging, or you suddenly want to add tags to a lot of archives at once. Editing tags manually for each file ain't gonna cut it... Enter **Batch Tagging**, allowing for laser-focus, one-time operations over large sets of archives. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-34922b7a9db9e96dc461bcbb811ca4e325d64236%252Fbatch.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=4c511cea&sv=2) Batch Tagging interface as of 0.5.6 All your archives are shown in the checklist on the right, with archives with no tags pre-checked for ease of access. Past that, it's just a matter of selecting what you want to do, optionally plugging in special arguments for the run, and going ham on batching! The currently available operations are: * **Use Plugin**: Use a plugin on the selected archives. The arguments available for overriding will depend on the plugin. * **Apply Tag Rules**: Apply your default [Tag Rules](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules) to the selected archives. * **Clear New**: Remove new flag from selected archives. * **Delete**: Delete the selected archives. circle-info As shown in the screenshot, you can only override **Global Arguments** in Batch Tagging. One-shot arguments, such as specifying a E-Hentai URL, are only available when editing a single archive through the classic Edit menu. If you set a timeout value, the batch session will wait the specified time between archives. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-a8511a5f35207cbdda182616cefab7a91187ef44%252Fbatchlog.png%3Falt%3Dmedia%26token%3D2f25fba8-395f-4852-ab41-7a9831145e5e&width=768&dpr=3&quality=100&sign=d03c307a&sv=2) Batch Tagging status window While a batch session runs, you get a live summary of what the server is doing, and can cancel at any time. [PreviousThemeschevron-left](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/themes) [NextCategorieschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/categories) Last updated 2 months ago --- # Themes | Nightly Release | LANraragi The front-end interface of LANraragi is customizable out of the box through CSS. A few themes are built-in already. Theme Preference is saved server-wide and will be shown to all users. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-69c39d4a3104d7e74d991f1a0ed787991e16ba15%252Fthemes.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=4940f56d&sv=2) Theme Selector Changing Themes can be done alongside all the other app settings. You can write your own themes by modifying the existing ones - Dropping them in the _/public/themes_ folder will make them appear in the selection. While optional, you can also add a preview thumbnail for your theme in _/public/img/theme\_preview_. circle-exclamation For users who don't have access to the app folder and want to make custom themes, your only option currently is to use a custom CSS browser extension. Docker users can try binding a folder on their machine to the _/home/koyomi/lanraragi/public/themes_ folder. [PreviousStatistics and Logschevron-left](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/stats) [NextBatch Operationschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/batch-tagging) Last updated 2 days ago --- # LRR for Windows (Win10) | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#download-a-release) Download a Release ------------------------------------------------------------------------------------------------------------------------- You can download the latest Windows MSI Installer on the [Release Pagearrow-up-right](https://github.com/Difegue/LANraragi/releases) . Windows 10 1809 is the minimum supported version. Windows 10 2004 and newer are recommended. circle-exclamation If you're using Windows 10 1809, UTF-8 support needs to be enabled. You can find instructions [here](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#mangled-filenames-when-running-on-windows-10-1809) . circle-info Windows Nightlies are available [herearrow-up-right](https://nightly.link/Difegue/LANraragi/workflows/push-continous-delivery/dev) . [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#installation) Installation ------------------------------------------------------------------------------------------------------------- Simply execute the installer package. You might get a SmartScreen prompt from Windows as the installer isn't signed; These are perfectly normal. (If you're wondering why I don't sign installers, [thisarrow-up-right](https://web.archive.org/web/20241204064244/https://gaby.dev/posts/code-signing) article is a good read.) Once the install completes properly, you'll be able to launch the GUI from the shortcut in your Start Menu: ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-9560c53e11d68da89271c7a840b112604d8e99c2%252Fkaren-startmenu.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=4a53aab3&sv=2) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#configuration) 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. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-6974ba4831532f5e0f9409db89ea5b3feb9db8aa%252Fkaren-light.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=f386f467&sv=2) Tray GUI and Settings Window You can also decide whether to start the GUI alongside Windows, or start LRR alongside the GUI. Combining the two makes it so that LANraragi starts alongside Windows. 🔥🔥🔥 [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#usage) Usage ----------------------------------------------------------------------------------------------- ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-24e9961b1fcb6b93eed91834a45695064d116583%252Fkaren-dark.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=22c830a8&sv=2) Tray GUI and Log Console. Check that Dark Theme tho Once the program is running, you can open the Web Client through the shortcut button on the user interface. You can also toggle the Log Console on/off to see what's going on behind the scenes. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#updating) Updating ----------------------------------------------------------------------------------------------------- Updates have to be done manually by downloading and running the latest installer. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#uninstallation) Uninstallation ----------------------------------------------------------------------------------------------------------------- Simply uninstall the app from Windows Settings. Presto! Your database is not deleted in case you ever fancy coming back. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#troubleshooting) Troubleshooting ------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#installer-failures) Installer failures Make sure you have the Windows App SDK runtime installed to ensure the tray GUI app can run. A copy can be downloaded here: [https://aka.ms/windowsappsdk/1.7/1.7.250606001/windowsappruntimeinstall-x64.exearrow-up-right](https://aka.ms/windowsappsdk/1.7/1.7.250606001/windowsappruntimeinstall-x64.exe) The tray GUI will show the error message it encountered instead of the LRR Version number if it fails to test the runtime - This might help you troubleshoot further. A detailed error can be found in the log console. Some users reported that antivirus software can block the runtime install portion of the installer, so you might have some luck temporarily disabling it. If you're still getting installer failures past that, try generating a full log of the installer: and open a GitHub issue with it. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#server-isnt-available-on-localhost-3000-even-though-it-has-started-properly) Server isn't available on `localhost:3000` even though it has started properly Running the application as Administrator might fix this in some instances. Otherwise, make sure the Windows Firewall isn't blocking any `perl` process. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#mangled-filenames-when-running-on-windows-10-1809) Mangled filenames when running on Windows 10 1809 This specific version of Windows 10 does not support per application UTF-8 so it needs to be enabled globally. Run `intl.cpl` to open the Region settings, select the "Administrative" tab and click on "Change system locale..." ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-61330944b9b9906826e470798b85e589da778143%252Futf8-region.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=5cb55a7d&sv=2) In the popup select the "Beta: Use Unicode UTF-8" option. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-e8e6c3aa61d3964de469f70dd4e10653c03ae538%252Futf8-popup.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=70bed7b&sv=2) Restart and use the "Rescan content folder" button to fix existing paths. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-746c01fa4c9ac608ff1bc2ba4dec8393fee9fe61%252Futf8-restart.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=f4415241&sv=2) [PreviousWhich installation method is best for me?chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/methods) [NextHomebrew (macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/macos) Last updated 2 months ago * [Download a Release](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#download-a-release) * [Installation](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#installation) * [Configuration](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#configuration) * [Usage](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#usage) * [Updating](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#updating) * [Uninstallation](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#uninstallation) * [Troubleshooting](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#troubleshooting) * [Installer failures](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#installer-failures) * [Server isn't available on localhost:3000 even though it has started properly](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#server-isnt-available-on-localhost-3000-even-though-it-has-started-properly) * [Mangled filenames when running on Windows 10 1809](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/windows#mangled-filenames-when-running-on-windows-10-1809) Copy msiexec /i "lanraragi.msi" /l*v "install.log" --- # Downloading Archives | Nightly Release | LANraragi Starting with version 0.7.3, LANraragi can directly download URLs to its content folder. This allows you to seamlessly add archives from the Internet to your LRR instance for safekeeping. 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.) circle-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) 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. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-a9dbd110a151183caa2b9b97bae70ef1879aeadb%252Fdownloaders.png%3Falt%3Dmedia%26token%3Dbfd8d923-2c57-4caa-871c-b2f0a3f3655b&width=768&dpr=3&quality=100&sign=39c4ca7&sv=2) Downloader Plugins circle-info Just like with Metadata plugins, Downloaders might require using a matching **Login Plugin** to authenticate to the remote website. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/downloading#browser-extension) Browser Extension --------------------------------------------------------------------------------------------------------------------- You can also install the [Tsukihi Browser Extensionarrow-up-right](https://github.com/Difegue/Tsukihi) to automatically verify/download URLs you browse to your server instance. [PreviousCategorieschevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/categories) [NextBackup and Restorechevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/backup-and-restore) Last updated 2 months ago --- # Getting Started | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#quick-to-do-list-for-newcomers) Quick To-Do List for newcomers ------------------------------------------------------------------------------------------------------------------------------------------------- * Change Security Settings * Enable and configure wanted Plugins to tag your content * Move the Thumbnail Folder to a dedicated folder if you don't want them alongside your content * Change the default Content Folder to your personal folder, or start adding files to the default Content Folder! circle-info If you want to change the used Redis address/database (If you don't know what that means, you don't want to), you can do so by editing the _lrr.conf_ file at the root of the app folder. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#security) Security ----------------------------------------------------------------------------------------------------- The first step you'll probably do is head to the Configuration page to modify the default security settings. When logged in as Admin in LRR, you have access to the full functionalities of the app. By default, unlogged users can only **read** archives. There are three basic levels of security you can enable: Security Level Reading Archives Public API Editing Metadata Change Settings Password Disabled ✅ ✅ ✅ ✅ Password Enabled (default) ✅ ✅ ❌ ❌ No-Fun Mode ❌ ❌ ❌ ❌ If you're running the app on a server that's potentially accessible by others, I recommend leaving password protection enabled and changing the default password. If you don't want any page of the app to be accessible to outsiders, you should enable No-Fun Mode **and restart the application** to make sure it is enabled. circle-exclamation If you enable No-Fun Mode, you'll have to set an **API Key** to be able to use the Public API methods. See more information in the API page. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#content-folder) Content Folder ----------------------------------------------------------------------------------------------------------------- One of LRR's core concepts is the **content folder.** This folder contains all the user-generated data: * Archives * Thumbnails for said archives * The Redis database (Windows only) By default, this folder is placed at the root of the LRR installation, but you can configure it to use any folder on your machine instead. The content folder is subdirectory-aware, so you can easily drop-in an already sorted collection. The content folder can be read-only if you so desire, but the caveat is that the thumbnail subfolder (`/thumb`) needs write rights to function properly for the time being. See the section below if you want to move the thumbnail subfolder somewhere else. circle-check The following formats are supported by LRR for Archives: * zip/cbz * rar/cbr (up to RAR4 only) * tar.gz/cbt * lzma * 7z/cb7 * xz * pdf * epub (images only if viewed in the Web Client or through the Client API, potentially out of order)\\ circle-info If you plan on setting your content folder to a folder that already contains archives, you might want to enable **some Plugins** beforehand, so that metadata will be fetched for your files as they're added. See the Metadata documentation linked below for more info. However, beware that if you enable plugins that depend on remote services, querying said services to scrap metadata for a large number of archives might lead to **temporary bans**! If you have a large number of archives (More than 500), you might want to ignore Automatic Plugin execution and use [Batch Taggingarrow-up-right](https://github.com/Difegue/LANraragi/blob/dev/tools/Documentation/advanced-usage/batch-tagging/README.md) instead. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#thumbnail-folder) Thumbnail Folder --------------------------------------------------------------------------------------------------------------------- Starting with 0.7.7, the thumbnail folder can be dissociated from the Content Folder, if you want to move it to a SSD or keep your Content Folder fully read-only. circle-exclamation There is no support for moving your thumbnails from the old folder to the new one, so make sure to move them manually once you've switched! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#plugin-configuration) Plugin Configuration ----------------------------------------------------------------------------------------------------------------------------- **Plugins** are used by LANraragi to fetch Metadata for your Archives using various online services. Currently supported out of the box are: * E-Hentai/Exhentai * nHentai * Chaika.moe * .json files embedded into your Archives from the eze userscript * .json files embedded into your Archives from HDoujin Downloader ...and more! See the Adding Metadata section for more information. [✒️Adding Metadatachevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/metadata) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#uploading-archives) Uploading Archives ------------------------------------------------------------------------------------------------------------------------- You can add archives to the application by either copying them to the content folder, or using the built-in uploader tool. They'll be automatically indexed and added to the database. Plugins will also be ran automatically to try and fetch metadata for them, if you toggled them in **Plugin Configuration** previously. You can also **queue downloads** by giving URLs to the server in the uploader tool, which will then be downloaded to your content folder seamlessly. See the link below for more details. [⬇️Downloading Archiveschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/downloading) [PreviousJail (FreeBSD)chevron-left](https://sugoi.gitbook.io/lanraragi/dev/installing-lanraragi/jail) [NextReading Archiveschevron-right](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/archives) Last updated 2 months ago * [Quick To-Do List for newcomers](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#quick-to-do-list-for-newcomers) * [Security](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#security) * [Content Folder](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#content-folder) * [Thumbnail Folder](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#thumbnail-folder) * [Plugin Configuration](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#plugin-configuration) * [Uploading Archives](https://sugoi.gitbook.io/lanraragi/dev/basic-operations/first-steps#uploading-archives) --- # Proxy Setup | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/proxy-setup#setting-up-lanraragi-behind-a-proxy-reverse-proxy-setup) Setting up LANraragi behind a proxy (reverse proxy setup) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- A common post-install setup is to make requests to the app transit through a gateway server such as Apache or nginx. If you do so, please note that archive uploads through LRR will likely **not work out of the box** due to maximum sizes on uploads those servers can enforce. The example below is for nginx: Copy http { client_max_body_size 0; <----------------------- This line here } server { listen 80; server_name lanraragi.[REDACTED].net; return 301 https://$host$request_uri; } server { listen 443 ssl; index index.php index.html index.htm; server_name lanraragi.[REDACTED].net; client_max_body_size 0; <---------- And this line here to disable upload limit proxy_max_temp_file_size 0; <---------- And this line here to support large downloads # Cert Stuff Omitted location / { proxy_pass http://0.0.0.0:3000; proxy_http_version 1.1; <----- The two following lines are needed for batch tagger support with SSL -----> proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } } By default, LRR runs at the server root, e.g. https://lanraragi.example.com/. You may wish to instead run it under a specific URL subdirectory, e.g. https://example.com/lanraragi/. This configuration requires that the reverse proxy be configured to strip the URL prefix from requests before forwarding it. For nginx, this is: After this is done, you need to configure LANraragi to use the new prefix. This is set under `lrr.conf` in the app root directory. Set the variable`base_url_path` as desired, e.g.: Make sure to restart the server after editing `lrr.conf`. This will make the app available under `/lanraragi`. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/proxy-setup#setting-up-lanraragi-to-use-a-proxy-for-outbound-network-requests) Setting up LANraragi to use a proxy for outbound network requests --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- This is a less common scenario, but you might want to have downloads or metadata requests to external services go through a proxy, in case said external services are blocked by your friendly local totalitarian regime. LANraragi runs on top of the Mojolicious web server, which has [built-inarrow-up-right](https://docs.mojolicious.org/Mojo/UserAgent/Proxy#detect) support for proxifying external requests. To enable automatic proxy detection, the `MOJO_PROXY` environment variable must be set to 1 on your machine: This is enabled by default on Docker builds. Once said detection enabled, environment variables `HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY` and `no_proxy` will be checked for proxy information. Here's an example for a Docker-compose setup: [PreviousNetwork Interface Setupchevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces) [NextTag Ruleschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules) Last updated 9 months ago * [Setting up LANraragi behind a proxy (reverse proxy setup)](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/proxy-setup#setting-up-lanraragi-behind-a-proxy-reverse-proxy-setup) * [Setting up LANraragi to use a proxy for outbound network requests](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/proxy-setup#setting-up-lanraragi-to-use-a-proxy-for-outbound-network-requests) Copy server { # ... location /lanraragi { rewrite ^/lanraragi(.*)$ $1 last; # ...rest of the block here } } Copy { # other directives... base_url_path => "/lanraragi", } Copy --- version: "2.1" services: lanraragi: image: difegue/lanraragi:latest container_name: lanraragi environment: - http_proxy=http://192.168.10.186:1082 - https_proxy=http://192.168.10.186:1082 volumes: - [database]:/home/koyomi/lanraragi/database - [content]:/home/koyomi/lanraragi/content ports: - 7070:3000 restart: unless-stopped --- # Backup and Restore | Nightly Release | LANraragi This page, available from the top menu once logged in, allows you to backup the entire database to a JSON file. This includes **all your categories**, and for **every file in the database**: * The unique ID of the archive (For the more technologically-enclined: LRR uses a SHA-1 hash of the first 512KBs of the file as the ID) * The saved tags * The saved title This JSON can then be restored in another LRR instance, if it has archives with matching unique IDs. circle-info You can also make backup JSONs with the `npm run backup-db` command or through the Client API. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-90b77c3cef3e1a41d1003a3a10bf062f93470186%252Fbackup.png%3Falt%3Dmedia%26token%3D240a8ef5-20eb-4075-a7ce-96c64e9157af&width=768&dpr=3&quality=100&sign=c21102c9&sv=2) Average backup.json [PreviousDownloading Archiveschevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/downloading) [NextUsing External Readerschevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers) Last updated 2 months ago --- # Tag Rules | Nightly Release | LANraragi _Tag Rules_ allow you to write rules that will extend the basic functionality of automatic tagging. The rules will be applied to the list of tags returned by the plugins in order to filter or rewrite the tags based on your tastes. _Tag Rules_ must be written one rule per line, without "_comma_" or "_semicolon_" unless they are part of the tag. The format is as follows: * `tag | -tag` : removes the tag * `-namespace:*` : removes all tags within this namespace * `~namespace` : strips the namespace from the tags * `tag -> new-tag` : replaces one tag * `tag => new-tag` : replaces one tag, but uses a hash table internally for faster performance. These rules will be executed **once** after all other rules. * `namespace:* -> new-namespace:*` : replaces the namespace in all tags that contain it Also note that _the match is case insensitive_, but the replacement will keep the case specified in the rule, so you can write this rule Copy serie:one piece -> parody:One Piece to replace `SERIE:ONE PIECE` with `parody:One Piece`. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules#blacklist) Blacklist --------------------------------------------------------------------------------------------------- This is the simplest list of rules you can write. Both formats are valid: Copy already uploaded forbidden content incomplete ongoing complete various digital translated [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules#advanced-usage) Advanced usage ------------------------------------------------------------------------------------------------------------- Combining the above rules, you can make _LRR_ do some work for you. For example the following set of rules: will transform this tag list in this [PreviousProxy Setupchevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/proxy-setup) [NextSetup a Development Environmentchevron-right](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index) Last updated 1 year ago * [Blacklist](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules#blacklist) * [Advanced usage](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules#advanced-usage) Copy -already uploaded -forbidden content -incomplete -ongoing -complete -various -digital -translated Copy -already uploaded -misc:* serie:* -> parody:* various -> various artists ~language Copy already uploaded, misc:ongoing, misc:complete, language:english, serie:one piece, serie:naruto, various, crossover' Copy english, parody:one piece, parody:naruto, various artists, crossover --- # Network Interface Setup | Nightly Release | LANraragi By default, LRR listens on all IPv4 Interfaces on port 3000. To change this, you have to specify a different network location when starting the app. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#building-your-network-location-string) Building your network location string -------------------------------------------------------------------------------------------------------------------------------------------------------------------- The network location format accepted by LRR looks like this: `http(s)://*:(port)` All listen locations [supported by "listen" in Mojo::Server::Daemonarrow-up-right](http://www.mojolicious.org/perldoc/Mojo/Server/Daemon#listen) are valid. For example, if you want to listen on port 5555 with SSL only, the string would look like: `https://*:5555?cert=/path/to/server.crt&key=/path/to/server.key` Once you have your string ready, you can assign it to the environment variable `LRR_NETWORK`. It'll be picked up automagically. circle-info If you're using Docker, remember to mount your cert and keys to a path reachable by the container: The arguments above will resolve within the container's filesystem! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#source-installs) Source Installs ------------------------------------------------------------------------------------------------------------------------ Copy export LRR_NETWORK=http://127.0.0.1:8000 npm start > lanraragi@0.6.0 start /mnt/c/Users/tiki/Desktop/lrr > perl ./script/launcher.pl -f ./script/lanraragi キタ━━━━━━(゚∀゚)━━━━━━!!!!! [LANraragi] [info] LANraragi 0.6.0-BETA.2 (re-)started. (Debug Mode) [...] [Mojolicious] Listening at "http://127.0.0.1:8000" Server available at http://127.0.0.1:8000 [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#docker) Docker ------------------------------------------------------------------------------------------------------ [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#docker-with-ssl) Docker with SSL ------------------------------------------------------------------------------------------------------------------------ Notice that the certificate and key must come from your host filesystem and henceforth might need a second --mount command. [PreviousUsing External Readerschevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers) [NextProxy Setupchevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/proxy-setup) Last updated 4 years ago * [Building your network location string](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#building-your-network-location-string) * [Source Installs](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#source-installs) * [Docker](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#docker) * [Docker with SSL](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces#docker-with-ssl) Copy docker run --name=lanraragi -p 8000:8000 \ --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],\ target=/home/koyomi/lanraragi/content \ -e LRR_NETWORK=http://*:8000 difegue/lanraragi Copy docker run --name=lanraragi-ssl -p 3333:3333 \ --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],\ target=/home/koyomi/lanraragi/content \ --mount type=bind,source=[DIRECTORY_CONTAINING_SSL_CERT],target=/ssl \ -e LRR_NETWORK="https://*:3333?cert=/ssl/crt.crt&key=/ssl/crt.key" difegue/lanraragi --- # Using External Readers | Nightly Release | LANraragi If the built-in Web Reader is not enough for you, LANraragi's content can be consumed by multiple external applications who provide their own readers. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#dedicated-lanraragi-readers) Dedicated LANraragi readers ---------------------------------------------------------------------------------------------------------------------------------------------- Dedicated LANraragi readers use the Client API to provide an experience closely matching the capabilities of the Web interface. Here are some existing clients: ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#ichaival-android) [Ichaival (Android)arrow-up-right](https://github.com/Utazukin/Ichaival) [Download it here.arrow-up-right](https://github.com/Utazukin/Ichaival) **Features:** * View and search your LANraragi database * View tags * Read archives * Bookmark archives to keep track of your current page * Sort archives by date (requires Timestamp tags to be enabled) ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#lanreader-ios) [LANreader (iOS)arrow-up-right](https://github.com/Doraemoe/LANreader) [Download it on the App Store.arrow-up-right](https://github.com/Doraemoe/LANreader) ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#lrreader-windows-10) [LRReader (Windows 10)arrow-up-right](https://github.com/Guerra24/LRReader) [Download it here.arrow-up-right](https://github.com/Guerra24/LRReader) ![lrreader](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2Fs3.guerra24.net%2Fprojects%2Flrr%2Fscreenshots%2F01.png&width=300&dpr=3&quality=100&sign=74d62a5a&sv=2) **Features:** * Archives list. * Search. * Archive overview and reader. * Bookmarks. * Multiple servers/profiles. * Manage your server from within the app. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#mihon-tachiyomi-android) Mihon / Tachiyomi (Android) [Mihonarrow-up-right](https://mihon.app/) , formerly Tachiyomi, and [its forksarrow-up-right](https://mihon.app/forks/) use extensions that provide sources. The LANraragi extension is part of the [Keiyoushiarrow-up-right](https://github.com/keiyoushi) repository. For automated updates add the repository by following [these instructions.arrow-up-right](https://keiyoushi.github.io/docs/guides/getting-started#adding-the-extension-repo) (recommended) For manual updates search for LANraragi on Keiyoushi's [Extensions page.arrow-up-right](https://keiyoushi.github.io/extensions/) There may be additional repositories not linked here that provide the extension but support is not guaranteed. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#lrr-react-web) LRR React Web ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F3744230098-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-3168184435%252Fuploads%252Fgit-blob-3edfa3654b5713ae4ebb969908966f6e7405d32a%252Flrr_react.jpg%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=36a12ce6&sv=2) LRR React-Web A React-based frontend PWA making use of the Client API. "Works best on mobile and tablet viewports, but the desktop experience is okay." Check it out [here.arrow-up-right](https://github.com/hibikikuze4dan/lanraragi-react-web) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#generic-opds-readers) Generic OPDS readers -------------------------------------------------------------------------------------------------------------------------------- Some readers can leverage the [OPDS Catalogarrow-up-right](https://opds.io/) exposed by LANraragi to visualize and read the available archives. Those programs can't exploit all of LRR's features(Search, Database backup), but they might have reading features you won't find in the current dedicated clients. If your OPDS reader supports [Page Streaming Extensionsarrow-up-right](https://anansi-project.github.io/docs/opds-pse/intro) , LANraragi is compatible with it and will serve individual pages. circle-info LRR supports OPDS PSE 1.1, which means that if you have server-side progress tracking enabled, you can pick up where you stopped reading from any OPDS client. Syndication! The URL for the OPDS Catalog is `[YOUR_LANRARAGI_URL]/api/opds`. You can use [the Demoarrow-up-right](https://lrr.tvc-16.science/api/opds) as an example. Refer to your reader's documentation to figure out where to put this URL. circle-exclamation If you have No-Fun Mode enabled, remember that you'll need to add the API Key to this URL for the catalog to be available to your reader application. You can either use the `Bearer` token approach like with regular API calls, or add `?key=[API_KEY]` as a parameter to the URL. The following readers have been tested with the OPDS Catalog: * [**Moon+ Reader (Android)**arrow-up-right](https://play.google.com/store/apps/details?id=com.flyersoft.moonreader) * [**Librera Reader (Android)**arrow-up-right](https://librera.mobi/) * [**Challenger Comics Viewer (Android)**arrow-up-right](https://play.google.com/store/apps/details?id=org.kill.geek.bdviewer) * [**AlfaReader (Windows 7/8/10)**arrow-up-right](https://www.alfareader.org/) The following readers haven't been tested but should work: * [**TiReader (iOS)**arrow-up-right](http://tireader.com/) * [**Chunky Reader (iOS)**arrow-up-right](http://chunkyreader.com/) * [**Panels (iOS)**arrow-up-right](https://panels.app/) [PreviousBackup and Restorechevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/backup-and-restore) [NextNetwork Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/network-interfaces) Last updated 2 months ago * [Dedicated LANraragi readers](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#dedicated-lanraragi-readers) * [Ichaival (Android)](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#ichaival-android) * [LANreader (iOS)](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#lanreader-ios) * [LRReader (Windows 10)](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#lrreader-windows-10) * [Mihon / Tachiyomi (Android)](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#mihon-tachiyomi-android) * [LRR React Web](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#lrr-react-web) * [Generic OPDS readers](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/external-readers#generic-opds-readers) --- # Themes | LANraragi The front-end interface of LANraragi is customizable out of the box through CSS. A few themes are built-in already. Theme Preference is saved server-wide and will be shown to all users. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-69c39d4a3104d7e74d991f1a0ed787991e16ba15%252Fthemes.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=67b48208&sv=2) Theme Selector Changing Themes can be done alongside all the other app settings. You can write your own themes by modifying the existing ones - Dropping them in the _/public/themes_ folder will make them appear in the selection. While optional, you can also add a preview thumbnail for your theme in _/public/img/theme\_preview_. circle-exclamation For users who don't have access to the app folder and want to make custom themes, your only option currently is to use a custom CSS browser extension. Docker users can try binding a folder on their machine to the _/home/koyomi/lanraragi/public/themes_ folder. [PreviousStatistics and Logschevron-left](https://sugoi.gitbook.io/lanraragi/basic-operations/stats) [NextBatch Operationschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/batch-tagging) Last updated 1 day ago --- # Translating LANraragi to other languages | Nightly Release | LANraragi LRR will automatically render its web UI in the language requested by your web browser's `Accept-Language` header, if it supports it. You can also manually force a specific language in the Configuration page under Global Settings. Unsupported languages will fallback to English. Here are some pointers on contributing additional translations to LANraragi. LRR uses standard `.po` files to contain its localizations. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#using-weblate) Using Weblate ------------------------------------------------------------------------------------------------------------------- You can easily contribute to translations to existing or new languages through LRR's Weblate project: https://hosted.weblate.org/projects/lanraragi/lanraragi-source/ Strings submitted to Weblate will be automatically commited to a PR against the base LANraragi GitHub repository. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#translate-text-in-source) Translate text in-source ----------------------------------------------------------------------------------------------------------------------------------------- First, open the `locales\template` folder where you will see the current translation files. It's recommended to use the `en.po` file as your base for translation. Next, make a copy of `en.po` and rename it to the language you wish to translate into, for example, `zh.po`. Then, open the `zh.po` file. There, you will see something like this: Copy # Sample Data msgid "" msgstr "" # ------Start of Backup.html.tt2------ msgid "Database Backup/Restore" msgstr "Database Backup/Restore" msgid "You can backup your existing database here, or restore an existing backup." msgstr "You can backup your existing database here, or restore an existing backup." ... For translation purposes, you need only modify the content in `msgstr`. For instance, if you are translating from English to Chinese, you would replace the English in `msgstr` with the corresponding Chinese. For example:`msgstr "Database Backup/Restore"` becomes `msgstr "数据库备份/恢复"`. Continue translating the text within `msgstr` into your language, and that will complete the translation of the text within LANraragi's templates! Here are a few points you might need to pay attention to: 1. Some translation texts include HTML styles. It's advisable not to remove these styles; instead, match the styles with your translated text accordingly. 2. Some translation files contain placeholders. It's crucial not to delete these placeholders. Only translate the content excluding placeholders and then position the placeholders appropriately. For example:`msgstr "Version %1 %2"` should become `msgstr "版本 %1 %2"`. 3. Due to the limitations of `Locale::Maketext`, some special texts require special handling. Currently, there's one known special case:`msgstr "~namespace : strips the namespace from the tags"` Make sure not to discard the `~` when you see the `msgid` for `msgid "namespace : strips the namespace from the tags"`, because `~` is recognized as an escape character in `Locale::Maketext` (though attempts to use `~~` haven't been successfully recognized). [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#handling-missing-translations) Handling missing translations --------------------------------------------------------------------------------------------------------------------------------------------------- If you notice that some texts are missing translations in the relevant `template` files, here is a step-by-step example of how to address this: ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#html) HTML For instance, see the following code in your `index.html.tt2` template: To handle the missing translation, wrap the text with `[% c.lh("...text to be handled...") %]` like this: ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#javascript) Javascript For JS text, you need to replace your hard-coded string with a `I18N.xxxxx` variable/function. For example: will become Then, modify the `i18n.html.tt2` file to include your new variable/function. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#modifying-the-.po-file) Modifying the .po file Locate `# ------Start of xxxxx.html.tt2------` in the `en.po` file (with xxxxx being either index or i18n in this example), which marks where the corresponding text in the template begins. Add the following entries: Here, `msgid` is used to match the text, and `msgstr` contains the translated text. It is crucial to ensure that the text in `msgid` is exactly as it appears post-modification in your template to ensure proper matching. For example, the code below includes an extra space, causing a mismatch which prevents it from being replaced correctly: ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#placeholders-html) Placeholders (HTML) For special cases, like in `config.html.tt2`, which looks like this: You'll need to use placeholders: In translation files, HTML placeholders should be written as `%number` instead of `[_number]` used in templates. Therefore, it should be: ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#placeholders-javascript) Placeholders (Javascript) For **Javascript**, placeholders instead need to be written like the following: Pay attention to the slash only being present in the msgid. Then, your entry in `i18n.html.tt2` needs to be modified to accomodate for the placeholders being passed at runtime by using a function instead of a constant: and is used like so: ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#special-cases) Special cases There are also peculiar cases such as the following found in `config_tags.html.tt2`: Here, `~` is a designated escape character in `Locale::Maketext`, so including a `~` in `msgid` will prevent proper matching. However, including `~` in `msgstr` won't affect functionality, thus it's preferable to remember this nuance: [PreviousArchitecture & Stylechevron-left](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture) [NextGetting startedchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/getting-started) Last updated 2 months ago * [Using Weblate](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#using-weblate) * [Translate text in-source](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#translate-text-in-source) * [Handling missing translations](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#handling-missing-translations) * [HTML](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#html) * [Javascript](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#javascript) * [Modifying the .po file](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#modifying-the-.po-file) * [Placeholders (HTML)](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#placeholders-html) * [Placeholders (Javascript)](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#placeholders-javascript) * [Special cases](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations#special-cases) Copy Add Archives Copy [% c.lh("Add Archives") %] Copy $("#result").html("Backup failed!"); Copy $("#result").html(I18N.BackupFailed); Copy I18N.BackupFailed = "[% c.lh("Backup failed!") %]"; Copy msgid "Add Archives" msgstr "Add Archives" msgid "Backup failed!" msgid "Backup failed!" Copy [% c.lh("Add Archives ") %] Copy

LANraragi

Version [% version %], "[% vername %]"
Copy

LANraragi

[% c.lh("Version [_1] [_2]", version, vername) %]
Copy msgid "Version %1 %2" msgstr "Version %1 %2" Copy msgid "Changed title to: \${title}" msgstr "Changed title to: ${title}" Copy I18N.BatchChangedTitle = (title) => `[% c.lh("Changed title to: \${title}") %]`; Copy $("#log-container").append(I18N.BatchChangedTitle(msg.title)); Copy
~namespace : strips the namespace from the tags Copy msgid "namespace : strips the namespace from the tags" msgstr "~namespace : strips the namespace from the tags" --- # Getting started | Nightly Release | LANraragi The Client API allows you to communicate with a running LANraragi instance from a dedicated client. All the (public)endpoints below can be tested on the demo! [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/getting-started#authenticating-with-the-api) Authenticating with the API ------------------------------------------------------------------------------------------------------------------------------------------------ Most of the API endpoints require a form of authentication. Said authentication is provided by a configurable **API Key,** which is set by the user in the LRR settings. This key must be added to your calls as an `Authorization: Bearer` header, with the key encoded in base64: Copy DELETE /api/search/cache HTTP/1.1 Accept: application/json Authorization: Bearer SEVBVEhFTg== If you fail to meet this requirement, the API endpoint will return error 401 and the following JSON: Copy { "error":"This API is protected and requires login or an API Key." } circle-exclamation If the user's LRR installation is running under **No-Fun Mode**, all API methods will be locked behind the key. Empty API Keys will **not** work, even if there's no key set in Configuration. Private endpoints will be indicated by a 🔑 symbol next to their name in the following sections. [PreviousTranslating LANraragi to other languageschevron-left](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations) [NextSearch APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api) Last updated 3 years ago --- # Search API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api#get-search) Search Archives get https://lrr.tvc-16.science/api/search Search for Archives. You can use the IDs of this JSON with the other endpoints. Query parameters categorystring · min: 14 · max: 14Optional ID of the category you want to restrict this search to. filterstringOptional Search query. You can use the following special characters in it: **Quotation Marks ("...")** Exact string search. Allows a search term to include spaces. Everything placed inside a pair of quotation marks is treated as a singular term. Wildcard characters are still interpreted as wildcards. **Question Mark (?), Underscore (\_)** Wildcard. Can match any single character. **Asterisk (\*), Percentage Sign (%)** Wildcard. Can match any sequence of characters (including none). **Subtraction Sign (-)** Exclusion. When placed before a term, prevents search results from including that term. **Dollar Sign ($)** Add at the end of a tag to perform an exact tag search rather than displaying all elements that start with the term. Only matches tags regardless of search parameters and can be used as an exclusion to ignore misc tags in the search query. startintegerOptional From which archive in the total result count this enumeration should start. The total number of archives displayed depends on the server-side page size preference. From 0.8.2 onwards, you can use "-1" here to get the full, unpaged data. sortbystringOptional Namespace by which you want to sort the results. There are specific sort keys you can use: * _title_ if you want to sort by title * _lastread_ if you want to sort by last read time. (If **Server-side Progress Tracking** is enabled) (Default value is title. If you sort by lastread, IDs that have never been read will be removed from the search.) orderstringOptional Order of the sort, either `asc` or `desc`. newonlybooleanOptional Limit search to new archives only. untaggedonlybooleanOptional Limit search to untagged archives only. groupby\_tanksbooleanOptional Enable or disable Tankoubon grouping. Defaults to true. When enabled, Tankoubons will show in search results, replacing all the archive IDs they contain. Responses chevron-right 200 Search results application/json dataobject\[\]Optional Archive metadata objects for each search result Example: `{"arcid":"28697b96f0ac5858be2614ed10ca47742c9522fd","isnew":false,"extension":"rar","pagecount":34,"progress":3,"tags":"parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color","lastreadtime":1337038281,"title":"Fate GO MEMO","filename":"Fate GO MEMO","summary":null,"size":1234567,"toc":[{"name":"Chapter 1","page":1},{"name":"Chapter 2","page":13},{"name":"Chapter 3","page":25}]}` Show propertiesplus recordsFilteredintegerOptional Amount of archives in the search result recordsTotalintegerOptional Total number of archives available. This result will change depending on the `groupby_tanks` parameter. chevron-right 204 Search engine is not initialized yet. Please wait a few seconds. get /search HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Search results chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api#get-search-random) Search random Archives get https://lrr.tvc-16.science/api/search/random Get randomly selected Archives from the given filter and/or category. Query parameters categorystring · min: 14 · max: 14Optional ID of the category you want to restrict this search to. filterstringOptional Search query. This follows the same rules as the queries in `/api/search`. countintegerOptional How many archives you want to pull randomly. Defaults to 5. If the search doesn't return enough data to match your count, you will get the full search shuffled randomly. newonlybooleanOptional Limit search to new archives only. untaggedonlybooleanOptional Limit search to untagged archives only. groupby\_tanksbooleanOptional Enable or disable Tankoubon grouping. Defaults to true. When enabled, Tankoubons will show in search results, replacing all the archive IDs they contain. Responses chevron-right 200 Search results application/json dataobject\[\]Optional Archive metadata objects for each search result Example: `{"arcid":"28697b96f0ac5858be2614ed10ca47742c9522fd","isnew":false,"extension":"rar","pagecount":34,"progress":3,"tags":"parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color","lastreadtime":1337038281,"title":"Fate GO MEMO","filename":"Fate GO MEMO","summary":null,"size":1234567,"toc":[{"name":"Chapter 1","page":1},{"name":"Chapter 2","page":13},{"name":"Chapter 3","page":25}]}` Show propertiesplus recordsTotalintegerOptional get /search/random HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Search results ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api#delete-search-cache) 🔑 Discard Search Cache delete https://lrr.tvc-16.science/api/search/cache Discard the cache containing previous user searches. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json delete /search/cache HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down [PreviousGetting startedchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/getting-started) [NextArchive APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api) Last updated 2 months ago * [GETSearch Archives](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api#get-search) * [GETSearch random Archives](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api#get-search-random) * [DELETE🔑 Discard Search Cache](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api#delete-search-cache) Copy GET /api/search HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "data": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color",\ "lastreadtime": 1337038281,\ "title": "Fate GO MEMO",\ "filename": "Fate GO MEMO",\ "summary": null\ },\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:jojo's bizarre adventure",\ "lastreadtime": 1337038281,\ "title": "Rohan Kishibe goes to Gucci",\ "filename": "Gucc",\ "summary": "cool summary"\ }\ ], "recordsFiltered": 2, "recordsTotal": 2 } Copy GET /api/search/random HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "data": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:jojo's bizarre adventure",\ "lastreadtime": 1337038281,\ "title": "Rohan Kishibe goes to Gucci",\ "filename": "Gucc",\ "summary": "cool summary"\ }\ ], "recordsTotal": 2 } Copy DELETE /api/search/cache HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Reading Archives | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/archives#using-the-archive-index) Using the Archive Index ---------------------------------------------------------------------------------------------------------------------------- The main page will show all the Archives loaded into the application, sorted by name. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-33bbb0ebe6051050047d4add7f363634b2618739%252Farchive_thumb.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=bf7055f6&sv=2) Archive Index in Thumbnail mode You can customize display options to show the index in compact mode, as well as add extra namespaces and select which namespaces to show in said columns. The topmost **carousel** view will show random archives from your current search in both thumbnail and compact modes -- It can also be configured to show New or Untagged archives instead. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-b6a512a7b383dcd6acb77158cb8b262d464dfffb%252Farchive_list.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=e5ceab8e&sv=2) Index page of a regular LRR install in compact mode circle-info Don't forget you can **right-click** archives to show a context menu, allowing you to edit/download/delete them, or to add them to a category. When reading an archive, it is automatically extracted to a temporary folder. This folder is then simply loaded into the built-in Web Reader. The temporary folder will clean up on its own when it reaches a large enough size, so there's no need to worry about your disk filling up over time. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/archives#web-reader-options) Web Reader Options ------------------------------------------------------------------------------------------------------------------ In the reader, you can use the keyboard arrows or the built-in arrow icons to move from page to page. You can also simply click the right or left side of the image. When reading an archive, various features are available to you with the side button controls — Feel free to hover over them to see what options are available. You can click the help icon on the left side of the Reader to get a quick refresher about its controls. The cog/Reader Options button shows the various options you can toggle to change the reading experience. (Double page, Japanese read order, etc.) The Page Overlay button (also actionable by pressing **CTRL**) will show all the pages of the current archive, allowing for quick navigation and preview. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-e3652d2827375590c4514312437b6a7dc0dad9ff%252Freader_overlay.jpg%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=cae07c7d&sv=2) Reader with overlay The Reader comes with its own set of clientside options to customize the reading experience as you want. If "Progression Tracking" is enabled, when you close and reopen the archive, it'll show you the page you last stopped at. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/archives#non-web-reader-third-party-applications) Non-Web Reader (Third-Party applications) -------------------------------------------------------------------------------------------------------------------------------------------------------------- If you want to use a third-party application to read your archives, you can use the software listed in the following page: [📱Using External Readerschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers) [PreviousGetting Startedchevron-left](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps) [NextAdding Metadatachevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata) Last updated 1 day ago * [Using the Archive Index](https://sugoi.gitbook.io/lanraragi/basic-operations/archives#using-the-archive-index) * [Web Reader Options](https://sugoi.gitbook.io/lanraragi/basic-operations/archives#web-reader-options) * [Non-Web Reader (Third-Party applications)](https://sugoi.gitbook.io/lanraragi/basic-operations/archives#non-web-reader-third-party-applications) --- # Getting started | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#how-to-write-a-plugin-for-lrr) How To Write a Plugin for LRR ------------------------------------------------------------------------------------------------------------------------------------ LANraragi supports a Plugin system for various purposes: * Logging in to external web services * Importing metadata from said web services and other sources * Taking an URL from one of those web services and returning a matching, downloadable URL to add to the archive index * Running scripts against the LRR system to manipulate and extract data at will This part of the documentation aims at giving pointers to would-be Plugin developers. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#available-language-and-modules) Available Language and Modules -------------------------------------------------------------------------------------------------------------------------------------- Plugins are expected to be [Perl Modulesarrow-up-right](http://www.perlmonks.org/?node_id=102347) . All Plugins need to declare their metadata through the `plugin_info` hash. Other subroutines need to be implemented depending on the Plugin type. Once the module is recognized, it will be available for use in LANraragi. All Perl features are available for use, as well as all installed CPAN Modules and LRR API functions present. Basically, _as long as it can run, it will run_. triangle-exclamation 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/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. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#plugin-metadata) Plugin Metadata -------------------------------------------------------------------------------------------------------- Metadata follows a simple format, being all present in a hash returned by the `plugin_info` subroutine: There are no restrictions on what you can write in those fields, except for the `namespace`, which should preferrably be **a single word.** It's used as a unique ID for your Plugin in various parts of the app. The `login_from` parameter can be used to execute a login plugin before your plugin runs. The `type` field can be either: * `login` for [Login Plugins](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login) * `metadata` for [Metadata Plugins](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata) * `download` for [Downloader Plugins](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download) * `script` for [Script Plugins](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts) The `parameters` hash can contain as many arguments as you need. They can be set by the user in Plugin Configuration, and are transmitted every time. Typical uses for it include login credentials for a remote website, configuration options, etc. Basic stuff. Please give meaningful names to the parameters, as they are used to return the associated values ​​when using the plugin and make it easier for other contributors to understand the code. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#installing-and-testing-your-plugin) Installing and Testing your Plugin ---------------------------------------------------------------------------------------------------------------------------------------------- Installing a Plugin is as simple as dropping the .pm file in LANraragi's Plugin directory. Restart the app, and your Plugin's name should appear on the initial listing. circle-info You can also sideload Plugins through Plugin Configuration in the webapp. Once this is done, you can test your plugin by simply using it: * Metadata plugins can be used by enabling them for Automatic Execution or on individual archives. * Script plugins can be directly executed from Plugin Configuration. * Login plugins can't be tested directly for now. circle-info It is also possible to execute plugins through the [Client API](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/getting-started) . If LANraragi is running in Debug Mode, debug messages from your plugin will be logged. [PreviousMiscellaneous other APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api) [NextLogin Pluginschevron-right](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login) Last updated 1 year ago * [How To Write a Plugin for LRR](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#how-to-write-a-plugin-for-lrr) * [Available Language and Modules](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#available-language-and-modules) * [Plugin Metadata](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#plugin-metadata) * [Installing and Testing your Plugin](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index#installing-and-testing-your-plugin) Copy #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "My Plugin", type => "metadata", #login_from => "dummylogin", namespace => "dummyplug", author => "Hackerman", version => "0.001", description => "This is the description of my Plugin", icon => "This is a base64-encoded 20x20 image that will be displayed as an icon in the plugin list. Optional!" oneshot_arg => "This is the description for a one-shot argument that can be entered by the user when executing this plugin on a file", parameters => { 'my-boolean' => {type => "bool", desc => "Boolean parameter description", default_value => "1"}, 'my-string' => {type => "string", desc => "String parameter description", default_value => "A default parameter"}, 'my-number' => {type => "int", desc => "Integer parameter description"} }, # Tag-specific metadata cooldown => "If this is a Metadata Plugin, you can set a recommended value for how long a user should wait between executions to avoid remote bans. Shown in Batch Tagging only, defaults to 0.", # Downloader-specific metadata url_regex => "If this is a Downloader Plugin, this is the regex that will trigger said plugin if it matches the URL to download." ); } --- # Community (Linux) | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community#unraid) UnRAID ----------------------------------------------------------------------------------------------- An UnRAID package based on the Docker images is available [here.arrow-up-right](https://github.com/naipilk/LANraragi-unraid-template/) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community#nix-nixos) Nix/NixOS ----------------------------------------------------------------------------------------------------- If you're using [NixOSarrow-up-right](https://nixos.org/) or the Nix package manager, a [LANraragiarrow-up-right](https://search.nixos.org/packages?channel=unstable&show=lanraragi&from=0&size=50&sort=relevance&type=packages&query=lanraragi) package is available. Unlike the other options here, this one is also available for Darwin/macOS! [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community#arch-linux) Arch Linux ------------------------------------------------------------------------------------------------------- An installation package is provided [in the AURarrow-up-right](https://aur.archlinux.org/packages/lanraragi/) (Arch User Repository). Using the AUR package the installation process in Arch Linux should be as easy as entering `pikaur -S lanraragi` in the command line (if using pikaur). Using other AUR managers should be just as easy. To install lanraragi without an AUR package manager the installation process would be something like: Copy wget https://aur.archlinux.org/cgit/aur.git/snapshot/lanraragi.tar.gz -O - | tar -xz cd lanraragi makepkg -rsi That would take care of installing LRR together with build and normal dependencies and deleting build dependencies after successful building and installing. The installer also creates a lanraragi.service unit file for starting, restarting and stopping LRR with systemd's `systemctl`. If Redis is down it will get it up. `systemctl start lanraragi.service` `systemctl restart lanraragi.service` `systemctl stop lanraragi.service` `systemctl status lanraragi.service` Systemd integration also gives an easy way to read the log (if necessary). `journalctl -u lanraragi -f` [PreviousSource Code (Linux/macOS)chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) [NextJail (FreeBSD)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail) Last updated 2 years ago * [UnRAID](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community#unraid) * [Nix/NixOS](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community#nix-nixos) * [Arch Linux](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community#arch-linux) --- # Statistics and Logs | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/stats#statistics) Statistics ----------------------------------------------------------------------------------------------- This page shows basic stats about your content folder, as well as your most used tags. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/stats#logs) Logs ----------------------------------------------------------------------------------- This page allows you to quickly see logs from the app, in case something went wrong. If you enable _Debug Mode_ in Configuration, more logs will be displayed. circle-exclamation If you enable Debug Mode for troubleshooting purposes, make sure to disable it once you're done! [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/stats#metrics) Metrics ----------------------------------------------------------------------------------------- LANraragi supports exporting server metrics via the `/api/info/metrics` endpoint in the text-based Prometheus exposition format, allowing you to see server analytics and trendlines using a Prometheus/Grafana stack. The `/api/info/metrics` endpoint is disabled by default. To enable this feature, go to the "Global Settings" configuration and toggle on "Enable Metrics". Then, restart the server. Supported metrics include: * Number of total archives and workers * Number of requests handled and total request handling duration for a given endpoint and worker * CPU, memory and file-descriptor statistics * Miscellaneous server info (version, version name) circle-exclamation Due to the metrics exporter relying on Redis as its shared memory store, the collection process may apply a high write pressure to the database which can overwhelm its [default persistence configurationsarrow-up-right](https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/#snapshotting) . [PreviousSearching the Archive Indexchevron-left](https://sugoi.gitbook.io/lanraragi/basic-operations/searching) [NextThemeschevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/themes) Last updated 1 day ago * [Statistics](https://sugoi.gitbook.io/lanraragi/basic-operations/stats#statistics) * [Logs](https://sugoi.gitbook.io/lanraragi/basic-operations/stats#logs) * [Metrics](https://sugoi.gitbook.io/lanraragi/basic-operations/stats#metrics) --- # Downloader Plugins | Nightly Release | LANraragi Downloader Plugins are used as part of LANraragi's built-in downloading feature. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#required-subroutines) Required subroutines --------------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `provide_url`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. Your plugin also needs an extra field in its metadata: `url_regex`, which contains a Regular Expression that'll be used by LANraragi to know if your Downloader should be used. For example, if your regex is `https?:\/\/example.com.*`, LANraragi will invoke your plugin if the user wants to download an URL that comes from `example.com`. circle-info In case of multiple Downloaders matching the given URL, the server will invoke the first plugin that matches. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#expected-input) Expected Input The following section deals with writing the `provide_url` subroutine. When executing your Plugin, LRR will call this subroutine and pass it the following variables: Copy sub provide_url { #First lines you should have in the subroutine shift; my $lrr_info = shift; # Global info hash my ($param1, $param2) = @_; # Plugin parameters The variables match the parameters you've entered in the `plugin_info` subroutine. The `$lrr_info` hash contains three variables you can use in your plugin: * _$lrr\_info->{url}_: The URL that needs to be downloaded. * _$lrr\_info->{user\_agent}_: [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object you can use for web requests. If this plugin depends on a Login plugin, this UserAgent will be pre-configured with the cookies from the Login. * _$lrr\_info->{tempdir}_: A temporary directory path where you can store files. This is useful when you need to download and process multiple images, and are assembling the archive locally. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#expected-output) Expected Output LRR expects Downloaders to return a hash containing either a new URL that can be downloaded directly, _or_ a path to a file that has already been downloaded. For returning a URL to download: `return ( download_url => "http://my.remote.service/download/secret-archive.zip" );` circle-info Said URL should **directly** point to a file -- Any form of HTML will trigger a failed download. For returning a local file path (that you've already downloaded/created): `return ( file_path => "/path/to/downloaded/file.zip" );` If your script errored out, you can immediately stop the plugin execution and tell LRR that an error occurred by throwing an exception: `die "my error :(\n";` or by returning a hash containing an "error" field (**this method is deprecated**): `return ( error => "my error :(" );` If you do this, the error will be logged/displayed to the user. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#plugin-template) Plugin Template ----------------------------------------------------------------------------------------------------------- [PreviousMetadata Pluginschevron-left](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata) [NextGeneric Plugins ("Scripts")chevron-right](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts) Last updated 9 months ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download#plugin-template) Copy package LANraragi::Plugin::Download::MyNewDownloader; use strict; use warnings; # Plugins can freely use all Perl packages already installed on the system # Try however to restrain yourself to the ones already installed for LRR (see tools/cpanfile) to avoid extra installations by the end-user. use Mojo::UserAgent; # You can also use LRR packages when fitting. # All packages are fair game, but only functions explicitly exported by the Utils packages are supported between versions. # Everything else is considered internal API and can be broken/renamed between versions. use LANraragi::Model::Plugins; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Example.com Downloader", type => "download", namespace => "dummydl", author => "Hackerman", version => "0.1", description => "This is base boilerplate for writing LRR downloaders. Returns a static URL if you try to download a URL from http://example.com.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABZSURBVDhPzY5JCgAhDATzSl+e/2irOUjQSFzQog5hhqIl3uBEHPxIXK7oFXwVE+Hj5IYX4lYVtN6MUW4tGw5jNdjdt5bLkwX1q2rFU0/EIJ9OUEm8xquYOQFEhr9vvu2U8gAAAABJRU5ErkJggg==", # Downloader-specific metadata url_regex => "https?:\/\/example.com.*" ); } ## Mandatory function to be implemented by your script sub provide_url { shift; my $lrr_info = shift; # Global info hash my ($useposts) = @_; # Plugin parameters my $logger = get_logger( "Dingus Downloader", "plugins" ); # Get the url my $url = $lrr_info->{url}; $logger->debug("We have been given the following URL: $url" ); # This is the downloadable url we'll give back. It can be completely different from the base domain provided. my $reply = "https://archive.org/download/quake-essays-sep-15-fin-4-graco-l-cl/QUAKE_essays_SEP15_FIN4_GRACoL_CL.pdf"; # Just for fun, use the provided useragent to see if we've been given a real URL my $ua = $lrr_info->{user_agent}; my $res = $ua->get($url)->result; if ($res->is_success) { return ( download_url => $reply ); } elsif ($res->is_error) { die "Dingus! ".$res->message; } } 1; --- # Generic Plugins ("Scripts") | Nightly Release | LANraragi Script Plugins are meant for generic workflows that aren't explicitly supported. The main usecase is essentially for users to script their own API endpoints, since those plugins can easily be invoked through the [Client API](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/getting-started) . [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#required-subroutines) Required subroutines -------------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `run_script`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#expected-input) Expected Input The following section deals with writing the `run_script` subroutine. When executing your Plugin, LRR will call this subroutine and pass it the following variables: Copy sub run_script { #First lines you should have in the subroutine # $lrr_info: global info hash, contains various metadata provided by LRR # %params : plugin parameters shift; my ( $lrr_info, $params ) = @_; The variables match the parameters you've entered in the `plugin_info` subroutine. The `$lrr_info` hash contains two variables you can use in your plugin: * _$lrr\_info->{oneshot\_param}_: Value of your one-shot argument, if it's been set by the User. See below. * _$lrr\_info->{user\_agent}_: [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object you can use for web requests. If this plugin depends on a Login plugin, this UserAgent will be pre-configured with the cookies from the Login. The `$params` hash contains the values of the user defined parameters. #### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#one-shot-runtime-arguments) One-Shot/Runtime Arguments Scripts can have one string argument given to them when executed. If you want the user to be able to enter this override, the `oneshot_arg` field must be present in `plugin_info`, and contain a brief description of what your argument is for. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#expected-output) Expected Output LRR expects Scripts to return a hash, containing the results of whatever operations they ran. This hash is then projected back to the user. `return (total => $filtered, partial_ids => \@ids );` If your script errored out, you can tell LRR that an error occurred by returning a hash containing an "error" field: `return ( error => "my error :(" );` If you do this, the error will be logged/displayed to the user. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#plugin-template) Plugin Template ---------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#converting-existing-plugins-to-named-parameters) Converting existing plugins to named parameters If you have a plugin that you want to convert to using named parameters check [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) in the [Metadata](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata) section. [PreviousDownloader Pluginschevron-left](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download) [NextCode Exampleschevron-right](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples) Last updated 1 year ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#plugin-template) * [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts#converting-existing-plugins-to-named-parameters) Copy package LANraragi::Plugin::Scripts::MyNewPlugin; use strict; use warnings; # Plugins can freely use all Perl packages already installed on the system # Try however to restrain yourself to the ones already installed for LRR (see tools/cpanfile) to avoid extra installations by the end-user. use Mojo::UserAgent; # You can also use LRR packages when fitting. # All packages are fair game, but only functions explicitly exported by the Utils packages are supported between versions. # Everything else is considered internal API and can be broken/renamed between versions. use LANraragi::Model::Plugins; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Script Boilerplate", type => "script", namespace => "dummyscript", author => "Hackerman", version => "0.1", description => "This is base boilerplate for writing LRR scripts. Uses JSONPlaceholder to return bogus data.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABZSURBVDhPzY5JCgAhDATzSl+e/2irOUjQSFzQog5hhqIl3uBEHPxIXK7oFXwVE+Hj5IYX4lYVtN6MUW4tGw5jNdjdt5bLkwX1q2rFU0/EIJ9OUEm8xquYOQFEhr9vvu2U8gAAAABJRU5ErkJggg==", oneshot_arg => "ID argument for https://jsonplaceholder.typicode.com/", parameters => { 'useposts' => {type => "bool", desc => "Use posts instead of todos (jsonplaceholder)"} } ); } ## Mandatory function to be implemented by your script sub run_script { shift; # $lrr_info: global info hash, contains various metadata provided by LRR # %params : plugin parameters my ( $lrr_info, $params ) = @_; my $logger = get_logger( "Source Finder", "plugins" ); # Get the runtime parameter my $id = $lrr_info->{oneshot_param}; my $url = ""; $logger->debug("useposts = " . $param->{useposts} ); if ($param->{useposts}) { $url = "https://jsonplaceholder.typicode.com/posts/$id"; } else { $url = "https://jsonplaceholder.typicode.com/todos/$id"; } $logger->debug("Loading " . $url ); if ($id eq "") { return ( error => "No ID specified!"); } # Use the provided useragent my $ua = $lrr_info->{user_agent}; my $res = $ua->get($url)->result; if ($res->is_success) { # Return the response JSON directly. return %{$res->json}; } elsif ($res->is_error) { return ( error => $res->message ); } } 1; --- # Adding Metadata | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata#editing-an-archive-manually) Editing an Archive manually ------------------------------------------------------------------------------------------------------------------------------------ To use a plugin on a single archive, you need to access its **editing** page by clicking the pencil icon on the main view. From here, you can modify all metadata manually. Don't forget to save! triangle-exclamation The "Delete Archive" button will permanently wipe the Archive from your filesystem! [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata#using-plugins) Using Plugins -------------------------------------------------------------------------------------------------------- LANraragi supports the use of **Plugins** to fetch tags for your archives Said Plugins can be used in three different ways: * On a per-archive basis through the standard Edit dialog * Automatically on every newly added archive. * During a Batch Tagging session. For more info on Batch Tagging, check the following article: [🦇Batch Operationschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/batch-tagging) To use plugins automatically, you have to first use the **Plugin Configuration** page to choose which plugins will be automatically executed, and set their options if they need any. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-d2e36942d3139ffcb526767032d5e432d405d03e%252Fcfg_plugin.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=396f44fc&sv=2) Plugin Configuration (on this screenshot, eze and regex parsing will be executed automatically.) LRR ships with a few plugins out of the box, in the _/lib/LANraragi/Plugins_ folder. To install other Plugins (in .pm format), drag them to this folder and they'll appear in Plugin Configuration. You can also install Plugins through the "Install Plugin" button in Plugin Configuration. This feature requires Debug Mode to be enabled for security purposes. Debug Mode can be disabled once you're done installing Plugins. circle-exclamation Plugins have as much control over your system as the main LANraragi application does! When installing Plugins from unknown sources, do a little research first. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata#about-source-tags) About source: tags ----------------------------------------------------------------------------------------------------------------- If your archive has a `source:` tag (likely from the use of the [built-in downloading feature](https://sugoi.gitbook.io/lanraragi/advanced-usage/downloading) ), 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. [PreviousReading Archiveschevron-left](https://sugoi.gitbook.io/lanraragi/basic-operations/archives) [NextSearching the Archive Indexchevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/searching) Last updated 1 day ago * [Editing an Archive manually](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata#editing-an-archive-manually) * [Using Plugins](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata#using-plugins) * [About source: tags](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata#about-source-tags) --- # Source Code (Linux/macOS) | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#a-small-fyi-about-vendor-perl) A small FYI about Vendor Perl ------------------------------------------------------------------------------------------------------------------------------------------ As you might have noticed, LANraragi entirely depends on the Perl programming language. A version of Perl ships already compiled on most Linux distributions(and macOS). It's usually called "Vendor Perl". Using vendor Perl is [generally discouragedarrow-up-right](http://www.modernperlbooks.com/mt/2012/01/avoiding-the-vendor-perl-fad-diet.html) due to possible fuck-ups by the Linux distribution creator. As such, you might want to install LANraragi with your own compiled Perl, using a tool such as [Perlbrewarrow-up-right](https://perlbrew.pl/) . For information, my personal tests are done using Debian's vendor Perl. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#needed-dependencies) Needed dependencies ---------------------------------------------------------------------------------------------------------------------- Copy 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 libjxl-dev \ perlmagick ghostscript npm libvips-dev _Base software dependencies._ circle-info ImageMagick and libvips are optional, but you need to install at least one to get thumbnail support. libvips is faster than ImageMagick and will be used automatically if both are installed. circle-info If your package manager requires you to specify which ImageMagick version to install, choose version 7. If you're using perlbrew, you'll have to install `Alien::ImageMagick` with CPAN in perlbrew's perl lib, which will handle downloading and building the `perlmagick` API bindings for you. (LRR can work without ImageMagick running, but you'll lose out on any thumbnail support) circle-info For macOS, you should be able to install the dependencies using Homebrew. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#installing-lrr) Installing LRR ------------------------------------------------------------------------------------------------------------ All you need to do is clone the git repo somewhere (or download one of [the releasesarrow-up-right](https://github.com/Difegue/LANraragi/releases) ) and run the installer. I recommend doing this with a brand new Linux user account. (I'm using "koyomi" here): {% hint style="info"} Do not use `sudo` in the above command if you are using `perlbrew`. Arch users might need to install `perl-config-autoconf` and use env variable `export PERL5LIB=~/perl5/lib/perl5` before running the installer. Once this is done, you can get started by running `npm start` and opening [http://localhost:3000arrow-up-right](http://localhost:3000/) . To change the default port or add SSL support, see this page: [🌐Network Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces) circle-info By default, LRR listens on all IPv4 Interfaces on port 3000, unsecured HTTP. ### [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#updating) Updating Getting all the files from the latest release and pasting them in the directory of the application should give you a painless update 95% of the time. To be on the safe side, make sure to rerun the installer once this is done: [PreviousDocker (All platforms)chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker) [NextCommunity (Linux)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community) Last updated 5 months ago * [A small FYI about Vendor Perl](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#a-small-fyi-about-vendor-perl) * [Needed dependencies](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#needed-dependencies) * [Installing LRR](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#installing-lrr) * [Updating](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#updating) Copy git clone -b master http://github.com/Difegue/LANraragi /home/koyomi/lanraragi cd /home/koyomi/lanraragi && sudo npm run lanraragi-installer install-full Copy npm run lanraragi-installer install-full --- # Homebrew (macOS) | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#migration) Migration ------------------------------------------------------------------------------------------------- To use all your existing files within a brewed LRR, you can issue the following commands: Copy lrr="${HOME}/Library/Application Support/LANraragi/" # if you’re on Linux, use the next line instead: #lrr="${HOME}/LANraragi/" cd mkdir -p "${lrr}" mv content "${lrr}/content" mv log "${lrr}/log" mv temp "${lrr}/temp" mv database.rdb "${lrr}/database/database.rdb" circle-info This simply moves all your files to the default location where LRR looks for them when installed with Homebrew. You can do that manually too, if you chose so. If you succeeded in moving, you can proceed to the next step! [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#installation) Installation ------------------------------------------------------------------------------------------------------- If you do not have Homebrew installed yet, simply use the command on [their pagearrow-up-right](https://brew.sh/) . The next step is to then install LRR. Copy brew install lanraragi [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#configuration) Configuration --------------------------------------------------------------------------------------------------------- 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.) 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. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#usage) Usage ----------------------------------------------------------------------------------------- Once installed, you can get started by running `lanraragi` and opening [http://localhost:3000arrow-up-right](http://localhost:3000/) . To change the default port or add SSL support, see this page: [🌐Network Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces) circle-info By default, LRR listens on all IPv4 Interfaces on port 3000, unsecured HTTP. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#updating) Updating ----------------------------------------------------------------------------------------------- Simply run `brew install lanraragi --HEAD` again to update to the latest version. circle-exclamation The same warning as in the Installation step applies. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#uninstallation) Uninstallation ----------------------------------------------------------------------------------------------------------- Run `brew remove lanraragi` to uninstall the app. Data in the `${HOME}/Library/Application Support/LANraragi`/`${HOME}/LANraragi/` folder is not deleted. [PreviousLRR for Windows (Win10)chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows) [NextDocker (All platforms)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker) Last updated 1 day ago * [Migration](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#migration) * [Installation](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#installation) * [Configuration](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#configuration) * [Usage](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#usage) * [Updating](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#updating) * [Uninstallation](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos#uninstallation) --- # Metadata Plugins | Nightly Release | LANraragi Metadata plugins are the bread-n-butter of LRR plugins: For a given archive, they can look for tags in a remote service or a local file and return this info so it can be integrated into LRR's database. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#required-subroutines) Required subroutines --------------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `get_tags`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#expected-input) Expected Input The following section deals with writing the `get_tags` subroutine. When executing your Plugin, LRR will call this subroutine and pass it the following variables: Copy sub get_tags { #First lines you should have in the subroutine # $lrr_info: global info hash, contains various metadata provided by LRR # $params : plugin parameters shift; my ( $lrr_info, $params ) = @_; The variables match the parameters you've entered in the `plugin_info` subroutine. (Example here is for E-H. ) The `$lrr_info` hash contains various variables you can use in your plugin: * _$lrr\_info->{archive\_id}_: The internal ID of the archive. * _$lrr\_info->{archive\_title}_: The title of the archive, as entered by the User. * _$lrr\_info->{existing\_tags}_: The tags that are already in LRR for this archive, if there are any. * _$lrr\_info->{thumbnail\_hash}_: A SHA-1 hash of the first image of the archive. * _$lrr\_info->{file\_path}_: The filesystem path to the archive. * _$lrr\_info->{oneshot\_param}_: Value of your one-shot argument, if it's been set by the User. See below. * _$lrr\_info->{user\_agent}_: [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object you can use for web requests. If this plugin depends on a Login plugin, this UserAgent will be pre-configured with the cookies from the Login. The `$params` hash contains the values of the user defined parameters. #### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#one-shot-arguments) One-Shot Arguments The **One-Shot Argument** can be set by the user every time he uses your Plugin on a specific file, through LRR's Edit Menu. It's more meant for special overrides you'd want to use for this specific file: For example, in E-Hentai and nHentai plugins, it can be used to set a specific Gallery URL you want to pull tags from. If you want the user to be able to enter this override, the `oneshot_arg` field must be present in `plugin_info`, and contain a brief description of what your argument is for. One-Shot Arguments can only be strings. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#expected-output) Expected Output Once you're done and obtained your tags, all that's needed for LRR to handle them is to return a hash containg said tags. Tags are expected to be separated by commas, like this: `return ( tags => "my:new, tags:here, look ma no namespace" );` Plugins can also modify the title or the summary of the archive: `return ( tags => "some:tags", title=>"My new epic archive title", summary=>"Phenomenal! Wheres that David Lynch clip where he says phenomenal" );` Those two parameters are completely optional. (The tags one isn't, but it can very well be empty.) If the Plugin's user has disabled "Plugins can modify archive titles" in their settings, you can still pass a new title - It'll simply do nothing. If you couldn't obtain tags for some reason, you can tell LRR that an error occurred by throwing an exception: `die "my error :(\n";` The old error handling still exists, but it's **deprecated**: `return ( error => "my error :(" );` If you do this, no tags will be added for this archive, and the error will be logged/displayed to the user. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#plugin-template) Plugin Template ----------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) Converting existing plugins to named parameters With the release of version **0.9.3** of LANraragi, **named parameters** for plugins have been introduced. Compared to previous versions, where plugin parameters were based on an _ordered array_, _named parameters_ should make it easier to understand the source code and write new plugins, especially if they make use of many parameters. _For the time being LANraragi will continue to support the plugins based on ordered array parameters_ so there is no need to rush to update your plugin. But if you still want to upgrade, the following information should help you. If you have a plugin that you want to convert to using named parameters without losing the existing configuration, you can add a new key called `to_named_params` to the `plugin_info` hash. The new key must contain an array of the names assigned to the old parameters in the exact sequence in which they were present before the conversion. If you have added new parameters in the meantime, you don't have to specify them in the `to_named_params` key. The following example shows how to convert from the old parameter structure: to the new structure: Note that `salvation` is not included in the conversion and the order of the items inside `to_named_params` corresponds to the sequence of the parameters in the old format. The `to_named_params` key must be present the first time you load the plugin with the new parameter structure, otherwise the existing configuration will be lost. After the first use, however, it is no longer needed and you can remove it from a future version of the plugin. [PreviousLogin Pluginschevron-left](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login) [NextDownloader Pluginschevron-right](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/download) Last updated 1 year ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#plugin-template) * [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) Copy package LANraragi::Plugin::Metadata::MyNewPlugin; use strict; use warnings; # Plugins can freely use all Perl packages already installed on the system # Try however to restrain yourself to the ones already installed for LRR (see tools/cpanfile) to avoid extra installations by the end-user. use Mojo::UserAgent; # You can also use LRR packages when fitting. # All packages are fair game, but only functions explicitly exported by the Utils packages are supported between versions. # Everything else is considered internal API and can be broken/renamed between versions. use LANraragi::Model::Plugins; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Plugin Boilerplate", type => "metadata", namespace => "dummyplug", #login_from => "dummylogin", author => "Hackerman", version => "0.001", description => "This is base boilerplate for writing LRR plugins.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBI\nWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4wYDFCYzptBwXAAAAB1pVFh0Q29tbWVudAAAAAAAQ3Jl\nYXRlZCB3aXRoIEdJTVBkLmUHAAAAjUlEQVQ4y82UwQ7AIAhDqeH/f7k7kRgmiozDPKppyisAkpTG\nM6T5vAQBCIAeQQBCUkiWRTV68KJZ1FuG5vY/oazYGdcWh7diy1Bml5We1yiMW4dmQr+W65mPjFjU\n5PMg2P9jKKvUdxWMU8neqYUW4cBpffnxi8TsXk/Qs8GkGGaWhmes1ZmNmr8kuMPwAJzzZSoHwxbF\nAAAAAElFTkSuQmCC", #If your plugin uses/needs custom arguments, input their name here. #This name will be displayed in plugin configuration next to an input box for global arguments, and in archive edition for one-shot arguments. oneshot_arg => "This is a one-shot argument that can be entered by the user when executing this plugin on a file", parameters => [\ 'doomsday' => {type => "bool", desc => "Enable the DOOMSDAY DEVICE"},\ 'iterations' => {type => "int", desc => "Number of iterations", default_value => "9001"}\ ] ); } #Mandatory function to be implemented by your plugin sub get_tags { shift; # $lrr_info: global info hash, contains various metadata provided by LRR # $params : plugin parameters my ( $lrr_info, $params ) = @_; if ($lrr_info->{oneshot_param}) { die "Yaaaaaaaaa gomen gomen the oneshot argument isn't implemented -- You entered ".$lrr_info->{oneshot_param}.", right ?\n"; } #Use the logger to output status - they'll be passed to a specialized logfile and written to STDOUT. my $logger = get_logger("My Cool Plugin","plugins"); #Work your magic here - You can create subroutines below to organize the code better $logger->info("Gettin' tags"); my $newtags = get_tags_from_somewhere($params->{iterations}, $params->{doomsday}); #To be implemented my $error = 0; #Something went wrong? Return an error. if ($error) { $logger->error("Oh no"); die "Error Text Here\n"; } #Otherwise, return the tags you've harvested. return ( tags => $newtags ); } sub get_tags_from_somewhere { my ($iterations, $doomsday) = @_; my $logger = get_logger("My Cool Plugin","plugins"); if ($doomsday) { die "You fools! You've messed with the natural order!\n"; } $logger->info("I'm supposed to be iterating $iterations times but I don't give a damn my man"); #Tags are expected to be submitted as a single string, containing tags split up by commas. Namespaces are optional. return "my:new, tags:here, look ma no namespace"; } 1; Copy # [...] parameters => [\ {type => "bool", desc => "Enable the DOOMSDAY DEVICE"},\ {type => "int", desc => "Number of iterations", default_value => "9001"}\ ] # [...] Copy # [...] to_named_params => ['doomsday', 'iterations'], parameters => { 'iterations' => {type => "int", desc => "Number of iterations", default_value => "9001"}, 'doomsday' => {type => "bool", desc => "Enable the DOOMSDAY DEVICE"}, 'salvation' => {type => "bool", desc => "Now you can be saved"} } # [...] --- # Plugin API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api#get-plugins-type) 🔑 List available plugins get https://lrr.tvc-16.science/api/plugins/{type} List all plugins of the given type. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters typestring · enumRequired Type of plugins you want to list. You can use "all" to get all types at once. Possible values: `download``login``metadata``script``all` Responses chevron-right 200 Array of plugins application/json Metadata payload for a LRR Plugin. authorstringOptional Author of the plugin descriptionstringOptional Description of the plugin namestringOptional Name of the plugin iconstringOptional Base64 image of the plugin icon typestring · enumOptional Type of the plugin Possible values: `download``login``metadata``script` namespacestringOptional Unique namespace for the plugin parametersobject\[\]Optional Parameter for a LRR Plugin. Example: `{"default_value":0,"desc":"Force resampled archive download","name":"forceresampled","type":"bool"}` Show propertiesplus versionstringOptional Version of the plugin oneshot\_argstring · nullableOptional Description of the manual one-shot argument users can fill in for manual plugin calls url\_regexstring · nullableOptional For downloader plugins, regex where it should be used login\_fromstring · nullableOptional Namespace of the login plugin this plugin depends on get /plugins/{type} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Array of plugins ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api#post-plugins-use) 🔑 Use a Plugin post https://lrr.tvc-16.science/api/plugins/use Uses a Plugin and returns the result. If using a metadata plugin, the matching archive will not be modified in the database. See more info on Plugins in the matching section of the Docs. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters idstring · min: 40 · max: 40Optional ID of the archive to use the Plugin on. This is only mandatory for metadata plugins. pluginstringOptional Namespace of the plugin to use. argstringOptional Optional One-Shot argument to use when executing this Plugin. Responses chevron-right 200 Plugin result application/json operationstring · enumOptionalPossible values: `use_plugin` typestring · enum · nullableOptionalPossible values: `download``login``metadata``script` successinteger · enumOptional Whether the Plugin run succeeded or not. Possible values: `0``1` errorstring · nullableOptional dataobjectOptional Arbitrary data returned by the Plugin. post /plugins/use HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Plugin result ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api#post-plugins-queue) 🔑 Use a Plugin Asynchronously post https://lrr.tvc-16.science/api/plugins/queue Uses a Plugin and returns a Minion Job ID matching the Plugin run. This endpoint is useful if you want to run longer-lived plugins which might timeout if ran with the standard endpoint. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters idstring · min: 40 · max: 40Optional ID of the archive to use the Plugin on. This is only mandatory for metadata plugins. priorityintegerOptional Priority of the Minion job. The higher the number, the more important the job is. pluginstringOptional Namespace of the plugin to use. argstringOptional Optional One-Shot argument to use when executing this Plugin. Responses chevron-right 200 Enqueued job application/json operationstring · enumOptionalPossible values: `queue_plugin_exec` successinteger · enumOptionalPossible values: `0``1` jobintegerOptional ID of the created Minion job post /plugins/queue HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job [PreviousTankoubon APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api) [NextShinobu APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api) Last updated 2 months ago * [GET🔑 List available plugins](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api#get-plugins-type) * [POST🔑 Use a Plugin](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api#post-plugins-use) * [POST🔑 Use a Plugin Asynchronously](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api#post-plugins-queue) Copy GET /api/plugins/{type} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy [\ {\ "author": "Difegue",\ "description": "Searches chaika.moe for tags matching your archive.",\ "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\\nB3RJTUUH4wYCFQocjU4r+QAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUH\\nAAAEZElEQVQ4y42T3WtTdxzGn/M7J+fk5SRpTk7TxMZkXU84tTbVNrUT3YxO7HA4pdtQZDe7cgx2\\ns8vBRvEPsOwFYTDYGJUpbDI2wV04cGXCGFLonIu1L2ptmtrmxeb1JDkvv121ZKVze66f74eH7/f5\\nMmjRwMCAwrt4/9KDpflMJpPHvyiR2DPcJklJ3TRDDa0xk36cvrm8vDwHAAwAqKrqjjwXecPG205w\\nHBuqa9rk77/d/qJYLD7cCht5deQIIczbgiAEKLVAKXWUiqVV06Tf35q8dYVJJBJem2A7Kwi2nQzD\\nZig1CG93+PO5/KN6tf5NKpVqbsBUVVVFUUxwHJc1TXNBoxojS7IbhrnLMMx9pVJlBqFQKBKPxwcB\\nkJYgjKIo3QCE1nSKoghbfJuKRqN2RVXexMaQzWaLezyeEUEQDjscjk78PxFFUYRkMsltJgGA3t7e\\nyMLCwie6rr8iCILVbDbvMgwzYRjGxe0o4XC4s1AoHPP5fMP5/NNOyzLKAO6Ew+HrDADBbre/Ryk9\\nnzx81FXJNlEpVpF+OqtpWu2MpmnXWmH9/f2umZmZi4cOHXnLbILLzOchhz1YerJAs9m1GwRAg2GY\\nh7GYah488BJYzYW+2BD61AFBlmX/1nSNRqN9//792ujoaIPVRMjOKHoie3DytVGmp2fXCAEAjuMm\\nu7u7Umosho6gjL/u/QHeEgvJZHJ2K/D+/fuL4+PjXyvPd5ldkShy1UXcmb4DnjgQj/fd5gDA6/XS\\nYCAwTwh9oT3QzrS1+VDVi+vd3Tsy26yQVoFF3dAXJVmK96p9EJ0iLNOwKKU3CQCk0+lSOpP5WLDz\\nF9Q9kZqyO0SloOs6gMfbHSU5NLRiUOuax2/HyZPHEOsLw2SbP83eu/fLxrkNp9P554XxCzVa16MC\\n7+BPnTk9cfmH74KJE8nmga7Xy5JkZ8VKifGIHpoBb1VX8hNTd3/t/7lQ3OeXfFPvf/jBRw8ezD/a\\n7M/aWq91cGgnJaZ2VcgSdnV1XRNNd3vAoBVVYusmnEQS65hfgSG6c+zy3Kre7nF/KrukcMW0Zg8O\\nD08DoJutDxxOEb5IPUymwrq8ft1gLKfkFojkkRxemERCAQUACPFWRazYLJcrFGwQhyufbQQ7rFpy\\nLMkCwGZC34qPIuwp+XPOjBFwazQ/txrdFS2GGS/Xuj+pUKLGk1Kjvlded3s72lyGW+PLbGVcmrAA\\ngN0wTk1NWYODg9XOKltGtpazi5GigzroUnHN5nUHG1ylRsG7rDXHmnEpu4CeEtEKkqNc6QqlLc/M\\n8uT5lLH5eq0aGxsju1O7GQB498a5s/0x9dRALPaQEDZnYwnhWJtMCCNrjeb0UP34Z6e/PW22zjPP\\n+vwXBwfPvbw38XnXjk7GsiwKAIQQhjAMMrlsam45d+zLH6/8o6vkWcBcrXbVKQhf6bpucCwLjmUB\\nSmmhXC419eblrbD/TAgAkUjE987xE0c7ZDmk66ajUCnq+cL63fErl25s5/8baQPaWLhx6goAAAAA\\nSUVORK5CYII=",\ "name": "Chaika.moe",\ "namespace": "trabant",\ "oneshot_arg": "Chaika Gallery or Archive URL (Will attach matching tags to your archive)",\ "type": "metadata",\ "version": 2.1,\ "parameters": [\ {\ "desc": "ipb_pass_hash cookie",\ "type": "string"\ },\ {\ "default_value": 0,\ "desc": "Force resampled archive download",\ "name": "forceresampled",\ "type": "bool"\ }\ ]\ }\ ] Copy POST /api/plugins/use HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "use_plugin", "success": 1, "type": "metadata", "data": { "new_tags": "pages:45" } } Copy POST /api/plugins/queue HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 86, "operation": "queue_plugin_exec", "success": 1 } --- # Setup a Development Environment | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#quick-rundown) Quick rundown ------------------------------------------------------------------------------------------------------------ LRR is written in Perl on the server-side with the help of the [Mojoliciousarrow-up-right](http://mojolicious.org/) framework, with basic JQuery on the clientside. **npm** is used for JavaScript dependency management and basic shortcuts, while **cpanm** is used for Perl dependency management. As of v.0.5.5, a basic Client API is available for you to write clients that can connect to a LANraragi instance. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#quick-setup) Quick setup -------------------------------------------------------------------------------------------------------- Once you've got a running LANraragi instance, you can basically dive right into the files to modify stuff to your needs. As you need raw access to the files, a native OS install is needed! I recommend a Linux or WSL install, as the _morbo_ development server only works on Linux. Said development server can be ran with the `npm run dev-server` command. The major difference is that this server will automatically reload when you modify any file within LANraragi. Background worker included! You'll also probably want to enable **Debug Mode** in the LRR Options, as that will allow you to view debug-tier logs, alongside the raw Mojolicious logs. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#using-msys2) Using MSYS2 -------------------------------------------------------------------------------------------------------- The environment for development is **UCRT64**, other have not been tested. Since Mojolicious and other perl dependencies are not designed to run on Windows they need to be patched. The patches can be found in `tools/build/windows` alongside other utility scripts. You need to provide a redis-compatible server. To setup an environment that can be used for development you need to do the following steps: 1. Update the environment with the `pacman -Syu` command. 2. cd into the LRR directory. 3. Run the script for installing native dependencies `./tools/build/windows/install-deps.sh` 4. Restart the environment (close and open the shell). 5. Run the script for installing perl dependencies `./tools/build/windows/install.sh` Finally you can launch LRR with the `perl ./script/launcher.pl -d -v ./script/lanraragi` command. There is no support for hot-reload, multithreading/multiprocess or a dev server. The only supported Mojo server is Daemon, this applies to development or production installs. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#utf-8-support) UTF-8 support If you have issues with path names getting mangled you need to patch perl to enable support for UTF-8. A recent Windows SDK is required for the patching tools. 1. Open a Visual Studio developer console. 2. cd into `\ucrt64\bin`. 3. Run the `mt.exe -manifest \tools\build\windows\perl.exe.manifest "-outputresource:perl.exe;#1"` command. This will tell perl to use UTF-8 mode and accept any special characters. If you update the environment you might need to patch it again. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#using-github-codespaces) Using Github Codespaces -------------------------------------------------------------------------------------------------------------------------------- The LRR Git repository contains [devcontainer.jsonarrow-up-right](https://github.com/Difegue/LANraragi/tree/dev/.devcontainer) configuration for [Codespacesarrow-up-right](https://github.com/Difegue/LANraragi/codespaces) , so you can easily spin up a development VM using that. Deployment might take some time, as the VM will download all dependencies. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#using-docker-compose) Using Docker Compose -------------------------------------------------------------------------------------------------------------------------- You can use [Docker Composearrow-up-right](https://docs.docker.com/compose/) for quickly bringing up a LANraragi instance suitable for development. Run `docker compose up -d` inside `tools/build/docker` and hack away! [PreviousTag Ruleschevron-left](https://sugoi.gitbook.io/lanraragi/dev/advanced-usage/tag-rules) [NextArchitecture & Stylechevron-right](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture) Last updated 7 months ago * [Quick rundown](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#quick-rundown) * [Quick setup](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#quick-setup) * [Using MSYS2](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#using-msys2) * [UTF-8 support](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#utf-8-support) * [Using Github Codespaces](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#using-github-codespaces) * [Using Docker Compose](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index#using-docker-compose) --- # Searching the Archive Index | LANraragi The search bar in LANraragi tries to not be too dumb and will actively suggest tags to you as you type. If you want to queue multiple terms/tags, you have to use **commas** to separate them, much like how tags are entered in the metadata field when editing an archive. You can mix both tags and a specific title in a search if you want. You can search for galleries with a specific number of pages with `pages:20`, or with a page range: `pages:>20, pages:<=30`. You can also search for galleries with a specific number of pages read with similar syntax, `read:20`, or with a range: `read:>20, read:<=30`. You can also use the following special characters in a search: **Quotation Marks ("...")** Exact string search. Everything placed inside a pair of quotation marks is treated as a singular term. Wildcard characters are still interpreted as wildcards. **Question Mark (?), Underscore (\_)** Wildcard. Can match any single character. **Asterisk (\*), Percentage Sign (%)** Wildcard. Can match any sequence of characters (including none). **Subtraction Sign (-)** Exclusion. When placed before a term, prevents search results from including that term. **Dollar Sign ($)** Add at the end of a tag to perform an exact tag search rather than displaying all elements that start with the term. Can be used as an exclusion to ignore misc tags in the search query. [PreviousAdding Metadatachevron-left](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata) [NextStatistics and Logschevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/stats) Last updated 1 day ago --- # Code Examples | Nightly Release | LANraragi This section contains a few bits of code for things you might want to do with Plugins. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#write-messages-to-the-plugin-log) **Write messages to the Plugin Log** ------------------------------------------------------------------------------------------------------------------------------------------------------ Copy # Import the LRR logging module use LANraragi::Utils::Logging qw(get_plugin_logger); # Use the logger to output status - they'll be passed to a specialized logfile and written to STDOUT. my $logger = get_plugin_logger(); $plugin->debug("This message will only show if LRR is in Debug Mode") $plugin->info("You know me the fighting freak Knuckles and we're at Pumpkin Hill"); $plugin->warn("You ready?"); $plugin->error("Oh no"); The logger is a preconfigured [Mojo::Logarrow-up-right](http://mojolicious.org/perldoc/Mojo/Log) object. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#make-requests-to-a-remote-webservice) **Make requests to a remote WebService** -------------------------------------------------------------------------------------------------------------------------------------------------------------- [Mojo::UserAgentarrow-up-right](http://mojolicious.org/perldoc/Mojo/UserAgent) is a full-featured HTTP client coming with LRR you can use. Copy use Mojo::UserAgent; my $ua = $lrr_info->{user_agent}; #Get HTML from a simple GET request $ua->get("http://example.com")->result->body; #Make a POST request and get the JSON result my $rep = $ua->post( "https://jsonplaceholder.typicode.com/" => json => { stage => "Meteor Herd", location => [ [ "space", "colony" ] ], emeralds => 3 } )->result; #JSON decoded to a perl object my $jsonresponse = $rep->json; #JSON decoded to a string my $textrep = $rep->body; [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#read-values-in-the-lrr-database) **Read values in the LRR Database** ---------------------------------------------------------------------------------------------------------------------------------------------------- This uses the excellent [Perl binding libraryarrow-up-right](http://search.cpan.org/~dams/Redis-1.991/lib/Redis.pm) for Redis. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#extract-files-from-the-archive-being-examined) **Extract files from the archive being examined** -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- If you're running 0.5.2 or later: [PreviousGeneric Plugins ("Scripts")chevron-left](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/scripts) Last updated 1 year ago * [Write messages to the Plugin Log](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#write-messages-to-the-plugin-log) * [Make requests to a remote WebService](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#make-requests-to-a-remote-webservice) * [Read values in the LRR Database](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#read-values-in-the-lrr-database) * [Extract files from the archive being examined](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/code-examples#extract-files-from-the-archive-being-examined) Copy my $redis = LANraragi::Model::Config->get_redis; my $value = $redis->get("key"); Copy use LANraragi::Utils::Archive qw(is_file_in_archive extract_file_from_archive); # Check if info.json is in the archive located at $file and get its precise path my $info_path = is_file_in_archive($file, "info.json"); if ($info_path) { #Extract info.json my $filepath = extract_file_from_archive($file, $info_path); #Do whatever you need with the extracted file open( my $fh, '<:encoding(UTF-8)', $filepath ) or die "Could not open $filepath!\n"; while ( my $row = <$fh> ) { #... } #Delete it unlink $filepath; } --- # Database API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#get-database-stats) Get Statistics get https://lrr.tvc-16.science/api/database/stats Get tags from the database, with a value symbolizing their prevalence. Query parameters minweightintegerOptional Add this parameter if you want to only get tags whose weight is at least the given minimum. Default is 1 if not specified, to get all tags. hide\_excluded\_namespacesstringOptional Set to true to exclude namespaces configured in server settings from the results. Default behavior returns all tags. Responses chevron-right 200 Success response application/json namespacestring · nullableOptional Namespace of the tag textstringOptional The tag itself weightintegerOptional Weight of the tag in the database get /database/stats HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#get-database-backup) 🔑 Get a backup JSON get https://lrr.tvc-16.science/api/database/backup Scans the entire database and returns a backup in JSON form. This backup can be reimported manually through the Backup and Restore feature. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json archivesobject\[\]Optional Array of archive metadata Show propertiesplus categoriesobject\[\]Optional Array of category metadata Show propertiesplus tankoubonsobject\[\]Optional Array of tankoubon metadata Example: `{"tankid":"TANK_1749925516","name":"sailor moon","archives":["e69e43e1355267f7d32a4f9b7f2fe108d2401ebf","e69e43e1355267f7d32a4f9b7f2fe108d2401ebg"]}` Show propertiesplus get /database/backup HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#delete-database-isnew) 🔑 Clear All "New" flags delete https://lrr.tvc-16.science/api/database/isnew Clears the "New!" flag on all archives. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` delete /database/isnew HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#post-database-clean) 🔑 Clean the Database post https://lrr.tvc-16.science/api/database/clean Cleans the Database, hiding then removing entries for files that are no longer on the filesystem. Entries that are no longer on the filesystem are only unlinked at first so they don't appear in the UI -- A subsequent run of this cleanup will **delete** unlinked entries. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringOptional Name of the operation successinteger · enumOptional Returns 1 if operation successful, else 0. Possible values: `0``1` deletedintegerOptional Amount of unlinked DB entries that were deleted unlinkedintegerOptional Amount of live DB entries that got unlinked - Run Clean again to delete them. post /database/clean HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#post-database-drop) 🔑 Drop the Database post https://lrr.tvc-16.science/api/database/drop Delete the entire database, including user preferences. This is a rather dangerous endpoint, invoking it might lock you out of the server as a client! Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` post /database/drop HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response [PreviousArchive APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api) [NextCategory APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api) Last updated 2 months ago * [GETGet Statistics](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#get-database-stats) * [GET🔑 Get a backup JSON](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#get-database-backup) * [DELETE🔑 Clear All "New" flags](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#delete-database-isnew) * [POST🔑 Clean the Database](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#post-database-clean) * [POST🔑 Drop the Database](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api#post-database-drop) Copy GET /api/database/stats HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ {\ "namespace": "character",\ "text": "jeanne alter",\ "weight": 2\ },\ {\ "namespace": "character",\ "text": "xuanzang",\ "weight": 2\ },\ {\ "namespace": "parody",\ "text": "fate grand order",\ "weight": 3\ },\ {\ "namespace": null,\ "text": "artbook",\ "weight": 3\ }\ ] Copy GET /api/database/backup HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "archives": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "title": "Fate GO MEMO",\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color, super:test, date_added:1553537258",\ "summary": null,\ "thumbhash": "ec2a0ca3a3da67a9390889f0910fe494241faa9a",\ "filename": "FateGOMEMO"\ },\ {\ "arcid": "d1858d5dc36925aa66be072a97817650d39de166",\ "title": "test title",\ "tags": null,\ "summary": null,\ "thumbhash": "9846bb6d62949b56545c42e88d8010446b65702e",\ "filename": "(Memes)9B789D38B0784C5FBC9D59A9F24D20F2"\ }\ ], "categories": [\ {\ "archives": [],\ "catid": "SET_1749925633",\ "name": "english",\ "search": "language:english"\ }\ ], "tankoubons": [\ {\ "tankid": "TANK_1749925516",\ "name": "sailor moon",\ "archives": [\ "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "d1858d5dc36925aa66be072a97817650d39de166"\ ]\ }\ ] } Copy DELETE /api/database/isnew HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy POST /api/database/clean HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "success": 0, "deleted": 1, "unlinked": 1 } Copy POST /api/database/drop HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Which installation method is best for me? | LANraragi As LRR is a server app first and foremost, its setup is a bit more complex than your usual Desktop application. However, a lot of work as been done behind the scenes to make it easy! Look at the methods below for something that fits your OS and usage. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-macos-homebrew) Linux/macOS: _Homebrew_ ---------------------------------------------------------------------------------------------------------------------------- [Homebrewarrow-up-right](https://brew.sh/) allows you to quickly setup LRR on macOS and Linux without relying on containers or modifying your preinstalled system libaries. [🍎Homebrew (macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos) circle-info While not a part of the main repo, you can check out the [Nix](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community) package as well if brew isn't to your taste. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#windows-10-11-lrr-for-windows) Windows 10/11: _LRR for Windows_ ---------------------------------------------------------------------------------------------------------------------------------------------- circle-exclamation This method works on **64-bit** editions of Windows 10 only. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-51b137f57b9d19b464400f3fb289b571c2f6217e%252Fkaren.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=378dfda8&sv=2) win10 I provide a dedicated installer for Windows machines as of 0.6.0, complete with a GUI and autostart. [🪟LRR for Windows (Win10)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-macos-windows-10-docker) Linux/macOS/Windows 10: _Docker_ ---------------------------------------------------------------------------------------------------------------------------------------------- Taking a page from sysadmin books, you can easily install LRR as a **container** with Docker. They're lightweight, easy to update, and automatically built/tested. I recommend this for NAS setups! [🐳Docker (All platforms)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-macos-installing-from-source) Linux/macOS: _Installing from Source_ -------------------------------------------------------------------------------------------------------------------------------------------------------- Installing from **source** is a more involved procedure, but it does put you in full control and able to hack up the app's files as you wish. [🛠️Source Code (Linux/macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-community-community-provided-install-packages) Linux/Community: _Community provided install packages_ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Ready-to-install packages provided by voluntary maintainers or by a linux distribution itself. [🐧Community (Linux)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#freebsd-jail) FreeBSD/Jail --------------------------------------------------------------------------------------------------------- Similar to installing from source with an altered process for FreeBSD compatability. [👿Jail (FreeBSD)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#windows-7-or-8-dont) Windows 7 or 8: don't ------------------------------------------------------------------------------------------------------------------------- Switch to 10 or Linux. [PreviousLANraragi Documentationchevron-left](https://sugoi.gitbook.io/lanraragi) [NextLRR for Windows (Win10)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows) Last updated 1 day ago * [Linux/macOS: Homebrew](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-macos-homebrew) * [Windows 10/11: LRR for Windows](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#windows-10-11-lrr-for-windows) * [Linux/macOS/Windows 10: Docker](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-macos-windows-10-docker) * [Linux/macOS: Installing from Source](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-macos-installing-from-source) * [Linux/Community: Community provided install packages](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#linux-community-community-provided-install-packages) * [FreeBSD/Jail](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#freebsd-jail) * [Windows 7 or 8: don't](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods#windows-7-or-8-dont) --- # Shinobu API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#get-shinobu) 🔑 Get Shinobu status get https://lrr.tvc-16.science/api/shinobu Get the current status of the FileWatcher. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Status application/json operationstring · enumOptionalPossible values: `shinobu_status` successinteger · enumOptionalPossible values: `0``1` is\_aliveinteger · enumOptionalPossible values: `0``1` pidintegerOptional Current PID of the Watcher process get /shinobu HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Status ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#post-shinobu-stop) 🔑 Stop Shinobu post https://lrr.tvc-16.science/api/shinobu/stop Stops the Filewatcher. Use `/api/shinobu/restart` to start it again. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` post /shinobu/stop HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#post-shinobu-restart) 🔑 Restart Shinobu post https://lrr.tvc-16.science/api/shinobu/restart Restart the Shinobu filewatcher Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Result application/json operationstring · enumOptionalPossible values: `shinobu_restart` successinteger · enumOptionalPossible values: `0``1` new\_pidintegerOptional PID of the new Watcher process. post /shinobu/restart HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#post-shinobu-rescan) 🔑 Rescan filemap and restart Shinobu post https://lrr.tvc-16.science/api/shinobu/rescan This deletes the internal map of scanned files on your system (the "filemap") and restarts Shinobu, effectively prompting a full rescan of your FS. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Result application/json operationstring · enumOptionalPossible values: `shinobu_rescan` successinteger · enumOptionalPossible values: `0``1` new\_pidintegerOptional PID of the new Watcher process. post /shinobu/rescan HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result [PreviousPlugin APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api) [NextMinion APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api) Last updated 2 months ago * [GET🔑 Get Shinobu status](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#get-shinobu) * [POST🔑 Stop Shinobu](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#post-shinobu-stop) * [POST🔑 Restart Shinobu](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#post-shinobu-restart) * [POST🔑 Rescan filemap and restart Shinobu](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api#post-shinobu-rescan) Copy GET /api/shinobu HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "success": 1, "is_alive": 1, "operation": "shinobu_status", "pid": 1608 } Copy POST /api/shinobu/stop HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy POST /api/shinobu/restart HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "shinobu_restart", "success": 1, "new_pid": 1727 } Copy POST /api/shinobu/rescan HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "shinobu_rescan", "success": 1, "new_pid": 1727 } --- # OPDS Catalog | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog#get-opds) Get the OPDS Catalog get https://lrr.tvc-16.science/api/opds Get the Archive Index as an OPDS 1.2 Catalog with PSE 1.1 compatibility. Query parameters categorystringOptional Category ID. If passed, the OPDS catalog will be filtered to only show archives from this category. Responses chevron-right 200 OPDS catalog XML application/xml stringOptional get /opds HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 OPDS catalog XML ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog#get-opds-id) Get a specific archive through OPDS get https://lrr.tvc-16.science/api/opds/{id} Returns a specific OPDS item as XML. This will show only one for the given ID in the result, instead of all the archives. Path parameters idstringRequired Responses chevron-right 200 OPDS entry XML application/xml stringOptional get /opds/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 OPDS entry XML ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog#get-opds-id-pse) OPDS-PSE get https://lrr.tvc-16.science/api/opds/{id}/pse Returns a specific image page for OPDS-PSE as XML. Path parameters idstringRequired Query parameters pageintegerOptional Responses chevron-right 200 Image file for the requested page application/octet-stream string · binaryOptional get /opds/{id}/pse HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Image file for the requested page [PreviousMinion APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api) [NextMiscellaneous other APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api) Last updated 2 months ago * [GETGet the OPDS Catalog](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog#get-opds) * [GETGet a specific archive through OPDS](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog#get-opds-id) * [GETOPDS-PSE](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog#get-opds-id-pse) Copy GET /api/opds HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy urn:lrr:0 LANraragi 2010-01-10T10:03:10Z Welcome to this Library running LANraragi! /favicon.ico 9.9.9 http://github.org/Difegue/LANraragi Fate GO MEMO urn:lrr:28697b96f0ac5858be2614ed10ca47742c9522fd 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z wada rco wadamemo parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color, male:very cool too Fate GO MEMO 2 urn:lrr:2810d5e0a8d027ecefebca6237031a0fa7b91eb3 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z wada rco wadamemo parody:fate grand order, character:abigail williams, character:artoria pendragon alter, character:asterios, character:ereshkigal, character:gilgamesh, character:hans christian andersen, character:hassan of serenity, character:hector, character:helena blavatsky, character:irisviel von einzbern, character:jeanne alter, character:jeanne darc, character:kiara sessyoin, character:kiyohime, character:lancer, character:martha, character:minamoto no raikou, character:mochizuki chiyome, character:mordred pendragon, character:nitocris, character:oda nobunaga, character:osakabehime, character:penthesilea, character:queen of sheba, character:rin tosaka, character:saber, character:sakata kintoki, character:scheherazade, character:sherlock holmes, character:suzuka gozen, character:tamamo no mae, character:ushiwakamaru, character:waver velvet, character:xuanzang, character:zhuge liang, group:wadamemo, artist:wada rco, artbook, full color Ghost in the Shell 1.5 - Human-Error Processor vol01ch01 urn:lrr:4857fd2e7c00db8b0af0337b94055d8445118630 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z shirow masamune artist:shirow masamune Rohan Kishibe goes to Gucci urn:lrr:e4c422fd10943dc169e3489a38cdbf57101a5f7e 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z parody: jojo's bizarre adventure Saturn Backup Cartridge - American Manual urn:lrr:e69e43e1355267f7d32a4f9b7f2fe108d2401ebg 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z character:segata, female:very cool too Saturn Backup Cartridge - Japanese Manual urn:lrr:e69e43e1355267f7d32a4f9b7f2fe108d2401ebf 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z character:segata sanshiro, male:very cool Copy GET /api/opds/{id} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy Aya Sugimoto - [1989.05.15] 杉本彩写真集 Seductive urn:lrr:0a053b3a3960e85c331da2905513a18fa1375d99 2024-07-02T20:40:58Z 2024-07-02T20:40:58Z date_added:1719952858 Copy GET /api/opds/{id}/pse HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary --- # Login Plugins | Nightly Release | LANraragi Login Plugins mostly play a support role: They can be called by all other plugins: Metadata, Downloader and Script Plugins. Their role is to provide a configured [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object that can be used to perform authenticated operations on a remote Web service. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#required-subroutines) Required subroutines ------------------------------------------------------------------------------------------------------------------ Only one subroutine needs to be implemented for the module to be recognized: `do_login`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#expected-input) Expected Input When executing your Plugin, LRR will call the `do_login` subroutine and give it the following variables: Copy sub do_login { #First lines you should have in the subroutine shift; my ($params) = @_; # Plugin parameters The `$params` hash contains the values of the user defined parameters. ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#expected-output) Expected Output Your plugin must return a [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object. That's it! There's no particular error handling for Login Plugins at the moment, so I recommend you return an empty UserAgent if Login fails and handle the error in the matching Metadata/Script plugin. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#plugin-template) Plugin Template -------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#converting-existing-plugins-to-named-parameters) Converting existing plugins to named parameters If you have a plugin that you want to convert to using named parameters check [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) in the [Metadata](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata) section. [PreviousGetting startedchevron-left](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index) [NextMetadata Pluginschevron-right](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/metadata) Last updated 1 year ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#plugin-template) * [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/login#converting-existing-plugins-to-named-parameters) Copy package LANraragi::Plugin::Login::MyNewPlugin; use strict; use warnings; use Mojo::UserAgent; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Login Plugin", type => "login", namespace => "dummylogin", author => "Hackerman", version => "0.001", description => "This is base boilerplate for writing LRR plugins.", #If your plugin uses/needs custom arguments, input their name here. #This name will be displayed in plugin configuration next to an input box. parameters => { 'loginenabled' => {type => "bool", desc => "Enable logging in to service X", default_value => "1"}, 'uid' => {type => "int", desc => "User ID"}, 'password' => {type => "string", desc => "Password"} } ); } # Mandatory function to be implemented by your login plugin # Returns a Mojo::UserAgent object only! sub do_login { # Login plugins only receive the parameters entered by the user. my ( undef, $params ) = @_; my $logger = get_logger( "Undernet Login", "plugins" ); my $ua = Mojo::UserAgent->new; if ($params->{loginenabled}) { $ua->cookie_jar->add( Mojo::Cookie::Response->new( name => 'userID', value => $params->{uid}, domain => 'example.com', path => '/' ) ); $ua->cookie_jar->add( Mojo::Cookie::Response->new( name => 'password', value => $params->{password}, domain => 'example.com', path => '/' ) ); } else { $logger->info( "No cookies provided, returning blank UserAgent."); } return $ua; } 1; --- # Minion API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api#get-minion-jobid) Get the basic status of a Minion Job get https://lrr.tvc-16.science/api/minion/{jobid} For a given Minion job ID, check whether it succeeded or failed. Minion jobs are ran for various occasions like thumbnails, cache warmup and handling incoming files. For some jobs, you can check the notes field for progress information. Look at https://docs.mojolicious.org/Minion/Guide#Job-progress for more information. Path parameters jobidintegerRequired ID of the Job to query status for. Responses chevron-right 200 Job status data application/json taskstringOptional statestring · enumOptionalPossible values: `inactive``active``finished``failed` notesobject · nullableOptional Arbitrary data attached to the Job. errorstring · nullableOptional get /minion/{jobid} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Job status data ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api#get-minion-jobid-detail) 🔑 Get the full status of a Minion Job get https://lrr.tvc-16.science/api/minion/{jobid}/detail Get the status of a Minion Job. This API is there for internal usage mostly, but you can use it to get detailed status for jobs like plugin runs or URL downloads. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters jobidintegerRequired Responses chevron-right 200 Job detail application/json objectOptionalExample: `{"args":["/tmp/QF3UCnKdMr/myfile.zip"],"attempts":1,"children":[],"created":1601145004,"delayed":1601145004,"expires":null,"finished":1601145004,"id":7,"lax":0,"notes":{},"parents":[],"priority":0,"queue":"default","result":{"id":"75d18ce470dc99f83dc355bdad66319d1f33c82b","message":"This file already exists in the Library.","success":0},"retried":null,"retries":0,"started":1601145004,"state":"finished","task":"handle_upload","time":1601145005,"worker":1}` get /minion/{jobid}/detail HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Job detail ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api#post-minion-jobname-queue) 🔑 Queue a Minion job post https://lrr.tvc-16.science/api/minion/{jobname}/queue Queue a Job with the specified type and parameters. See LANraragi::Utils::Minion for all the available types of jobs and the parameters they require. There's no API contract in place for whether a Job type exists on a given server version, so I wouldn't recommend using this unless you have a good reason to. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters jobnamestring · enumRequired Type of the job to instantiate. Possible values: `thumbnail_task``page_thumbnails``regen_all_thumbnails``find_duplicates``build_stat_hashes``handle_upload``download_url``run_plugin` Query parameters argsstringRequired Arguments as a JSON array string priorityintegerOptional Priority of the Minion job. The higher the number, the more important the job is. Responses chevron-right 200 Enqueued job application/json JSON object for a queued Minion job. jobintegerRequired Minion job ID operationstringRequired Name of operation successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `1``0` post /minion/{jobname}/queue HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job [PreviousShinobu APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/shinobu-api) [NextOPDS Catalogchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog) Last updated 2 months ago * [GETGet the basic status of a Minion Job](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api#get-minion-jobid) * [GET🔑 Get the full status of a Minion Job](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api#get-minion-jobid-detail) * [POST🔑 Queue a Minion job](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/minion-api#post-minion-jobname-queue) Copy GET /api/minion/{jobid} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "state": "finished", "task": "handle_upload", "notes": { "example_note": "This note could contain the name of the upload, for example." }, "error": null } Copy GET /api/minion/{jobid}/detail HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "args": [\ "/tmp/QF3UCnKdMr/myfile.zip"\ ], "attempts": 1, "children": [], "created": 1601145004, "delayed": 1601145004, "expires": null, "finished": 1601145004, "id": 7, "lax": 0, "notes": {}, "parents": [], "priority": 0, "queue": "default", "result": { "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b", "message": "This file already exists in the Library.", "success": 0 }, "retried": null, "retries": 0, "started": 1601145004, "state": "finished", "task": "handle_upload", "time": 1601145005, "worker": 1 } Copy POST /api/minion/{jobname}/queue?args=text HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 1, "operation": "text", "success": 1 } --- # LRR for Windows (Win10) | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#download-a-release) Download a Release --------------------------------------------------------------------------------------------------------------------- You can download the latest Windows MSI Installer on the [Release Pagearrow-up-right](https://github.com/Difegue/LANraragi/releases) . Windows 10 1809 is the minimum supported version. Windows 10 2004 and newer are recommended. circle-exclamation If you're using Windows 10 1809, UTF-8 support needs to be enabled. You can find instructions [here](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#mangled-filenames-when-running-on-windows-10-1809) . circle-info Windows Nightlies are available [herearrow-up-right](https://nightly.link/Difegue/LANraragi/workflows/push-continous-delivery/dev) . [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#installation) Installation --------------------------------------------------------------------------------------------------------- Simply execute the installer package. You might get a SmartScreen prompt from Windows as the installer isn't signed; These are perfectly normal. (If you're wondering why I don't sign installers, [thisarrow-up-right](https://web.archive.org/web/20241204064244/https://gaby.dev/posts/code-signing) article is a good read.) Once the install completes properly, you'll be able to launch the GUI from the shortcut in your Start Menu: ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-9560c53e11d68da89271c7a840b112604d8e99c2%252Fkaren-startmenu.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=d9a4556c&sv=2) [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#configuration) 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. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-6974ba4831532f5e0f9409db89ea5b3feb9db8aa%252Fkaren-light.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=22d5ff30&sv=2) Tray GUI and Settings Window You can also decide whether to start the GUI alongside Windows, or start LRR alongside the GUI. Combining the two makes it so that LANraragi starts alongside Windows. 🔥🔥🔥 [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#usage) Usage ------------------------------------------------------------------------------------------- ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-24e9961b1fcb6b93eed91834a45695064d116583%252Fkaren-dark.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=c6f6eddd&sv=2) Tray GUI and Log Console. Check that Dark Theme tho Once the program is running, you can open the Web Client through the shortcut button on the user interface. You can also toggle the Log Console on/off to see what's going on behind the scenes. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#updating) Updating ------------------------------------------------------------------------------------------------- Updates have to be done manually by downloading and running the latest installer. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#uninstallation) Uninstallation ------------------------------------------------------------------------------------------------------------- Simply uninstall the app from Windows Settings. Presto! Your database is not deleted in case you ever fancy coming back. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#troubleshooting) Troubleshooting --------------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#installer-failures) Installer failures Make sure you have the Windows App SDK runtime installed to ensure the tray GUI app can run. A copy can be downloaded here: [https://aka.ms/windowsappsdk/1.7/1.7.250606001/windowsappruntimeinstall-x64.exearrow-up-right](https://aka.ms/windowsappsdk/1.7/1.7.250606001/windowsappruntimeinstall-x64.exe) The tray GUI will show the error message it encountered instead of the LRR Version number if it fails to test the runtime - This might help you troubleshoot further. A detailed error can be found in the log console. Some users reported that antivirus software can block the runtime install portion of the installer, so you might have some luck temporarily disabling it. If you're still getting installer failures past that, try generating a full log of the installer: and open a GitHub issue with it. ### [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#server-isnt-available-on-localhost-3000-even-though-it-has-started-properly) Server isn't available on `localhost:3000` even though it has started properly Running the application as Administrator might fix this in some instances. Otherwise, make sure the Windows Firewall isn't blocking any `perl` process. ### [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#mangled-filenames-when-running-on-windows-10-1809) Mangled filenames when running on Windows 10 1809 This specific version of Windows 10 does not support per application UTF-8 so it needs to be enabled globally. Run `intl.cpl` to open the Region settings, select the "Administrative" tab and click on "Change system locale..." ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-61330944b9b9906826e470798b85e589da778143%252Futf8-region.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=1b229be2&sv=2) In the popup select the "Beta: Use Unicode UTF-8" option. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-e8e6c3aa61d3964de469f70dd4e10653c03ae538%252Futf8-popup.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=3a1b12b2&sv=2) Restart and use the "Rescan content folder" button to fix existing paths. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-746c01fa4c9ac608ff1bc2ba4dec8393fee9fe61%252Futf8-restart.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=94b40eb4&sv=2) [PreviousWhich installation method is best for me?chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/methods) [NextHomebrew (macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos) Last updated 1 day ago * [Download a Release](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#download-a-release) * [Installation](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#installation) * [Configuration](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#configuration) * [Usage](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#usage) * [Updating](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#updating) * [Uninstallation](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#uninstallation) * [Troubleshooting](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#troubleshooting) * [Installer failures](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#installer-failures) * [Server isn't available on localhost:3000 even though it has started properly](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#server-isnt-available-on-localhost-3000-even-though-it-has-started-properly) * [Mangled filenames when running on Windows 10 1809](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/windows#mangled-filenames-when-running-on-windows-10-1809) Copy msiexec /i "lanraragi.msi" /l*v "install.log" --- # Architecture & Style | Nightly Release | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#installation-script) Installation Script ------------------------------------------------------------------------------------------------------------------------------- The _install.pl_ script is essentially a sequence of commands executed to install the backend and frontend dependencies needed to run LRR, as well as basic environment checks. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#specific-environment-variables-you-can-apply-to-change-lrr-behavior) Specific environment variables you can apply to change LRR behavior ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Those variables were introduced for the Homebrew package, but they can be declared at anytime on any type of install; LRR will try to use them. * `LRR_DATA_DIRECTORY` - Data directory override. If this variable is set to a path, said path will house the content folder. * `LRR_THUMB_DIRECTORY` - Thumbnail directory override. If this variable is set to a path, said path will house the generated archive thumbnails. * `LRR_TEMP_DIRECTORY` - Temporary directory override. If this variable is set to a path, the temporary folder will be there instead of `/temp`. * `LRR_LOG_DIRECTORY` - Log directory override. Changes the location of the `log` folder. * `LRR_FORCE_DEBUG` - Debug Mode override. This will force Debug Mode to be enabled regardless of the user setting. * `LRR_NETWORK` - Network Interface. See the dedicated page in Advanced Operations. * `LRR_REDIS_ADDRESS` - Redis address override. This has priority over the `redis_address` specified in `lrr.conf`. * `LRR_DISABLE_OPENAPI` - Disable OpenAPI validation override. If set to `1`, API request/response validation is disabled regardless of the user setting. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#coding-style) Coding Style ----------------------------------------------------------------------------------------------------------------- While Perl's mantra is "There's more than one way to do it", I try to make LRR follow the PBP, aka Perl Best Practices. This is done by the use of the [Perl::Criticarrow-up-right](https://metacpan.org/pod/Perl::Critic) module, which reports PBP violations. If installed, you can run the critic on the entire LRR source tree through the `npm run critic` shortcut command. Critic is automatically run on every commit made to LRR at the level 5 thanks to [GitHub Actionsarrow-up-right](https://github.com/Difegue/LANraragi/blob/dev/.github/main.workflow) . I also run [perltidyarrow-up-right](https://en.wikipedia.org/wiki/PerlTidy) on the source tree every now and then for consistency. The rules used in perltidy passes are stored in the .perltidyrc file at the source root. Some extras: * Code width limit is stupid for long strings and comments (ie the base64 pngs in plugin metadata), which is perltidy's default behavior. * The visual indentation when setting a bunch of variables at once a perltidy thing, but I actually really like it! I leave it in and try to repro it whenever it makes sense. * The codebase does have issues with variable naming -- perl packages usually go for snakecase buuut short variables are ok in flatcase (as per [perlstylearrow-up-right](https://perldoc.perl.org/perlstyle.html) ) * `'`'s should only be used for escaping `"` easily and vice-versa but I don't really care about that one. 😐 A small practice I try to keep on my own for LRR's packages is to use methods (arrow notation, `Class::Name->do_thing`) to call subroutines that take no arguments, and functions (namespace notation, `Class::Name::do_thing($param)`) to call subs with arguments. It doesn't really matter much, but it looks cleaner to me! Also makes it easier if one day I take the OOP pill for this project, as methods always get the current object (or class name) as the first parameter of their call. Packages in the `Utils` folder export most of their functions, as those are used by Plugins as well. I recommend trying to only use exported functions in your code, and consider the rest as internal API suspect to change/breakage. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#main-app-architecture) Main App Architecture ----------------------------------------------------------------------------------------------------------------------------------- [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#shinobu-architecture) Shinobu Architecture --------------------------------------------------------------------------------------------------------------------------------- The Shinobu File Watcher runs in parallel of the LRR Mojolicious Server and handles various tasks: * Scanning the content folder for new archives at start * Keeping track of new/deleted archives using inotify watches * Adding new archives to the database and executing Plugins on them if enabled It's a second process spawned through the Proc::Simple Perl Module. Heavier tasks are handled by a [Minionarrow-up-right](https://docs.mojolicious.org/Minion) Job Queue, which is much more closely linked to Mojo and basically just werks™ [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#about-the-search-cache) About the Search Cache ------------------------------------------------------------------------------------------------------------------------------------- When you perform a search in LRR, that search is saved to a cache in order to be served faster the next time it's queried. This cache is busted as soon as the archive index is modified in any way.(be it editing metadata or adding/removing archives) [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#behaviour-in-debug-mode) Behaviour in Debug Mode --------------------------------------------------------------------------------------------------------------------------------------- In Debug Mode: * The Mojolicious server auto-restarts on every file modification, * Logs are way more detailed, * You get access to Mojolicious logs in LRR's built-in Log View, * A Status dashboard becomes available at `http://LRR_URL/debug`. [hashtag](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#database-architecture) Database Architecture ----------------------------------------------------------------------------------------------------------------------------------- You can look inside the LRR Redis databases at any moment through the `redis-cli` tool. LRR uses three databases to store its own data, and a fourth for the Minion Job Queue. The base architecture is as follows: circle-info The archive IDs computed by LRR are created by taking the first 512KBs of the file, and computing a SHA-1 hash from this data. You can find the code used for the calculation in _LANraragi::Utils::Database_. [PreviousSetup a Development Environmentchevron-left](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/index) [NextTranslating LANraragi to other languageschevron-right](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/translations) Last updated 3 days ago * [Installation Script](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#installation-script) * [Specific environment variables you can apply to change LRR behavior](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#specific-environment-variables-you-can-apply-to-change-lrr-behavior) * [Coding Style](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#coding-style) * [Main App Architecture](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#main-app-architecture) * [Shinobu Architecture](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#shinobu-architecture) * [About the Search Cache](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#about-the-search-cache) * [Behaviour in Debug Mode](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#behaviour-in-debug-mode) * [Database Architecture](https://sugoi.gitbook.io/lanraragi/dev/extending-lanraragi/architecture#database-architecture) Copy root/ |- .devcontainer <- VSCode setup files for Codespaces |- .github <- GitHub-specific files | |- action-run-tests <- Run the LRR Test Suite | |- ISSUE_TEMPLATE <- Template for bug reports | |- workflows <- GitHub Actions workflows | |- CD <- Continuous Delivery, Nightly builds | |- CI <- Tests | +- Release <- Build latest and upload .zip to release post on GH | +- FUNDING.yml <- GitHub Sponsors file | |- content <- Default content folder | |- lib <- Core application code | |- LANraragi.pm <- Entrypoint for the app, contains basic startup code and routing to Controllers | |- Shinobu.pm <- Background Worker (see below) | +- LANraragi | |- Controller <- One Controller per page | | |- Api <- API implementation | | | +- ... | +- *.pm <- Index, Config, Reader, etc. | |- Model <- Application code that doesn't rely on Mojolicious | |- Archive.pm <- Serve files from archives and OPDS catalog | |- Backup.pm <- Encodes/Decodes Backup JSONs | |- Category.pm <- Save/Read Category data | |- Config.pm <- Communicates with the Redis DB to store/retrieve Configuration | |- Plugins.pm <- Executes Plugins on archives | |- Reader.pm <- Archive Extraction | |- Search.pm <- Search Engine | |- Stats.pm <- Tag Cloud and Statistics | +- Upload.pm <- Handle incoming files (Download System) | +- Plugin <- LRR Plugins are stored here | |- Login | |- Metadata | +- Scripts | +- Utils <- Generic Functions | |- *.pm | +- Minion.pm <- Minion jobs are implemented here | |- locales <- Internationalization/Localization files | +- template | |- en.po <- English translations in .po (gettext) format | |- zh.po <- Chinese translations in .po format | |- ... | |- log <- Application Logs end up here | |- public <- Files available to Web Clients | |- css <- Global CSS sheets | |- lrr.css | +- vendor <- Third-party CSS sheets obtained through NPM | |- img <- Image resources | |- js <- JavaScript functions | |- *.js | +- vendor <- Third-party JS obtained through NPM | |- temp <- Archives are extracted in this folder to be served to clients. Also used for thumbnail creation. | | |- server.pid <- PID of the currently running Prefork Manager process, if existing | | |- shinobu.pid <- Last known PID of the Shinobu File Watcher (Serialized Proc::Simple object) | | +- minion.pid <- Last known PID of the Minion Job Queue (Serialized Proc::Simple object) | +- themes <- Contains CSS sheets for Themes. | |- script | |- backup <- Standalone script for running database backups. | |- launcher.pl <- Launcher, uses either Morbo or Prefork to run the bootstrap script | +- lanraragi <- Bootstrap script, starts LANraragi.pm | |- tests <- Tests go here | |- templates <- Templates for Web pages | +- *.html.tt2 | |- tools <- Contains scripts for building and installing LRR. | |- Documentation <- What you're reading right now | |- build <- Build tools and scripts | |- docker <- Dockerfile and configuration files for LRR Docker Container | |- homebrew <- Script and configuration files for the LRR Homebrew cask | |- windows <- MSYS2 Windows build scripts, patches and submodule link to the Karen WPF Bootstrapper | |- cpanfile <- Perl dependencies description | |- install.pl <- LANraragi Installer | +- lanraragi-systemd.service <- Example SystemD service | |- lrr.conf <- Mojolicious configuration file |- .perltidy.rc <- PerlTidy config file to match the coding style |- eslint.config.mjs <- ESLint config file for linting of JavaScript files |- package.json <- NPM file, contains front-end dependency listing and shortcuts +- package-lock.json <- NPM lockfile used by installer/`npm ci` for reproducible builds Copy -Redis Database 1 - Archive & category data | |- SET_xxxxxxxxxx <- A Category. | |- archives <- Serialized array of IDs this category holds (if static) | |- search <- Search predicate of this category (if dynamic) | |- name <- Name of the Category, as set by the User | |- pinned <- Whether the category is pinned in the index or not | |- TANK_xxxxxxxxxx <- A Tankoubon. Tankoubons are Redis sorted sets containing some metadata and a list of Archive IDs. | |- tags (-2) <- Additional tags for the Tankoubon. Tanks collate every tag from the archives they contain by default. | |- summary (-1) <- Dedicated summary for the Tankoubon. | |- name (0) <- Name of the Tankoubon. | |- **************************************** (1) <- First archive in the Tankoubon | |- **************************************** (2) <- Second archive in the Tankoubon | +- etc. (3, 4, 5...) | |- **************************************** <- 40-character long ID for every logged archive | |- tags <- Saved tags | |- summary <- Summary of the archive, as set by the User | |- name <- Name of the archive file, kept for filesystem checks | |- title <- Title of the archive, as set by the User | |- file <- Filesystem path to archive | |- isnew <- Whether the archive has been opened in LRR once or not | |- pagecount <- Number of pages of the archive file | |- progress <- Reading progress, if server-side progress is enabled | +- thumbhash <- SHA-1 hash of the first image of the archive + -Redis Database 2 - Configuration | |- LRR_PLUGIN_xxxxxxx <- Settings for a plugin with namespace xxxxxxx | |- LRR_TOTALPAGESTAT <- Total pages read | |- LRR_FILEMAP <- Shinobu Filemap, maps IDs in the database to their location on the filesystem | |- LRR_CONFIG <- Configuration keys, usually set through the LRR Configuration page. | |- htmltitle | |- motd | |- language <- Forced UI language | |- dirname <- Content directory | |- thumbdir <- Thumbnail directory | |- tempmaxsize <- Temp folder max size | |- enableresize <- Whether automatic image resizing is enabled | |- sizethreshold <- Auto-resizing threshold | |- readerquality <- Auto-resizing quality | |- enablecors <- Whether CORS headers are enabled | |- disableopenapi <- Whether OpenAPI API schema validation is disabled | |- enablemetrics <- Whether metrics exporting is enabled | |- tagruleson <- Whether tag rules are enabled | |- tagrules <- Tag rules, saved as a big ol' string | |- devmode <- Whether debug mode is enabled | |- enablepass <- Enable/Disable Password Authentication. | |- nofunmode <- Whether No-Fun Mode is enabled | |- pagesize <- Amount of archives per Index page | +- apikey <- Key for API requests | |- LRR_DUPLICATE_GROUPS <- Duplicate groups found by duplicate detection | +- dupgp_xxxxxx <- A group of dupe IDs, as a JSON list | +- LRR_TAGRULES <- Computed Tag Rules, as a Redis list -Redis Database 3 - Search indexes | |- LRR_URLMAP <- Maps archive IDs to their source: tag, used by the Downloader system. | |- LRR_STATS <- Redis sorted set used to build the statistics/tag cloud JSON. | |- LRR_UNTAGGED <- Redis set of archive IDs that don't have any tags (except for tags added automatically by the autotagger) | |- LRR_TITLES <- Redis lexicographically sorted set containing all titles in the DB, alongside their ID. (In the "title\0ID" format) | |- INDEX_***:**** <- Each tag(namespaced or not) has a matching Redis set, with all the IDs that have this tag in their metadata. This is used for search indexing. | +- LRR_SEARCHCACHE <- Search Cache |- $columnfilter-$filter-$sortkey-$sortorder-$newonly <- Unique ID for a search. The search result is serialized and saved as the value for this ID. +- --title-asc-0 <- Example ID for a search made on titles with no filters. -Redis Database 4 - Metrics | |- metrics:worker:{PID}:{endpoint_encoded}_{method} <- Per-worker API request metrics | |- count <- Total number of requests | |- duration_sum <- Cumulative request duration in seconds | |- request_size_sum <- Cumulative request payload size in bytes | +- response_size_sum <- Cumulative response payload size in bytes | |- metrics:http:{PID} <- HTTP worker process metrics |- metrics:minion:{PID} <- Minion worker process metrics |- metrics:shinobu:{PID} <- Shinobu worker process metrics | |- cpu_user_seconds_total <- Total user CPU time in seconds | |- cpu_system_seconds_total <- Total system CPU time in seconds | |- cpu_seconds_total <- Total CPU time (user + system) in seconds | |- virtual_memory_bytes <- Virtual memory size in bytes | |- resident_memory_bytes <- Resident memory size in bytes | |- open_fds <- Number of open file descriptors | |- max_fds <- Maximum allowed file descriptors | |- start_time_seconds <- Unix epoch time when process started | |- read_bytes_total <- Total bytes read from storage | +- write_bytes_total <- Total bytes written to storage + --- # Getting Started | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#quick-to-do-list-for-newcomers) Quick To-Do List for newcomers --------------------------------------------------------------------------------------------------------------------------------------------- * Change Security Settings * Enable and configure wanted Plugins to tag your content * Move the Thumbnail Folder to a dedicated folder if you don't want them alongside your content * Change the default Content Folder to your personal folder, or start adding files to the default Content Folder! circle-info If you want to change the used Redis address/database (If you don't know what that means, you don't want to), you can do so by editing the _lrr.conf_ file at the root of the app folder. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#security) Security ------------------------------------------------------------------------------------------------- The first step you'll probably do is head to the Configuration page to modify the default security settings. When logged in as Admin in LRR, you have access to the full functionalities of the app. By default, unlogged users can only **read** archives. There are three basic levels of security you can enable: Security Level Reading Archives Public API Editing Metadata Change Settings Password Disabled ✅ ✅ ✅ ✅ Password Enabled (default) ✅ ✅ ❌ ❌ No-Fun Mode ❌ ❌ ❌ ❌ If you're running the app on a server that's potentially accessible by others, I recommend leaving password protection enabled and changing the default password. If you don't want any page of the app to be accessible to outsiders, you should enable No-Fun Mode **and restart the application** to make sure it is enabled. circle-exclamation If you enable No-Fun Mode, you'll have to set an **API Key** to be able to use the Public API methods. See more information in the API page. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#content-folder) Content Folder ------------------------------------------------------------------------------------------------------------- One of LRR's core concepts is the **content folder.** This folder contains all the user-generated data: * Archives * Thumbnails for said archives * The Redis database (Windows only) By default, this folder is placed at the root of the LRR installation, but you can configure it to use any folder on your machine instead. The content folder is subdirectory-aware, so you can easily drop-in an already sorted collection. The content folder can be read-only if you so desire, but the caveat is that the thumbnail subfolder (`/thumb`) needs write rights to function properly for the time being. See the section below if you want to move the thumbnail subfolder somewhere else. circle-check The following formats are supported by LRR for Archives: * zip/cbz * rar/cbr (up to RAR4 only) * tar.gz/cbt * lzma * 7z/cb7 * xz * pdf * epub (images only if viewed in the Web Client or through the Client API, potentially out of order)\\ circle-info If you plan on setting your content folder to a folder that already contains archives, you might want to enable **some Plugins** beforehand, so that metadata will be fetched for your files as they're added. See the Metadata documentation linked below for more info. However, beware that if you enable plugins that depend on remote services, querying said services to scrap metadata for a large number of archives might lead to **temporary bans**! If you have a large number of archives (More than 500), you might want to ignore Automatic Plugin execution and use [Batch Taggingarrow-up-right](https://github.com/Difegue/LANraragi/blob/master/tools/Documentation/advanced-usage/batch-tagging/README.md) instead. [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#thumbnail-folder) Thumbnail Folder ----------------------------------------------------------------------------------------------------------------- Starting with 0.7.7, the thumbnail folder can be dissociated from the Content Folder, if you want to move it to a SSD or keep your Content Folder fully read-only. circle-exclamation There is no support for moving your thumbnails from the old folder to the new one, so make sure to move them manually once you've switched! [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#plugin-configuration) Plugin Configuration ------------------------------------------------------------------------------------------------------------------------- **Plugins** are used by LANraragi to fetch Metadata for your Archives using various online services. Currently supported out of the box are: * E-Hentai/Exhentai * nHentai * Chaika.moe * .json files embedded into your Archives from the eze userscript * .json files embedded into your Archives from HDoujin Downloader ...and more! See the Adding Metadata section for more information. [✒️Adding Metadatachevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/metadata) [hashtag](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#uploading-archives) Uploading Archives --------------------------------------------------------------------------------------------------------------------- You can add archives to the application by either copying them to the content folder, or using the built-in uploader tool. They'll be automatically indexed and added to the database. Plugins will also be ran automatically to try and fetch metadata for them, if you toggled them in **Plugin Configuration** previously. You can also **queue downloads** by giving URLs to the server in the uploader tool, which will then be downloaded to your content folder seamlessly. See the link below for more details. [⬇️Downloading Archiveschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/downloading) [PreviousJail (FreeBSD)chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail) [NextReading Archiveschevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/archives) Last updated 1 day ago * [Quick To-Do List for newcomers](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#quick-to-do-list-for-newcomers) * [Security](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#security) * [Content Folder](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#content-folder) * [Thumbnail Folder](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#thumbnail-folder) * [Plugin Configuration](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#plugin-configuration) * [Uploading Archives](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps#uploading-archives) --- # Jail (FreeBSD) | LANraragi Installing LANraragi on FreeBSD or in a jail is similar to [installing it from sourcearrow-up-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) with slighly altered dependecies and some extra steps. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#jail-creation) Jail creation -------------------------------------------------------------------------------------------------------- For creating the jail on a regular FreeBSD installation, refer to its [documentationarrow-up-right](https://docs.freebsd.org/doc/7.3-RELEASE/usr/share/doc/handbook/jails-build.html) . For creating the jail on FreeNAS, simply navigate to the jails tab in the webui and click on 'add'. After creating the jail enter it, type `pkg` and confirm the next prompt. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-d1996090681b5d397dff606ec2beacc66fdc6a42%252Fshell.jpg%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=cd51a4d1&sv=2) Entering a jail If you want to install it on the main system itself (which in most cases is not recommended) you can simply skip this step. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#installing-dependencies) Installing dependencies ---------------------------------------------------------------------------------------------------------------------------- It is recommended that you first check/install all neccessary dependecies. Although you can also go along with the installation and fix any critical dependency errors along the way. This will decrease installation size, but most likely result in issues later on. circle-info If you want to configure your jail a little bit leaner you can install the noX11 version of ImageMagick and other dependencies if available. Afterwards, you need to add redis\_enable="YES" to your `rc.conf` with your text editor of choice. The preinstalled one is Easy Editor (`ee`), but you can install `nano` as well. `ee /etc/rc.conf` circle-info You need to restart the jail now so that the changes can take effect (Keep in mind to cd back into your LANraragi folder afterwards or you will have to use the full filepath for the following commands). [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#installing-lanraragi) Installing LANraragi ---------------------------------------------------------------------------------------------------------------------- This step is effectively the same as when [installing from sourcearrow-up-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) . Depending on how you have built your jail you might already have a place to put your installation, else I recommend conforming to Unix standards. After the installer completed you can go ahead and `npm start` You might get an error thrown in on your first startup. It does not appear to affect LANraragi and does not appear on subsequent startups, so do not worry too much about that one too much. Now you can switch over to any device in your network and test if LANraragi is working properly by accessing your\_configured\_ip:3000 You will need to keep the console open during that. If you close it now LANraragi stops as well. We will take care of that in the next step. After checking if everything works you can close down LANraragi either by pressing crtl+C in your console or simply closing the console window. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#setting-up-lanraragi-as-daemon) Setting up LANraragi as Daemon ------------------------------------------------------------------------------------------------------------------------------------------ Now we are setting up LANraragi to autostart when starting the jail. That way it will also keep running until you stop the jail entirely. Now LANraragi should run as a service. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#mountpoints) Mountpoints ---------------------------------------------------------------------------------------------------- In many setups, jails are running on fast but small drives while the bulk of data is offloaded somewhere else. If you are running a similar config you might want to consider offloading your content and tmp folders from your SSD to your HDDs with the help of mountpoints. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-184fb23794fbf2873dc5111155a7790cc0ae90a0%252Fmountpoints.jpg%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=c64b6bc0&sv=2) Mountpoints [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#updating) Updating ---------------------------------------------------------------------------------------------- Updating works the same as when installing from source [installing from sourcearrow-up-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source#updating) . circle-info By default, LRR listens on all IPv4 Interfaces on port 3000, unsecured HTTP. [PreviousCommunity (Linux)chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/community) [NextGetting Startedchevron-right](https://sugoi.gitbook.io/lanraragi/basic-operations/first-steps) Last updated 1 day ago * [Jail creation](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#jail-creation) * [Installing dependencies](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#installing-dependencies) * [Installing LANraragi](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#installing-lanraragi) * [Setting up LANraragi as Daemon](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#setting-up-lanraragi-as-daemon) * [Mountpoints](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#mountpoints) * [Updating](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/jail#updating) Copy pkg update pkg upgrade pkg install gnupg pkg install p5-App-cpanminus pkg install redis pkg install libarchive pkg install ImageMagick7 pkg install libressl pkg install npm pkg install p5-mojolicious pkg install git cpan Parallel::Loops Copy mkdir /usr/local/etc/LANraragi cd /usr/local/etc/LANraragi git clone -b master http://github.com/Difegue/LANraragi /usr/local/etc/LANraragi npm run lanraragi-installer install-full Copy ee /usr/local/etc/LANraragi/lrr Copy #!/bin/share/doc/handbook/jails-build lrr_start() { user='root' cd /usr/local/etc/LANraragi su ${user} -c "/usr/local/bin/npm start /usr/local/etc/LANraragi/" } lrr_start Copy ee /etc/rc.d/lrrd Copy #!/bin/sh . /etc/rc.subr name="lrr" rcvar=`lrrd_enable` command="/usr/local/etc/LANraragi/${name}" run_rc_command "$1" --- # Batch Operations | LANraragi It's a pretty common occurence: You imported archives without enabling automatic tagging, or you suddenly want to add tags to a lot of archives at once. Editing tags manually for each file ain't gonna cut it... Enter **Batch Tagging**, allowing for laser-focus, one-time operations over large sets of archives. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-34922b7a9db9e96dc461bcbb811ca4e325d64236%252Fbatch.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=cc18b5c1&sv=2) Batch Tagging interface as of 0.5.6 All your archives are shown in the checklist on the right, with archives with no tags pre-checked for ease of access. Past that, it's just a matter of selecting what you want to do, optionally plugging in special arguments for the run, and going ham on batching! The currently available operations are: * **Use Plugin**: Use a plugin on the selected archives. The arguments available for overriding will depend on the plugin. * **Apply Tag Rules**: Apply your default [Tag Rules](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules) to the selected archives. * **Clear New**: Remove new flag from selected archives. * **Delete**: Delete the selected archives. circle-info As shown in the screenshot, you can only override **Global Arguments** in Batch Tagging. One-shot arguments, such as specifying a E-Hentai URL, are only available when editing a single archive through the classic Edit menu. If you set a timeout value, the batch session will wait the specified time between archives. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-a8511a5f35207cbdda182616cefab7a91187ef44%252Fbatchlog.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=2525447&sv=2) Batch Tagging status window While a batch session runs, you get a live summary of what the server is doing, and can cancel at any time. [PreviousThemeschevron-left](https://sugoi.gitbook.io/lanraragi/basic-operations/themes) [NextCategorieschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/categories) Last updated 1 day ago --- # Miscellaneous other API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#get-info) Get server info get https://lrr.tvc-16.science/api/info Returns some basic information about the LRR instance this server is running. Responses chevron-right 200 Server info application/json Server info payload emitted by /api/info. Older server versions used integers instead of booleans here. namestringOptional Name of the instance motdstringOptional MOTD of the instance versionstringOptional Version of the server version\_namestringOptional Version name version\_descstringOptional Version description has\_passwordbooleanOptional Whether the instance is password-protected debug\_modebooleanOptional Whether the instance has debug mode enabled nofun\_modebooleanOptional Whether the instance has no-fun mode enabled archives\_per\_pageintegerOptional How many archives per page the server lists server\_resizes\_imagesbooleanOptional Whether the instance auto-downsizes images before serving them server\_tracks\_progressbooleanOptional Whether the instance tracks reading progression server-side authenticated\_progressbooleanOptional Whether the instance requires authentication for server-side progress updates total\_pages\_readintegerOptional Total amount of pages read total\_archivesintegerOptional Total amount of archives stored on instance cache\_last\_clearedintegerOptional Timestamp for last time the search cache was wiped excluded\_namespacesstring\[\]Optional List of tag namespaces excluded from search suggestions and tag statistics get /info HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Server info ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#delete-tempfolder) Clean the Temporary Folder delete https://lrr.tvc-16.science/api/tempfolder Cleans the server's temporary folder. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Cleanup result application/json operationstring · enumOptionalPossible values: `cleantemp` successinteger · enumOptionalPossible values: `0``1` errorstring · nullableOptional Error message if something went wrong during cleanup. (The call will still return 200) newsizeintegerOptional Current size of the temporary folder post-cleanup. delete /tempfolder HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Cleanup result ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#post-download_url) Queue a URL download post https://lrr.tvc-16.science/api/download\_url Add a URL to be downloaded by the server and added to its library. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters urlstring · uriRequired URL to download catidstring · min: 14 · max: 14Optional Category ID to add the downloaded URL to. Responses chevron-right 200 Enqueued job application/json operationstring · enumOptionalPossible values: `download_url` urlstringOptional URL queued for download categorystring · nullableOptional successinteger · enumOptionalPossible values: `0``1` jobintegerOptional chevron-right 400 Bad request application/json post /download\_url HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#post-regen_thumbs) Regenerate Thumbnails post https://lrr.tvc-16.science/api/regen\_thumbs Queue a Minion job to regenerate missing/all thumbnails on the server. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters forcebooleanOptional Whether to generate all thumbnails, or only the missing ones. Responses chevron-right 200 Enqueued job application/json operationstring · enumOptionalPossible values: `regen_thumbnails` successinteger · enumOptionalPossible values: `0``1` jobintegerOptional post /regen\_thumbs HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#metrics) Metrics ---------------------------------------------------------------------------------------------------------------- The `/api/info/metrics` endpoint returns metrics in the [Prometheus exposition formatarrow-up-right](https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-example) . [PreviousOPDS Catalogchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/opds-catalog) [NextGetting startedchevron-right](https://sugoi.gitbook.io/lanraragi/dev/plugin-docs/index) Last updated 3 days ago * [GETGet server info](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#get-info) * [DELETEClean the Temporary Folder](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#delete-tempfolder) * [POSTQueue a URL download](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#post-download_url) * [POSTRegenerate Thumbnails](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#post-regen_thumbs) * [Metrics](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/miscellaneous-other-api#metrics) Copy GET /api/info HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "archives_per_page": 100, "cache_last_cleared": 1728852701, "debug_mode": true, "has_password": false, "name": "LANraragi", "motd": "aye lads time to read some manga", "nofun_mode": false, "server_resizes_images": false, "server_tracks_progress": true, "authenticated_progress": false, "total_archives": 104, "total_pages_read": 252, "version": "0.9.30", "excluded_namespaces": [\ "source",\ "date_added"\ ], "version_desc": "I'm under Japanese influence and my honor's at stake!", "version_name": "Law (Earthlings On Fire)" } Copy DELETE /api/tempfolder HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "cleantemp", "error": null, "newsize": 0, "success": 1 } Copy POST /api/download_url?url=https%3A%2F%2Fexample.com HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 86, "operation": "download_url", "success": 1, "url": "https://example.com" } Copy POST /api/regen_thumbs HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 3, "operation": "regen_thumbnails", "success": 1 } Copy # HELP lanraragi_api_requests_total Total number of API requests # TYPE lanraragi_api_requests_total counter lanraragi_api_requests_total{endpoint="/",method="GET"} 4063 lanraragi_api_requests_total{endpoint="/api/archives/:id",method="DELETE"} 2 lanraragi_api_requests_total{endpoint="/api/archives/:id/categories",method="GET"} 1 lanraragi_api_requests_total{endpoint="/api/archives/:id/files",method="GET"} 7 lanraragi_api_requests_total{endpoint="/api/archives/:id/files/thumbnails",method="POST"} 5 lanraragi_api_requests_total{endpoint="/api/archives/:id/isnew",method="DELETE"} 7 lanraragi_api_requests_total{endpoint="/api/archives/:id/metadata",method="GET"} 8 # ... --- # Backup and Restore | LANraragi This page, available from the top menu once logged in, allows you to backup the entire database to a JSON file. This includes **all your categories**, and for **every file in the database**: * The unique ID of the archive (For the more technologically-enclined: LRR uses a SHA-1 hash of the first 512KBs of the file as the ID) * The saved tags * The saved title This JSON can then be restored in another LRR instance, if it has archives with matching unique IDs. circle-info You can also make backup JSONs with the `npm run backup-db` command or through the Client API. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-90b77c3cef3e1a41d1003a3a10bf062f93470186%252Fbackup.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=1715ab88&sv=2) Average backup.json [PreviousDownloading Archiveschevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/downloading) [NextUsing External Readerschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers) Last updated 1 day ago --- # Downloading Archives | LANraragi Starting with version 0.7.3, LANraragi can directly download URLs to its content folder. This allows you to seamlessly add archives from the Internet to your LRR instance for safekeeping. 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.) circle-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) 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. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-a9dbd110a151183caa2b9b97bae70ef1879aeadb%252Fdownloaders.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=8cd2d53a&sv=2) Downloader Plugins circle-info Just like with Metadata plugins, Downloaders might require using a matching **Login Plugin** to authenticate to the remote website. [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/downloading#browser-extension) Browser Extension ----------------------------------------------------------------------------------------------------------------- You can also install the [Tsukihi Browser Extensionarrow-up-right](https://github.com/Difegue/Tsukihi) to automatically verify/download URLs you browse to your server instance. [PreviousCategorieschevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/categories) [NextBackup and Restorechevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/backup-and-restore) Last updated 1 day ago --- # Categories | LANraragi Categories appear in the archive index as shortcut buttons. There are two distinct kinds: * 📁 Static Categories are arbitrary collections of Archives, where you can add as many items as you want. * ⚡ Dynamic Categories contain all archives matching a given predicate, and automatically update alongside your library. Toggling a category in the index will restrict all your searches to that category, for as long as it is toggled. If you have a lot of categories, the most recently used will appear first in the list. **📌Pinned** Categories will always show first. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-ec2c938b3cfc4d2fd8d3539e00412f18610cf091%252Fcategory_filtered.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=9867bcd5&sv=2) filtered To create categories, you can use the dedicated setting page in the app: circle-info If you have an existing folder hierarchy for your Archives, LRR can automatically create categories from said hierarchy through the dedicated utility Script. Look for it in Plugin Configuration. [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/categories#bookmark-feature) 🔖 Bookmark Feature ----------------------------------------------------------------------------------------------------------------- LANraragi includes a bookmark feature that provides a quick way to add or remove archives from a designated static category. In new installations, a "Favorites" static category is automatically created and linked to this feature. When enabled, a bookmark icon appears next to all archive thumbnails on the homepage and in the reader interface. Clicking this icon instantly adds or removes the archive from the linked category, making content curation faster and more convenient. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-4a257c2958e682d7990b52341472a2bdb6e27e9f%252Fbookmark_button.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=a2f6cc96&sv=2) Bookmark icon You can link the bookmark feature to any static category of your choice. To change which category is used, navigate to the Category Management page, select the desired static category, and enable the "Store Bookmarks in this Category" toggle. circle-info Only static categories can be linked to the bookmark feature. Dynamic categories (those based on search predicates) cannot be used with this feature. To disable the bookmark feature entirely, simply toggle off the "Store Bookmarks in this Category" option for the currently linked category. ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-3e5aabbe5ff1f532dfc44af0eb7b44066b9429e0%252Fbookmark_config.png%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=faf19542&sv=2) Bookmark configuration toggle circle-info If you delete a category that is currently linked to the bookmark feature, the bookmark functionality will be automatically disabled. [PreviousBatch Operationschevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/batch-tagging) [NextDownloading Archiveschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/downloading) Last updated 1 day ago --- # Proxy Setup | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/proxy-setup#setting-up-lanraragi-behind-a-proxy-reverse-proxy-setup) Setting up LANraragi behind a proxy (reverse proxy setup) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- A common post-install setup is to make requests to the app transit through a gateway server such as Apache or nginx. If you do so, please note that archive uploads through LRR will likely **not work out of the box** due to maximum sizes on uploads those servers can enforce. The example below is for nginx: Copy http { client_max_body_size 0; <----------------------- This line here } server { listen 80; server_name lanraragi.[REDACTED].net; return 301 https://$host$request_uri; } server { listen 443 ssl; index index.php index.html index.htm; server_name lanraragi.[REDACTED].net; client_max_body_size 0; <---------- And this line here to disable upload limit proxy_max_temp_file_size 0; <---------- And this line here to support large downloads # Cert Stuff Omitted location / { proxy_pass http://0.0.0.0:3000; proxy_http_version 1.1; <----- The two following lines are needed for batch tagger support with SSL -----> proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } } By default, LRR runs at the server root, e.g. https://lanraragi.example.com/. You may wish to instead run it under a specific URL subdirectory, e.g. https://example.com/lanraragi/. This configuration requires that the reverse proxy be configured to strip the URL prefix from requests before forwarding it. For nginx, this is: After this is done, you need to configure LANraragi to use the new prefix. This is set under `lrr.conf` in the app root directory. Set the variable`base_url_path` as desired, e.g.: Make sure to restart the server after editing `lrr.conf`. This will make the app available under `/lanraragi`. [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/proxy-setup#setting-up-lanraragi-to-use-a-proxy-for-outbound-network-requests) Setting up LANraragi to use a proxy for outbound network requests ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- This is a less common scenario, but you might want to have downloads or metadata requests to external services go through a proxy, in case said external services are blocked by your friendly local totalitarian regime. LANraragi runs on top of the Mojolicious web server, which has [built-inarrow-up-right](https://docs.mojolicious.org/Mojo/UserAgent/Proxy#detect) support for proxifying external requests. To enable automatic proxy detection, the `MOJO_PROXY` environment variable must be set to 1 on your machine: This is enabled by default on Docker builds. Once said detection enabled, environment variables `HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy, NO_PROXY` and `no_proxy` will be checked for proxy information. Here's an example for a Docker-compose setup: [PreviousNetwork Interface Setupchevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces) [NextTag Ruleschevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules) Last updated 1 day ago * [Setting up LANraragi behind a proxy (reverse proxy setup)](https://sugoi.gitbook.io/lanraragi/advanced-usage/proxy-setup#setting-up-lanraragi-behind-a-proxy-reverse-proxy-setup) * [Setting up LANraragi to use a proxy for outbound network requests](https://sugoi.gitbook.io/lanraragi/advanced-usage/proxy-setup#setting-up-lanraragi-to-use-a-proxy-for-outbound-network-requests) Copy server { # ... location /lanraragi { rewrite ^/lanraragi(.*)$ $1 last; # ...rest of the block here } } Copy { # other directives... base_url_path => "/lanraragi", } Copy --- version: "2.1" services: lanraragi: image: difegue/lanraragi:latest container_name: lanraragi environment: - http_proxy=http://192.168.10.186:1082 - https_proxy=http://192.168.10.186:1082 volumes: - [database]:/home/koyomi/lanraragi/database - [content]:/home/koyomi/lanraragi/content ports: - 7070:3000 restart: unless-stopped --- # Docker (All platforms) | LANraragi A Docker image exists for deploying LANraragi installs to your machine easily without disrupting your already-existing web server setup. Docker is the best way to install the software on remote servers. I don't recommand it for Desktop machines and casual users due to it being a bit complex to wield. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#cloning-the-base-lrr-image) Cloning the base LRR image ------------------------------------------------------------------------------------------------------------------------------------ Download [the Docker setuparrow-up-right](https://www.docker.com/products/docker) and install it. circle-exclamation The LRR Docker container uses a fairly recent ([3.14arrow-up-right](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`. Once you're done, execute: Copy 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 \ --mount type=bind,source=[YOUR_THUMBNAIL_DIRECTORY],target=/home/koyomi/lanraragi/thumb difegue/lanraragi circle-info You can tell Docker to auto-restart the LRR container on boot by adding the `--restart always` flag to this command. If you need to sideload plugins, consider adding an additional bind mount for the `/home/koyomi/lanraragi/lib/LANraragi/Plugin/Sideloaded` folder. circle-info Alternatively, if you prefer a `docker-compose.yml` file, use: Copy --- services: lanraragi: image: difegue/lanraragi container_name: lanraragi ports: - "3000:3000" volumes: - [YOUR_CONTENT_DIRECTORY]:/home/koyomi/lanraragi/content - [YOUR_THUMBNAIL_DIRECTORY]:/home/koyomi/lanraragi/thumb - [YOUR_DATABASE_DIRECTORY]:/home/koyomi/lanraragi/database restart: unless-stopped 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. circle-info You can also mount the database/thumbnail directories to dedicated Docker volumes: The volume can be reused when updating, so your database will still follow along even if the container is destroyed. You can always backup the database using LANraragi's internal tool. Once your LANraragi container is loaded, you can access it at [http://localhost:3000arrow-up-right](http://localhost:3000/) . You can use the following commands to stop/start/remove the container(Removing it won't delete the archive directory you specified) : [Tagsarrow-up-right](https://hub.docker.com/r/difegue/lanraragi/tags/) exist for major releases, so you can use those if you want to run another version: `docker run [yadda yadda] difegue/lanraragi:0.4.0` triangle-exclamation If you're feeling **extra dangerous**, you can run the last files directly from the _dev_ branch of the Git repo through the _nightly_ tag: `docker run [zoinks] difegue/lanraragi:nightly` [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#platform-specific-caveats) Platform-specific caveats ---------------------------------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#windows) Windows If you're running on Windows, please check the syntax for mapping your content directory [herearrow-up-right](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. ### [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#raspbian) 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`: Regular versions of Debian shouldn't have this issue. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#changing-the-port) 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 the `LRR_NETWORK` environment variable. [🌐Network Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces) circle-info The default healthchecks of the Docker container base themselves on port 3000. If you use the LRR\_NETWORK variable to change the outgoing port instead of Docker's port mapping, said healthchecks will fail. If you have to use the variable for SSL or the like, I recommend leaving the port in it to 3000 and doing your port mapping on the Docker side. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#changing-the-user-id-in-case-of-permission-issues) Changing the user ID in case of permission issues ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The container runs the software by default using the uid/gid provided by the LRR\_UID/LRR\_GID variables. If you don't specify said variables, the container will run under uid/gid 9001/9001. This is good enough for most scenarios, but in case you need to run it as the current user, you can do the following: `docker run [wassup] -e LRR_UID=``id -u $USER`` -e LRR_GID=``id -g $USER`` difegue/lanraragi` This uses `id` to automatically fetch your userid/groupid. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#skip-permission-fixing) Skip permission fixing ---------------------------------------------------------------------------------------------------------------------------- By default, LANraragi will change the permissions for all files and folders in the thumbnail and content folder during startup: * Everything in the thumbnail folder will be owned by the provided UID/GID (9001/9001 by default) * Files and folders in the thumbnail folder can be read and written by the owner * Files and folders in the content folder are readable by the owner * Folders in the thumbnail/content folder can be executed by the owner While this can resolve some permission issues, but it will result in a longer start-up time for large library and may even prevent the container from starting on Docker Swarm. To disable this behaviour, you can set the environment variable `LRR_AUTOFIX_PERMISSIONS=-1`, but make sure you have manually set the permissions beforehand. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#updating) Updating ------------------------------------------------------------------------------------------------ As Docker containers are immutable, you need to destroy your existing container and build a new one. As long as you use the same content/database directories(or volumes) as before, your data will still be there. circle-info If you update often, you might want to consider using docker-compose or [Portainerarrow-up-right](https://portainer.io/) to redeploy containers without entering the entire configuration every time. [hashtag](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#building-your-own) Building your own ------------------------------------------------------------------------------------------------------------------ The previous setup gets a working LANraragi container from the Docker Hub, but you can build your own bleeding edge version by executing `npm run docker-build` from a cloned Git repo. This will use your cloned Git repo to build the image, modifications you might have made included. Of course, this requires a Docker installation. If you're running WSL1, which can't run Docker natively, you can directly use the Docker for Windows executable with a simple symlink: [PreviousHomebrew (macOS)chevron-left](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/macos) [NextSource Code (Linux/macOS)chevron-right](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/source) Last updated 7 months ago * [Cloning the base LRR image](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#cloning-the-base-lrr-image) * [Platform-specific caveats](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#platform-specific-caveats) * [Windows](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#windows) * [Raspbian](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#raspbian) * [Changing the port](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#changing-the-port) * [Changing the user ID in case of permission issues](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#changing-the-user-id-in-case-of-permission-issues) * [Skip permission fixing](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#skip-permission-fixing) * [Updating](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#updating) * [Building your own](https://sugoi.gitbook.io/lanraragi/installing-lanraragi/docker#building-your-own) Copy docker volume create lrr-database docker volume create lrr-thumbnails docker run --name=lanraragi -p 3000:3000 \ --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],target=/home/koyomi/lanraragi/content \ --mount source=lrr-database,target=/home/koyomi/lanraragi/database \ --mount source=lrr-thumbnails,target=/home/koyomi/lanraragi/thumb \ difegue/lanraragi Copy docker stop lanraragi docker start lanraragi docker rm lanraragi Copy 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 Copy 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 \ --mount type=bind,source=[YOUR_DATABASE_DIRECTORY],target=/home/koyomi/lanraragi/database \ --mount type=bind,source=[YOUR_THUMBNAIL_DIRECTORY],target=/home/koyomi/lanraragi/thumb difegue/lanraragi Copy sudo ln -s '/mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe' \ /usr/local/bin/docker --- # Tag Rules | LANraragi _Tag Rules_ allow you to write rules that will extend the basic functionality of automatic tagging. The rules will be applied to the list of tags returned by the plugins in order to filter or rewrite the tags based on your tastes. _Tag Rules_ must be written one rule per line, without "_comma_" or "_semicolon_" unless they are part of the tag. The format is as follows: * `tag | -tag` : removes the tag * `-namespace:*` : removes all tags within this namespace * `~namespace` : strips the namespace from the tags * `tag -> new-tag` : replaces one tag * `tag => new-tag` : replaces one tag, but uses a hash table internally for faster performance. These rules will be executed **once** after all other rules. * `namespace:* -> new-namespace:*` : replaces the namespace in all tags that contain it Also note that _the match is case insensitive_, but the replacement will keep the case specified in the rule, so you can write this rule Copy serie:one piece -> parody:One Piece to replace `SERIE:ONE PIECE` with `parody:One Piece`. [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules#blacklist) Blacklist ----------------------------------------------------------------------------------------------- This is the simplest list of rules you can write. Both formats are valid: Copy already uploaded forbidden content incomplete ongoing complete various digital translated [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules#advanced-usage) Advanced usage --------------------------------------------------------------------------------------------------------- Combining the above rules, you can make _LRR_ do some work for you. For example the following set of rules: will transform this tag list in this [PreviousProxy Setupchevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/proxy-setup) [NextSetup a Development Environmentchevron-right](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index) Last updated 1 year ago * [Blacklist](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules#blacklist) * [Advanced usage](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules#advanced-usage) Copy -already uploaded -forbidden content -incomplete -ongoing -complete -various -digital -translated Copy -already uploaded -misc:* serie:* -> parody:* various -> various artists ~language Copy already uploaded, misc:ongoing, misc:complete, language:english, serie:one piece, serie:naruto, various, crossover' Copy english, parody:one piece, parody:naruto, various artists, crossover --- # Network Interface Setup | LANraragi By default, LRR listens on all IPv4 Interfaces on port 3000. To change this, you have to specify a different network location when starting the app. [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#building-your-network-location-string) Building your network location string ---------------------------------------------------------------------------------------------------------------------------------------------------------------- The network location format accepted by LRR looks like this: `http(s)://*:(port)` All listen locations [supported by "listen" in Mojo::Server::Daemonarrow-up-right](http://www.mojolicious.org/perldoc/Mojo/Server/Daemon#listen) are valid. For example, if you want to listen on port 5555 with SSL only, the string would look like: `https://*:5555?cert=/path/to/server.crt&key=/path/to/server.key` Once you have your string ready, you can assign it to the environment variable `LRR_NETWORK`. It'll be picked up automagically. circle-info If you're using Docker, remember to mount your cert and keys to a path reachable by the container: The arguments above will resolve within the container's filesystem! [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#source-installs) Source Installs -------------------------------------------------------------------------------------------------------------------- Copy export LRR_NETWORK=http://127.0.0.1:8000 npm start > lanraragi@0.6.0 start /mnt/c/Users/tiki/Desktop/lrr > perl ./script/launcher.pl -f ./script/lanraragi キタ━━━━━━(゚∀゚)━━━━━━!!!!! [LANraragi] [info] LANraragi 0.6.0-BETA.2 (re-)started. (Debug Mode) [...] [Mojolicious] Listening at "http://127.0.0.1:8000" Server available at http://127.0.0.1:8000 [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#docker) Docker -------------------------------------------------------------------------------------------------- [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#docker-with-ssl) Docker with SSL -------------------------------------------------------------------------------------------------------------------- Notice that the certificate and key must come from your host filesystem and henceforth might need a second --mount command. [PreviousUsing External Readerschevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers) [NextProxy Setupchevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/proxy-setup) Last updated 4 years ago * [Building your network location string](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#building-your-network-location-string) * [Source Installs](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#source-installs) * [Docker](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#docker) * [Docker with SSL](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces#docker-with-ssl) Copy docker run --name=lanraragi -p 8000:8000 \ --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],\ target=/home/koyomi/lanraragi/content \ -e LRR_NETWORK=http://*:8000 difegue/lanraragi Copy docker run --name=lanraragi-ssl -p 3333:3333 \ --mount type=bind,source=[YOUR_CONTENT_DIRECTORY],\ target=/home/koyomi/lanraragi/content \ --mount type=bind,source=[DIRECTORY_CONTAINING_SSL_CERT],target=/ssl \ -e LRR_NETWORK="https://*:3333?cert=/ssl/crt.crt&key=/ssl/crt.key" difegue/lanraragi --- # Category API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#get-categories) Get all Categories get https://lrr.tvc-16.science/api/categories Get all the categories saved on the server. Responses chevron-right 200 Categories application/json Category metadata. archivesstring\[\]Optional Array of archive IDs (if this is a static category, empty otherwise) idstring · min: 14 · max: 14Required ID of the category namestringOptional Name of the category pinnedinteger · enumOptional Whether this category should be pinned in the UI Possible values: `0``1` searchstring · nullableOptional Category search filter (if this is a dynamic category, empty otherwise) get /categories HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Categories ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories) 🔑 Create a Category put https://lrr.tvc-16.science/api/categories Create a new Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data namestringRequired Name of the Category. searchstringOptional Matching predicate, if creating a Dynamic Category. pinnedbooleanOptional Add this parameter if you want the created category to be pinned. Responses chevron-right 200 Success response application/json operationstring · enumOptionalPossible values: `create_category` category\_idstring · min: 14 · max: 14Optional ID of the created Category successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json put /categories HTTPchevron-down HTTPcURLJavaScriptPython application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#get-categories-bookmark_link) Get bookmark-linked Category get https://lrr.tvc-16.science/api/categories/bookmark\_link Retrieves the ID of the category currently linked to the bookmark feature. Returns an empty string if no category is linked. Responses chevron-right 200 Link application/json operationstring · enumOptionalPossible values: `get_bookmark_link` successinteger · enumOptionalPossible values: `0``1` category\_idany ofOptional string · min: 14 · max: 14Optional or string · enumOptionalPossible values: get /categories/bookmark\_link HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Link ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#delete-categories-bookmark_link) 🔑 Disable bookmark feature delete https://lrr.tvc-16.science/api/categories/bookmark\_link Disables the bookmark feature by removing the link to any category. Returns the ID of the previously linked category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringOptional category\_idany ofOptional ID of the previously linked category. string · min: 14 · max: 14Optional or string · enumOptionalPossible values: successinteger · enumOptionalPossible values: `0``1` delete /categories/bookmark\_link HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories-bookmark_link-id) 🔑 Update bookmark-linked Category put https://lrr.tvc-16.science/api/categories/bookmark\_link/{id} Links the bookmark feature to the specified static category. This determines which category archives are added to when using the bookmark button. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 14 · max: 14Required Responses chevron-right 200 Success response application/json operationstringOptional category\_idstring · min: 14 · max: 14Optional ID of the category that was linked successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json chevron-right 404 Category with specified ID does not exist application/json put /categories/bookmark\_link/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#get-categories-id) Get a single Category get https://lrr.tvc-16.science/api/categories/{id} Get the details of the specified category ID. Path parameters idstring · min: 14 · max: 14Required Responses chevron-right 200 Category application/json Category metadata. archivesstring\[\]Optional Array of archive IDs (if this is a static category, empty otherwise) idstring · min: 14 · max: 14Required ID of the category namestringOptional Name of the category pinnedinteger · enumOptional Whether this category should be pinned in the UI Possible values: `0``1` searchstring · nullableOptional Category search filter (if this is a dynamic category, empty otherwise) get /categories/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Category ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories-id) 🔑 Update Category put https://lrr.tvc-16.science/api/categories/{id} Modify a Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data namestringOptional New name of the Category searchstringOptional Predicate. Trying to add a predicate to a category that already contains Archives will give you an error. pinnedbooleanOptional Add this argument to pin the Category. If you don't, the category will be unpinned on update. Responses chevron-right 200 Success response application/json operationstring · enumOptionalPossible values: `update_category` category\_idstring · min: 14 · max: 14Optional successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Category is currently locked for modification application/json put /categories/{id} HTTPchevron-down HTTPcURLJavaScriptPython application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#delete-categories-id) 🔑 Delete Category delete https://lrr.tvc-16.science/api/categories/{id} Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 423 The category ID is currently locked for modification application/json delete /categories/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories-id-archive) 🔑 Add an Archive to a Category put https://lrr.tvc-16.science/api/categories/{id}/{archive} Adds the specified Archive ID (see Archive API) to the given Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 14 · max: 14Required Archive ID to add. archivestring · min: 40 · max: 40Required Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 423 The category ID is currently locked for modification application/json put /categories/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#delete-categories-id-archive) 🔑 Remove an Archive from a Category delete https://lrr.tvc-16.science/api/categories/{id}/{archive} Remove an Archive ID from a Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 14 · max: 14Required Archive ID to remove. archivestring · min: 40 · max: 40Required Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 423 The category ID is currently locked for modification application/json delete /categories/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result chevron-down [PreviousDatabase APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api) [NextTankoubon APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api) Last updated 2 months ago * [GETGet all Categories](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#get-categories) * [PUT🔑 Create a Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories) * [GETGet bookmark-linked Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#get-categories-bookmark_link) * [DELETE🔑 Disable bookmark feature](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#delete-categories-bookmark_link) * [PUT🔑 Update bookmark-linked Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories-bookmark_link-id) * [GETGet a single Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#get-categories-id) * [PUT🔑 Update Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories-id) * [DELETE🔑 Delete Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#delete-categories-id) * [PUT🔑 Add an Archive to a Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#put-categories-id-archive) * [DELETE🔑 Remove an Archive from a Category](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api#delete-categories-id-archive) Copy GET /api/categories HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ {\ "id": "SET_1613080290",\ "name": "My great category",\ "pinned": 0,\ "search": null,\ "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "7f03b8b1f337e1e42b2c2890533c0de7479d41ca"\ ]\ }\ ] Copy PUT /api/categories HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded Accept: */* Content-Length: 45 "name='text'&search='text'&pinned=true" Copy { "operation": "create_category", "category_id": "text", "success": 0 } Copy GET /api/categories/bookmark_link HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "operation": "get_bookmark_link", "success": 0, "category_id": "text" } Copy DELETE /api/categories/bookmark_link HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "category_id": "text", "success": 0 } Copy PUT /api/categories/bookmark_link/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "category_id": "text", "success": 0 } Copy GET /api/categories/{id} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "id": "SET_1613080290", "name": "My great category", "pinned": 0, "search": null, "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "7f03b8b1f337e1e42b2c2890533c0de7479d41ca"\ ] } Copy PUT /api/categories/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded Accept: */* Content-Length: 45 "name='text'&search='text'&pinned=true" Copy { "operation": "update_category", "category_id": "text", "success": 0 } Copy DELETE /api/categories/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy PUT /api/categories/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/categories/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Getting started | LANraragi The Client API allows you to communicate with a running LANraragi instance from a dedicated client. All the (public)endpoints below can be tested on the demo! [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/getting-started#authenticating-with-the-api) Authenticating with the API -------------------------------------------------------------------------------------------------------------------------------------------- Most of the API endpoints require a form of authentication. Said authentication is provided by a configurable **API Key,** which is set by the user in the LRR settings. This key must be added to your calls as an `Authorization: Bearer` header, with the key encoded in base64: Copy DELETE /api/search/cache HTTP/1.1 Accept: application/json Authorization: Bearer SEVBVEhFTg== If you fail to meet this requirement, the API endpoint will return error 401 and the following JSON: Copy { "error":"This API is protected and requires login or an API Key." } circle-exclamation If the user's LRR installation is running under **No-Fun Mode**, all API methods will be locked behind the key. Empty API Keys will **not** work, even if there's no key set in Configuration. Private endpoints will be indicated by a 🔑 symbol next to their name in the following sections. [PreviousTranslating LANraragi to other languageschevron-left](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations) [NextSearch APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api) Last updated 3 years ago --- # Tankoubon API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#get-tankoubons) Get all Tankoubons get https://lrr.tvc-16.science/api/tankoubons Get list of Tankoubons paginated. Query parameters pageintegerOptional Page of the list of Tankoubons. The amount of tanks per page depends on the server `archives_per_page` setting. Responses chevron-right 200 Tankoubons application/json resultobject\[\]Optional Tankoubon metadata Example: `{"tankid":"TANK_1749925516","name":"sailor moon","archives":["e69e43e1355267f7d32a4f9b7f2fe108d2401ebf","e69e43e1355267f7d32a4f9b7f2fe108d2401ebg"]}` Show propertiesplus totalintegerOptional Total count of Tankoubons on the server filteredintegerOptional Number of Tankoubons on the current page get /tankoubons HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Tankoubons ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#put-tankoubons) 🔑 Create a Tankoubon put https://lrr.tvc-16.science/api/tankoubons Create a new Tankoubon or update the name of an existing one. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data namestringRequired Name of the Tankoubon tankidstringOptional ID of an existing Tankoubon, if you want to change its name. Responses chevron-right 200 Success response application/json operationstring · enumOptionalPossible values: `create_tankoubon` tankoubon\_idstringOptional ID of the created/modified Tankoubon successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json put /tankoubons HTTPchevron-down HTTPcURLJavaScriptPython application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#get-tankoubons-id) Get a single Tankoubon get https://lrr.tvc-16.science/api/tankoubons/{id} Get the details of the specified tankoubon ID, with the archives list paginated. The amount of archives per page depends on the server `archives_per_page` setting. Path parameters idstringRequired ID of the Tankoubon desired Query parameters include\_full\_databooleanOptional If set to true, a `full_data` array will be added to the response with full Archive metadata. pageintegerOptional Page of the Archives list. You can use -1 to return all archives if needed. Responses chevron-right 200 Tankoubon application/json resultobjectOptional Show propertiesplus totalintegerOptional The total amount of archives in this Tankoubon. filteredintegerOptional The amount of archives in the current page. chevron-right 400 Error response application/json get /tankoubons/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Tankoubon chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#put-tankoubons-id) 🔑 Update Tankoubon metadata/contents put https://lrr.tvc-16.science/api/tankoubons/{id} Modify the full metadata (name, summary, additional tags) or the contents of a Tankoubon. If you only need to change the name of Tank, consider just using PUT `/api/tankoubons`. Note: If there is no need to update something in one of the `data` keys, do not send the key -- This otherwise can result in unwanted results. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstringRequired ID of the Tankoubon to update. Body application/jsonchevron-down application/json archivesstring\[\]Optional Ordered array with the IDs of the archives. metadataobjectOptional Metadata parameters -- All are optional. Show propertiesplus Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json put /tankoubons/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#delete-tankoubons-id) 🔑 Delete Tankoubon delete https://lrr.tvc-16.science/api/tankoubons/{id} Remove a Tankoubon from the server. This doesn't delete underlying Archives. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json delete /tankoubons/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#put-tankoubons-id-archive) 🔑 Add an Archive to a Tankoubon put https://lrr.tvc-16.science/api/tankoubons/{id}/{archive} Append an archive at the final position of a Tankoubon. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstringRequired ID of the Tankoubon to update. archivestring · min: 40 · max: 40Required ID of the Archive to append. Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json put /tankoubons/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#delete-tankoubons-id-archive) 🔑 Remove an Archive from a Tankoubon delete https://lrr.tvc-16.science/api/tankoubons/{id}/{archive} Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstringRequired ID of the Tankoubon to update. archivestring · min: 40 · max: 40Required ID of the Archive to remove. Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json delete /tankoubons/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result chevron-down [PreviousCategory APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/category-api) [NextPlugin APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/plugin-api) Last updated 2 months ago * [GETGet all Tankoubons](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#get-tankoubons) * [PUT🔑 Create a Tankoubon](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#put-tankoubons) * [GETGet a single Tankoubon](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#get-tankoubons-id) * [PUT🔑 Update Tankoubon metadata/contents](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#put-tankoubons-id) * [DELETE🔑 Delete Tankoubon](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#delete-tankoubons-id) * [PUT🔑 Add an Archive to a Tankoubon](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#put-tankoubons-id-archive) * [DELETE🔑 Remove an Archive from a Tankoubon](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/tankoubon-api#delete-tankoubons-id-archive) Copy GET /api/tankoubons HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "result": [\ {\ "tankid": "TANK_1749925516",\ "name": "sailor moon",\ "archives": [\ "e69e43e1355267f7d32a4f9b7f2fe108d2401ebf",\ "e69e43e1355267f7d32a4f9b7f2fe108d2401ebg"\ ]\ }\ ], "total": 1, "filtered": 1 } Copy PUT /api/tankoubons HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded Accept: */* Content-Length: 31 "name='text'&tankid='text'" Copy { "operation": "create_tankoubon", "tankoubon_id": "text", "success": 0 } Copy GET /api/tankoubons/{id} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "result": { "archives": [\ null\ ], "full_data": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color",\ "lastreadtime": 1337038281,\ "title": "Fate GO MEMO",\ "filename": "Fate GO MEMO",\ "summary": null,\ "size": 1234567,\ "toc": [\ {\ "name": "Chapter 1",\ "page": 1\ },\ {\ "name": "Chapter 2",\ "page": 13\ },\ {\ "name": "Chapter 3",\ "page": 25\ }\ ]\ }\ ] }, "total": 1, "filtered": 1 } Copy PUT /api/tankoubons/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/json Accept: */* Content-Length: 79 { "archives": [\ "text"\ ], "metadata": { "name": "text", "summary": "text", "tags": "text" } } Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/tankoubons/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy PUT /api/tankoubons/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/tankoubons/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Using External Readers | LANraragi If the built-in Web Reader is not enough for you, LANraragi's content can be consumed by multiple external applications who provide their own readers. [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#dedicated-lanraragi-readers) Dedicated LANraragi readers ------------------------------------------------------------------------------------------------------------------------------------------ Dedicated LANraragi readers use the Client API to provide an experience closely matching the capabilities of the Web interface. Here are some existing clients: ### [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#ichaival-android) [Ichaival (Android)arrow-up-right](https://github.com/Utazukin/Ichaival) [Download it here.arrow-up-right](https://github.com/Utazukin/Ichaival) **Features:** * View and search your LANraragi database * View tags * Read archives * Bookmark archives to keep track of your current page * Sort archives by date (requires Timestamp tags to be enabled) ### [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#lanreader-ios) [LANreader (iOS)arrow-up-right](https://github.com/Doraemoe/LANreader) [Download it on the App Store.arrow-up-right](https://github.com/Doraemoe/LANreader) ### [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#lrreader-windows-10) [LRReader (Windows 10)arrow-up-right](https://github.com/Guerra24/LRReader) [Download it here.arrow-up-right](https://github.com/Guerra24/LRReader) ![lrreader](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2Fs3.guerra24.net%2Fprojects%2Flrr%2Fscreenshots%2F01.png&width=300&dpr=3&quality=100&sign=74d62a5a&sv=2) **Features:** * Archives list. * Search. * Archive overview and reader. * Bookmarks. * Multiple servers/profiles. * Manage your server from within the app. ### [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#mihon-tachiyomi-android) Mihon / Tachiyomi (Android) [Mihonarrow-up-right](https://mihon.app/) , formerly Tachiyomi, and [its forksarrow-up-right](https://mihon.app/forks/) use extensions that provide sources. The LANraragi extension is part of the [Keiyoushiarrow-up-right](https://github.com/keiyoushi) repository. For automated updates add the repository by following [these instructions.arrow-up-right](https://keiyoushi.github.io/docs/guides/getting-started#adding-the-extension-repo) (recommended) For manual updates search for LANraragi on Keiyoushi's [Extensions page.arrow-up-right](https://keiyoushi.github.io/extensions/) There may be additional repositories not linked here that provide the extension but support is not guaranteed. ### [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#lrr-react-web) LRR React Web ![](https://sugoi.gitbook.io/lanraragi/~gitbook/image?url=https%3A%2F%2F2810982854-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-LPbsOo9_KVq_qSlpg5H-887967055%252Fuploads%252Fgit-blob-3edfa3654b5713ae4ebb969908966f6e7405d32a%252Flrr_react.jpg%3Falt%3Dmedia&width=768&dpr=3&quality=100&sign=eb2a1ca1&sv=2) LRR React-Web A React-based frontend PWA making use of the Client API. "Works best on mobile and tablet viewports, but the desktop experience is okay." Check it out [here.arrow-up-right](https://github.com/hibikikuze4dan/lanraragi-react-web) [hashtag](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#generic-opds-readers) Generic OPDS readers ---------------------------------------------------------------------------------------------------------------------------- Some readers can leverage the [OPDS Catalogarrow-up-right](https://opds.io/) exposed by LANraragi to visualize and read the available archives. Those programs can't exploit all of LRR's features(Search, Database backup), but they might have reading features you won't find in the current dedicated clients. If your OPDS reader supports [Page Streaming Extensionsarrow-up-right](https://anansi-project.github.io/docs/opds-pse/intro) , LANraragi is compatible with it and will serve individual pages. circle-info LRR supports OPDS PSE 1.1, which means that if you have server-side progress tracking enabled, you can pick up where you stopped reading from any OPDS client. Syndication! The URL for the OPDS Catalog is `[YOUR_LANRARAGI_URL]/api/opds`. You can use [the Demoarrow-up-right](https://lrr.tvc-16.science/api/opds) as an example. Refer to your reader's documentation to figure out where to put this URL. circle-exclamation If you have No-Fun Mode enabled, remember that you'll need to add the API Key to this URL for the catalog to be available to your reader application. You can either use the `Bearer` token approach like with regular API calls, or add `?key=[API_KEY]` as a parameter to the URL. The following readers have been tested with the OPDS Catalog: * [**Moon+ Reader (Android)**arrow-up-right](https://play.google.com/store/apps/details?id=com.flyersoft.moonreader) * [**Librera Reader (Android)**arrow-up-right](https://librera.mobi/) * [**Challenger Comics Viewer (Android)**arrow-up-right](https://play.google.com/store/apps/details?id=org.kill.geek.bdviewer) * [**AlfaReader (Windows 7/8/10)**arrow-up-right](https://www.alfareader.org/) The following readers haven't been tested but should work: * [**TiReader (iOS)**arrow-up-right](http://tireader.com/) * [**Chunky Reader (iOS)**arrow-up-right](http://chunkyreader.com/) * [**Panels (iOS)**arrow-up-right](https://panels.app/) [PreviousBackup and Restorechevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/backup-and-restore) [NextNetwork Interface Setupchevron-right](https://sugoi.gitbook.io/lanraragi/advanced-usage/network-interfaces) Last updated 1 day ago * [Dedicated LANraragi readers](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#dedicated-lanraragi-readers) * [Ichaival (Android)](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#ichaival-android) * [LANreader (iOS)](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#lanreader-ios) * [LRReader (Windows 10)](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#lrreader-windows-10) * [Mihon / Tachiyomi (Android)](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#mihon-tachiyomi-android) * [LRR React Web](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#lrr-react-web) * [Generic OPDS readers](https://sugoi.gitbook.io/lanraragi/advanced-usage/external-readers#generic-opds-readers) --- # Translating LANraragi to other languages | LANraragi LRR will automatically render its web UI in the language requested by your web browser's `Accept-Language` header, if it supports it. You can also manually force a specific language in the Configuration page under Global Settings. Unsupported languages will fallback to English. Here are some pointers on contributing additional translations to LANraragi. LRR uses standard `.po` files to contain its localizations. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#using-weblate) Using Weblate --------------------------------------------------------------------------------------------------------------- You can easily contribute to translations to existing or new languages through LRR's Weblate project: https://hosted.weblate.org/projects/lanraragi/lanraragi-source/ Strings submitted to Weblate will be automatically commited to a PR against the base LANraragi GitHub repository. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#translate-text-in-source) Translate text in-source ------------------------------------------------------------------------------------------------------------------------------------- First, open the `locales\template` folder where you will see the current translation files. It's recommended to use the `en.po` file as your base for translation. Next, make a copy of `en.po` and rename it to the language you wish to translate into, for example, `zh.po`. Then, open the `zh.po` file. There, you will see something like this: Copy # Sample Data msgid "" msgstr "" # ------Start of Backup.html.tt2------ msgid "Database Backup/Restore" msgstr "Database Backup/Restore" msgid "You can backup your existing database here, or restore an existing backup." msgstr "You can backup your existing database here, or restore an existing backup." ... For translation purposes, you need only modify the content in `msgstr`. For instance, if you are translating from English to Chinese, you would replace the English in `msgstr` with the corresponding Chinese. For example:`msgstr "Database Backup/Restore"` becomes `msgstr "数据库备份/恢复"`. Continue translating the text within `msgstr` into your language, and that will complete the translation of the text within LANraragi's templates! Here are a few points you might need to pay attention to: 1. Some translation texts include HTML styles. It's advisable not to remove these styles; instead, match the styles with your translated text accordingly. 2. Some translation files contain placeholders. It's crucial not to delete these placeholders. Only translate the content excluding placeholders and then position the placeholders appropriately. For example:`msgstr "Version %1 %2"` should become `msgstr "版本 %1 %2"`. 3. Due to the limitations of `Locale::Maketext`, some special texts require special handling. Currently, there's one known special case:`msgstr "~namespace : strips the namespace from the tags"` Make sure not to discard the `~` when you see the `msgid` for `msgid "namespace : strips the namespace from the tags"`, because `~` is recognized as an escape character in `Locale::Maketext` (though attempts to use `~~` haven't been successfully recognized). [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#handling-missing-translations) Handling missing translations ----------------------------------------------------------------------------------------------------------------------------------------------- If you notice that some texts are missing translations in the relevant `template` files, here is a step-by-step example of how to address this: ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#html) HTML For instance, see the following code in your `index.html.tt2` template: To handle the missing translation, wrap the text with `[% c.lh("...text to be handled...") %]` like this: ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#javascript) Javascript For JS text, you need to replace your hard-coded string with a `I18N.xxxxx` variable/function. For example: will become Then, modify the `i18n.html.tt2` file to include your new variable/function. ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#modifying-the-.po-file) Modifying the .po file Locate `# ------Start of xxxxx.html.tt2------` in the `en.po` file (with xxxxx being either index or i18n in this example), which marks where the corresponding text in the template begins. Add the following entries: Here, `msgid` is used to match the text, and `msgstr` contains the translated text. It is crucial to ensure that the text in `msgid` is exactly as it appears post-modification in your template to ensure proper matching. For example, the code below includes an extra space, causing a mismatch which prevents it from being replaced correctly: ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#placeholders-html) Placeholders (HTML) For special cases, like in `config.html.tt2`, which looks like this: You'll need to use placeholders: In translation files, HTML placeholders should be written as `%number` instead of `[_number]` used in templates. Therefore, it should be: ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#placeholders-javascript) Placeholders (Javascript) For **Javascript**, placeholders instead need to be written like the following: Pay attention to the slash only being present in the msgid. Then, your entry in `i18n.html.tt2` needs to be modified to accomodate for the placeholders being passed at runtime by using a function instead of a constant: and is used like so: ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#special-cases) Special cases There are also peculiar cases such as the following found in `config_tags.html.tt2`: Here, `~` is a designated escape character in `Locale::Maketext`, so including a `~` in `msgid` will prevent proper matching. However, including `~` in `msgstr` won't affect functionality, thus it's preferable to remember this nuance: [PreviousArchitecture & Stylechevron-left](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture) [NextGetting startedchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/getting-started) Last updated 1 day ago * [Using Weblate](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#using-weblate) * [Translate text in-source](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#translate-text-in-source) * [Handling missing translations](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#handling-missing-translations) * [HTML](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#html) * [Javascript](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#javascript) * [Modifying the .po file](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#modifying-the-.po-file) * [Placeholders (HTML)](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#placeholders-html) * [Placeholders (Javascript)](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#placeholders-javascript) * [Special cases](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations#special-cases) Copy Add Archives Copy [% c.lh("Add Archives") %] Copy $("#result").html("Backup failed!"); Copy $("#result").html(I18N.BackupFailed); Copy I18N.BackupFailed = "[% c.lh("Backup failed!") %]"; Copy msgid "Add Archives" msgstr "Add Archives" msgid "Backup failed!" msgid "Backup failed!" Copy [% c.lh("Add Archives ") %] Copy

LANraragi

Version [% version %], "[% vername %]"
Copy

LANraragi

[% c.lh("Version [_1] [_2]", version, vername) %]
Copy msgid "Version %1 %2" msgstr "Version %1 %2" Copy msgid "Changed title to: \${title}" msgstr "Changed title to: ${title}" Copy I18N.BatchChangedTitle = (title) => `[% c.lh("Changed title to: \${title}") %]`; Copy $("#log-container").append(I18N.BatchChangedTitle(msg.title)); Copy
~namespace : strips the namespace from the tags Copy msgid "namespace : strips the namespace from the tags" msgstr "~namespace : strips the namespace from the tags" --- # Search API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api#get-search) Search Archives get https://lrr.tvc-16.science/api/search Search for Archives. You can use the IDs of this JSON with the other endpoints. Query parameters categorystring · min: 14 · max: 14Optional ID of the category you want to restrict this search to. filterstringOptional Search query. You can use the following special characters in it: **Quotation Marks ("...")** Exact string search. Allows a search term to include spaces. Everything placed inside a pair of quotation marks is treated as a singular term. Wildcard characters are still interpreted as wildcards. **Question Mark (?), Underscore (\_)** Wildcard. Can match any single character. **Asterisk (\*), Percentage Sign (%)** Wildcard. Can match any sequence of characters (including none). **Subtraction Sign (-)** Exclusion. When placed before a term, prevents search results from including that term. **Dollar Sign ($)** Add at the end of a tag to perform an exact tag search rather than displaying all elements that start with the term. Only matches tags regardless of search parameters and can be used as an exclusion to ignore misc tags in the search query. startintegerOptional From which archive in the total result count this enumeration should start. The total number of archives displayed depends on the server-side page size preference. From 0.8.2 onwards, you can use "-1" here to get the full, unpaged data. sortbystringOptional Namespace by which you want to sort the results. There are specific sort keys you can use: * _title_ if you want to sort by title * _lastread_ if you want to sort by last read time. (If **Server-side Progress Tracking** is enabled) (Default value is title. If you sort by lastread, IDs that have never been read will be removed from the search.) orderstringOptional Order of the sort, either `asc` or `desc`. newonlybooleanOptional Limit search to new archives only. untaggedonlybooleanOptional Limit search to untagged archives only. groupby\_tanksbooleanOptional Enable or disable Tankoubon grouping. Defaults to true. When enabled, Tankoubons will show in search results, replacing all the archive IDs they contain. Responses chevron-right 200 Search results application/json dataobject\[\]Optional Archive metadata objects for each search result Example: `{"arcid":"28697b96f0ac5858be2614ed10ca47742c9522fd","isnew":false,"extension":"rar","pagecount":34,"progress":3,"tags":"parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color","lastreadtime":1337038281,"title":"Fate GO MEMO","filename":"Fate GO MEMO","summary":null,"size":1234567,"toc":[{"name":"Chapter 1","page":1},{"name":"Chapter 2","page":13},{"name":"Chapter 3","page":25}]}` Show propertiesplus recordsFilteredintegerOptional Amount of archives in the search result recordsTotalintegerOptional Total number of archives available. This result will change depending on the `groupby_tanks` parameter. chevron-right 204 Search engine is not initialized yet. Please wait a few seconds. get /search HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Search results chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api#get-search-random) Search random Archives get https://lrr.tvc-16.science/api/search/random Get randomly selected Archives from the given filter and/or category. Query parameters categorystring · min: 14 · max: 14Optional ID of the category you want to restrict this search to. filterstringOptional Search query. This follows the same rules as the queries in `/api/search`. countintegerOptional How many archives you want to pull randomly. Defaults to 5. If the search doesn't return enough data to match your count, you will get the full search shuffled randomly. newonlybooleanOptional Limit search to new archives only. untaggedonlybooleanOptional Limit search to untagged archives only. groupby\_tanksbooleanOptional Enable or disable Tankoubon grouping. Defaults to true. When enabled, Tankoubons will show in search results, replacing all the archive IDs they contain. Responses chevron-right 200 Search results application/json dataobject\[\]Optional Archive metadata objects for each search result Example: `{"arcid":"28697b96f0ac5858be2614ed10ca47742c9522fd","isnew":false,"extension":"rar","pagecount":34,"progress":3,"tags":"parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color","lastreadtime":1337038281,"title":"Fate GO MEMO","filename":"Fate GO MEMO","summary":null,"size":1234567,"toc":[{"name":"Chapter 1","page":1},{"name":"Chapter 2","page":13},{"name":"Chapter 3","page":25}]}` Show propertiesplus recordsTotalintegerOptional get /search/random HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Search results ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api#delete-search-cache) 🔑 Discard Search Cache delete https://lrr.tvc-16.science/api/search/cache Discard the cache containing previous user searches. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json delete /search/cache HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down [PreviousGetting startedchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/getting-started) [NextArchive APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api) Last updated 1 day ago * [GETSearch Archives](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api#get-search) * [GETSearch random Archives](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api#get-search-random) * [DELETE🔑 Discard Search Cache](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api#delete-search-cache) Copy GET /api/search HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "data": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color",\ "lastreadtime": 1337038281,\ "title": "Fate GO MEMO",\ "filename": "Fate GO MEMO",\ "summary": null\ },\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:jojo's bizarre adventure",\ "lastreadtime": 1337038281,\ "title": "Rohan Kishibe goes to Gucci",\ "filename": "Gucc",\ "summary": "cool summary"\ }\ ], "recordsFiltered": 2, "recordsTotal": 2 } Copy GET /api/search/random HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "data": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:jojo's bizarre adventure",\ "lastreadtime": 1337038281,\ "title": "Rohan Kishibe goes to Gucci",\ "filename": "Gucc",\ "summary": "cool summary"\ }\ ], "recordsTotal": 2 } Copy DELETE /api/search/cache HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Setup a Development Environment | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#quick-rundown) Quick rundown -------------------------------------------------------------------------------------------------------- LRR is written in Perl on the server-side with the help of the [Mojoliciousarrow-up-right](http://mojolicious.org/) framework, with basic JQuery on the clientside. **npm** is used for JavaScript dependency management and basic shortcuts, while **cpanm** is used for Perl dependency management. As of v.0.5.5, a basic Client API is available for you to write clients that can connect to a LANraragi instance. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#quick-setup) Quick setup ---------------------------------------------------------------------------------------------------- Once you've got a running LANraragi instance, you can basically dive right into the files to modify stuff to your needs. As you need raw access to the files, a native OS install is needed! I recommend a Linux or WSL install, as the _morbo_ development server only works on Linux. Said development server can be ran with the `npm run dev-server` command. The major difference is that this server will automatically reload when you modify any file within LANraragi. Background worker included! You'll also probably want to enable **Debug Mode** in the LRR Options, as that will allow you to view debug-tier logs, alongside the raw Mojolicious logs. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#using-msys2) Using MSYS2 ---------------------------------------------------------------------------------------------------- The environment for development is **UCRT64**, other have not been tested. Since Mojolicious and other perl dependencies are not designed to run on Windows they need to be patched. The patches can be found in `tools/build/windows` alongside other utility scripts. You need to provide a redis-compatible server. To setup an environment that can be used for development you need to do the following steps: 1. Update the environment with the `pacman -Syu` command. 2. cd into the LRR directory. 3. Run the script for installing native dependencies `./tools/build/windows/install-deps.sh` 4. Restart the environment (close and open the shell). 5. Run the script for installing perl dependencies `./tools/build/windows/install.sh` Finally you can launch LRR with the `perl ./script/launcher.pl -d -v ./script/lanraragi` command. There is no support for hot-reload, multithreading/multiprocess or a dev server. The only supported Mojo server is Daemon, this applies to development or production installs. ### [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#utf-8-support) UTF-8 support If you have issues with path names getting mangled you need to patch perl to enable support for UTF-8. A recent Windows SDK is required for the patching tools. 1. Open a Visual Studio developer console. 2. cd into `\ucrt64\bin`. 3. Run the `mt.exe -manifest \tools\build\windows\perl.exe.manifest "-outputresource:perl.exe;#1"` command. This will tell perl to use UTF-8 mode and accept any special characters. If you update the environment you might need to patch it again. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#using-github-codespaces) Using Github Codespaces ---------------------------------------------------------------------------------------------------------------------------- The LRR Git repository contains [devcontainer.jsonarrow-up-right](https://github.com/Difegue/LANraragi/tree/dev/.devcontainer) configuration for [Codespacesarrow-up-right](https://github.com/Difegue/LANraragi/codespaces) , so you can easily spin up a development VM using that. Deployment might take some time, as the VM will download all dependencies. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#using-docker-compose) Using Docker Compose ---------------------------------------------------------------------------------------------------------------------- You can use [Docker Composearrow-up-right](https://docs.docker.com/compose/) for quickly bringing up a LANraragi instance suitable for development. Run `docker compose up -d` inside `tools/build/docker` and hack away! [PreviousTag Ruleschevron-left](https://sugoi.gitbook.io/lanraragi/advanced-usage/tag-rules) [NextArchitecture & Stylechevron-right](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture) Last updated 7 months ago * [Quick rundown](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#quick-rundown) * [Quick setup](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#quick-setup) * [Using MSYS2](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#using-msys2) * [UTF-8 support](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#utf-8-support) * [Using Github Codespaces](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#using-github-codespaces) * [Using Docker Compose](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index#using-docker-compose) --- # Database API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#get-database-stats) Get Statistics get https://lrr.tvc-16.science/api/database/stats Get tags from the database, with a value symbolizing their prevalence. Query parameters minweightintegerOptional Add this parameter if you want to only get tags whose weight is at least the given minimum. Default is 1 if not specified, to get all tags. hide\_excluded\_namespacesstringOptional Set to true to exclude namespaces configured in server settings from the results. Default behavior returns all tags. Responses chevron-right 200 Success response application/json namespacestring · nullableOptional Namespace of the tag textstringOptional The tag itself weightintegerOptional Weight of the tag in the database get /database/stats HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#get-database-backup) 🔑 Get a backup JSON get https://lrr.tvc-16.science/api/database/backup Scans the entire database and returns a backup in JSON form. This backup can be reimported manually through the Backup and Restore feature. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json archivesobject\[\]Optional Array of archive metadata Show propertiesplus categoriesobject\[\]Optional Array of category metadata Show propertiesplus tankoubonsobject\[\]Optional Array of tankoubon metadata Example: `{"tankid":"TANK_1749925516","name":"sailor moon","archives":["e69e43e1355267f7d32a4f9b7f2fe108d2401ebf","e69e43e1355267f7d32a4f9b7f2fe108d2401ebg"]}` Show propertiesplus get /database/backup HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#delete-database-isnew) 🔑 Clear All "New" flags delete https://lrr.tvc-16.science/api/database/isnew Clears the "New!" flag on all archives. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` delete /database/isnew HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#post-database-clean) 🔑 Clean the Database post https://lrr.tvc-16.science/api/database/clean Cleans the Database, hiding then removing entries for files that are no longer on the filesystem. Entries that are no longer on the filesystem are only unlinked at first so they don't appear in the UI -- A subsequent run of this cleanup will **delete** unlinked entries. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringOptional Name of the operation successinteger · enumOptional Returns 1 if operation successful, else 0. Possible values: `0``1` deletedintegerOptional Amount of unlinked DB entries that were deleted unlinkedintegerOptional Amount of live DB entries that got unlinked - Run Clean again to delete them. post /database/clean HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#post-database-drop) 🔑 Drop the Database post https://lrr.tvc-16.science/api/database/drop Delete the entire database, including user preferences. This is a rather dangerous endpoint, invoking it might lock you out of the server as a client! Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` post /database/drop HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response [PreviousArchive APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api) [NextCategory APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api) Last updated 1 day ago * [GETGet Statistics](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#get-database-stats) * [GET🔑 Get a backup JSON](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#get-database-backup) * [DELETE🔑 Clear All "New" flags](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#delete-database-isnew) * [POST🔑 Clean the Database](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#post-database-clean) * [POST🔑 Drop the Database](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api#post-database-drop) Copy GET /api/database/stats HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ {\ "namespace": "character",\ "text": "jeanne alter",\ "weight": 2\ },\ {\ "namespace": "character",\ "text": "xuanzang",\ "weight": 2\ },\ {\ "namespace": "parody",\ "text": "fate grand order",\ "weight": 3\ },\ {\ "namespace": null,\ "text": "artbook",\ "weight": 3\ }\ ] Copy GET /api/database/backup HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "archives": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "title": "Fate GO MEMO",\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color, super:test, date_added:1553537258",\ "summary": null,\ "thumbhash": "ec2a0ca3a3da67a9390889f0910fe494241faa9a",\ "filename": "FateGOMEMO"\ },\ {\ "arcid": "d1858d5dc36925aa66be072a97817650d39de166",\ "title": "test title",\ "tags": null,\ "summary": null,\ "thumbhash": "9846bb6d62949b56545c42e88d8010446b65702e",\ "filename": "(Memes)9B789D38B0784C5FBC9D59A9F24D20F2"\ }\ ], "categories": [\ {\ "archives": [],\ "catid": "SET_1749925633",\ "name": "english",\ "search": "language:english"\ }\ ], "tankoubons": [\ {\ "tankid": "TANK_1749925516",\ "name": "sailor moon",\ "archives": [\ "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "d1858d5dc36925aa66be072a97817650d39de166"\ ]\ }\ ] } Copy DELETE /api/database/isnew HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy POST /api/database/clean HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "success": 0, "deleted": 1, "unlinked": 1 } Copy POST /api/database/drop HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Login Plugins | LANraragi Login Plugins mostly play a support role: They can be called by all other plugins: Metadata, Downloader and Script Plugins. Their role is to provide a configured [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object that can be used to perform authenticated operations on a remote Web service. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#required-subroutines) Required subroutines -------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `do_login`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#expected-input) Expected Input When executing your Plugin, LRR will call the `do_login` subroutine and give it the following variables: Copy sub do_login { #First lines you should have in the subroutine shift; my ($params) = @_; # Plugin parameters The `$params` hash contains the values of the user defined parameters. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#expected-output) Expected Output Your plugin must return a [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object. That's it! There's no particular error handling for Login Plugins at the moment, so I recommend you return an empty UserAgent if Login fails and handle the error in the matching Metadata/Script plugin. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#plugin-template) Plugin Template ---------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#converting-existing-plugins-to-named-parameters) Converting existing plugins to named parameters If you have a plugin that you want to convert to using named parameters check [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) in the [Metadata](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata) section. [PreviousGetting startedchevron-left](https://sugoi.gitbook.io/lanraragi/plugin-docs/index) [NextMetadata Pluginschevron-right](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata) Last updated 1 year ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#plugin-template) * [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/plugin-docs/login#converting-existing-plugins-to-named-parameters) Copy package LANraragi::Plugin::Login::MyNewPlugin; use strict; use warnings; use Mojo::UserAgent; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Login Plugin", type => "login", namespace => "dummylogin", author => "Hackerman", version => "0.001", description => "This is base boilerplate for writing LRR plugins.", #If your plugin uses/needs custom arguments, input their name here. #This name will be displayed in plugin configuration next to an input box. parameters => { 'loginenabled' => {type => "bool", desc => "Enable logging in to service X", default_value => "1"}, 'uid' => {type => "int", desc => "User ID"}, 'password' => {type => "string", desc => "Password"} } ); } # Mandatory function to be implemented by your login plugin # Returns a Mojo::UserAgent object only! sub do_login { # Login plugins only receive the parameters entered by the user. my ( undef, $params ) = @_; my $logger = get_logger( "Undernet Login", "plugins" ); my $ua = Mojo::UserAgent->new; if ($params->{loginenabled}) { $ua->cookie_jar->add( Mojo::Cookie::Response->new( name => 'userID', value => $params->{uid}, domain => 'example.com', path => '/' ) ); $ua->cookie_jar->add( Mojo::Cookie::Response->new( name => 'password', value => $params->{password}, domain => 'example.com', path => '/' ) ); } else { $logger->info( "No cookies provided, returning blank UserAgent."); } return $ua; } 1; --- # Plugin API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api#get-plugins-type) 🔑 List available plugins get https://lrr.tvc-16.science/api/plugins/{type} List all plugins of the given type. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters typestring · enumRequired Type of plugins you want to list. You can use "all" to get all types at once. Possible values: `download``login``metadata``script``all` Responses chevron-right 200 Array of plugins application/json Metadata payload for a LRR Plugin. authorstringOptional Author of the plugin descriptionstringOptional Description of the plugin namestringOptional Name of the plugin iconstringOptional Base64 image of the plugin icon typestring · enumOptional Type of the plugin Possible values: `download``login``metadata``script` namespacestringOptional Unique namespace for the plugin parametersobject\[\]Optional Parameter for a LRR Plugin. Example: `{"default_value":0,"desc":"Force resampled archive download","name":"forceresampled","type":"bool"}` Show propertiesplus versionstringOptional Version of the plugin oneshot\_argstring · nullableOptional Description of the manual one-shot argument users can fill in for manual plugin calls url\_regexstring · nullableOptional For downloader plugins, regex where it should be used login\_fromstring · nullableOptional Namespace of the login plugin this plugin depends on get /plugins/{type} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Array of plugins ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api#post-plugins-use) 🔑 Use a Plugin post https://lrr.tvc-16.science/api/plugins/use Uses a Plugin and returns the result. If using a metadata plugin, the matching archive will not be modified in the database. See more info on Plugins in the matching section of the Docs. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters idstring · min: 40 · max: 40Optional ID of the archive to use the Plugin on. This is only mandatory for metadata plugins. pluginstringOptional Namespace of the plugin to use. argstringOptional Optional One-Shot argument to use when executing this Plugin. Responses chevron-right 200 Plugin result application/json operationstring · enumOptionalPossible values: `use_plugin` typestring · enum · nullableOptionalPossible values: `download``login``metadata``script` successinteger · enumOptional Whether the Plugin run succeeded or not. Possible values: `0``1` errorstring · nullableOptional dataobjectOptional Arbitrary data returned by the Plugin. post /plugins/use HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Plugin result ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api#post-plugins-queue) 🔑 Use a Plugin Asynchronously post https://lrr.tvc-16.science/api/plugins/queue Uses a Plugin and returns a Minion Job ID matching the Plugin run. This endpoint is useful if you want to run longer-lived plugins which might timeout if ran with the standard endpoint. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters idstring · min: 40 · max: 40Optional ID of the archive to use the Plugin on. This is only mandatory for metadata plugins. priorityintegerOptional Priority of the Minion job. The higher the number, the more important the job is. pluginstringOptional Namespace of the plugin to use. argstringOptional Optional One-Shot argument to use when executing this Plugin. Responses chevron-right 200 Enqueued job application/json operationstring · enumOptionalPossible values: `queue_plugin_exec` successinteger · enumOptionalPossible values: `0``1` jobintegerOptional ID of the created Minion job post /plugins/queue HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job [PreviousTankoubon APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api) [NextShinobu APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api) Last updated 1 day ago * [GET🔑 List available plugins](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api#get-plugins-type) * [POST🔑 Use a Plugin](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api#post-plugins-use) * [POST🔑 Use a Plugin Asynchronously](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api#post-plugins-queue) Copy GET /api/plugins/{type} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy [\ {\ "author": "Difegue",\ "description": "Searches chaika.moe for tags matching your archive.",\ "icon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA\\nB3RJTUUH4wYCFQocjU4r+QAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUH\\nAAAEZElEQVQ4y42T3WtTdxzGn/M7J+fk5SRpTk7TxMZkXU84tTbVNrUT3YxO7HA4pdtQZDe7cgx2\\ns8vBRvEPsOwFYTDYGJUpbDI2wV04cGXCGFLonIu1L2ptmtrmxeb1JDkvv121ZKVze66f74eH7/f5\\nMmjRwMCAwrt4/9KDpflMJpPHvyiR2DPcJklJ3TRDDa0xk36cvrm8vDwHAAwAqKrqjjwXecPG205w\\nHBuqa9rk77/d/qJYLD7cCht5deQIIczbgiAEKLVAKXWUiqVV06Tf35q8dYVJJBJem2A7Kwi2nQzD\\nZig1CG93+PO5/KN6tf5NKpVqbsBUVVVFUUxwHJc1TXNBoxojS7IbhrnLMMx9pVJlBqFQKBKPxwcB\\nkJYgjKIo3QCE1nSKoghbfJuKRqN2RVXexMaQzWaLezyeEUEQDjscjk78PxFFUYRkMsltJgGA3t7e\\nyMLCwie6rr8iCILVbDbvMgwzYRjGxe0o4XC4s1AoHPP5fMP5/NNOyzLKAO6Ew+HrDADBbre/Ryk9\\nnzx81FXJNlEpVpF+OqtpWu2MpmnXWmH9/f2umZmZi4cOHXnLbILLzOchhz1YerJAs9m1GwRAg2GY\\nh7GYah488BJYzYW+2BD61AFBlmX/1nSNRqN9//792ujoaIPVRMjOKHoie3DytVGmp2fXCAEAjuMm\\nu7u7Umosho6gjL/u/QHeEgvJZHJ2K/D+/fuL4+PjXyvPd5ldkShy1UXcmb4DnjgQj/fd5gDA6/XS\\nYCAwTwh9oT3QzrS1+VDVi+vd3Tsy26yQVoFF3dAXJVmK96p9EJ0iLNOwKKU3CQCk0+lSOpP5WLDz\\nF9Q9kZqyO0SloOs6gMfbHSU5NLRiUOuax2/HyZPHEOsLw2SbP83eu/fLxrkNp9P554XxCzVa16MC\\n7+BPnTk9cfmH74KJE8nmga7Xy5JkZ8VKifGIHpoBb1VX8hNTd3/t/7lQ3OeXfFPvf/jBRw8ezD/a\\n7M/aWq91cGgnJaZ2VcgSdnV1XRNNd3vAoBVVYusmnEQS65hfgSG6c+zy3Kre7nF/KrukcMW0Zg8O\\nD08DoJutDxxOEb5IPUymwrq8ft1gLKfkFojkkRxemERCAQUACPFWRazYLJcrFGwQhyufbQQ7rFpy\\nLMkCwGZC34qPIuwp+XPOjBFwazQ/txrdFS2GGS/Xuj+pUKLGk1Kjvlded3s72lyGW+PLbGVcmrAA\\ngN0wTk1NWYODg9XOKltGtpazi5GigzroUnHN5nUHG1ylRsG7rDXHmnEpu4CeEtEKkqNc6QqlLc/M\\n8uT5lLH5eq0aGxsju1O7GQB498a5s/0x9dRALPaQEDZnYwnhWJtMCCNrjeb0UP34Z6e/PW22zjPP\\n+vwXBwfPvbw38XnXjk7GsiwKAIQQhjAMMrlsam45d+zLH6/8o6vkWcBcrXbVKQhf6bpucCwLjmUB\\nSmmhXC419eblrbD/TAgAkUjE987xE0c7ZDmk66ajUCnq+cL63fErl25s5/8baQPaWLhx6goAAAAA\\nSUVORK5CYII=",\ "name": "Chaika.moe",\ "namespace": "trabant",\ "oneshot_arg": "Chaika Gallery or Archive URL (Will attach matching tags to your archive)",\ "type": "metadata",\ "version": 2.1,\ "parameters": [\ {\ "desc": "ipb_pass_hash cookie",\ "type": "string"\ },\ {\ "default_value": 0,\ "desc": "Force resampled archive download",\ "name": "forceresampled",\ "type": "bool"\ }\ ]\ }\ ] Copy POST /api/plugins/use HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "use_plugin", "success": 1, "type": "metadata", "data": { "new_tags": "pages:45" } } Copy POST /api/plugins/queue HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 86, "operation": "queue_plugin_exec", "success": 1 } --- # Downloader Plugins | LANraragi Downloader Plugins are used as part of LANraragi's built-in downloading feature. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#required-subroutines) Required subroutines ----------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `provide_url`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. Your plugin also needs an extra field in its metadata: `url_regex`, which contains a Regular Expression that'll be used by LANraragi to know if your Downloader should be used. For example, if your regex is `https?:\/\/example.com.*`, LANraragi will invoke your plugin if the user wants to download an URL that comes from `example.com`. circle-info In case of multiple Downloaders matching the given URL, the server will invoke the first plugin that matches. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#expected-input) Expected Input The following section deals with writing the `provide_url` subroutine. When executing your Plugin, LRR will call this subroutine and pass it the following variables: Copy sub provide_url { #First lines you should have in the subroutine shift; my $lrr_info = shift; # Global info hash my ($param1, $param2) = @_; # Plugin parameters The variables match the parameters you've entered in the `plugin_info` subroutine. The `$lrr_info` hash contains three variables you can use in your plugin: * _$lrr\_info->{url}_: The URL that needs to be downloaded. * _$lrr\_info->{user\_agent}_: [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object you can use for web requests. If this plugin depends on a Login plugin, this UserAgent will be pre-configured with the cookies from the Login. * _$lrr\_info->{tempdir}_: A temporary directory path where you can store files. This is useful when you need to download and process multiple images, and are assembling the archive locally. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#expected-output) Expected Output LRR expects Downloaders to return a hash containing either a new URL that can be downloaded directly, _or_ a path to a file that has already been downloaded. For returning a URL to download: `return ( download_url => "http://my.remote.service/download/secret-archive.zip" );` circle-info Said URL should **directly** point to a file -- Any form of HTML will trigger a failed download. For returning a local file path (that you've already downloaded/created): `return ( file_path => "/path/to/downloaded/file.zip" );` If your script errored out, you can immediately stop the plugin execution and tell LRR that an error occurred by throwing an exception: `die "my error :(\n";` or by returning a hash containing an "error" field (**this method is deprecated**): `return ( error => "my error :(" );` If you do this, the error will be logged/displayed to the user. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#plugin-template) Plugin Template ------------------------------------------------------------------------------------------------------- [PreviousMetadata Pluginschevron-left](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata) [NextGeneric Plugins ("Scripts")chevron-right](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts) Last updated 1 day ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/plugin-docs/download#plugin-template) Copy package LANraragi::Plugin::Download::MyNewDownloader; use strict; use warnings; # Plugins can freely use all Perl packages already installed on the system # Try however to restrain yourself to the ones already installed for LRR (see tools/cpanfile) to avoid extra installations by the end-user. use Mojo::UserAgent; # You can also use LRR packages when fitting. # All packages are fair game, but only functions explicitly exported by the Utils packages are supported between versions. # Everything else is considered internal API and can be broken/renamed between versions. use LANraragi::Model::Plugins; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Example.com Downloader", type => "download", namespace => "dummydl", author => "Hackerman", version => "0.1", description => "This is base boilerplate for writing LRR downloaders. Returns a static URL if you try to download a URL from http://example.com.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABZSURBVDhPzY5JCgAhDATzSl+e/2irOUjQSFzQog5hhqIl3uBEHPxIXK7oFXwVE+Hj5IYX4lYVtN6MUW4tGw5jNdjdt5bLkwX1q2rFU0/EIJ9OUEm8xquYOQFEhr9vvu2U8gAAAABJRU5ErkJggg==", # Downloader-specific metadata url_regex => "https?:\/\/example.com.*" ); } ## Mandatory function to be implemented by your script sub provide_url { shift; my $lrr_info = shift; # Global info hash my ($useposts) = @_; # Plugin parameters my $logger = get_logger( "Dingus Downloader", "plugins" ); # Get the url my $url = $lrr_info->{url}; $logger->debug("We have been given the following URL: $url" ); # This is the downloadable url we'll give back. It can be completely different from the base domain provided. my $reply = "https://archive.org/download/quake-essays-sep-15-fin-4-graco-l-cl/QUAKE_essays_SEP15_FIN4_GRACoL_CL.pdf"; # Just for fun, use the provided useragent to see if we've been given a real URL my $ua = $lrr_info->{user_agent}; my $res = $ua->get($url)->result; if ($res->is_success) { return ( download_url => $reply ); } elsif ($res->is_error) { die "Dingus! ".$res->message; } } 1; --- # Generic Plugins ("Scripts") | LANraragi Script Plugins are meant for generic workflows that aren't explicitly supported. The main usecase is essentially for users to script their own API endpoints, since those plugins can easily be invoked through the [Client API](https://sugoi.gitbook.io/lanraragi/api-documentation/getting-started) . [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#required-subroutines) Required subroutines ---------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `run_script`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#expected-input) Expected Input The following section deals with writing the `run_script` subroutine. When executing your Plugin, LRR will call this subroutine and pass it the following variables: Copy sub run_script { #First lines you should have in the subroutine # $lrr_info: global info hash, contains various metadata provided by LRR # %params : plugin parameters shift; my ( $lrr_info, $params ) = @_; The variables match the parameters you've entered in the `plugin_info` subroutine. The `$lrr_info` hash contains two variables you can use in your plugin: * _$lrr\_info->{oneshot\_param}_: Value of your one-shot argument, if it's been set by the User. See below. * _$lrr\_info->{user\_agent}_: [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object you can use for web requests. If this plugin depends on a Login plugin, this UserAgent will be pre-configured with the cookies from the Login. The `$params` hash contains the values of the user defined parameters. #### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#one-shot-runtime-arguments) One-Shot/Runtime Arguments Scripts can have one string argument given to them when executed. If you want the user to be able to enter this override, the `oneshot_arg` field must be present in `plugin_info`, and contain a brief description of what your argument is for. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#expected-output) Expected Output LRR expects Scripts to return a hash, containing the results of whatever operations they ran. This hash is then projected back to the user. `return (total => $filtered, partial_ids => \@ids );` If your script errored out, you can tell LRR that an error occurred by returning a hash containing an "error" field: `return ( error => "my error :(" );` If you do this, the error will be logged/displayed to the user. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#plugin-template) Plugin Template ------------------------------------------------------------------------------------------------------ ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#converting-existing-plugins-to-named-parameters) Converting existing plugins to named parameters If you have a plugin that you want to convert to using named parameters check [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) in the [Metadata](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata) section. [PreviousDownloader Pluginschevron-left](https://sugoi.gitbook.io/lanraragi/plugin-docs/download) [NextCode Exampleschevron-right](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples) Last updated 10 months ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#plugin-template) * [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts#converting-existing-plugins-to-named-parameters) Copy package LANraragi::Plugin::Scripts::MyNewPlugin; use strict; use warnings; # Plugins can freely use all Perl packages already installed on the system # Try however to restrain yourself to the ones already installed for LRR (see tools/cpanfile) to avoid extra installations by the end-user. use Mojo::UserAgent; # You can also use LRR packages when fitting. # All packages are fair game, but only functions explicitly exported by the Utils packages are supported between versions. # Everything else is considered internal API and can be broken/renamed between versions. use LANraragi::Model::Plugins; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Script Boilerplate", type => "script", namespace => "dummyscript", author => "Hackerman", version => "0.1", description => "This is base boilerplate for writing LRR scripts. Uses JSONPlaceholder to return bogus data.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABZSURBVDhPzY5JCgAhDATzSl+e/2irOUjQSFzQog5hhqIl3uBEHPxIXK7oFXwVE+Hj5IYX4lYVtN6MUW4tGw5jNdjdt5bLkwX1q2rFU0/EIJ9OUEm8xquYOQFEhr9vvu2U8gAAAABJRU5ErkJggg==", oneshot_arg => "ID argument for https://jsonplaceholder.typicode.com/", parameters => { 'useposts' => {type => "bool", desc => "Use posts instead of todos (jsonplaceholder)"} } ); } ## Mandatory function to be implemented by your script sub run_script { shift; # $lrr_info: global info hash, contains various metadata provided by LRR # %params : plugin parameters my ( $lrr_info, $params ) = @_; my $logger = get_logger( "Source Finder", "plugins" ); # Get the runtime parameter my $id = $lrr_info->{oneshot_param}; my $url = ""; $logger->debug("useposts = " . $param->{useposts} ); if ($param->{useposts}) { $url = "https://jsonplaceholder.typicode.com/posts/$id"; } else { $url = "https://jsonplaceholder.typicode.com/todos/$id"; } $logger->debug("Loading " . $url ); if ($id eq "") { return ( error => "No ID specified!"); } # Use the provided useragent my $ua = $lrr_info->{user_agent}; my $res = $ua->get($url)->result; if ($res->is_success) { # Return the response JSON directly. return %{$res->json}; } elsif ($res->is_error) { return ( error => $res->message ); } } 1; --- # Code Examples | LANraragi This section contains a few bits of code for things you might want to do with Plugins. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#write-messages-to-the-plugin-log) **Write messages to the Plugin Log** -------------------------------------------------------------------------------------------------------------------------------------------------- Copy # Import the LRR logging module use LANraragi::Utils::Logging qw(get_plugin_logger); # Use the logger to output status - they'll be passed to a specialized logfile and written to STDOUT. my $logger = get_plugin_logger(); $plugin->debug("This message will only show if LRR is in Debug Mode") $plugin->info("You know me the fighting freak Knuckles and we're at Pumpkin Hill"); $plugin->warn("You ready?"); $plugin->error("Oh no"); The logger is a preconfigured [Mojo::Logarrow-up-right](http://mojolicious.org/perldoc/Mojo/Log) object. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#make-requests-to-a-remote-webservice) **Make requests to a remote WebService** ---------------------------------------------------------------------------------------------------------------------------------------------------------- [Mojo::UserAgentarrow-up-right](http://mojolicious.org/perldoc/Mojo/UserAgent) is a full-featured HTTP client coming with LRR you can use. Copy use Mojo::UserAgent; my $ua = $lrr_info->{user_agent}; #Get HTML from a simple GET request $ua->get("http://example.com")->result->body; #Make a POST request and get the JSON result my $rep = $ua->post( "https://jsonplaceholder.typicode.com/" => json => { stage => "Meteor Herd", location => [ [ "space", "colony" ] ], emeralds => 3 } )->result; #JSON decoded to a perl object my $jsonresponse = $rep->json; #JSON decoded to a string my $textrep = $rep->body; [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#read-values-in-the-lrr-database) **Read values in the LRR Database** ------------------------------------------------------------------------------------------------------------------------------------------------ This uses the excellent [Perl binding libraryarrow-up-right](http://search.cpan.org/~dams/Redis-1.991/lib/Redis.pm) for Redis. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#extract-files-from-the-archive-being-examined) **Extract files from the archive being examined** ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- If you're running 0.5.2 or later: [PreviousGeneric Plugins ("Scripts")chevron-left](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts) Last updated 1 year ago * [Write messages to the Plugin Log](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#write-messages-to-the-plugin-log) * [Make requests to a remote WebService](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#make-requests-to-a-remote-webservice) * [Read values in the LRR Database](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#read-values-in-the-lrr-database) * [Extract files from the archive being examined](https://sugoi.gitbook.io/lanraragi/plugin-docs/code-examples#extract-files-from-the-archive-being-examined) Copy my $redis = LANraragi::Model::Config->get_redis; my $value = $redis->get("key"); Copy use LANraragi::Utils::Archive qw(is_file_in_archive extract_file_from_archive); # Check if info.json is in the archive located at $file and get its precise path my $info_path = is_file_in_archive($file, "info.json"); if ($info_path) { #Extract info.json my $filepath = extract_file_from_archive($file, $info_path); #Do whatever you need with the extracted file open( my $fh, '<:encoding(UTF-8)', $filepath ) or die "Could not open $filepath!\n"; while ( my $row = <$fh> ) { #... } #Delete it unlink $filepath; } --- # Shinobu API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#get-shinobu) 🔑 Get Shinobu status get https://lrr.tvc-16.science/api/shinobu Get the current status of the FileWatcher. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Status application/json operationstring · enumOptionalPossible values: `shinobu_status` successinteger · enumOptionalPossible values: `0``1` is\_aliveinteger · enumOptionalPossible values: `0``1` pidintegerOptional Current PID of the Watcher process get /shinobu HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Status ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#post-shinobu-stop) 🔑 Stop Shinobu post https://lrr.tvc-16.science/api/shinobu/stop Stops the Filewatcher. Use `/api/shinobu/restart` to start it again. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` post /shinobu/stop HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#post-shinobu-restart) 🔑 Restart Shinobu post https://lrr.tvc-16.science/api/shinobu/restart Restart the Shinobu filewatcher Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Result application/json operationstring · enumOptionalPossible values: `shinobu_restart` successinteger · enumOptionalPossible values: `0``1` new\_pidintegerOptional PID of the new Watcher process. post /shinobu/restart HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#post-shinobu-rescan) 🔑 Rescan filemap and restart Shinobu post https://lrr.tvc-16.science/api/shinobu/rescan This deletes the internal map of scanned files on your system (the "filemap") and restarts Shinobu, effectively prompting a full rescan of your FS. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Result application/json operationstring · enumOptionalPossible values: `shinobu_rescan` successinteger · enumOptionalPossible values: `0``1` new\_pidintegerOptional PID of the new Watcher process. post /shinobu/rescan HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result [PreviousPlugin APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api) [NextMinion APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api) Last updated 1 day ago * [GET🔑 Get Shinobu status](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#get-shinobu) * [POST🔑 Stop Shinobu](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#post-shinobu-stop) * [POST🔑 Restart Shinobu](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#post-shinobu-restart) * [POST🔑 Rescan filemap and restart Shinobu](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api#post-shinobu-rescan) Copy GET /api/shinobu HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "success": 1, "is_alive": 1, "operation": "shinobu_status", "pid": 1608 } Copy POST /api/shinobu/stop HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy POST /api/shinobu/restart HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "shinobu_restart", "success": 1, "new_pid": 1727 } Copy POST /api/shinobu/rescan HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "shinobu_rescan", "success": 1, "new_pid": 1727 } --- # Minion API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api#get-minion-jobid) Get the basic status of a Minion Job get https://lrr.tvc-16.science/api/minion/{jobid} For a given Minion job ID, check whether it succeeded or failed. Minion jobs are ran for various occasions like thumbnails, cache warmup and handling incoming files. For some jobs, you can check the notes field for progress information. Look at https://docs.mojolicious.org/Minion/Guide#Job-progress for more information. Path parameters jobidintegerRequired ID of the Job to query status for. Responses chevron-right 200 Job status data application/json taskstringOptional statestring · enumOptionalPossible values: `inactive``active``finished``failed` notesobject · nullableOptional Arbitrary data attached to the Job. errorstring · nullableOptional get /minion/{jobid} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Job status data ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api#get-minion-jobid-detail) 🔑 Get the full status of a Minion Job get https://lrr.tvc-16.science/api/minion/{jobid}/detail Get the status of a Minion Job. This API is there for internal usage mostly, but you can use it to get detailed status for jobs like plugin runs or URL downloads. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters jobidintegerRequired Responses chevron-right 200 Job detail application/json objectOptionalExample: `{"args":["/tmp/QF3UCnKdMr/myfile.zip"],"attempts":1,"children":[],"created":1601145004,"delayed":1601145004,"expires":null,"finished":1601145004,"id":7,"lax":0,"notes":{},"parents":[],"priority":0,"queue":"default","result":{"id":"75d18ce470dc99f83dc355bdad66319d1f33c82b","message":"This file already exists in the Library.","success":0},"retried":null,"retries":0,"started":1601145004,"state":"finished","task":"handle_upload","time":1601145005,"worker":1}` get /minion/{jobid}/detail HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Job detail ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api#post-minion-jobname-queue) 🔑 Queue a Minion job post https://lrr.tvc-16.science/api/minion/{jobname}/queue Queue a Job with the specified type and parameters. See LANraragi::Utils::Minion for all the available types of jobs and the parameters they require. There's no API contract in place for whether a Job type exists on a given server version, so I wouldn't recommend using this unless you have a good reason to. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters jobnamestring · enumRequired Type of the job to instantiate. Possible values: `thumbnail_task``page_thumbnails``regen_all_thumbnails``find_duplicates``build_stat_hashes``handle_upload``download_url``run_plugin` Query parameters argsstringRequired Arguments as a JSON array string priorityintegerOptional Priority of the Minion job. The higher the number, the more important the job is. Responses chevron-right 200 Enqueued job application/json JSON object for a queued Minion job. jobintegerRequired Minion job ID operationstringRequired Name of operation successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `1``0` post /minion/{jobname}/queue HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job [PreviousShinobu APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/shinobu-api) [NextOPDS Catalogchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog) Last updated 1 day ago * [GETGet the basic status of a Minion Job](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api#get-minion-jobid) * [GET🔑 Get the full status of a Minion Job](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api#get-minion-jobid-detail) * [POST🔑 Queue a Minion job](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api#post-minion-jobname-queue) Copy GET /api/minion/{jobid} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "state": "finished", "task": "handle_upload", "notes": { "example_note": "This note could contain the name of the upload, for example." }, "error": null } Copy GET /api/minion/{jobid}/detail HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "args": [\ "/tmp/QF3UCnKdMr/myfile.zip"\ ], "attempts": 1, "children": [], "created": 1601145004, "delayed": 1601145004, "expires": null, "finished": 1601145004, "id": 7, "lax": 0, "notes": {}, "parents": [], "priority": 0, "queue": "default", "result": { "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b", "message": "This file already exists in the Library.", "success": 0 }, "retried": null, "retries": 0, "started": 1601145004, "state": "finished", "task": "handle_upload", "time": 1601145005, "worker": 1 } Copy POST /api/minion/{jobname}/queue?args=text HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 1, "operation": "text", "success": 1 } --- # Architecture & Style | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#installation-script) Installation Script --------------------------------------------------------------------------------------------------------------------------- The _install.pl_ script is essentially a sequence of commands executed to install the backend and frontend dependencies needed to run LRR, as well as basic environment checks. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#specific-environment-variables-you-can-apply-to-change-lrr-behavior) Specific environment variables you can apply to change LRR behavior --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Those variables were introduced for the Homebrew package, but they can be declared at anytime on any type of install; LRR will try to use them. * `LRR_DATA_DIRECTORY` - Data directory override. If this variable is set to a path, said path will house the content folder. * `LRR_THUMB_DIRECTORY` - Thumbnail directory override. If this variable is set to a path, said path will house the generated archive thumbnails. * `LRR_TEMP_DIRECTORY` - Temporary directory override. If this variable is set to a path, the temporary folder will be there instead of `/temp`. * `LRR_LOG_DIRECTORY` - Log directory override. Changes the location of the `log` folder. * `LRR_FORCE_DEBUG` - Debug Mode override. This will force Debug Mode to be enabled regardless of the user setting. * `LRR_NETWORK` - Network Interface. See the dedicated page in Advanced Operations. * `LRR_REDIS_ADDRESS` - Redis address override. This has priority over the `redis_address` specified in `lrr.conf`. * `LRR_DISABLE_OPENAPI` - Disable OpenAPI validation override. If set to `1`, API request/response validation is disabled regardless of the user setting. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#coding-style) Coding Style ------------------------------------------------------------------------------------------------------------- While Perl's mantra is "There's more than one way to do it", I try to make LRR follow the PBP, aka Perl Best Practices. This is done by the use of the [Perl::Criticarrow-up-right](https://metacpan.org/pod/Perl::Critic) module, which reports PBP violations. If installed, you can run the critic on the entire LRR source tree through the `npm run critic` shortcut command. Critic is automatically run on every commit made to LRR at the level 5 thanks to [GitHub Actionsarrow-up-right](https://github.com/Difegue/LANraragi/blob/master/.github/main.workflow) . I also run [perltidyarrow-up-right](https://en.wikipedia.org/wiki/PerlTidy) on the source tree every now and then for consistency. The rules used in perltidy passes are stored in the .perltidyrc file at the source root. Some extras: * Code width limit is stupid for long strings and comments (ie the base64 pngs in plugin metadata), which is perltidy's default behavior. * The visual indentation when setting a bunch of variables at once a perltidy thing, but I actually really like it! I leave it in and try to repro it whenever it makes sense. * The codebase does have issues with variable naming -- perl packages usually go for snakecase buuut short variables are ok in flatcase (as per [perlstylearrow-up-right](https://perldoc.perl.org/perlstyle.html) ) * `'`'s should only be used for escaping `"` easily and vice-versa but I don't really care about that one. 😐 A small practice I try to keep on my own for LRR's packages is to use methods (arrow notation, `Class::Name->do_thing`) to call subroutines that take no arguments, and functions (namespace notation, `Class::Name::do_thing($param)`) to call subs with arguments. It doesn't really matter much, but it looks cleaner to me! Also makes it easier if one day I take the OOP pill for this project, as methods always get the current object (or class name) as the first parameter of their call. Packages in the `Utils` folder export most of their functions, as those are used by Plugins as well. I recommend trying to only use exported functions in your code, and consider the rest as internal API suspect to change/breakage. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#main-app-architecture) Main App Architecture ------------------------------------------------------------------------------------------------------------------------------- [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#shinobu-architecture) Shinobu Architecture ----------------------------------------------------------------------------------------------------------------------------- The Shinobu File Watcher runs in parallel of the LRR Mojolicious Server and handles various tasks: * Scanning the content folder for new archives at start * Keeping track of new/deleted archives using inotify watches * Adding new archives to the database and executing Plugins on them if enabled It's a second process spawned through the Proc::Simple Perl Module. Heavier tasks are handled by a [Minionarrow-up-right](https://docs.mojolicious.org/Minion) Job Queue, which is much more closely linked to Mojo and basically just werks™ [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#about-the-search-cache) About the Search Cache --------------------------------------------------------------------------------------------------------------------------------- When you perform a search in LRR, that search is saved to a cache in order to be served faster the next time it's queried. This cache is busted as soon as the archive index is modified in any way.(be it editing metadata or adding/removing archives) [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#behaviour-in-debug-mode) Behaviour in Debug Mode ----------------------------------------------------------------------------------------------------------------------------------- In Debug Mode: * The Mojolicious server auto-restarts on every file modification, * Logs are way more detailed, * You get access to Mojolicious logs in LRR's built-in Log View, * A Status dashboard becomes available at `http://LRR_URL/debug`. [hashtag](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#database-architecture) Database Architecture ------------------------------------------------------------------------------------------------------------------------------- You can look inside the LRR Redis databases at any moment through the `redis-cli` tool. LRR uses three databases to store its own data, and a fourth for the Minion Job Queue. The base architecture is as follows: circle-info The archive IDs computed by LRR are created by taking the first 512KBs of the file, and computing a SHA-1 hash from this data. You can find the code used for the calculation in _LANraragi::Utils::Database_. [PreviousSetup a Development Environmentchevron-left](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/index) [NextTranslating LANraragi to other languageschevron-right](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/translations) Last updated 1 day ago * [Installation Script](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#installation-script) * [Specific environment variables you can apply to change LRR behavior](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#specific-environment-variables-you-can-apply-to-change-lrr-behavior) * [Coding Style](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#coding-style) * [Main App Architecture](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#main-app-architecture) * [Shinobu Architecture](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#shinobu-architecture) * [About the Search Cache](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#about-the-search-cache) * [Behaviour in Debug Mode](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#behaviour-in-debug-mode) * [Database Architecture](https://sugoi.gitbook.io/lanraragi/extending-lanraragi/architecture#database-architecture) Copy root/ |- .devcontainer <- VSCode setup files for Codespaces |- .github <- GitHub-specific files | |- action-run-tests <- Run the LRR Test Suite | |- ISSUE_TEMPLATE <- Template for bug reports | |- workflows <- GitHub Actions workflows | |- CD <- Continuous Delivery, Nightly builds | |- CI <- Tests | +- Release <- Build latest and upload .zip to release post on GH | +- FUNDING.yml <- GitHub Sponsors file | |- content <- Default content folder | |- lib <- Core application code | |- LANraragi.pm <- Entrypoint for the app, contains basic startup code and routing to Controllers | |- Shinobu.pm <- Background Worker (see below) | +- LANraragi | |- Controller <- One Controller per page | | |- Api <- API implementation | | | +- ... | +- *.pm <- Index, Config, Reader, etc. | |- Model <- Application code that doesn't rely on Mojolicious | |- Archive.pm <- Serve files from archives and OPDS catalog | |- Backup.pm <- Encodes/Decodes Backup JSONs | |- Category.pm <- Save/Read Category data | |- Config.pm <- Communicates with the Redis DB to store/retrieve Configuration | |- Plugins.pm <- Executes Plugins on archives | |- Reader.pm <- Archive Extraction | |- Search.pm <- Search Engine | |- Stats.pm <- Tag Cloud and Statistics | +- Upload.pm <- Handle incoming files (Download System) | +- Plugin <- LRR Plugins are stored here | |- Login | |- Metadata | +- Scripts | +- Utils <- Generic Functions | |- *.pm | +- Minion.pm <- Minion jobs are implemented here | |- locales <- Internationalization/Localization files | +- template | |- en.po <- English translations in .po (gettext) format | |- zh.po <- Chinese translations in .po format | |- ... | |- log <- Application Logs end up here | |- public <- Files available to Web Clients | |- css <- Global CSS sheets | |- lrr.css | +- vendor <- Third-party CSS sheets obtained through NPM | |- img <- Image resources | |- js <- JavaScript functions | |- *.js | +- vendor <- Third-party JS obtained through NPM | |- temp <- Archives are extracted in this folder to be served to clients. Also used for thumbnail creation. | | |- server.pid <- PID of the currently running Prefork Manager process, if existing | | |- shinobu.pid <- Last known PID of the Shinobu File Watcher (Serialized Proc::Simple object) | | +- minion.pid <- Last known PID of the Minion Job Queue (Serialized Proc::Simple object) | +- themes <- Contains CSS sheets for Themes. | |- script | |- backup <- Standalone script for running database backups. | |- launcher.pl <- Launcher, uses either Morbo or Prefork to run the bootstrap script | +- lanraragi <- Bootstrap script, starts LANraragi.pm | |- tests <- Tests go here | |- templates <- Templates for Web pages | +- *.html.tt2 | |- tools <- Contains scripts for building and installing LRR. | |- Documentation <- What you're reading right now | |- build <- Build tools and scripts | |- docker <- Dockerfile and configuration files for LRR Docker Container | |- homebrew <- Script and configuration files for the LRR Homebrew cask | |- windows <- MSYS2 Windows build scripts, patches and submodule link to the Karen WPF Bootstrapper | |- cpanfile <- Perl dependencies description | |- install.pl <- LANraragi Installer | +- lanraragi-systemd.service <- Example SystemD service | |- lrr.conf <- Mojolicious configuration file |- .perltidy.rc <- PerlTidy config file to match the coding style |- eslint.config.mjs <- ESLint config file for linting of JavaScript files |- package.json <- NPM file, contains front-end dependency listing and shortcuts +- package-lock.json <- NPM lockfile used by installer/`npm ci` for reproducible builds Copy -Redis Database 1 - Archive & category data | |- SET_xxxxxxxxxx <- A Category. | |- archives <- Serialized array of IDs this category holds (if static) | |- search <- Search predicate of this category (if dynamic) | |- name <- Name of the Category, as set by the User | |- pinned <- Whether the category is pinned in the index or not | |- TANK_xxxxxxxxxx <- A Tankoubon. Tankoubons are Redis sorted sets containing some metadata and a list of Archive IDs. | |- tags (-2) <- Additional tags for the Tankoubon. Tanks collate every tag from the archives they contain by default. | |- summary (-1) <- Dedicated summary for the Tankoubon. | |- name (0) <- Name of the Tankoubon. | |- **************************************** (1) <- First archive in the Tankoubon | |- **************************************** (2) <- Second archive in the Tankoubon | +- etc. (3, 4, 5...) | |- **************************************** <- 40-character long ID for every logged archive | |- tags <- Saved tags | |- summary <- Summary of the archive, as set by the User | |- name <- Name of the archive file, kept for filesystem checks | |- title <- Title of the archive, as set by the User | |- file <- Filesystem path to archive | |- isnew <- Whether the archive has been opened in LRR once or not | |- pagecount <- Number of pages of the archive file | |- progress <- Reading progress, if server-side progress is enabled | +- thumbhash <- SHA-1 hash of the first image of the archive + -Redis Database 2 - Configuration | |- LRR_PLUGIN_xxxxxxx <- Settings for a plugin with namespace xxxxxxx | |- LRR_TOTALPAGESTAT <- Total pages read | |- LRR_FILEMAP <- Shinobu Filemap, maps IDs in the database to their location on the filesystem | |- LRR_CONFIG <- Configuration keys, usually set through the LRR Configuration page. | |- htmltitle | |- motd | |- language <- Forced UI language | |- dirname <- Content directory | |- thumbdir <- Thumbnail directory | |- tempmaxsize <- Temp folder max size | |- enableresize <- Whether automatic image resizing is enabled | |- sizethreshold <- Auto-resizing threshold | |- readerquality <- Auto-resizing quality | |- enablecors <- Whether CORS headers are enabled | |- disableopenapi <- Whether OpenAPI API schema validation is disabled | |- enablemetrics <- Whether metrics exporting is enabled | |- tagruleson <- Whether tag rules are enabled | |- tagrules <- Tag rules, saved as a big ol' string | |- devmode <- Whether debug mode is enabled | |- enablepass <- Enable/Disable Password Authentication. | |- nofunmode <- Whether No-Fun Mode is enabled | |- pagesize <- Amount of archives per Index page | +- apikey <- Key for API requests | |- LRR_DUPLICATE_GROUPS <- Duplicate groups found by duplicate detection | +- dupgp_xxxxxx <- A group of dupe IDs, as a JSON list | +- LRR_TAGRULES <- Computed Tag Rules, as a Redis list -Redis Database 3 - Search indexes | |- LRR_URLMAP <- Maps archive IDs to their source: tag, used by the Downloader system. | |- LRR_STATS <- Redis sorted set used to build the statistics/tag cloud JSON. | |- LRR_UNTAGGED <- Redis set of archive IDs that don't have any tags (except for tags added automatically by the autotagger) | |- LRR_TITLES <- Redis lexicographically sorted set containing all titles in the DB, alongside their ID. (In the "title\0ID" format) | |- INDEX_***:**** <- Each tag(namespaced or not) has a matching Redis set, with all the IDs that have this tag in their metadata. This is used for search indexing. | +- LRR_SEARCHCACHE <- Search Cache |- $columnfilter-$filter-$sortkey-$sortorder-$newonly <- Unique ID for a search. The search result is serialized and saved as the value for this ID. +- --title-asc-0 <- Example ID for a search made on titles with no filters. -Redis Database 4 - Metrics | |- metrics:worker:{PID}:{endpoint_encoded}_{method} <- Per-worker API request metrics | |- count <- Total number of requests | |- duration_sum <- Cumulative request duration in seconds | |- request_size_sum <- Cumulative request payload size in bytes | +- response_size_sum <- Cumulative response payload size in bytes | |- metrics:http:{PID} <- HTTP worker process metrics |- metrics:minion:{PID} <- Minion worker process metrics |- metrics:shinobu:{PID} <- Shinobu worker process metrics | |- cpu_user_seconds_total <- Total user CPU time in seconds | |- cpu_system_seconds_total <- Total system CPU time in seconds | |- cpu_seconds_total <- Total CPU time (user + system) in seconds | |- virtual_memory_bytes <- Virtual memory size in bytes | |- resident_memory_bytes <- Resident memory size in bytes | |- open_fds <- Number of open file descriptors | |- max_fds <- Maximum allowed file descriptors | |- start_time_seconds <- Unix epoch time when process started | |- read_bytes_total <- Total bytes read from storage | +- write_bytes_total <- Total bytes written to storage + --- # Metadata Plugins | LANraragi Metadata plugins are the bread-n-butter of LRR plugins: For a given archive, they can look for tags in a remote service or a local file and return this info so it can be integrated into LRR's database. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#required-subroutines) Required subroutines ----------------------------------------------------------------------------------------------------------------- Only one subroutine needs to be implemented for the module to be recognized: `get_tags`, which contains your working code. You're free to implement other subroutines for cleaner code, of course. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#expected-input) Expected Input The following section deals with writing the `get_tags` subroutine. When executing your Plugin, LRR will call this subroutine and pass it the following variables: Copy sub get_tags { #First lines you should have in the subroutine # $lrr_info: global info hash, contains various metadata provided by LRR # $params : plugin parameters shift; my ( $lrr_info, $params ) = @_; The variables match the parameters you've entered in the `plugin_info` subroutine. (Example here is for E-H. ) The `$lrr_info` hash contains various variables you can use in your plugin: * _$lrr\_info->{archive\_id}_: The internal ID of the archive. * _$lrr\_info->{archive\_title}_: The title of the archive, as entered by the User. * _$lrr\_info->{existing\_tags}_: The tags that are already in LRR for this archive, if there are any. * _$lrr\_info->{thumbnail\_hash}_: A SHA-1 hash of the first image of the archive. * _$lrr\_info->{file\_path}_: The filesystem path to the archive. * _$lrr\_info->{oneshot\_param}_: Value of your one-shot argument, if it's been set by the User. See below. * _$lrr\_info->{user\_agent}_: [Mojo::UserAgentarrow-up-right](https://mojolicious.org/perldoc/Mojo/UserAgent) object you can use for web requests. If this plugin depends on a Login plugin, this UserAgent will be pre-configured with the cookies from the Login. The `$params` hash contains the values of the user defined parameters. #### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#one-shot-arguments) One-Shot Arguments The **One-Shot Argument** can be set by the user every time he uses your Plugin on a specific file, through LRR's Edit Menu. It's more meant for special overrides you'd want to use for this specific file: For example, in E-Hentai and nHentai plugins, it can be used to set a specific Gallery URL you want to pull tags from. If you want the user to be able to enter this override, the `oneshot_arg` field must be present in `plugin_info`, and contain a brief description of what your argument is for. One-Shot Arguments can only be strings. ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#expected-output) Expected Output Once you're done and obtained your tags, all that's needed for LRR to handle them is to return a hash containg said tags. Tags are expected to be separated by commas, like this: `return ( tags => "my:new, tags:here, look ma no namespace" );` Plugins can also modify the title or the summary of the archive: `return ( tags => "some:tags", title=>"My new epic archive title", summary=>"Phenomenal! Wheres that David Lynch clip where he says phenomenal" );` Those two parameters are completely optional. (The tags one isn't, but it can very well be empty.) If the Plugin's user has disabled "Plugins can modify archive titles" in their settings, you can still pass a new title - It'll simply do nothing. If you couldn't obtain tags for some reason, you can tell LRR that an error occurred by throwing an exception: `die "my error :(\n";` The old error handling still exists, but it's **deprecated**: `return ( error => "my error :(" );` If you do this, no tags will be added for this archive, and the error will be logged/displayed to the user. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#plugin-template) Plugin Template ------------------------------------------------------------------------------------------------------- ### [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) Converting existing plugins to named parameters With the release of version **0.9.3** of LANraragi, **named parameters** for plugins have been introduced. Compared to previous versions, where plugin parameters were based on an _ordered array_, _named parameters_ should make it easier to understand the source code and write new plugins, especially if they make use of many parameters. _For the time being LANraragi will continue to support the plugins based on ordered array parameters_ so there is no need to rush to update your plugin. But if you still want to upgrade, the following information should help you. If you have a plugin that you want to convert to using named parameters without losing the existing configuration, you can add a new key called `to_named_params` to the `plugin_info` hash. The new key must contain an array of the names assigned to the old parameters in the exact sequence in which they were present before the conversion. If you have added new parameters in the meantime, you don't have to specify them in the `to_named_params` key. The following example shows how to convert from the old parameter structure: to the new structure: Note that `salvation` is not included in the conversion and the order of the items inside `to_named_params` corresponds to the sequence of the parameters in the old format. The `to_named_params` key must be present the first time you load the plugin with the new parameter structure, otherwise the existing configuration will be lost. After the first use, however, it is no longer needed and you can remove it from a future version of the plugin. [PreviousLogin Pluginschevron-left](https://sugoi.gitbook.io/lanraragi/plugin-docs/login) [NextDownloader Pluginschevron-right](https://sugoi.gitbook.io/lanraragi/plugin-docs/download) Last updated 1 year ago * [Required subroutines](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#required-subroutines) * [Expected Input](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#expected-input) * [Expected Output](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#expected-output) * [Plugin Template](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#plugin-template) * [Converting existing plugins to named parameters](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata#converting-existing-plugins-to-named-parameters) Copy package LANraragi::Plugin::Metadata::MyNewPlugin; use strict; use warnings; # Plugins can freely use all Perl packages already installed on the system # Try however to restrain yourself to the ones already installed for LRR (see tools/cpanfile) to avoid extra installations by the end-user. use Mojo::UserAgent; # You can also use LRR packages when fitting. # All packages are fair game, but only functions explicitly exported by the Utils packages are supported between versions. # Everything else is considered internal API and can be broken/renamed between versions. use LANraragi::Model::Plugins; use LANraragi::Utils::Logging qw(get_logger); #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "Plugin Boilerplate", type => "metadata", namespace => "dummyplug", #login_from => "dummylogin", author => "Hackerman", version => "0.001", description => "This is base boilerplate for writing LRR plugins.", icon => "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBI\nWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4wYDFCYzptBwXAAAAB1pVFh0Q29tbWVudAAAAAAAQ3Jl\nYXRlZCB3aXRoIEdJTVBkLmUHAAAAjUlEQVQ4y82UwQ7AIAhDqeH/f7k7kRgmiozDPKppyisAkpTG\nM6T5vAQBCIAeQQBCUkiWRTV68KJZ1FuG5vY/oazYGdcWh7diy1Bml5We1yiMW4dmQr+W65mPjFjU\n5PMg2P9jKKvUdxWMU8neqYUW4cBpffnxi8TsXk/Qs8GkGGaWhmes1ZmNmr8kuMPwAJzzZSoHwxbF\nAAAAAElFTkSuQmCC", #If your plugin uses/needs custom arguments, input their name here. #This name will be displayed in plugin configuration next to an input box for global arguments, and in archive edition for one-shot arguments. oneshot_arg => "This is a one-shot argument that can be entered by the user when executing this plugin on a file", parameters => [\ 'doomsday' => {type => "bool", desc => "Enable the DOOMSDAY DEVICE"},\ 'iterations' => {type => "int", desc => "Number of iterations", default_value => "9001"}\ ] ); } #Mandatory function to be implemented by your plugin sub get_tags { shift; # $lrr_info: global info hash, contains various metadata provided by LRR # $params : plugin parameters my ( $lrr_info, $params ) = @_; if ($lrr_info->{oneshot_param}) { die "Yaaaaaaaaa gomen gomen the oneshot argument isn't implemented -- You entered ".$lrr_info->{oneshot_param}.", right ?\n"; } #Use the logger to output status - they'll be passed to a specialized logfile and written to STDOUT. my $logger = get_logger("My Cool Plugin","plugins"); #Work your magic here - You can create subroutines below to organize the code better $logger->info("Gettin' tags"); my $newtags = get_tags_from_somewhere($params->{iterations}, $params->{doomsday}); #To be implemented my $error = 0; #Something went wrong? Return an error. if ($error) { $logger->error("Oh no"); die "Error Text Here\n"; } #Otherwise, return the tags you've harvested. return ( tags => $newtags ); } sub get_tags_from_somewhere { my ($iterations, $doomsday) = @_; my $logger = get_logger("My Cool Plugin","plugins"); if ($doomsday) { die "You fools! You've messed with the natural order!\n"; } $logger->info("I'm supposed to be iterating $iterations times but I don't give a damn my man"); #Tags are expected to be submitted as a single string, containing tags split up by commas. Namespaces are optional. return "my:new, tags:here, look ma no namespace"; } 1; Copy # [...] parameters => [\ {type => "bool", desc => "Enable the DOOMSDAY DEVICE"},\ {type => "int", desc => "Number of iterations", default_value => "9001"}\ ] # [...] Copy # [...] to_named_params => ['doomsday', 'iterations'], parameters => { 'iterations' => {type => "int", desc => "Number of iterations", default_value => "9001"}, 'doomsday' => {type => "bool", desc => "Enable the DOOMSDAY DEVICE"}, 'salvation' => {type => "bool", desc => "Now you can be saved"} } # [...] --- # Getting started | LANraragi [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#how-to-write-a-plugin-for-lrr) How To Write a Plugin for LRR -------------------------------------------------------------------------------------------------------------------------------- LANraragi supports a Plugin system for various purposes: * Logging in to external web services * Importing metadata from said web services and other sources * Taking an URL from one of those web services and returning a matching, downloadable URL to add to the archive index * Running scripts against the LRR system to manipulate and extract data at will This part of the documentation aims at giving pointers to would-be Plugin developers. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#available-language-and-modules) Available Language and Modules ---------------------------------------------------------------------------------------------------------------------------------- Plugins are expected to be [Perl Modulesarrow-up-right](http://www.perlmonks.org/?node_id=102347) . All Plugins need to declare their metadata through the `plugin_info` hash. Other subroutines need to be implemented depending on the Plugin type. Once the module is recognized, it will be available for use in LANraragi. All Perl features are available for use, as well as all installed CPAN Modules and LRR API functions present. Basically, _as long as it can run, it will run_. triangle-exclamation 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/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. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#plugin-metadata) Plugin Metadata ---------------------------------------------------------------------------------------------------- Metadata follows a simple format, being all present in a hash returned by the `plugin_info` subroutine: There are no restrictions on what you can write in those fields, except for the `namespace`, which should preferrably be **a single word.** It's used as a unique ID for your Plugin in various parts of the app. The `login_from` parameter can be used to execute a login plugin before your plugin runs. The `type` field can be either: * `login` for [Login Plugins](https://sugoi.gitbook.io/lanraragi/plugin-docs/login) * `metadata` for [Metadata Plugins](https://sugoi.gitbook.io/lanraragi/plugin-docs/metadata) * `download` for [Downloader Plugins](https://sugoi.gitbook.io/lanraragi/plugin-docs/download) * `script` for [Script Plugins](https://sugoi.gitbook.io/lanraragi/plugin-docs/scripts) The `parameters` hash can contain as many arguments as you need. They can be set by the user in Plugin Configuration, and are transmitted every time. Typical uses for it include login credentials for a remote website, configuration options, etc. Basic stuff. Please give meaningful names to the parameters, as they are used to return the associated values ​​when using the plugin and make it easier for other contributors to understand the code. [hashtag](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#installing-and-testing-your-plugin) Installing and Testing your Plugin ------------------------------------------------------------------------------------------------------------------------------------------ Installing a Plugin is as simple as dropping the .pm file in LANraragi's Plugin directory. Restart the app, and your Plugin's name should appear on the initial listing. circle-info You can also sideload Plugins through Plugin Configuration in the webapp. Once this is done, you can test your plugin by simply using it: * Metadata plugins can be used by enabling them for Automatic Execution or on individual archives. * Script plugins can be directly executed from Plugin Configuration. * Login plugins can't be tested directly for now. circle-info It is also possible to execute plugins through the [Client API](https://sugoi.gitbook.io/lanraragi/api-documentation/getting-started) . If LANraragi is running in Debug Mode, debug messages from your plugin will be logged. [PreviousMiscellaneous other APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api) [NextLogin Pluginschevron-right](https://sugoi.gitbook.io/lanraragi/plugin-docs/login) Last updated 10 months ago * [How To Write a Plugin for LRR](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#how-to-write-a-plugin-for-lrr) * [Available Language and Modules](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#available-language-and-modules) * [Plugin Metadata](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#plugin-metadata) * [Installing and Testing your Plugin](https://sugoi.gitbook.io/lanraragi/plugin-docs/index#installing-and-testing-your-plugin) Copy #Meta-information about your plugin. sub plugin_info { return ( #Standard metadata name => "My Plugin", type => "metadata", #login_from => "dummylogin", namespace => "dummyplug", author => "Hackerman", version => "0.001", description => "This is the description of my Plugin", icon => "This is a base64-encoded 20x20 image that will be displayed as an icon in the plugin list. Optional!" oneshot_arg => "This is the description for a one-shot argument that can be entered by the user when executing this plugin on a file", parameters => { 'my-boolean' => {type => "bool", desc => "Boolean parameter description", default_value => "1"}, 'my-string' => {type => "string", desc => "String parameter description", default_value => "A default parameter"}, 'my-number' => {type => "int", desc => "Integer parameter description"} }, # Tag-specific metadata cooldown => "If this is a Metadata Plugin, you can set a recommended value for how long a user should wait between executions to avoid remote bans. Shown in Batch Tagging only, defaults to 0.", # Downloader-specific metadata url_regex => "If this is a Downloader Plugin, this is the regex that will trigger said plugin if it matches the URL to download." ); } --- # OPDS Catalog | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog#get-opds) Get the OPDS Catalog get https://lrr.tvc-16.science/api/opds Get the Archive Index as an OPDS 1.2 Catalog with PSE 1.1 compatibility. Query parameters categorystringOptional Category ID. If passed, the OPDS catalog will be filtered to only show archives from this category. Responses chevron-right 200 OPDS catalog XML application/xml stringOptional get /opds HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 OPDS catalog XML ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog#get-opds-id) Get a specific archive through OPDS get https://lrr.tvc-16.science/api/opds/{id} Returns a specific OPDS item as XML. This will show only one for the given ID in the result, instead of all the archives. Path parameters idstringRequired Responses chevron-right 200 OPDS entry XML application/xml stringOptional get /opds/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 OPDS entry XML ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog#get-opds-id-pse) OPDS-PSE get https://lrr.tvc-16.science/api/opds/{id}/pse Returns a specific image page for OPDS-PSE as XML. Path parameters idstringRequired Query parameters pageintegerOptional Responses chevron-right 200 Image file for the requested page application/octet-stream string · binaryOptional get /opds/{id}/pse HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Image file for the requested page [PreviousMinion APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/minion-api) [NextMiscellaneous other APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api) Last updated 1 day ago * [GETGet the OPDS Catalog](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog#get-opds) * [GETGet a specific archive through OPDS](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog#get-opds-id) * [GETOPDS-PSE](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog#get-opds-id-pse) Copy GET /api/opds HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy urn:lrr:0 LANraragi 2010-01-10T10:03:10Z Welcome to this Library running LANraragi! /favicon.ico 9.9.9 http://github.org/Difegue/LANraragi Fate GO MEMO urn:lrr:28697b96f0ac5858be2614ed10ca47742c9522fd 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z wada rco wadamemo parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color, male:very cool too Fate GO MEMO 2 urn:lrr:2810d5e0a8d027ecefebca6237031a0fa7b91eb3 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z wada rco wadamemo parody:fate grand order, character:abigail williams, character:artoria pendragon alter, character:asterios, character:ereshkigal, character:gilgamesh, character:hans christian andersen, character:hassan of serenity, character:hector, character:helena blavatsky, character:irisviel von einzbern, character:jeanne alter, character:jeanne darc, character:kiara sessyoin, character:kiyohime, character:lancer, character:martha, character:minamoto no raikou, character:mochizuki chiyome, character:mordred pendragon, character:nitocris, character:oda nobunaga, character:osakabehime, character:penthesilea, character:queen of sheba, character:rin tosaka, character:saber, character:sakata kintoki, character:scheherazade, character:sherlock holmes, character:suzuka gozen, character:tamamo no mae, character:ushiwakamaru, character:waver velvet, character:xuanzang, character:zhuge liang, group:wadamemo, artist:wada rco, artbook, full color Ghost in the Shell 1.5 - Human-Error Processor vol01ch01 urn:lrr:4857fd2e7c00db8b0af0337b94055d8445118630 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z shirow masamune artist:shirow masamune Rohan Kishibe goes to Gucci urn:lrr:e4c422fd10943dc169e3489a38cdbf57101a5f7e 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z parody: jojo's bizarre adventure Saturn Backup Cartridge - American Manual urn:lrr:e69e43e1355267f7d32a4f9b7f2fe108d2401ebg 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z character:segata, female:very cool too Saturn Backup Cartridge - Japanese Manual urn:lrr:e69e43e1355267f7d32a4f9b7f2fe108d2401ebf 2010-01-10T10:01:11Z 2010-01-10T10:01:11Z character:segata sanshiro, male:very cool Copy GET /api/opds/{id} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy Aya Sugimoto - [1989.05.15] 杉本彩写真集 Seductive urn:lrr:0a053b3a3960e85c331da2905513a18fa1375d99 2024-07-02T20:40:58Z 2024-07-02T20:40:58Z date_added:1719952858 Copy GET /api/opds/{id}/pse HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary --- # Miscellaneous other API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#get-info) Get server info get https://lrr.tvc-16.science/api/info Returns some basic information about the LRR instance this server is running. Responses chevron-right 200 Server info application/json Server info payload emitted by /api/info. Older server versions used integers instead of booleans here. namestringOptional Name of the instance motdstringOptional MOTD of the instance versionstringOptional Version of the server version\_namestringOptional Version name version\_descstringOptional Version description has\_passwordbooleanOptional Whether the instance is password-protected debug\_modebooleanOptional Whether the instance has debug mode enabled nofun\_modebooleanOptional Whether the instance has no-fun mode enabled archives\_per\_pageintegerOptional How many archives per page the server lists server\_resizes\_imagesbooleanOptional Whether the instance auto-downsizes images before serving them server\_tracks\_progressbooleanOptional Whether the instance tracks reading progression server-side authenticated\_progressbooleanOptional Whether the instance requires authentication for server-side progress updates total\_pages\_readintegerOptional Total amount of pages read total\_archivesintegerOptional Total amount of archives stored on instance cache\_last\_clearedintegerOptional Timestamp for last time the search cache was wiped excluded\_namespacesstring\[\]Optional List of tag namespaces excluded from search suggestions and tag statistics get /info HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Server info ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#delete-tempfolder) Clean the Temporary Folder delete https://lrr.tvc-16.science/api/tempfolder Cleans the server's temporary folder. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Cleanup result application/json operationstring · enumOptionalPossible values: `cleantemp` successinteger · enumOptionalPossible values: `0``1` errorstring · nullableOptional Error message if something went wrong during cleanup. (The call will still return 200) newsizeintegerOptional Current size of the temporary folder post-cleanup. delete /tempfolder HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Cleanup result ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#post-download_url) Queue a URL download post https://lrr.tvc-16.science/api/download\_url Add a URL to be downloaded by the server and added to its library. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters urlstring · uriRequired URL to download catidstring · min: 14 · max: 14Optional Category ID to add the downloaded URL to. Responses chevron-right 200 Enqueued job application/json operationstring · enumOptionalPossible values: `download_url` urlstringOptional URL queued for download categorystring · nullableOptional successinteger · enumOptionalPossible values: `0``1` jobintegerOptional chevron-right 400 Bad request application/json post /download\_url HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#post-regen_thumbs) Regenerate Thumbnails post https://lrr.tvc-16.science/api/regen\_thumbs Queue a Minion job to regenerate missing/all thumbnails on the server. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Query parameters forcebooleanOptional Whether to generate all thumbnails, or only the missing ones. Responses chevron-right 200 Enqueued job application/json operationstring · enumOptionalPossible values: `regen_thumbnails` successinteger · enumOptionalPossible values: `0``1` jobintegerOptional post /regen\_thumbs HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Enqueued job [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#metrics) Metrics ------------------------------------------------------------------------------------------------------------ The `/api/info/metrics` endpoint returns metrics in the [Prometheus exposition formatarrow-up-right](https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-example) . [PreviousOPDS Catalogchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/opds-catalog) [NextGetting startedchevron-right](https://sugoi.gitbook.io/lanraragi/plugin-docs/index) Last updated 1 day ago * [GETGet server info](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#get-info) * [DELETEClean the Temporary Folder](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#delete-tempfolder) * [POSTQueue a URL download](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#post-download_url) * [POSTRegenerate Thumbnails](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#post-regen_thumbs) * [Metrics](https://sugoi.gitbook.io/lanraragi/api-documentation/miscellaneous-other-api#metrics) Copy GET /api/info HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "archives_per_page": 100, "cache_last_cleared": 1728852701, "debug_mode": true, "has_password": false, "name": "LANraragi", "motd": "aye lads time to read some manga", "nofun_mode": false, "server_resizes_images": false, "server_tracks_progress": true, "authenticated_progress": false, "total_archives": 104, "total_pages_read": 252, "version": "0.9.30", "excluded_namespaces": [\ "source",\ "date_added"\ ], "version_desc": "I'm under Japanese influence and my honor's at stake!", "version_name": "Law (Earthlings On Fire)" } Copy DELETE /api/tempfolder HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "cleantemp", "error": null, "newsize": 0, "success": 1 } Copy POST /api/download_url?url=https%3A%2F%2Fexample.com HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 86, "operation": "download_url", "success": 1, "url": "https://example.com" } Copy POST /api/regen_thumbs HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "job": 3, "operation": "regen_thumbnails", "success": 1 } Copy # HELP lanraragi_api_requests_total Total number of API requests # TYPE lanraragi_api_requests_total counter lanraragi_api_requests_total{endpoint="/",method="GET"} 4063 lanraragi_api_requests_total{endpoint="/api/archives/:id",method="DELETE"} 2 lanraragi_api_requests_total{endpoint="/api/archives/:id/categories",method="GET"} 1 lanraragi_api_requests_total{endpoint="/api/archives/:id/files",method="GET"} 7 lanraragi_api_requests_total{endpoint="/api/archives/:id/files/thumbnails",method="POST"} 5 lanraragi_api_requests_total{endpoint="/api/archives/:id/isnew",method="DELETE"} 7 lanraragi_api_requests_total{endpoint="/api/archives/:id/metadata",method="GET"} 8 # ... --- # Tankoubon API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#get-tankoubons) Get all Tankoubons get https://lrr.tvc-16.science/api/tankoubons Get list of Tankoubons paginated. Query parameters pageintegerOptional Page of the list of Tankoubons. The amount of tanks per page depends on the server `archives_per_page` setting. Responses chevron-right 200 Tankoubons application/json resultobject\[\]Optional Tankoubon metadata Example: `{"tankid":"TANK_1749925516","name":"sailor moon","archives":["e69e43e1355267f7d32a4f9b7f2fe108d2401ebf","e69e43e1355267f7d32a4f9b7f2fe108d2401ebg"]}` Show propertiesplus totalintegerOptional Total count of Tankoubons on the server filteredintegerOptional Number of Tankoubons on the current page get /tankoubons HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Tankoubons ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#put-tankoubons) 🔑 Create a Tankoubon put https://lrr.tvc-16.science/api/tankoubons Create a new Tankoubon or update the name of an existing one. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data namestringRequired Name of the Tankoubon tankidstringOptional ID of an existing Tankoubon, if you want to change its name. Responses chevron-right 200 Success response application/json operationstring · enumOptionalPossible values: `create_tankoubon` tankoubon\_idstringOptional ID of the created/modified Tankoubon successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json put /tankoubons HTTPchevron-down HTTPcURLJavaScriptPython application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#get-tankoubons-id) Get a single Tankoubon get https://lrr.tvc-16.science/api/tankoubons/{id} Get the details of the specified tankoubon ID, with the archives list paginated. The amount of archives per page depends on the server `archives_per_page` setting. Path parameters idstringRequired ID of the Tankoubon desired Query parameters include\_full\_databooleanOptional If set to true, a `full_data` array will be added to the response with full Archive metadata. pageintegerOptional Page of the Archives list. You can use -1 to return all archives if needed. Responses chevron-right 200 Tankoubon application/json resultobjectOptional Show propertiesplus totalintegerOptional The total amount of archives in this Tankoubon. filteredintegerOptional The amount of archives in the current page. chevron-right 400 Error response application/json get /tankoubons/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Tankoubon chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#put-tankoubons-id) 🔑 Update Tankoubon metadata/contents put https://lrr.tvc-16.science/api/tankoubons/{id} Modify the full metadata (name, summary, additional tags) or the contents of a Tankoubon. If you only need to change the name of Tank, consider just using PUT `/api/tankoubons`. Note: If there is no need to update something in one of the `data` keys, do not send the key -- This otherwise can result in unwanted results. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstringRequired ID of the Tankoubon to update. Body application/jsonchevron-down application/json archivesstring\[\]Optional Ordered array with the IDs of the archives. metadataobjectOptional Metadata parameters -- All are optional. Show propertiesplus Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json put /tankoubons/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#delete-tankoubons-id) 🔑 Delete Tankoubon delete https://lrr.tvc-16.science/api/tankoubons/{id} Remove a Tankoubon from the server. This doesn't delete underlying Archives. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json delete /tankoubons/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#put-tankoubons-id-archive) 🔑 Add an Archive to a Tankoubon put https://lrr.tvc-16.science/api/tankoubons/{id}/{archive} Append an archive at the final position of a Tankoubon. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstringRequired ID of the Tankoubon to update. archivestring · min: 40 · max: 40Required ID of the Archive to append. Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json put /tankoubons/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#delete-tankoubons-id-archive) 🔑 Remove an Archive from a Tankoubon delete https://lrr.tvc-16.science/api/tankoubons/{id}/{archive} Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstringRequired ID of the Tankoubon to update. archivestring · min: 40 · max: 40Required ID of the Archive to remove. Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Tankoubon is currently locked for modification application/json delete /tankoubons/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result chevron-down [PreviousCategory APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api) [NextPlugin APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/plugin-api) Last updated 1 day ago * [GETGet all Tankoubons](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#get-tankoubons) * [PUT🔑 Create a Tankoubon](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#put-tankoubons) * [GETGet a single Tankoubon](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#get-tankoubons-id) * [PUT🔑 Update Tankoubon metadata/contents](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#put-tankoubons-id) * [DELETE🔑 Delete Tankoubon](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#delete-tankoubons-id) * [PUT🔑 Add an Archive to a Tankoubon](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#put-tankoubons-id-archive) * [DELETE🔑 Remove an Archive from a Tankoubon](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api#delete-tankoubons-id-archive) Copy GET /api/tankoubons HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "result": [\ {\ "tankid": "TANK_1749925516",\ "name": "sailor moon",\ "archives": [\ "e69e43e1355267f7d32a4f9b7f2fe108d2401ebf",\ "e69e43e1355267f7d32a4f9b7f2fe108d2401ebg"\ ]\ }\ ], "total": 1, "filtered": 1 } Copy PUT /api/tankoubons HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded Accept: */* Content-Length: 31 "name='text'&tankid='text'" Copy { "operation": "create_tankoubon", "tankoubon_id": "text", "success": 0 } Copy GET /api/tankoubons/{id} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "result": { "archives": [\ null\ ], "full_data": [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color",\ "lastreadtime": 1337038281,\ "title": "Fate GO MEMO",\ "filename": "Fate GO MEMO",\ "summary": null,\ "size": 1234567,\ "toc": [\ {\ "name": "Chapter 1",\ "page": 1\ },\ {\ "name": "Chapter 2",\ "page": 13\ },\ {\ "name": "Chapter 3",\ "page": 25\ }\ ]\ }\ ] }, "total": 1, "filtered": 1 } Copy PUT /api/tankoubons/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/json Accept: */* Content-Length: 79 { "archives": [\ "text"\ ], "metadata": { "name": "text", "summary": "text", "tags": "text" } } Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/tankoubons/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy PUT /api/tankoubons/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/tankoubons/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Category API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#get-categories) Get all Categories get https://lrr.tvc-16.science/api/categories Get all the categories saved on the server. Responses chevron-right 200 Categories application/json Category metadata. archivesstring\[\]Optional Array of archive IDs (if this is a static category, empty otherwise) idstring · min: 14 · max: 14Required ID of the category namestringOptional Name of the category pinnedinteger · enumOptional Whether this category should be pinned in the UI Possible values: `0``1` searchstring · nullableOptional Category search filter (if this is a dynamic category, empty otherwise) get /categories HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Categories ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories) 🔑 Create a Category put https://lrr.tvc-16.science/api/categories Create a new Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data namestringRequired Name of the Category. searchstringOptional Matching predicate, if creating a Dynamic Category. pinnedbooleanOptional Add this parameter if you want the created category to be pinned. Responses chevron-right 200 Success response application/json operationstring · enumOptionalPossible values: `create_category` category\_idstring · min: 14 · max: 14Optional ID of the created Category successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json put /categories HTTPchevron-down HTTPcURLJavaScriptPython application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#get-categories-bookmark_link) Get bookmark-linked Category get https://lrr.tvc-16.science/api/categories/bookmark\_link Retrieves the ID of the category currently linked to the bookmark feature. Returns an empty string if no category is linked. Responses chevron-right 200 Link application/json operationstring · enumOptionalPossible values: `get_bookmark_link` successinteger · enumOptionalPossible values: `0``1` category\_idany ofOptional string · min: 14 · max: 14Optional or string · enumOptionalPossible values: get /categories/bookmark\_link HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Link ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#delete-categories-bookmark_link) 🔑 Disable bookmark feature delete https://lrr.tvc-16.science/api/categories/bookmark\_link Disables the bookmark feature by removing the link to any category. Returns the ID of the previously linked category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringOptional category\_idany ofOptional ID of the previously linked category. string · min: 14 · max: 14Optional or string · enumOptionalPossible values: successinteger · enumOptionalPossible values: `0``1` delete /categories/bookmark\_link HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories-bookmark_link-id) 🔑 Update bookmark-linked Category put https://lrr.tvc-16.science/api/categories/bookmark\_link/{id} Links the bookmark feature to the specified static category. This determines which category archives are added to when using the bookmark button. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 14 · max: 14Required Responses chevron-right 200 Success response application/json operationstringOptional category\_idstring · min: 14 · max: 14Optional ID of the category that was linked successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json chevron-right 404 Category with specified ID does not exist application/json put /categories/bookmark\_link/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#get-categories-id) Get a single Category get https://lrr.tvc-16.science/api/categories/{id} Get the details of the specified category ID. Path parameters idstring · min: 14 · max: 14Required Responses chevron-right 200 Category application/json Category metadata. archivesstring\[\]Optional Array of archive IDs (if this is a static category, empty otherwise) idstring · min: 14 · max: 14Required ID of the category namestringOptional Name of the category pinnedinteger · enumOptional Whether this category should be pinned in the UI Possible values: `0``1` searchstring · nullableOptional Category search filter (if this is a dynamic category, empty otherwise) get /categories/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Category ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories-id) 🔑 Update Category put https://lrr.tvc-16.science/api/categories/{id} Modify a Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data namestringOptional New name of the Category searchstringOptional Predicate. Trying to add a predicate to a category that already contains Archives will give you an error. pinnedbooleanOptional Add this argument to pin the Category. If you don't, the category will be unpinned on update. Responses chevron-right 200 Success response application/json operationstring · enumOptionalPossible values: `update_category` category\_idstring · min: 14 · max: 14Optional successinteger · enumOptionalPossible values: `0``1` chevron-right 400 Error response application/json chevron-right 423 The Category is currently locked for modification application/json put /categories/{id} HTTPchevron-down HTTPcURLJavaScriptPython application/x-www-form-urlencodedchevron-down application/x-www-form-urlencodedmultipart/form-data Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#delete-categories-id) 🔑 Delete Category delete https://lrr.tvc-16.science/api/categories/{id} Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Responses chevron-right 200 Success response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 423 The category ID is currently locked for modification application/json delete /categories/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories-id-archive) 🔑 Add an Archive to a Category put https://lrr.tvc-16.science/api/categories/{id}/{archive} Adds the specified Archive ID (see Archive API) to the given Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 14 · max: 14Required Archive ID to add. archivestring · min: 40 · max: 40Required Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 423 The category ID is currently locked for modification application/json put /categories/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#delete-categories-id-archive) 🔑 Remove an Archive from a Category delete https://lrr.tvc-16.science/api/categories/{id}/{archive} Remove an Archive ID from a Category. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 14 · max: 14Required Archive ID to remove. archivestring · min: 40 · max: 40Required Responses chevron-right 200 Result application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 423 The category ID is currently locked for modification application/json delete /categories/{id}/{archive} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Result chevron-down [PreviousDatabase APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api) [NextTankoubon APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/tankoubon-api) Last updated 1 day ago * [GETGet all Categories](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#get-categories) * [PUT🔑 Create a Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories) * [GETGet bookmark-linked Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#get-categories-bookmark_link) * [DELETE🔑 Disable bookmark feature](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#delete-categories-bookmark_link) * [PUT🔑 Update bookmark-linked Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories-bookmark_link-id) * [GETGet a single Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#get-categories-id) * [PUT🔑 Update Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories-id) * [DELETE🔑 Delete Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#delete-categories-id) * [PUT🔑 Add an Archive to a Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#put-categories-id-archive) * [DELETE🔑 Remove an Archive from a Category](https://sugoi.gitbook.io/lanraragi/api-documentation/category-api#delete-categories-id-archive) Copy GET /api/categories HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ {\ "id": "SET_1613080290",\ "name": "My great category",\ "pinned": 0,\ "search": null,\ "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "7f03b8b1f337e1e42b2c2890533c0de7479d41ca"\ ]\ }\ ] Copy PUT /api/categories HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded Accept: */* Content-Length: 45 "name='text'&search='text'&pinned=true" Copy { "operation": "create_category", "category_id": "text", "success": 0 } Copy GET /api/categories/bookmark_link HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "operation": "get_bookmark_link", "success": 0, "category_id": "text" } Copy DELETE /api/categories/bookmark_link HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "category_id": "text", "success": 0 } Copy PUT /api/categories/bookmark_link/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "category_id": "text", "success": 0 } Copy GET /api/categories/{id} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "id": "SET_1613080290", "name": "My great category", "pinned": 0, "search": null, "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "7f03b8b1f337e1e42b2c2890533c0de7479d41ca"\ ] } Copy PUT /api/categories/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: application/x-www-form-urlencoded Accept: */* Content-Length: 45 "name='text'&search='text'&pinned=true" Copy { "operation": "update_category", "category_id": "text", "success": 0 } Copy DELETE /api/categories/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy PUT /api/categories/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/categories/{id}/{archive} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } --- # Archive API | Nightly Release | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives) Get all Archives get https://lrr.tvc-16.science/api/archives Returns a list of all archives in the database. You can use the IDs of this JSON with the other endpoints. Responses chevron-right 200 Array of archives application/json JSON object for archive metadata for most API responses arcidone ofRequired Unique identifier for the archive (40-char SHA1) or tankoubon (15-char TANK\_\* ID) any · min: 40 · max: 40OptionalPattern: `^[0-9a-f]{40}$` or any · min: 15 · max: 15OptionalPattern: `^TANK_[0-9]{10}$` titlestringRequired Title of the archive filenamestringRequired Filename of the archive tagsstringRequired Comma-separated list of tags associated with the archive summarystring · nullableOptional Summary description of the archive isnewone of · nullableRequired Whether the archive is newly added. booleanOptional or stringOptional extensionstringRequired File extension of the archive progressintegerRequired Reading progress (page number) pagecountintegerRequired Total number of pages in the archive lastreadtimeintegerRequired Unix timestamp of when the archive was last read sizeintegerRequired Size of the archive in bytes tocarrayOptional Table of contents for the archive get /archives HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Array of archives ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-untagged) Get all untagged archives get https://lrr.tvc-16.science/api/archives/untagged Get archives that don't have any tags recorded. This follows the same rules as the Batch Tagging filter and will include archives that have parody:, date\_added:, series: or artist: tags. Responses chevron-right 200 Array of archive IDs application/json string\[\]Optional get /archives/untagged HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Array of archive IDs ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-upload) 🔑 Upload Archive put https://lrr.tvc-16.science/api/archives/upload Upload an Archive to the server. If a SHA1 checksum of the Archive is included, the server will perform an optional in-transit, file integrity validation, and reject the upload if the server-side checksum does not match. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body multipart/form-datachevron-down multipart/form-data filestring · binaryRequired Archive file to upload file\_checksumstringOptional SHA1 checksum of the archive for in-transit validation. Pattern: `^[a-fA-F0-9]{40}$` category\_idstring · min: 14 · max: 14Optional Category ID you'd want the archive to be added to. tagsstringOptional Set of tags you want to insert in the database alongside the archive. titlestringOptional Title of the Archive. summarystringOptional Summary of the Archive. Responses chevron-right 200 Archive uploaded successfully application/json operationstringRequired Name of operation Example: `upload` successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `1` idstring · min: 40 · max: 40Required ID of the uploaded archive chevron-right 400 Bad request application/json chevron-right 409 Duplicate archive application/json chevron-right 415 Unsupported file application/json chevron-right 417 Checksum mismatch application/json chevron-right 422 Unprocessable Entity application/json chevron-right 423 Locked resource response application/json chevron-right 500 Internal Server Error application/json put /archives/upload HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive uploaded successfully chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#delete-archives-id) 🔑 Delete archive delete https://lrr.tvc-16.science/api/archives/{id} Delete both the archive metadata and the file stored on the server. 🙏 Please ask your user for confirmation before invoking this endpoint. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive deleted response application/json operationstring · enumOptional Name of the operation Possible values: `delete_archive` idstring · min: 40 · max: 40Optional ID of the archive filenamestringOptional Filename of the deleted archive successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json delete /archives/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive deleted response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-metadata) Get archive metadata get https://lrr.tvc-16.science/api/archives/{id}/metadata Get Metadata (title, tags) for a given Archive. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive metadata application/json JSON object for archive metadata for most API responses arcidone ofRequired Unique identifier for the archive (40-char SHA1) or tankoubon (15-char TANK\_\* ID) any · min: 40 · max: 40OptionalPattern: `^[0-9a-f]{40}$` or any · min: 15 · max: 15OptionalPattern: `^TANK_[0-9]{10}$` titlestringRequired Title of the archive filenamestringRequired Filename of the archive tagsstringRequired Comma-separated list of tags associated with the archive summarystring · nullableOptional Summary description of the archive isnewone of · nullableRequired Whether the archive is newly added. booleanOptional or stringOptional extensionstringRequired File extension of the archive progressintegerRequired Reading progress (page number) pagecountintegerRequired Total number of pages in the archive lastreadtimeintegerRequired Unix timestamp of when the archive was last read sizeintegerRequired Size of the archive in bytes tocarrayOptional Table of contents for the archive chevron-right 400 No archive ID response application/json get /archives/{id}/metadata HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive metadata chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-metadata) 🔑 Update archive metadata put https://lrr.tvc-16.science/api/archives/{id}/metadata Update tags and title for the given Archive. Data supplied to the server through this method will **overwrite** the previous data. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters titlestringOptional New Title of the Archive. tagsstringOptional New Tags of the Archive. summarystringOptional New Summary of the Archive. Responses chevron-right 200 Archive metadata updated application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json put /archives/{id}/metadata HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive metadata updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-thumbnail) Get archive thumbnail get https://lrr.tvc-16.science/api/archives/{id}/thumbnail Get a Thumbnail image for a given Archive. This endpoint will return a placeholder image if it doesn't already exist. If you want to queue generation of the thumbnail in the background, you can use the no\_fallback query parameter. This will give you a background job ID instead of the placeholder. Path parameters idstring · min: 40 · max: 40Required ID of the archive to process Query parameters no\_fallbackstring · enumOptional Disables the placeholder image, queues the thumbnail for extraction and returns a JSON with code 202. This parameter does nothing if the image already exists. (You will get the image with code 200 no matter what) Possible values: `true``false` pageintegerOptional Specify which page you want to get a thumbnail for. Defaults to the cover, aka page 1. Responses chevron-right 200 If the thumbnail was already extracted, you get it directly. application/octet-stream string · binaryOptional chevron-right 202 The thumbnail is queued for extraction. Use `/api/minion/:jobid` to track when your thumbnail is ready. application/json chevron-right 400 No archive ID response application/json get /archives/{id}/thumbnail HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 If the thumbnail was already extracted, you get it directly. chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-thumbnail) 🔑 Update archive thumbnail put https://lrr.tvc-16.science/api/archives/{id}/thumbnail Update the cover thumbnail for the given Archive. You can specify a page number to use as the thumbnail, or you can use the default thumbnail. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters pageintegerOptional Page you want to make the thumbnail out of. Defaults to 1. Responses chevron-right 200 Archive thumbnail updated application/json operationstring · enumOptional Name of operation Possible values: `update_thumbnail` successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` new\_thumbnailstringOptional New thumbnail URL chevron-right 400 No archive ID response application/json put /archives/{id}/thumbnail HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive thumbnail updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-toc) 🔑 Add entry to Archive Table of Contents put https://lrr.tvc-16.science/api/archives/{id}/toc Add an entry to the Table of Contents of a given Archive. The ToC is stored as a JSON-encoded key-value array mapping a page to a title for the chapter/section starting at that page. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters pageintegerRequired Page number where the chapter/section starts. titlestringRequired Title of the chapter/section. Responses chevron-right 200 Archive TOC updated application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response or other error application/json chevron-right 423 Locked resource response application/json put /archives/{id}/toc HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive TOC updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#delete-archives-id-toc) 🔑 Remove entry from Archive Table of Contents delete https://lrr.tvc-16.science/api/archives/{id}/toc Delete an entry from the Table of Contents of a given Archive. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters pageintegerRequired Page number of the chapter/section to delete. Responses chevron-right 200 Archive TOC updated application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response or other error application/json chevron-right 423 Locked resource response application/json delete /archives/{id}/toc HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive TOC updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-categories) Get archive categories get https://lrr.tvc-16.science/api/archives/{id}/categories Get all the Categories which currently refer to this Archive ID. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive categories application/json categoriesobject\[\]Optional Array of category metadata Example: `{"id":"SET_1613080290","name":"My great category","pinned":0,"search":null,"archives":["0d50858d727723d856d2ab78564bb8e906e65f14","7f03b8b1f337e1e42b2c2890533c0de7479d41ca"]}` Show propertiesplus operationstring · enumOptional Name of the operation Possible values: `find_arc_categories` successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json get /archives/{id}/categories HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive categories chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-tankoubons) Get archive tankoubons get https://lrr.tvc-16.science/api/archives/{id}/tankoubons Get all the Tankoubons which currently refer to this Archive ID. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive tankoubons application/json tankoubonsstring\[\]Optional Array of tankoubon IDs operationstring · enumOptional Name of the operation Possible values: `find_arc_tankoubons` successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json get /archives/{id}/tankoubons HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive tankoubons chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-download) Download archive get https://lrr.tvc-16.science/api/archives/{id}/download Download an Archive from the server. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to download. Responses chevron-right 200 Archive file application/octet-stream string · binaryOptional chevron-right 400 No archive ID response application/json get /archives/{id}/download HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive file chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-files) Extract an Archive get https://lrr.tvc-16.science/api/archives/{id}/files Get a list of URLs pointing to the images contained in an archive. If necessary, this endpoint also launches a background Minion job to extract the archive so it is ready for reading. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters forcebooleanOptional Force a full background re-extraction of the Archive. Existing cached files might still be used in subsequent `/api/archives/:id/page` calls until the Archive is fully re-extracted. Responses chevron-right 200 You get page URLs, and the ID of the background extract job. application/json jobintegerOptional ID of the background extract job pagesstring\[\]Optional Page URLs chevron-right 400 No archive ID response application/json get /archives/{id}/files HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 You get page URLs, and the ID of the background extract job. chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#post-archives-id-files-thumbnails) Extract page thumbnails post https://lrr.tvc-16.science/api/archives/{id}/files/thumbnails Create thumbnails for every page of a given Archive. This endpoint will queue generation of the thumbnails in the background. If all thumbnails are detected as already existing, the call will return HTTP code 200. This endpoint can be called multiple times -- If a thumbnailing job is already in progress for the given ID, it'll just give you the ID for that ongoing job. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters forcebooleanOptional Whether to force regeneration of all thumbnails even if they already exist. Responses chevron-right 200 If thumbnails are already extracted and `force=0` application/json messagestringOptional operationstring · enumOptional Name of operation Possible values: `generate_page_thumbnails` successstring · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 202 The thumbnails are queued for extraction. You can use `/api/minion/:jobid` to track progress, by looking at `notes->progress` and `notes->pages`. application/json chevron-right 400 No archive ID response application/json post /archives/{id}/files/thumbnails HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 If thumbnails are already extracted and `force=0` chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-page) Get an archive page get https://lrr.tvc-16.science/api/archives/{id}/page Get an archive page. This call is mainly used alongside `/api/archives/files`. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to download. Query parameters pathanyRequired Path to the image. Responses chevron-right 200 Archive page application/octet-stream string · binaryOptional chevron-right 400 No archive ID response application/json get /archives/{id}/page HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive page chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-progress-page) Update reading progression put https://lrr.tvc-16.science/api/archives/{id}/progress/{page} Tell the server which page of this Archive you're currently showing/reading, so that it updates its internal reading progression accordingly. This endpoint will also update the date this Archive was last read, using the current server timestamp. You should call this endpoint only when you're sure the user is currently reading the page you present. **Don't** use it when preloading images off the server. Whether to make reading progression regressible or not is up to the client. (The web client will reduce progression if the user starts reading previous pages) Consider however removing the "New!" flag from an archive when you start updating its progress - The web client won't display any reading progression if the new flag is still set. ⚠ If the server is configured to use clientside progress tracking, this API call will return an error! Make sure to check using `/api/info` whether the server tracks reading progression or not before calling this endpoint. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. pageintegerRequired Current page to update the reading progress to. **Must** be a positive integer, and inferior or equal to the total page number of the archive. Responses chevron-right 200 Success response application/json idstring · min: 40 · max: 40Optional ID of the archive updated operationstring · enumOptional Name of the operation Possible values: `update_progress` pageintegerOptional Updated reading progress lastreadtimeintegerOptional Last read time in epoch seconds successinteger · enumOptional Returns 1 if successful, else 0 Possible values: `0``1` chevron-right 400 Generic error response application/json chevron-right 401 Authentication required when authprogress is enabled application/json chevron-right 423 Locked resource response application/json put /archives/{id}/progress/{page} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-isnew) 🔑 Set Archive New flag put https://lrr.tvc-16.science/api/archives/{id}/isnew Sets/Restores the "New!" flag on an archive. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Successful response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json put /archives/{id}/isnew HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Successful response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#delete-archives-id-isnew) Clear Archive New flag delete https://lrr.tvc-16.science/api/archives/{id}/isnew Clears the "New!" flag on an archive. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Successful response application/json idstring · min: 40 · max: 40Required ID of the archive operationstring · enumRequired Name of the operation Possible values: `clear_new` successinteger · enumRequired Returns 1 if successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json delete /archives/{id}/isnew HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Successful response chevron-down [PreviousSearch APIchevron-left](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/search-api) [NextDatabase APIchevron-right](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/database-api) Last updated 2 months ago * [GETGet all Archives](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives) * [GETGet all untagged archives](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-untagged) * [PUT🔑 Upload Archive](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-upload) * [DELETE🔑 Delete archive](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#delete-archives-id) * [GETGet archive metadata](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-metadata) * [PUT🔑 Update archive metadata](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-metadata) * [GETGet archive thumbnail](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-thumbnail) * [PUT🔑 Update archive thumbnail](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-thumbnail) * [PUT🔑 Add entry to Archive Table of Contents](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-toc) * [DELETE🔑 Remove entry from Archive Table of Contents](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#delete-archives-id-toc) * [GETGet archive categories](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-categories) * [GETGet archive tankoubons](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-tankoubons) * [GETDownload archive](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-download) * [GETExtract an Archive](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-files) * [POSTExtract page thumbnails](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#post-archives-id-files-thumbnails) * [GETGet an archive page](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#get-archives-id-page) * [PUTUpdate reading progression](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-progress-page) * [PUT🔑 Set Archive New flag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#put-archives-id-isnew) * [DELETEClear Archive New flag](https://sugoi.gitbook.io/lanraragi/dev/api-documentation/archive-api#delete-archives-id-isnew) Copy GET /api/archives HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color",\ "lastreadtime": 1337038281,\ "title": "Fate GO MEMO",\ "filename": "Fate GO MEMO",\ "summary": null,\ "size": 1234567,\ "toc": [\ {\ "name": "Chapter 1",\ "page": 1\ },\ {\ "name": "Chapter 2",\ "page": 13\ },\ {\ "name": "Chapter 3",\ "page": 25\ }\ ]\ }\ ] Copy GET /api/archives/untagged HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ "d1858d5dc36925aa66be072a97817650d39de166",\ "c3458d5dc36925da93be072a97817650d39de166",\ "28697b96f0ac5858be2614ed10ca47742c9522fd"\ ] Copy PUT /api/archives/upload HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: multipart/form-data Accept: */* Content-Length: 107 { "file": "binary", "file_checksum": "text", "category_id": "text", "tags": "text", "title": "text", "summary": "text" } Copy { "operation": "upload", "success": 1, "id": "text" } Copy DELETE /api/archives/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "delete_archive", "success": 1, "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b", "filename": "big_chungus.zip" } Copy GET /api/archives/{id}/metadata HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd", "isnew": false, "extension": "rar", "pagecount": 34, "progress": 3, "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color", "lastreadtime": 1337038281, "title": "Fate GO MEMO", "filename": "Fate GO MEMO", "summary": null, "size": 1234567, "toc": [\ {\ "name": "Chapter 1",\ "page": 1\ },\ {\ "name": "Chapter 2",\ "page": 13\ },\ {\ "name": "Chapter 3",\ "page": 25\ }\ ] } Copy PUT /api/archives/{id}/metadata HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "update_metadata", "success": 1 } Copy GET /api/archives/{id}/thumbnail HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary Copy PUT /api/archives/{id}/thumbnail HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "update_thumbnail", "success": 0, "new_thumbnail": "text" } Copy PUT /api/archives/{id}/toc?page=1&title=text HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "update_toc", "success": 1, "successMessage": "Added ToC entry for page 143." } Copy DELETE /api/archives/{id}/toc?page=1 HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "remove_toc", "success": 1, "successMessage": "Removed ToC entry for page 143." } Copy GET /api/archives/{id}/categories HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "operation": "find_arc_categories", "success": 1, "categories": [\ {\ "id": "SET_1613080290",\ "name": "My great category",\ "pinned": 0,\ "search": null,\ "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "7f03b8b1f337e1e42b2c2890533c0de7479d41ca"\ ]\ },\ {\ "id": "SET_1613080294",\ "name": "My other category",\ "pinned": 1,\ "search": null,\ "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "75d18ce470dc99f83dc355bdad66319d1f33c82b"\ ]\ }\ ] } Copy GET /api/archives/{id}/tankoubons HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "operation": "find_arc_tankoubons", "success": 1, "tankoubons": [\ "TANK_1688616437",\ "TANK_1688693913"\ ] } Copy GET /api/archives/{id}/download HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary Copy GET /api/archives/{id}/files HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "job": 561, "pages": [\ ".\\/api\\/archives\\/28697b96f0ac5858be2614ed10ca47742c9522fd\\/page&path=00.jpg",\ ".\\/api\\/archives\\/28697b96f0ac5858be2614ed10ca47742c9522fd\\/page&path=01.jpg"\ ] } Copy POST /api/archives/{id}/files/thumbnails HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "message": "No job queued, all thumbnails already exist.", "operation": "generate_page_thumbnails", "success": 1 } Copy GET /api/archives/{id}/page HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary Copy PUT /api/archives/{id}/progress/{page} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b", "operation": "update_progress", "page": 34, "lastreadtime": 123943543, "success": 1 } Copy PUT /api/archives/{id}/isnew HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/archives/{id}/isnew HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "id": "text", "operation": "clear_new", "success": 0 } --- # Archive API | LANraragi ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives) Get all Archives get https://lrr.tvc-16.science/api/archives Returns a list of all archives in the database. You can use the IDs of this JSON with the other endpoints. Responses chevron-right 200 Array of archives application/json JSON object for archive metadata for most API responses arcidone ofRequired Unique identifier for the archive (40-char SHA1) or tankoubon (15-char TANK\_\* ID) any · min: 40 · max: 40OptionalPattern: `^[0-9a-f]{40}$` or any · min: 15 · max: 15OptionalPattern: `^TANK_[0-9]{10}$` titlestringRequired Title of the archive filenamestringRequired Filename of the archive tagsstringRequired Comma-separated list of tags associated with the archive summarystring · nullableOptional Summary description of the archive isnewone of · nullableRequired Whether the archive is newly added. booleanOptional or stringOptional extensionstringRequired File extension of the archive progressintegerRequired Reading progress (page number) pagecountintegerRequired Total number of pages in the archive lastreadtimeintegerRequired Unix timestamp of when the archive was last read sizeintegerRequired Size of the archive in bytes tocarrayOptional Table of contents for the archive get /archives HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Array of archives ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-untagged) Get all untagged archives get https://lrr.tvc-16.science/api/archives/untagged Get archives that don't have any tags recorded. This follows the same rules as the Batch Tagging filter and will include archives that have parody:, date\_added:, series: or artist: tags. Responses chevron-right 200 Array of archive IDs application/json string\[\]Optional get /archives/untagged HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Array of archive IDs ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-upload) 🔑 Upload Archive put https://lrr.tvc-16.science/api/archives/upload Upload an Archive to the server. If a SHA1 checksum of the Archive is included, the server will perform an optional in-transit, file integrity validation, and reject the upload if the server-side checksum does not match. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Body multipart/form-datachevron-down multipart/form-data filestring · binaryRequired Archive file to upload file\_checksumstringOptional SHA1 checksum of the archive for in-transit validation. Pattern: `^[a-fA-F0-9]{40}$` category\_idstring · min: 14 · max: 14Optional Category ID you'd want the archive to be added to. tagsstringOptional Set of tags you want to insert in the database alongside the archive. titlestringOptional Title of the Archive. summarystringOptional Summary of the Archive. Responses chevron-right 200 Archive uploaded successfully application/json operationstringRequired Name of operation Example: `upload` successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `1` idstring · min: 40 · max: 40Required ID of the uploaded archive chevron-right 400 Bad request application/json chevron-right 409 Duplicate archive application/json chevron-right 415 Unsupported file application/json chevron-right 417 Checksum mismatch application/json chevron-right 422 Unprocessable Entity application/json chevron-right 423 Locked resource response application/json chevron-right 500 Internal Server Error application/json put /archives/upload HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive uploaded successfully chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#delete-archives-id) 🔑 Delete archive delete https://lrr.tvc-16.science/api/archives/{id} Delete both the archive metadata and the file stored on the server. 🙏 Please ask your user for confirmation before invoking this endpoint. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive deleted response application/json operationstring · enumOptional Name of the operation Possible values: `delete_archive` idstring · min: 40 · max: 40Optional ID of the archive filenamestringOptional Filename of the deleted archive successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json delete /archives/{id} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive deleted response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-metadata) Get archive metadata get https://lrr.tvc-16.science/api/archives/{id}/metadata Get Metadata (title, tags) for a given Archive. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive metadata application/json JSON object for archive metadata for most API responses arcidone ofRequired Unique identifier for the archive (40-char SHA1) or tankoubon (15-char TANK\_\* ID) any · min: 40 · max: 40OptionalPattern: `^[0-9a-f]{40}$` or any · min: 15 · max: 15OptionalPattern: `^TANK_[0-9]{10}$` titlestringRequired Title of the archive filenamestringRequired Filename of the archive tagsstringRequired Comma-separated list of tags associated with the archive summarystring · nullableOptional Summary description of the archive isnewone of · nullableRequired Whether the archive is newly added. booleanOptional or stringOptional extensionstringRequired File extension of the archive progressintegerRequired Reading progress (page number) pagecountintegerRequired Total number of pages in the archive lastreadtimeintegerRequired Unix timestamp of when the archive was last read sizeintegerRequired Size of the archive in bytes tocarrayOptional Table of contents for the archive chevron-right 400 No archive ID response application/json get /archives/{id}/metadata HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive metadata chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-metadata) 🔑 Update archive metadata put https://lrr.tvc-16.science/api/archives/{id}/metadata Update tags and title for the given Archive. Data supplied to the server through this method will **overwrite** the previous data. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters titlestringOptional New Title of the Archive. tagsstringOptional New Tags of the Archive. summarystringOptional New Summary of the Archive. Responses chevron-right 200 Archive metadata updated application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json put /archives/{id}/metadata HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive metadata updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-thumbnail) Get archive thumbnail get https://lrr.tvc-16.science/api/archives/{id}/thumbnail Get a Thumbnail image for a given Archive. This endpoint will return a placeholder image if it doesn't already exist. If you want to queue generation of the thumbnail in the background, you can use the no\_fallback query parameter. This will give you a background job ID instead of the placeholder. Path parameters idstring · min: 40 · max: 40Required ID of the archive to process Query parameters no\_fallbackstring · enumOptional Disables the placeholder image, queues the thumbnail for extraction and returns a JSON with code 202. This parameter does nothing if the image already exists. (You will get the image with code 200 no matter what) Possible values: `true``false` pageintegerOptional Specify which page you want to get a thumbnail for. Defaults to the cover, aka page 1. Responses chevron-right 200 If the thumbnail was already extracted, you get it directly. application/octet-stream string · binaryOptional chevron-right 202 The thumbnail is queued for extraction. Use `/api/minion/:jobid` to track when your thumbnail is ready. application/json chevron-right 400 No archive ID response application/json get /archives/{id}/thumbnail HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 If the thumbnail was already extracted, you get it directly. chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-thumbnail) 🔑 Update archive thumbnail put https://lrr.tvc-16.science/api/archives/{id}/thumbnail Update the cover thumbnail for the given Archive. You can specify a page number to use as the thumbnail, or you can use the default thumbnail. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters pageintegerOptional Page you want to make the thumbnail out of. Defaults to 1. Responses chevron-right 200 Archive thumbnail updated application/json operationstring · enumOptional Name of operation Possible values: `update_thumbnail` successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` new\_thumbnailstringOptional New thumbnail URL chevron-right 400 No archive ID response application/json put /archives/{id}/thumbnail HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive thumbnail updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-toc) 🔑 Add entry to Archive Table of Contents put https://lrr.tvc-16.science/api/archives/{id}/toc Add an entry to the Table of Contents of a given Archive. The ToC is stored as a JSON-encoded key-value array mapping a page to a title for the chapter/section starting at that page. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters pageintegerRequired Page number where the chapter/section starts. titlestringRequired Title of the chapter/section. Responses chevron-right 200 Archive TOC updated application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response or other error application/json chevron-right 423 Locked resource response application/json put /archives/{id}/toc HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive TOC updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#delete-archives-id-toc) 🔑 Remove entry from Archive Table of Contents delete https://lrr.tvc-16.science/api/archives/{id}/toc Delete an entry from the Table of Contents of a given Archive. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters pageintegerRequired Page number of the chapter/section to delete. Responses chevron-right 200 Archive TOC updated application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response or other error application/json chevron-right 423 Locked resource response application/json delete /archives/{id}/toc HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive TOC updated chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-categories) Get archive categories get https://lrr.tvc-16.science/api/archives/{id}/categories Get all the Categories which currently refer to this Archive ID. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive categories application/json categoriesobject\[\]Optional Array of category metadata Example: `{"id":"SET_1613080290","name":"My great category","pinned":0,"search":null,"archives":["0d50858d727723d856d2ab78564bb8e906e65f14","7f03b8b1f337e1e42b2c2890533c0de7479d41ca"]}` Show propertiesplus operationstring · enumOptional Name of the operation Possible values: `find_arc_categories` successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json get /archives/{id}/categories HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive categories chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-tankoubons) Get archive tankoubons get https://lrr.tvc-16.science/api/archives/{id}/tankoubons Get all the Tankoubons which currently refer to this Archive ID. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Archive tankoubons application/json tankoubonsstring\[\]Optional Array of tankoubon IDs operationstring · enumOptional Name of the operation Possible values: `find_arc_tankoubons` successinteger · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json get /archives/{id}/tankoubons HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive tankoubons chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-download) Download archive get https://lrr.tvc-16.science/api/archives/{id}/download Download an Archive from the server. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to download. Responses chevron-right 200 Archive file application/octet-stream string · binaryOptional chevron-right 400 No archive ID response application/json get /archives/{id}/download HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive file chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-files) Extract an Archive get https://lrr.tvc-16.science/api/archives/{id}/files Get a list of URLs pointing to the images contained in an archive. If necessary, this endpoint also launches a background Minion job to extract the archive so it is ready for reading. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters forcebooleanOptional Force a full background re-extraction of the Archive. Existing cached files might still be used in subsequent `/api/archives/:id/page` calls until the Archive is fully re-extracted. Responses chevron-right 200 You get page URLs, and the ID of the background extract job. application/json jobintegerOptional ID of the background extract job pagesstring\[\]Optional Page URLs chevron-right 400 No archive ID response application/json get /archives/{id}/files HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 You get page URLs, and the ID of the background extract job. chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#post-archives-id-files-thumbnails) Extract page thumbnails post https://lrr.tvc-16.science/api/archives/{id}/files/thumbnails Create thumbnails for every page of a given Archive. This endpoint will queue generation of the thumbnails in the background. If all thumbnails are detected as already existing, the call will return HTTP code 200. This endpoint can be called multiple times -- If a thumbnailing job is already in progress for the given ID, it'll just give you the ID for that ongoing job. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Query parameters forcebooleanOptional Whether to force regeneration of all thumbnails even if they already exist. Responses chevron-right 200 If thumbnails are already extracted and `force=0` application/json messagestringOptional operationstring · enumOptional Name of operation Possible values: `generate_page_thumbnails` successstring · enumOptional Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 202 The thumbnails are queued for extraction. You can use `/api/minion/:jobid` to track progress, by looking at `notes->progress` and `notes->pages`. application/json chevron-right 400 No archive ID response application/json post /archives/{id}/files/thumbnails HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 If thumbnails are already extracted and `force=0` chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-page) Get an archive page get https://lrr.tvc-16.science/api/archives/{id}/page Get an archive page. This call is mainly used alongside `/api/archives/files`. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to download. Query parameters pathanyRequired Path to the image. Responses chevron-right 200 Archive page application/octet-stream string · binaryOptional chevron-right 400 No archive ID response application/json get /archives/{id}/page HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Archive page chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-progress-page) Update reading progression put https://lrr.tvc-16.science/api/archives/{id}/progress/{page} Tell the server which page of this Archive you're currently showing/reading, so that it updates its internal reading progression accordingly. This endpoint will also update the date this Archive was last read, using the current server timestamp. You should call this endpoint only when you're sure the user is currently reading the page you present. **Don't** use it when preloading images off the server. Whether to make reading progression regressible or not is up to the client. (The web client will reduce progression if the user starts reading previous pages) Consider however removing the "New!" flag from an archive when you start updating its progress - The web client won't display any reading progression if the new flag is still set. ⚠ If the server is configured to use clientside progress tracking, this API call will return an error! Make sure to check using `/api/info` whether the server tracks reading progression or not before calling this endpoint. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. pageintegerRequired Current page to update the reading progress to. **Must** be a positive integer, and inferior or equal to the total page number of the archive. Responses chevron-right 200 Success response application/json idstring · min: 40 · max: 40Optional ID of the archive updated operationstring · enumOptional Name of the operation Possible values: `update_progress` pageintegerOptional Updated reading progress lastreadtimeintegerOptional Last read time in epoch seconds successinteger · enumOptional Returns 1 if successful, else 0 Possible values: `0``1` chevron-right 400 Generic error response application/json chevron-right 401 Authentication required when authprogress is enabled application/json chevron-right 423 Locked resource response application/json put /archives/{id}/progress/{page} HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Success response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-isnew) 🔑 Set Archive New flag put https://lrr.tvc-16.science/api/archives/{id}/isnew Sets/Restores the "New!" flag on an archive. Authorizations api\_keychevron-down api\_key AuthorizationstringRequired Use Authorization: Bearer Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Successful response application/json operationstringRequired Name of operation errorstringOptional Error message if any successMessagestringOptional Success message if any successinteger · enumRequired Returns 1 if operation was successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json put /archives/{id}/isnew HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Successful response chevron-down ### [hashtag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#delete-archives-id-isnew) Clear Archive New flag delete https://lrr.tvc-16.science/api/archives/{id}/isnew Clears the "New!" flag on an archive. Path parameters idstring · min: 40 · max: 40Required ID of the Archive to process. Responses chevron-right 200 Successful response application/json idstring · min: 40 · max: 40Required ID of the archive operationstring · enumRequired Name of the operation Possible values: `clear_new` successinteger · enumRequired Returns 1 if successful, else 0 Possible values: `0``1` chevron-right 400 No archive ID response application/json chevron-right 423 Locked resource response application/json delete /archives/{id}/isnew HTTPchevron-down HTTPcURLJavaScriptPython Test it 200 Successful response chevron-down [PreviousSearch APIchevron-left](https://sugoi.gitbook.io/lanraragi/api-documentation/search-api) [NextDatabase APIchevron-right](https://sugoi.gitbook.io/lanraragi/api-documentation/database-api) Last updated 1 day ago * [GETGet all Archives](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives) * [GETGet all untagged archives](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-untagged) * [PUT🔑 Upload Archive](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-upload) * [DELETE🔑 Delete archive](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#delete-archives-id) * [GETGet archive metadata](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-metadata) * [PUT🔑 Update archive metadata](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-metadata) * [GETGet archive thumbnail](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-thumbnail) * [PUT🔑 Update archive thumbnail](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-thumbnail) * [PUT🔑 Add entry to Archive Table of Contents](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-toc) * [DELETE🔑 Remove entry from Archive Table of Contents](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#delete-archives-id-toc) * [GETGet archive categories](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-categories) * [GETGet archive tankoubons](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-tankoubons) * [GETDownload archive](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-download) * [GETExtract an Archive](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-files) * [POSTExtract page thumbnails](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#post-archives-id-files-thumbnails) * [GETGet an archive page](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#get-archives-id-page) * [PUTUpdate reading progression](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-progress-page) * [PUT🔑 Set Archive New flag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#put-archives-id-isnew) * [DELETEClear Archive New flag](https://sugoi.gitbook.io/lanraragi/api-documentation/archive-api#delete-archives-id-isnew) Copy GET /api/archives HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ {\ "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd",\ "isnew": false,\ "extension": "rar",\ "pagecount": 34,\ "progress": 3,\ "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color",\ "lastreadtime": 1337038281,\ "title": "Fate GO MEMO",\ "filename": "Fate GO MEMO",\ "summary": null,\ "size": 1234567,\ "toc": [\ {\ "name": "Chapter 1",\ "page": 1\ },\ {\ "name": "Chapter 2",\ "page": 13\ },\ {\ "name": "Chapter 3",\ "page": 25\ }\ ]\ }\ ] Copy GET /api/archives/untagged HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy [\ "d1858d5dc36925aa66be072a97817650d39de166",\ "c3458d5dc36925da93be072a97817650d39de166",\ "28697b96f0ac5858be2614ed10ca47742c9522fd"\ ] Copy PUT /api/archives/upload HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Content-Type: multipart/form-data Accept: */* Content-Length: 107 { "file": "binary", "file_checksum": "text", "category_id": "text", "tags": "text", "title": "text", "summary": "text" } Copy { "operation": "upload", "success": 1, "id": "text" } Copy DELETE /api/archives/{id} HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "delete_archive", "success": 1, "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b", "filename": "big_chungus.zip" } Copy GET /api/archives/{id}/metadata HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "arcid": "28697b96f0ac5858be2614ed10ca47742c9522fd", "isnew": false, "extension": "rar", "pagecount": 34, "progress": 3, "tags": "parody:fate grand order, group:wadamemo, artist:wada rco, artbook, full color", "lastreadtime": 1337038281, "title": "Fate GO MEMO", "filename": "Fate GO MEMO", "summary": null, "size": 1234567, "toc": [\ {\ "name": "Chapter 1",\ "page": 1\ },\ {\ "name": "Chapter 2",\ "page": 13\ },\ {\ "name": "Chapter 3",\ "page": 25\ }\ ] } Copy PUT /api/archives/{id}/metadata HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "update_metadata", "success": 1 } Copy GET /api/archives/{id}/thumbnail HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary Copy PUT /api/archives/{id}/thumbnail HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "update_thumbnail", "success": 0, "new_thumbnail": "text" } Copy PUT /api/archives/{id}/toc?page=1&title=text HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "update_toc", "success": 1, "successMessage": "Added ToC entry for page 143." } Copy DELETE /api/archives/{id}/toc?page=1 HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "remove_toc", "success": 1, "successMessage": "Removed ToC entry for page 143." } Copy GET /api/archives/{id}/categories HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "operation": "find_arc_categories", "success": 1, "categories": [\ {\ "id": "SET_1613080290",\ "name": "My great category",\ "pinned": 0,\ "search": null,\ "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "7f03b8b1f337e1e42b2c2890533c0de7479d41ca"\ ]\ },\ {\ "id": "SET_1613080294",\ "name": "My other category",\ "pinned": 1,\ "search": null,\ "archives": [\ "0d50858d727723d856d2ab78564bb8e906e65f14",\ "75d18ce470dc99f83dc355bdad66319d1f33c82b"\ ]\ }\ ] } Copy GET /api/archives/{id}/tankoubons HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "operation": "find_arc_tankoubons", "success": 1, "tankoubons": [\ "TANK_1688616437",\ "TANK_1688693913"\ ] } Copy GET /api/archives/{id}/download HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary Copy GET /api/archives/{id}/files HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "job": 561, "pages": [\ ".\\/api\\/archives\\/28697b96f0ac5858be2614ed10ca47742c9522fd\\/page&path=00.jpg",\ ".\\/api\\/archives\\/28697b96f0ac5858be2614ed10ca47742c9522fd\\/page&path=01.jpg"\ ] } Copy POST /api/archives/{id}/files/thumbnails HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "message": "No job queued, all thumbnails already exist.", "operation": "generate_page_thumbnails", "success": 1 } Copy GET /api/archives/{id}/page HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy binary Copy PUT /api/archives/{id}/progress/{page} HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "id": "75d18ce470dc99f83dc355bdad66319d1f33c82b", "operation": "update_progress", "page": 34, "lastreadtime": 123943543, "success": 1 } Copy PUT /api/archives/{id}/isnew HTTP/1.1 Host: lrr.tvc-16.science Authorization: YOUR_API_KEY Accept: */* Copy { "operation": "text", "error": "text", "successMessage": "text", "success": 0 } Copy DELETE /api/archives/{id}/isnew HTTP/1.1 Host: lrr.tvc-16.science Accept: */* Copy { "id": "text", "operation": "clear_new", "success": 0 } ---