mirror of
https://github.com/misenhower/splatoon2.ink.git
synced 2026-04-26 01:20:38 -05:00
Add basic SplatNet update command
This commit is contained in:
parent
bc207534d7
commit
e6c0e398b4
1
.env.example
Normal file
1
.env.example
Normal file
|
|
@ -0,0 +1 @@
|
|||
NINTENDO_SESSION_ID=
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
|||
node_modules
|
||||
.env
|
||||
public/*
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
"dev": "webpack",
|
||||
"watch": "npm run dev -- --watch",
|
||||
"build": "webpack -p --env production",
|
||||
"serve": "webpack-dev-server"
|
||||
"serve": "webpack-dev-server --content-base public/",
|
||||
"splatnet": "node src/splatoon/update.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.16.2",
|
||||
"babel-core": "^6.25.0",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-preset-env": "^1.6.0",
|
||||
|
|
@ -14,11 +16,13 @@
|
|||
"bulma": "^0.5.0",
|
||||
"clean-webpack-plugin": "^0.1.16",
|
||||
"css-loader": "^0.28.4",
|
||||
"dotenv": "^4.0.0",
|
||||
"extract-text-webpack-plugin": "^3.0.0",
|
||||
"favicons-webpack-plugin": "^0.0.7",
|
||||
"file-loader": "^0.11.2",
|
||||
"html-loader": "^0.5.0",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"mkdirp": "^0.5.1",
|
||||
"node-sass": "^4.5.3",
|
||||
"purify-css": "^1.2.5",
|
||||
"purifycss-webpack": "^0.7.0",
|
||||
|
|
|
|||
|
|
@ -11,3 +11,9 @@ yarn serve
|
|||
```shell
|
||||
yarn build
|
||||
```
|
||||
|
||||
## Update SplatNet Data
|
||||
|
||||
```shell
|
||||
yarn splatnet
|
||||
```
|
||||
|
|
|
|||
22
src/splatoon/update.js
Normal file
22
src/splatoon/update.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
require('dotenv').config();
|
||||
const axios = require('axios');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const mkdirp = require('mkdirp');
|
||||
|
||||
// Make sure the data path exists
|
||||
const dataPath = path.resolve('public/data');
|
||||
mkdirp(dataPath);
|
||||
|
||||
// SplatNet2 API
|
||||
const api = axios.create({
|
||||
baseURL: 'https://app.splatoon2.nintendo.net/api/',
|
||||
headers: {'Cookie': `iksm_session=${process.env.NINTENDO_SESSION_ID}`},
|
||||
});
|
||||
|
||||
// Update map schedules
|
||||
console.info('Updating map schedules...');
|
||||
api.get('schedules').then(response => {
|
||||
fs.writeFile(`${dataPath}/schedules.json`, JSON.stringify(response.data));
|
||||
console.info('Updated map schedules.');
|
||||
});
|
||||
19
yarn.lock
19
yarn.lock
|
|
@ -236,6 +236,13 @@ aws4@^1.2.1:
|
|||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
|
||||
|
||||
axios@^0.16.2:
|
||||
version "0.16.2"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d"
|
||||
dependencies:
|
||||
follow-redirects "^1.2.3"
|
||||
is-buffer "^1.1.5"
|
||||
|
||||
babel-code-frame@^6.11.0, babel-code-frame@^6.22.0:
|
||||
version "6.22.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4"
|
||||
|
|
@ -1564,7 +1571,7 @@ debug@2.6.7:
|
|||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@2.6.8, debug@^2.1.1, debug@^2.2.0, debug@^2.6.6, debug@^2.6.8:
|
||||
debug@2.6.8, debug@^2.1.1, debug@^2.2.0, debug@^2.4.5, debug@^2.6.6, debug@^2.6.8:
|
||||
version "2.6.8"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc"
|
||||
dependencies:
|
||||
|
|
@ -1721,6 +1728,10 @@ domutils@1.5, domutils@1.5.1:
|
|||
dom-serializer "0"
|
||||
domelementtype "1"
|
||||
|
||||
dotenv@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-4.0.0.tgz#864ef1379aced55ce6f95debecdce179f7a0cd1d"
|
||||
|
||||
ecc-jsbn@~0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
|
||||
|
|
@ -2155,6 +2166,12 @@ flatten@^1.0.2:
|
|||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"
|
||||
|
||||
follow-redirects@^1.2.3:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.2.4.tgz#355e8f4d16876b43f577b0d5ce2668b9723214ea"
|
||||
dependencies:
|
||||
debug "^2.4.5"
|
||||
|
||||
for-each@^0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.2.tgz#2c40450b9348e97f281322593ba96704b9abd4d4"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user