LANraragi Documentation

repository·dev·Indexed 25 days ago

https://github.com/difegue/lanraragi

An 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.

Tokens
31.3K
Snippets
48
Records
221
Agent score
81%

What's inside LANraragi

  1. Overview of LANraragi

    dev
    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.
  2. Understand LANraragi terminology

    dev

    Use 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).
  3. Use Shinobu File Watcher for background tasks

    dev

    Shinobu is a background worker process spawned via the Proc::Simple Perl 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 inotify watches.
    • Adding new archives to the database.
    • Executing Plugins on new archives.

    For heavier tasks, Shinobu utilizes a Minion Job Queue.

  4. Understand the LANraragi directory structure

    dev

    The 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 like launcher.pl and lanraragi (bootstrap).
    • tools/: Build and installation tools, including install.pl.
  5. Configure LANraragi with Docker Compose

    dev

    If you prefer using docker-compose.yml, use the following configuration. This setup includes restart: unless-stopped to 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-stopped
  6. Manage Content and Thumbnail Folders

    dev

    The 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/cbz
    • rar/cbr (up to RAR4 only)
    • tar.gz/cbt
    • lzma
    • 7z/cb7
    • xz
    • pdf
    • epub (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.

  7. Manage Tankoubon metadata and order

    dev

    You 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).
  8. Configure Nginx as a reverse proxy for LANraragi

    dev

    When 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 Upgrade and Connection headers in the location / 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;
        }
    }
  9. Install and Test a Plugin

    dev

    Installation

    1. Drop the .pm file into the LANraragi Plugin directory.
    2. Restart the application.
    3. 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.