a1ex4 / ownfoil

Lightweight and customizable Tinfoil Shop manager, with automatic saves backup.
BSD 3-Clause "New" or "Revised" License
311 stars 32 forks source link
atmosphere homebrew nintendo nintendo-switch nintendo-switch-hacking self-hosted sigpatches switch tinfoil

Ownfoil

Docker Image Version (latest semver) Docker Pulls Docker Image Size (latest semver) Tinfoil Version Awoo Version

Ownfoil is a simple webserver aimed at running your own Tinfoil/Awoo shop from your local library, with full shop customisation and authentication. It is designed to periodically scan your library (default every 5 minutes), generate Tinfoil index file and serve it all over HTTP/S. This makes it easy to manage your library and have your personal collection available at any time.

Ownfoil can also be used to backup saves from multiple Switch devices, and make them available in your shop so you can use Tinfoil to reinstall them.

Why this project? I wanted a lightweight, dead simple, no dependancy and private personal Shop, without having to rely on other proprietary services (Google, 1fichier...) and having to maintain their implementation.

Table of Contents

Usage

Ownfoil is shipped as a Docker container for simplicity and compatibility. You first need to install Docker. Come back when you have a working installation!

Then, there are two ways to start the container, with docker run or docker-compose.

Use the PUID and PGID environment variables to make sure the app will have write access to your game directory.

Docker run

Running this command will start the shop on port 8000 with the library in /your/game/directory :

docker run -d -p 8000:80 -v /your/game/directory:/games --name ownfoil a1ex4/ownfoil

The shop is now accessible with your computer/server IP and port, i.e. http://localhost:8000 from the same computer or http://192.168.1.100:8000 from a device in your network.

Docker compose

Create a file named docker-compose.yml with the following content:

version: "3"

services:
  ownfoil:
    container_name: ownfoil
    image: a1ex4/ownfoil
    environment:
      # For write permission in /games directory
      - PUID=1000
      - PGID=1000
      # Setup auth
      - USERNAME=a1ex
      - PASSWORD=pass
      # - ROOT_DIR=/games
      # - SAVE_ENABLED=true
    volumes:
      - /your/game/directory:/games
    ports:
      - "8000:80"

You can then create and start the container with the command (executed in the same directory as the docker-compose file):

docker-compose up -d

This is usefull if you don't want to remember the docker run command and have a persistent and reproductible container configuration.

Tinfoil setup

In Tinfoil, add a shop with the following settings:

Configuration

On the first run of Ownfoil, a shop_config.toml file will be created in your games directory - use this file to configure different settings, like the scan interval.

All settings are described in the comments of the default configuration file.

Some settings can be overridden by using environment variables in the container, see here for the list.

Shop Customization

All Tinfoil shop index keys are configurable - at the first run of Ownfoil, a shop_template.toml will be created in your games directory, just fill in the keys to customize your shop.

Setup Authentication

To enable shop authentication, simply define and set the USERNAME and PASSWORD environment variables inside the container. See the docker-compose example.

Saves Manager

Ownfoil can be configured to backup saves from multiple Switch device and make them available in your shop, so that you can install them with Tinfoil. It uses FTP to periodically retrieve the saves.

Follow the guide below to enable an FTP server on your Switch and configure Ownfoil.

Setup sys-ftpd on the Switch

Follow the sys-ftpd configuration to set up the user, password and port used for the FTP connection. Note these for Ownfoil configuration, as well as the IP of your Switch. If you installed ovl-sysmodule you can toggle on/off the FTP server using the Tesla overlay.

It is recommended to test the FTP connection at least once with a regular FTP Client to make sure everything is working as expected on the switch.

Extract saves on the Switch

Using JKSV or Tinfoil (or any other saves manager), periodically extract your saves so that they can be retrieved by Ownfoil.

Note the folders where the saves are extracted. If you didn't change these settings, the default paths are:

Ownfoil configuration

In your shop configuration file, the save manager settings available are:

[saves]
# Enable or disable automatic saves backup
enabled = true

# Interval to retrieve saves, in minutes.
interval = 60

Make sure these settings are present if you are updating from a version < 1.2.0.

See the default shop default configuration file for a working configuration.

Then multiple switch can be configured, with the FTP connection details and saves directories to retrieve:

# Switches configuration for save retrieval.
# If user and pass are not specified, use anonymous connection
# Alex's Switch
[[saves.switches]]
host = "192.168.1.200"
port = "5000"
# user = "username"
# pass = "password"
folders = [
    {local = "Saves/Tinfoil", remote = "/switch/tinfoil/saves/common"},
    {local = "Saves/JKSV", remote = "/JKSV"}
]

The directories will be saved under your games directory so that the saves can be indexed by Ownfoil and made available in Tinfoil.

In the example above the Tinfoil saves will be saved under ./Saves/Tinfoil

Roadmap

Planned feature, in no particular order.

Changelog

1.2.3

1.2.2

1.2.1

1.2.0

1.1.1

1.1.0

1.0.1

Similar Projects

If you want to create your personal NSP Shop then check out these other similar projects: