Add Dockerfile

This commit is contained in:
Samuel Elliott 2022-03-17 15:54:05 +00:00
parent 2005f34780
commit 056bb1edd6
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6
4 changed files with 69 additions and 2 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
dist
data

38
Dockerfile Normal file
View File

@ -0,0 +1,38 @@
FROM node:17 as build
WORKDIR /app
ADD package.json /app
ADD package-lock.json /app
RUN npm install
COPY src /app/src
COPY bin /app/bin
ADD tsconfig.json /app
RUN npx tsc
FROM node:17
RUN apt update && \
apt install -y android-tools-adb && \
apt-get clean
WORKDIR /app
ADD package.json /app
ADD package-lock.json /app
RUN npm ci --production
COPY bin /app/bin
COPY resources /app/resources
COPY --from=build /app/dist /app/dist
RUN ln -s /data/android /root/.android
VOLUME [ "/data" ]
ENTRYPOINT [ "/app/resources/docker-entrypoint.sh" ]
CMD [ "--help" ]

View File

@ -3,6 +3,27 @@ nxapi
Access the Nintendo Switch Online and Nintendo Switch Parental Controls app APIs. Includes Discord Rich Presence and friend notifications.
### Install
#### Install from source
Node.js and npm must already be installed.
```sh
git clone https://gitlab.fancy.org.uk/samuel/nxapi.git # or download as an archive
cd nxapi
# Install locally
npm install
npx tsc
npm link
# Build Docker image
docker build . --tag gitlab.fancy.org.uk:5005/samuel/nxapi
# # Run in Docker
# docker run -it --rm -v ./data:/data gitlab.fancy.org.uk:5005/samuel/nxapi ...
```
### Nintendo Switch Online
#### Login to the Nintendo Switch Online app
@ -257,7 +278,7 @@ nxapi pctl dump-summaries summaries --device 0123456789abcdef
# This will only show cached data and does not make any requests to Nintendo servers
nxapi users list
# User a specific user in a command
# Use a specific user in a command
nxapi ... --user 0123456789abcdef
nxapi ... --token $NA_SESSION_TOKEN
@ -300,7 +321,7 @@ This requires:
- adb is installed on the computer running nxapi
- The Android device is running adbd as root or a su-like command can be used to escalate to root
- The frida-server executable to be located at `/data/local/tmp/frida-server` on the Android device
- The frida-server executable is located at `/data/local/tmp/frida-server` on the Android device
- The Nintendo Switch Online app is installed on the Android device
The Android device must be constantly reachable using ADB. The server will exit if the device is unreachable.

5
resources/docker-entrypoint.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
mkdir -p /data/android
exec /app/bin/nxapi.js --data-path /data $@