LANraragi Documentation
repository·dev·Indexed 25 days ago
https://github.com/difegue/lanraragiAn open-source archival server for comics and manga built on Mojolicious and Redis. It features web-based reading, an OPDS catalog for external reader software, and a Client API for third-party integration. Supported formats include zip, rar, 7z, cbz, cbr, pdf, and epub. The system includes features for managing archives, chapters, tags, and Tankoubons (meta-archives), as well as a comprehensive API for server interaction.
What's inside LANraragi
- LANraragi is an open-source server designed for the archival of comics and manga. It is built using Mojolicious and Redis. It allows users to store archives in various formats, read them directly in a web browser, or use dedicated reader software via an OPDS Catalog. It also provides a Client API for external program interaction.
Understand LANraragi terminology
devUse this glossary to understand the core concepts used within the LANraragi interface and configuration:
- Archive: The base unit of content (e.g., a book or manga).
- Chapter: A specific section within an Archive defined by a start and end page.
- Tag: Comma-separated metadata attached to an Archive.
- Index: The main library page used for searching and opening Archives.
- Category: A collection of Archives displayed in the Index (can be static or dynamic).
- Bookmark: A way to favorite an Archive by adding it to a 'Favorites' Category.
- Stamp: Geo-positioned metadata (X/Y coordinates) attached to a specific page within an Archive.
- Tankoubon: A merged set of Archives with a custom order that functions as a single unit (also known as Meta-Archives).
Use Shinobu File Watcher for background tasks
devShinobu is a background worker process spawned via the
Proc::SimplePerl module that runs in parallel with the Mojolicious Server. It is responsible for:- Scanning the content folder for new archives at startup.
- Monitoring the content folder for new or deleted archives using
inotifywatches. - Adding new archives to the database.
- Executing Plugins on new archives.
For heavier tasks, Shinobu utilizes a Minion Job Queue.
Understand the LANraragi directory structure
devThe application is organized into several key directories:
lib/: Core application code.LANraragi.pm: Entrypoint for the app, handles routing to Controllers.Shinobu.pm: Background worker process.LANraragi/Controller/: Contains logic for specific pages (e.g.,Api/).LANraragi/Model/: Application logic independent of Mojolicious (e.g.,Archive.pm,Config.pm,Plugins.pm,Search.pm).LANraragi/Plugin/: Stores LRR Plugins (Login, Metadata, Scripts).LANraragi/Utils/: Generic functions used by both the app and Plugins.
content/: Default folder for archives.public/: Static files for web clients (CSS, JS, Images, Themes).script/: Execution scripts likelauncher.plandlanraragi(bootstrap).tools/: Build and installation tools, includinginstall.pl.
Configure LANraragi with Docker Compose
devIf you prefer using
docker-compose.yml, use the following configuration. This setup includesrestart: unless-stoppedto ensure the service recovers after a reboot or crash.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-stoppedManage Content and Thumbnail Folders
devThe Content Folder is the core storage for LANraragi, containing archives, thumbnails, and (on Windows) the Redis database. The folder is subdirectory-aware.
Supported Archive Formats
zip/cbzrar/cbr(up to RAR4 only)tar.gz/cbtlzma7z/cb7xzpdfepub(images only via Web Client or Client API)cbw(ComicBookWeb: XML referencing remote images)
Thumbnail Configuration
You can dissociate the thumbnail folder from the Content Folder (e.g., to move it to an SSD or keep the Content Folder read-only).
Warning: If you switch to a new thumbnail location, you must move your existing thumbnails manually; LANraragi does not support automatic migration of thumbnails to a new folder.
Create a Blacklist of tags
devA blacklist is a simple list of rules used to remove unwanted tags. You can either list the tags directly or prefix them with a minus sign. Both formats are valid for removing tags.
# Format 1 forbidden content incomplete # Format 2 -forbidden content -incompleteManage Tankoubon metadata and order
devYou can customize a Tankoubon after creation by accessing its Edit metadata page. This allows you to:
- Add or modify metadata specific to the Tankoubon.
- Reorder the sub-Archives within the Tank.
- Drill down to edit the metadata of individual sub-Archives.
Warning on Deletion:
- Deleting a Tankoubon will not delete the sub-Archives; they will simply reappear in search results.
- Any metadata applied specifically to the Tankoubon (and not its sub-Archives) will be lost upon deletion.
- If sub-Archives are manually deleted from the server, the Tankoubon will remain in the database (even if it contains 0 Archives).
Build LANraragi from source using Docker
devIf you want to build a custom or bleeding-edge version from a cloned Git repository, run the following command from the root of the repo:
npm run docker-buildConfigure Nginx as a reverse proxy for LANraragi
devWhen running LANraragi behind an Nginx reverse proxy, you must adjust specific settings to ensure archive uploads and large downloads work correctly.
Key requirements:
- Set
client_max_body_size 0;to disable upload size limits. - Set
proxy_max_temp_file_size 0;to support large downloads. - Configure
UpgradeandConnectionheaders in thelocation /block to support the batch tagger when using SSL.
Example Nginx configuration:
http { client_max_body_size 0; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443 ssl; server_name lanraragi.example.net; client_max_body_size 0; proxy_max_temp_file_size 0; location / { proxy_pass http://0.0.0.0:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } }http { client_max_body_size 0; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443 ssl; server_name lanraragi.example.net; client_max_body_size 0; proxy_max_temp_file_size 0; location / { proxy_pass http://0.0.0.0:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } }- Set
Read values in the LRR Database
devAccess the LRR Redis database using the
LANraragi::Model::Configmodule. This utilizes the Redis Perl binding library.my $redis = LANraragi::Model::Config->get_redis; my $value = $redis->get("key");Install and Test a Plugin
devInstallation
- Drop the
.pmfile into the LANraragiPlugindirectory. - Restart the application.
- Alternatively, you can sideload plugins through the Plugin Configuration menu in the web interface.
Testing
- Metadata plugins: Enable them for Automatic Execution or run them on individual archives.
- Script plugins: Execute them directly from the Plugin Configuration menu.
- Login plugins: Currently cannot be tested directly.
- API: Plugins can also be executed via the Client API.
Note: If LANraragi is running in Debug Mode, debug messages from your plugin will be captured in the logs.
- Drop the