Skip to content

Commit 8b758e8

Browse files
committed
Initial version
0 parents  commit 8b758e8

20 files changed

+1917
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
permissions:
11+
contents: read
12+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
13+
# pull-requests: read
14+
jobs:
15+
golangci:
16+
name: lint
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: golangci-lint
21+
uses: golangci/golangci-lint-action@v2
22+
with:
23+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
24+
version: v1.29
25+
26+
# Optional: working directory, useful for monorepos
27+
# working-directory: somedir
28+
29+
# Optional: golangci-lint command line arguments.
30+
# args: --issues-exit-code=0
31+
32+
# Optional: show only new issues if it's a pull request. The default value is `false`.
33+
# only-new-issues: true
34+
35+
# Optional: if set to true then the action will use pre-installed Go.
36+
# skip-go-installation: true
37+
38+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
39+
# skip-pkg-cache: true
40+
41+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
42+
# skip-build-cache: true

.github/workflows/goreleaser.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
-
17+
id: vars
18+
run: |
19+
echo ::set-output name=go_version::$(cat go.mod | head -3 | tail -1 | cut -d ' ' -f 2)
20+
echo "Using Go version ${{ steps.vars.outputs.go_version }}"
21+
- name: Set up Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ steps.vars.outputs.go_version }}
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v2
27+
with:
28+
distribution: goreleaser
29+
version: latest
30+
args: release --rm-dist
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OS
2+
.DS_Store
3+
4+
# IDEs and editors
5+
/.idea
6+
.project
7+
.classpath
8+
.c9/
9+
*.launch
10+
.settings/
11+
*.sublime-workspace
12+
13+
# IDE - VSCode
14+
.vscode/*
15+
!.vscode/settings.json
16+
!.vscode/tasks.json
17+
!.vscode/launch.json
18+
!.vscode/extensions.json
19+
20+
# TinShop specific
21+
config.yaml
22+
titles.US.en.json
23+
/dist

.goreleaser.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This is an example .goreleaser.yml file with some sane defaults.
2+
# Make sure to check the documentation at http://goreleaser.com
3+
before:
4+
hooks:
5+
# You may remove this if you don't use go modules.
6+
- go mod tidy
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- windows
13+
- darwin
14+
archives:
15+
- replacements:
16+
darwin: Darwin
17+
linux: Linux
18+
windows: Windows
19+
386: i386
20+
amd64: x86_64
21+
checksum:
22+
name_template: 'checksums.txt'
23+
snapshot:
24+
name_template: "{{ incpatch .Version }}-next"
25+
changelog:
26+
sort: asc
27+
filters:
28+
exclude:
29+
- '^docs:'
30+
- '^doc:'
31+
- '^test:'
32+
- '^wip:'

.vscode/settings.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"cSpell.words": [
3+
"dblk",
4+
"fsnotify",
5+
"goreleaser",
6+
"tinshop",
7+
"titledb",
8+
"tmpl"
9+
]
10+
}

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<p align="center">
2+
<p align="center">
3+
<img alt="TinShop" src="./logo.png" width="50%">
4+
</p>
5+
<p align="center">
6+
Your own personal shop right into tinfoil!
7+
</p>
8+
9+
[![Actions Status](https://github.com/dblk/tinshop/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/dblk/tinshop/actions)
10+
[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/dblk/tinshop.svg)](https://github.com/dblk/tinshop)
11+
[![GoDoc reference example](https://img.shields.io/badge/godoc-reference-blue.svg)](https://godoc.org/github.com/dblk/tinshop/v0.0.1)
12+
[![GoReportCard example](https://goreportcard.com/badge/github.com/dblk/tinshop)](https://goreportcard.com/report/github.com/dblk/tinshop)
13+
[![GitHub release](https://img.shields.io/github/release/dblk/tinshop.svg)](https://GitHub.com/dblk/tinshop/releases/)
14+
15+
# Disclaimer
16+
17+
This program **DOES NOT** encourage piracy at all!
18+
It was designed to reduce the time to download/install a game from the Nintendo eShop.
19+
In case you have a ADSL connection, to install latest `Zelda` ([14.4Gb](https://www.nintendo.com/games/detail/the-legend-of-zelda-breath-of-the-wild-switch/)) it can take ages!
20+
21+
On top of that, if you have bought a game on eShop like [Jump Force](https://www.bandainamcoent.com/news/jump-force-sunsetting-announcement), once it is not anymore on the shop how can you install it again?
22+
Using your personal NSP dump, with `tinfoil` and `tinshop` everything should be fine and fast!
23+
24+
# Use
25+
26+
To proper use this software, here is the checklist:
27+
- [ ] _Optional:_ A proper configured `config.yaml`
28+
- [ ] Copy/Paste [`config.example.yaml`](https://github.com/DblK/tinshop/blob/master/config.example.yaml) to `config.yaml`
29+
- [ ] Comment/Uncomment parts in the config according to your needs
30+
- [ ] Games should have in their name `[ID][v0]` to be recognized
31+
- [ ] Retrieve binary from [latest release](https://github.com/DblK/tinshop/releases) or build from source (See `Dev` section below)
32+
33+
Now simply run it and add a shop inside tinfoil with the address setup in `config` (or `http://localIp:3000` if not specified).
34+
35+
# Features
36+
37+
Here is the list of all main features so far:
38+
- [X] Automatically download `titles.US.en.json` if missing at startup
39+
- [X] Basic protection from forged queries (should allow only tinfoil to use the shop)
40+
- [X] Serve from several mounted directories
41+
- [X] Serve from several network directories (Using NFS)
42+
- [X] Display a webpage for forbidden devices
43+
44+
# Dev or build from source
45+
46+
I suggest to use a tiny executable [gow](https://github.com/mitranim/gow) to help you during the process (hot reload, etc..).
47+
For example I use the following command to develop `gow -c run .`.
48+
49+
If you want to build `TinShop` from source, please run `go build`.
50+
51+
And then, simply run `./tinshop`.
52+
53+
## Want to do cross-build generation?
54+
55+
Wanting to generate all possible os binaries (macOS, linux, windows) with all architectures (arm, amd64)?
56+
Here is the command `goreleaser release --snapshot --skip-publish --rm-dist`.
57+
58+
Dead simple, thanks to Golang!
59+
60+
# Roadmap
61+
62+
You can see the [roadmap here](https://github.com/DblK/tinshop/projects/1).
63+
64+
If you have any suggestions, do not hesitate to participate!
65+
66+
# Q & A
67+
68+
## Why use this instead of `X` (NUT or others software)?
69+
70+
It's dead simple, and no dependencies! It's just a single small executable.
71+
Easier to install games without connecting switch or by updating SD card (Nightmare if you are on macOS).
72+
73+
The upcoming features will also be a huge advantage against others software.
74+
75+
## Where do I put my games?
76+
77+
By default, `TinShop` will look into the `games` directory relative to `tinshop` executable.
78+
79+
However in the `config.yaml` file, you can change this.
80+
In the `sources` section, you can have the following:
81+
- `directories`: List of directories where you put your games
82+
- `nfs`: List of NFS shares that contains your games
83+
84+
85+
## Can I set up a `https` endpoint?
86+
87+
Yes, you can!
88+
Use a reverse proxy (like [traefik](https://github.com/traefik/traefik), [caddy](https://github.com/caddyserver/caddy), nginx...) to do tls termination and forward to your instance on port `3000`.
89+
90+
## How can I add a `basic auth` to protect my shop?
91+
92+
TinShop **does not** implement basic auth by itself.
93+
You should configure it inside your reverse proxy.
94+
95+
For other type of protection, you can whitelist (__*__) your own switch and this will do the trick.
96+
97+
__*__ Feature not yet implemented!
98+
99+
## I have tons of missing title displayed in `tinfoil`, what should I do?
100+
101+
First, download and replace the latest [`titles.US.en.json`](https://github.com/AdamK2003/titledb/releases/download/latest/titles.US.en.json) available (or delete it, it will be automatically downloaded at startup).
102+
If this does not solve your issue, then you should use custom titledb entry (__*__) to describe those which are missing.
103+
104+
__*__ Feature not yet implemented!
105+
106+
# Credits
107+
108+
I would like to give back thanks to the people who helped me with or without knowing!
109+
- [Bogdan Rosu Creative](https://www.iconfinder.com/icons/353439/basket_purse_shopping_cart_ecommerce_shop_buy_online_icon) for his shop icon.
110+
- [Dono](https://github.com/Donorhan) for his support and tests.
111+
- [AdamK2003](https://github.com/AdamK2003/titledb) for his up-to-date [`titles.US.en.json`](https://github.com/AdamK2003/titledb/releases/download/latest/titles.US.en.json) and his answers on discord.

assets/shop.tmpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<html>
2+
<head>
3+
<meta charset="utf-8">
4+
<meta name="viewport" content="width=device-width">
5+
<title>{{.ShopTitle}}</title>
6+
<style>
7+
.copyright {
8+
color: #8a8a8a;
9+
bottom: 0;
10+
position: absolute;
11+
right: 0;
12+
margin: 1rem;
13+
}
14+
</style>
15+
</head>
16+
<body>
17+
<h1>Welcome to {{.ShopTitle}}!</h1>
18+
<h2>Please connect with a switch to be able to browse collection.</h2>
19+
<span class='copyright'>Powered by <a href="https://github.com/DblK/tinshop" target="_blank">TinShop</a>. © 2021 DblK</span>
20+
</body>
21+
</html>

config.example.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Name of the host [optional]
2+
host: tinshop.example.com
3+
4+
# Protocol (Can be http or https) [optional]
5+
# If you use "https" then you should set up a reverse-proxy in front to handle tls
6+
# And forward the port 443 to "yourIp:3000"
7+
protocol: https
8+
9+
# Port [optional]
10+
# This only affect the url to download games. The web server still run on port 3000.
11+
# If you change the port, you will need to set up a reverse proxy
12+
# port: 3000
13+
14+
# Shop name [optional]
15+
# This is used as title when trying to visit the shop with a non switch device
16+
name: TinShop
17+
18+
# All debug flags will be stored here
19+
debug:
20+
# Display more information when connecting to nfs share
21+
nfs: false
22+
23+
# All sources where we should look for games
24+
# If this section is commented out, then the directory "games" will be looked at
25+
sources:
26+
# Local mounted path [optional]
27+
directories:
28+
- /my/full/path/to/games
29+
- ./games
30+
31+
# NFS Shares [optional]
32+
nfs:
33+
- host:sharePath/to/game/files

0 commit comments

Comments
 (0)