├── .gitignore ├── library-manager ├── settings.json └── Dockerfile ├── tinfoil-web-server ├── Dockerfile └── settings.json ├── docker-compose.yml └── README.MD /.gitignore: -------------------------------------------------------------------------------- 1 | games 2 | library-manager/prod.keys 3 | -------------------------------------------------------------------------------- /library-manager/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "versions_etag": "W/\"ac50c92650d7d91:0\"", 3 | "titles_etag": "W/\"e543ce5fdd8d91:0\"", 4 | "prod_keys": "./prod.keys", 5 | "folder": "/games", 6 | "scan_folders": ["/games"], 7 | "gui": false, 8 | "debug": false, 9 | "check_for_missing_updates": true, 10 | "check_for_missing_dlc": true, 11 | "organize_options": { 12 | "create_folder_per_game": true, 13 | "rename_files": true, 14 | "delete_empty_folders": true, 15 | "delete_old_update_files": true, 16 | "folder_name_template": "{TITLE_NAME}", 17 | "switch_safe_file_names": true, 18 | "file_name_template": "{TITLE_NAME} ({DLC_NAME})[{TITLE_ID}][v{VERSION}]" 19 | }, 20 | "scan_recursively": true, 21 | "gui_page_size": 100 22 | } -------------------------------------------------------------------------------- /tinfoil-web-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:latest 2 | 3 | # install dependencies 4 | RUN apt update -y && apt install -y \ 5 | curl \ 6 | unzip \ 7 | libicu-dev 8 | 9 | # download the latest release of the app, extract it and remove the zip etc 10 | RUN latest_release_url=$(curl -s https://api.github.com/repos/Myster-Tee/TinfoilWebServer/releases/latest | grep "browser_download_url" | grep "Independent-linux-x64.zip" | cut -d '"' -f 4) \ 11 | && curl -L -o release.zip $latest_release_url \ 12 | && unzip release.zip || true \ 13 | && rm release.zip \ 14 | && mv /TinfoilWebServer* /TinfoilWebServer \ 15 | && chmod +x /TinfoilWebServer/TinfoilWebServer 16 | 17 | # copy the settings file from the host 18 | COPY ./settings.json /TinfoilWebServer.config.json 19 | 20 | # run the app 21 | ENTRYPOINT ["/TinfoilWebServer/TinfoilWebServer"] -------------------------------------------------------------------------------- /library-manager/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:latest 2 | 3 | # install dependencies 4 | RUN apt update -y && apt install -y \ 5 | wget \ 6 | unzip \ 7 | git 8 | 9 | # the directory (in the container) where the app will be installed 10 | RUN mkdir /app 11 | WORKDIR /app 12 | 13 | # download the latest release of the app, extract it and remove the zip etc 14 | RUN wget https://github.com/giwty/switch-library-manager/releases/latest/download/switch-library-manager.Console.linux.zip -O switch-library-manager.zip \ 15 | && unzip switch-library-manager.zip || true \ 16 | && rm switch-library-manager.zip \ 17 | && chmod +x ./switch-library-manager 18 | 19 | # need to run once to download the latest games list 20 | RUN ./switch-library-manager 21 | 22 | # copy the settings file and the prod.keys file from the host 23 | COPY ./settings.json ./settings.json 24 | COPY ./prod.keys ./prod.keys 25 | 26 | # run the app 27 | ENTRYPOINT ["./switch-library-manager"] -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | # version 3 is the best 3 | 4 | 5 | services: 6 | # this is tinfoil-web-server 7 | tinfoil-web-server: 8 | # i want to build this service from a dockerfile 9 | build: 10 | context: ./tinfoil-web-server 11 | dockerfile: Dockerfile 12 | # i want to name this container tinfoil-web-server 13 | container_name: tinfoil-web-server 14 | # i want to restart this service if it crashes 15 | restart: always 16 | # i want to expose port 80 on the container to port 8000 on the host 17 | ports: 18 | - "8000:80" 19 | # i want to store the games in a folder called games on the host 20 | volumes: 21 | - ./games:/games 22 | 23 | # this is the library manager that will rearrange the games correctly 24 | library-manager: 25 | # i want to build this service from a dockerfile 26 | build: 27 | context: ./library-manager 28 | dockerfile: Dockerfile 29 | container_name: library-manager 30 | # my games are stored in a folder called games on the host 31 | volumes: 32 | - ./games:/games -------------------------------------------------------------------------------- /tinfoil-web-server/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ServedDirectories": [ "/games" ], 3 | "StripDirectoryNames": true, 4 | "ServeEmptyDirectories": false, 5 | "AllowedExt": [ "nsp", "nsz", "xci" ], 6 | "MessageOfTheDay": "Welcome to my personal Tinfoil Web Server! if you are seeing this, you are probably a friend of mine. If you are not, please leave. but remember, fuck nintendo", 7 | "ExtraRepositories": [], 8 | "CacheExpiration": { 9 | "Enabled": true, 10 | "ExpirationDelay": "01:00:00" 11 | }, 12 | "Authentication": { 13 | "Enabled": true, 14 | "WebBrowserAuthEnabled": true, 15 | "Users": [ 16 | { 17 | "Name": "macron", 18 | "Pwd": "demission" 19 | } 20 | ] 21 | }, 22 | "Blacklist": { 23 | "Enabled": true, 24 | "FilePath": "blacklist.txt", 25 | "MaxConsecutiveFailedAuth": 3, 26 | "IsBehindProxy": true 27 | }, 28 | "Kestrel": { 29 | "Endpoints": { 30 | "Http": { 31 | "Url": "http://0.0.0.0:80" 32 | } 33 | } 34 | }, 35 | "Logging": { 36 | "LogLevel": { 37 | "Default": "Information" 38 | }, 39 | "Console": { 40 | "LogLevel": { 41 | "Default": "Information" 42 | } 43 | }, 44 | "File": { 45 | "Path": "TinfoilWebServer.log", 46 | "Append": true, 47 | "MinLevel": "Information", 48 | "FileSizeLimitBytes": 1000000, 49 | "MaxRollingFiles": 10 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | 2 | # tinfoil-shop-tutorial 3 | 4 | This is a homemade tutorial on how to run your own instance of a tinfoil shop (just like pixel shop and such) 5 | 6 | ## TLDR: i just want to run the project don't try to teach me anything! 7 | 8 | Clone the project 9 | 10 | ```bash 11 | git clone https://github.com/Reaster0/tinfoil-shop-tutorial.git 12 | ``` 13 | 14 | Go to the project directory 15 | 16 | ```bash 17 | cd tinfoil-shop-tutorial 18 | ``` 19 | 20 | - Add the ```prod.keys``` file in the library-manager directory 21 | 22 | Launch the docker-compose 23 | 24 | ```bash 25 | docker compose up --build -d 26 | ``` 27 | 28 | - Add your nsp/nsz/xci games to the new "games" folder 29 | 30 | (Ocasionally) restart the server to update the newly added files 31 | 32 | ```bash 33 | docker compose restart 34 | ``` 35 | or 36 | ```bash 37 | docker-compose restart 38 | ``` 39 | 40 | #### everything is now accessible at your local ip (or localhost) at the port : 8000 41 | ``` 42 | http://my-local-ip:8000 43 | ``` 44 | ## How does it work? 45 | 46 | it's actually simple, i won't go into the detail of how the tinfoil webserver is running in itself but more in HOW you deploy it (so you can deploy any versions or type of tinfoil-web-server) 47 | #### in short it's two services, ```tinfoil-web-server``` that run the server in itself and ```library-manager``` that will rearrange correctly our library 48 | - the tinfoil-web-server that will be used here is this one : ```https://github.com/Myster-Tee/TinfoilWebServer/``` 49 | - the library-manager that will ve used here is this one: ```https://github.com/giwty/switch-library-manager``` 50 | 51 | ### As the dockerman i command you to raise 52 | 53 | we will use a very used tool named docker compose that is an orchestrator of containers, but john what's a containers? we'll it's like a tiiiiny virtual computer os (like your shitty windows but better because it's linux and it's also tiny), so you can run your programs not in your ""own computer"" but on a "smol virtual computer in a big computer" (so it will run on any computer (windoshit, macos, linux), that's the point) 54 | 55 | so we make a docker compose file ```docker-compose.yml``` 56 | 57 | in it you'll find a description of the services that we want to run and how (read the comments there) 58 | ```the game directory that we mount is "games" by default``` 59 | - but what is a dockerfile? 60 | well it's the file in wich we will say what our "smol virtual computer in a big computer" is 61 | 62 | ### As the dockerfile i raise 63 | so we have a dockerfile in each directory, it's composed of command that it run in the smol linux to get us the programs that we need to run the program (yeah we need programs to run programs, funny isin't it?) 64 | ```don't worry if you don't understand much, it's the same for my parents when i explain to them my job``` 65 | - once the docker have builded they will stay in cache and it will be faster to relaunch the app after 66 | 67 | ### How do i run this blackmagic fuckery? 68 | well it's easy, first of all 69 | - step 1 70 | you can download the files using git (if you know how to do it), else you can download the files as a zip using the green "code" button, then you will need to have docker and docker-compose installed on your computer, you can install docker-desktop to have both if you are on windoshit or macos there ```https://www.docker.com/products/docker-desktop```, if you are on linux, well do it yourself chad 71 | 72 | - step 2 73 | modify the config files at your will, you don't have much to change for library-manager but for the tinfoil-web-server you can change the welcome message of your server and also the user/password (you can set many if you want) 74 | - by default its ```user: macron pswd: demission``` 75 | add the ```prod.keys``` file in the library-manager-dir, without it the program will try to guess the game from the name and it won't work well, i suppose that you know where to find this file right? 76 | 77 | - step 7 78 | open the terminal/cmd, go to the directory of the project (where the docker compose file is) then... 79 | 80 | Launch the docker-compose 81 | 82 | ```bash 83 | docker compose up --build -d 84 | ``` 85 | or 86 | ```bash 87 | docker-compose up --build -d 88 | ``` 89 | 90 | - Add your nsp/nsz/xci games to the new "games" folder 91 | 92 | (Ocasionally) restart the server to update the newly added files 93 | 94 | ```bash 95 | docker compose restart 96 | ``` 97 | 98 | #### everything is now accessible at your local ip (or localhost) at the port : 8000 99 | ``` 100 | http://my-local-ip:8000 101 | ``` 102 | 103 | the containers will run in the background while docker is running (even if you restart your computer the containers will re up themselves) 104 | if you want to stop them just use the following command: 105 | ``` 106 | docker compose down 107 | ``` 108 | or 109 | ``` 110 | docker-compose down 111 | ``` 112 | 113 | 114 | ## wasen't so hard no? 115 | 116 | ### if you have found this tutorial helpfull you can always tip me some monero (they're soo crunchy) : ```46gXH9dmfReixASkA5c8jN9eR6At4ZSJBQ5DqWkaAEMsLXquiWQQuBe4D8wVT2Utuh54bDTHnF1ScjBT3vUtAgUX1uu5Baw``` cheers mates! --------------------------------------------------------------------------------