PHPinfoil
Simple PHP, one file, no database, no external library and no bullshit to serve your backups and eshop games to Tinfoil and DBI
Check it here:
https://github.com/TheyKilledKenny/PHPinfoil/
I wanted to connect my HDD with my nsp to the Switch without the need for cables and I also wanted to reach my collection from anywhere.
I then took a Raspberry to which I connected my usb HDD, and with this php I solved my problems.
Works also on PC Windows/Linux/MacOs with PHP 5 or above, on Nas with php support and in many other place
Why another php to serve index to Tinfoil or DBI?
I needed a light, portable and fast php to create a repository for Tinfoil so that I could install backups without cables.
I also didn't have any need to link to external GDrives or similar.
The projects I found, however, were not able to manage a nested folder structure, which for some repositories can also be articulated and some of them required the use of a DB that I did not want to use.
If you want to use GDrive or others, please check other more feature rich projets like https://github.com/ibnux/php-tinfoil-server
What it does
Parameters:
At the beginning of the PHP file you will find some options to set for your setup
(the belows are quick examples, not intended for production environments)
Setup a Raspberry Pi and a USB HDD (with your backups) as personal shop:
From your PC Windows, Linux and should work also on MacOs
Simple PHP, one file, no database, no external library and no bullshit to serve your backups and eshop games to Tinfoil and DBI
Check it here:
https://github.com/TheyKilledKenny/PHPinfoil/
I wanted to connect my HDD with my nsp to the Switch without the need for cables and I also wanted to reach my collection from anywhere.
I then took a Raspberry to which I connected my usb HDD, and with this php I solved my problems.
Works also on PC Windows/Linux/MacOs with PHP 5 or above, on Nas with php support and in many other place
Why another php to serve index to Tinfoil or DBI?
I needed a light, portable and fast php to create a repository for Tinfoil so that I could install backups without cables.
I also didn't have any need to link to external GDrives or similar.
The projects I found, however, were not able to manage a nested folder structure, which for some repositories can also be articulated and some of them required the use of a DB that I did not want to use.
If you want to use GDrive or others, please check other more feature rich projets like https://github.com/ibnux/php-tinfoil-server
What it does
- Cycles through all the files and folders in the given path and creates the json file to be provided to Tinfoil
- The first run it creates a json index cache file (write permission is needed), to avoid rescan all the files. The following times if the cache file exists this is provided, otherwise a new file is created
- Call the PHPinfoil.php with ?reset to delete and recreate the cache file
- No Database Needed
- Put all your games in a folder under the path served by your php webserver, they can be divided into subfolders
- Copy the PHPinfoil.php file to a folder (also the same folder of games) on the same http server, reachable by http clients
- Check that all your games have [TitleID] in the filename or Tinfoil won't show it in the list
- Configure the parameters in PHPinfoil.php accordingly to your setup
Parameters:
At the beginning of the PHP file you will find some options to set for your setup
PHP:
//http Document root, This should be ok as is
$rootFolder = $_SERVER['DOCUMENT_ROOT'] . "/";
//folder where the nsp files are stored
$Folder = "games";
//Writable folder to hold the cache file
$cacheFolder = "cache/";
//Cache file name
$cacheFile = "mycache";
//Extentions to check
$arrExtensions = ['nsp','xci','nsz','xcz'];
// false = json output for Tinfoil, true = html output for Tinfoil and DBI
$DBI = true;
(the belows are quick examples, not intended for production environments)
Setup a Raspberry Pi and a USB HDD (with your backups) as personal shop:
- Follow this link to setup a nginx webserver and php: https://www.raspberrypi.org/documentation/remote-access/web-server/nginx.md
- Connect the usb hdd, open a terminal on your raspberry pi
- type sudo fdisk -l and find /dev/sdx that match your usb drive
- type sudo ls -l /dev/disk/by-uuid/ and find UUID related to your /dev/sdx usb drive (Needed in step 6)
- type sudo mkdir /var/www/html/php and copy in this PHPinfoil.php renamed in index.php
- type sudo mkdir /var/www/html/cache and sudo chmod 777 /var/www/html/cache
- type sudo mkdir /var/www/html/games to create a folder where to mount the usb drive
- type sudo nano /etc/fstab and add this line at the end UUID=uuid_Found_In_Step2 /var/www/html/games auto uid=pi,gid=pi 0 0
- Reboot
- enter the address http://rpi.address.ip/php/ in Tinfoil as a new location or open in a web browser to check the resulting json.
From your PC Windows, Linux and should work also on MacOs
- Install PHP 5 or greater for your system from https://www.php.net/downloads
- copy PHPinfoil.php in the folder where you store your games and rename it in index.php
- open terminal/cmd/bash/whatever
- type ipconfig or ifconfig command to get your current ip address
- cd into your game folder
- type php -S 0.0.0.0:80 to start php webserver
- set in Tinfoil a location to http://yourIp.at.step.4/
- close and reopen Tinfoil
Last edited by TheyKilledKenny,