Merge branch 'main' into dependabot/npm_and_yarn/next-seo-5.8.0

This commit is contained in:
Liam 2022-10-26 09:08:20 +01:00 committed by GitHub
commit 0f0a451798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 117 additions and 78 deletions

57
package-lock.json generated
View File

@ -11,7 +11,7 @@
"@nextui-org/react": "^1.0.0-beta.10",
"ioredis": "^5.2.3",
"next": "12",
"next-seo": "^5.8.0",
"next-seo": "^5.6.0",
"next-themes": "^0.2.1",
"node-fetch": "^3.2.10",
"prop-types": "^15.8.1",
@ -24,7 +24,7 @@
"devDependencies": {
"@types/node": "^18.11.3",
"@types/react": "^18.0.21",
"eslint": "8.25.0",
"eslint": "8.26.0",
"eslint-config-next": "12.3.1",
"typescript": "^4.8.4"
}
@ -197,9 +197,9 @@
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.10.7",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz",
"integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==",
"version": "0.11.6",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz",
"integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
@ -2488,14 +2488,15 @@
}
},
"node_modules/eslint": {
"version": "8.25.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz",
"integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==",
"version": "8.26.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.26.0.tgz",
"integrity": "sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/config-array": "^0.11.6",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -2511,14 +2512,14 @@
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.1",
"glob-parent": "^6.0.2",
"globals": "^13.15.0",
"globby": "^11.1.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
@ -3619,6 +3620,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/is-path-inside": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/is-regex": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",
@ -5322,9 +5332,9 @@
}
},
"@humanwhocodes/config-array": {
"version": "0.10.7",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.7.tgz",
"integrity": "sha512-MDl6D6sBsaV452/QSdX+4CXIjZhIcI0PELsxUjk4U828yd58vk3bTIvk/6w5FY+4hIy9sLW0sfrV7K7Kc++j/w==",
"version": "0.11.6",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz",
"integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
@ -7028,14 +7038,15 @@
"dev": true
},
"eslint": {
"version": "8.25.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz",
"integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==",
"version": "8.26.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.26.0.tgz",
"integrity": "sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/config-array": "^0.11.6",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@ -7051,14 +7062,14 @@
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.1",
"glob-parent": "^6.0.2",
"globals": "^13.15.0",
"globby": "^11.1.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
@ -7856,6 +7867,12 @@
"has-tostringtag": "^1.0.0"
}
},
"is-path-inside": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
"dev": true
},
"is-regex": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz",

View File

@ -26,7 +26,7 @@
"devDependencies": {
"@types/node": "^18.11.3",
"@types/react": "^18.0.21",
"eslint": "8.25.0",
"eslint": "8.26.0",
"eslint-config-next": "12.3.1",
"typescript": "^4.8.4"
}

View File

@ -44,14 +44,14 @@ export default class ScoreStats extends Component {
<p className={styles.scoreStatsAverageCut}>Average Cut</p>
<div className={styles.scoreStatsHands}>
<div className={styles.scoreStatsLeft}>
<p>{this.getAverage(data.SaberA.averagePreSwing).toFixed(2)}</p>
<p>{this.getAverage(data.SaberA.averagePostSwing).toFixed(2)}</p>
<p>{this.getAverage(data.SaberA.averageCut).toFixed(2)}</p>
<p>{data.SaberA.averagePreSwing.toFixed(2)}</p>
<p>{data.SaberA.averagePostSwing.toFixed(2)}</p>
<p>{data.SaberA.cutDistanceScore.toFixed(2)}</p>
</div>
<div className={styles.scoreStatsRight}>
<p>{this.getAverage(data.SaberB.averagePreSwing).toFixed(2)}</p>
<p>{this.getAverage(data.SaberB.averagePostSwing).toFixed(2)}</p>
<p>{this.getAverage(data.SaberB.averageCut).toFixed(2)}</p>
<p>{data.SaberB.averagePreSwing.toFixed(2)}</p>
<p>{data.SaberB.averagePostSwing.toFixed(2)}</p>
<p>{data.SaberB.cutDistanceScore.toFixed(2)}</p>
</div>
</div>
</div>

View File

@ -50,7 +50,7 @@ export async function getMapData(hash: string): Promise<MapData | undefined> {
bsr: jsonResponse.id,
mapArt: getLatestMapArt(jsonResponse),
};
await setValue(key, JSON.stringify(json));
await setValue(key, JSON.stringify(json), 86400 * 7); // Expire in a week
console.log(
`[Cache]: Cached BS Map Data for hash ${mapHash} in ${
Date.now() - before

View File

@ -32,7 +32,7 @@ export async function isValidSteamId(steamId) {
}
}
await setValue(`${KEY}${steamId}`, valid);
await setValue(`${KEY}${steamId}`, valid, valid ? 86400 * 7 : 86400); // Expire in a week if is valid
console.log(
`[Cache]: Cached Steam ID for id ${steamId} in ${Date.now() - before}ms`
);

View File

@ -15,6 +15,16 @@ export default class Overlay extends Component {
constructor(props) {
super(props);
this.cutData = [];
this.cutData.SaberA = {
count: [0, 0, 0],
totalScore: [0, 0, 0],
};
this.cutData.SaberB = {
count: [0, 0, 0],
totalScore: [0, 0, 0],
};
this._mounted = false;
this.state = {
hasError: false,
@ -41,14 +51,14 @@ export default class Overlay extends Component {
failed: false,
mapStarCount: undefined,
SaberA: {
averageCut: [15.0],
averagePreSwing: [70.0],
averagePostSwing: [30.0],
cutDistanceScore: 0.0,
averagePreSwing: 0.0,
averagePostSwing: 0.0,
},
SaberB: {
averageCut: [15.0],
averagePreSwing: [70.0],
averagePostSwing: [30.0],
cutDistanceScore: 0.0,
averagePreSwing: 0.0,
averagePostSwing: 0.0,
},
};
this.setupTimer();
@ -297,16 +307,25 @@ export default class Overlay extends Component {
await this.updateData(this.state.id);
}, 1000); // 1 second
}
this.cutData = [];
this.cutData.SaberA = {
count: [0, 0, 0],
totalScore: [0, 0, 0],
};
this.cutData.SaberB = {
count: [0, 0, 0],
totalScore: [0, 0, 0],
};
this.setState({
SaberA: {
averageCut: [15.0],
averagePreSwing: [70.0],
averagePostSwing: [30.0],
cutDistanceScore: 0.0,
averagePreSwing: 0.0,
averagePostSwing: 0.0,
},
SaberB: {
averageCut: [15.0],
averagePreSwing: [70.0],
averagePostSwing: [30.0],
cutDistanceScore: 0.0,
averagePreSwing: 0.0,
averagePostSwing: 0.0,
},
songInfo: undefined,
beatSaverData: undefined,
@ -352,25 +371,25 @@ export default class Overlay extends Component {
noteFullyCut: (data) => {
const { noteCut } = data;
let beforeCutScore = 0.0;
let afterCutScore = 0.0;
let cutDistanceScore = 0.0;
const cutDataSaber = this.cutData[noteCut.saberType];
cutDataSaber.count[0]++;
cutDataSaber.count[1]++;
cutDataSaber.count[2]++;
cutDataSaber.totalScore[0] += noteCut.beforeCutScore;
cutDataSaber.totalScore[1] += noteCut.afterCutScore;
cutDataSaber.totalScore[2] += noteCut.cutDistanceScore;
beforeCutScore = cutDataSaber.totalScore[0] / cutDataSaber.count[0];
afterCutScore = cutDataSaber.totalScore[1] / cutDataSaber.count[1];
cutDistanceScore = cutDataSaber.totalScore[2] / cutDataSaber.count[2];
const cutData = this.state[noteCut.saberType];
if (cutData.averageCut.includes(15) && cutData.averageCut.length === 1) {
cutData.averageCut = [];
}
if (
cutData.averagePreSwing.includes(70) &&
cutData.averagePreSwing.length === 1
) {
cutData.averagePreSwing = [];
}
if (
cutData.averagePostSwing.includes(30) &&
cutData.averagePostSwing.length === 1
) {
cutData.averagePostSwing = [];
}
cutData.averagePreSwing.push(noteCut.beforeCutScore);
cutData.averagePostSwing.push(noteCut.afterCutScore);
cutData.averageCut.push(noteCut.cutDistanceScore);
cutData.averagePreSwing = beforeCutScore;
cutData.averagePostSwing = afterCutScore;
cutData.cutDistanceScore = cutDistanceScore;
this.setState({ [noteCut.saberType]: cutData });
},
songStart: (data) => {

View File

@ -98,9 +98,10 @@
dependencies:
tslib "2.4.0"
"@humanwhocodes/config-array@^0.10.5":
version "0.10.7"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.7.tgz#6d53769fd0c222767e6452e8ebda825c22e9f0dc"
"@humanwhocodes/config-array@^0.11.6":
version "0.11.6"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.6.tgz#6a51d603a3aaf8d4cf45b42b3f2ac9318a4adc4b"
integrity sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==
dependencies:
"@humanwhocodes/object-schema" "^1.2.1"
debug "^4.1.1"
@ -252,7 +253,7 @@
version "2.0.5"
resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz"
"@nodelib/fs.walk@^1.2.3":
"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8":
version "1.2.8"
resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz"
dependencies:
@ -1127,13 +1128,7 @@ debug@^3.2.7:
dependencies:
ms "^2.1.1"
debug@^4.1.1, debug@^4.3.2:
version "4.3.3"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz"
dependencies:
ms "2.1.2"
debug@^4.3.4:
debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
dependencies:
@ -1397,13 +1392,15 @@ eslint-visitor-keys@^3.3.0:
version "3.3.0"
resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz"
eslint@8.25.0:
version "8.25.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.25.0.tgz#00eb962f50962165d0c4ee3327708315eaa8058b"
eslint@8.26.0:
version "8.26.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.26.0.tgz#2bcc8836e6c424c4ac26a5674a70d44d84f2181d"
integrity sha512-kzJkpaw1Bfwheq4VXUezFriD1GxszX6dUekM7Z3aC2o4hju+tsR/XyTC3RcoSD7jmy9VkPU3+N6YjVU2e96Oyg==
dependencies:
"@eslint/eslintrc" "^1.3.3"
"@humanwhocodes/config-array" "^0.10.5"
"@humanwhocodes/config-array" "^0.11.6"
"@humanwhocodes/module-importer" "^1.0.1"
"@nodelib/fs.walk" "^1.2.8"
ajv "^6.10.0"
chalk "^4.0.0"
cross-spawn "^7.0.2"
@ -1419,14 +1416,14 @@ eslint@8.25.0:
fast-deep-equal "^3.1.3"
file-entry-cache "^6.0.1"
find-up "^5.0.0"
glob-parent "^6.0.1"
glob-parent "^6.0.2"
globals "^13.15.0"
globby "^11.1.0"
grapheme-splitter "^1.0.4"
ignore "^5.2.0"
import-fresh "^3.0.0"
imurmurhash "^0.1.4"
is-glob "^4.0.0"
is-path-inside "^3.0.3"
js-sdsl "^4.1.4"
js-yaml "^4.1.0"
json-stable-stringify-without-jsonify "^1.0.1"
@ -1601,9 +1598,10 @@ glob-parent@^5.1.2:
dependencies:
is-glob "^4.0.1"
glob-parent@^6.0.1:
glob-parent@^6.0.2:
version "6.0.2"
resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3"
integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==
dependencies:
is-glob "^4.0.3"
@ -1831,6 +1829,11 @@ is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz"
is-path-inside@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
is-regex@^1.1.4:
version "1.1.4"
resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz"