diff --git a/.gitignore b/.gitignore
index d03b476..14917fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,4 +34,4 @@ yarn-error.log*
.vercel
# IntelliJ
-.idea
+.idea
\ No newline at end of file
diff --git a/README.md b/README.md
index 420b45b..97de9ec 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,8 @@
-# Simple ScoreSaber Overlay
+# ScoreSaber Overlay with real-time data
The public url to view/use this is: `https://bs-overlay.fascinated.cc`
-To use your scoresaber: `https://bs-overlay.fascinated.cc/?id=765611`
+To use your scoresaber: `https://bs-overlay.fascinated.cc/?id=76561198449412074`
+Support Server: https://discord.gg/4FYVVhZPm7
## Getting Started with developent
diff --git a/cache/0bf56fa581064964f936833a15d6351f0382a322.jpg b/cache/0bf56fa581064964f936833a15d6351f0382a322.jpg
new file mode 100644
index 0000000..9d29131
Binary files /dev/null and b/cache/0bf56fa581064964f936833a15d6351f0382a322.jpg differ
diff --git a/cache/4bbdaa1004a00eeb9c8d9432640e1c7d490b46d9.jpg b/cache/4bbdaa1004a00eeb9c8d9432640e1c7d490b46d9.jpg
new file mode 100644
index 0000000..0f4733d
Binary files /dev/null and b/cache/4bbdaa1004a00eeb9c8d9432640e1c7d490b46d9.jpg differ
diff --git a/cache/6423f3a3429d503fa97a1c5282155436d12a9366.jpg b/cache/6423f3a3429d503fa97a1c5282155436d12a9366.jpg
new file mode 100644
index 0000000..f4d6b16
Binary files /dev/null and b/cache/6423f3a3429d503fa97a1c5282155436d12a9366.jpg differ
diff --git a/cache/a79af292ca03aca894e7acc3bd8c3cacfddf2906.jpg b/cache/a79af292ca03aca894e7acc3bd8c3cacfddf2906.jpg
new file mode 100644
index 0000000..4459529
Binary files /dev/null and b/cache/a79af292ca03aca894e7acc3bd8c3cacfddf2906.jpg differ
diff --git a/components/Avatar.js b/components/Avatar.js
index d857a5c..9fdaa52 100644
--- a/components/Avatar.js
+++ b/components/Avatar.js
@@ -2,7 +2,7 @@ import Image from "next/image";
const Avatar = (props) => {
return <>
-
+
>
}
diff --git a/components/PlayerStats.js b/components/PlayerStats.js
index da563c3..28dfe05 100644
--- a/components/PlayerStats.js
+++ b/components/PlayerStats.js
@@ -1,7 +1,6 @@
import ReactCountryFlag from "react-country-flag";
const PlayerStats = (props) => {
-
return
{props.pp}pp
#{props.globalPos}
diff --git a/components/ScoreStats.js b/components/ScoreStats.js
index 1e35654..bd06e4e 100644
--- a/components/ScoreStats.js
+++ b/components/ScoreStats.js
@@ -6,8 +6,14 @@ export default class ScoreStats extends Component {
super(params);
}
- getAverage(values) {
- return values.reduce((p, c) => p + c, 0) / values.length;
+ /**
+ * Returns the average of the provided numbers list
+ *
+ * @param {List
} hitValues
+ * @returns The average value
+ */
+ getAverage(hitValues) {
+ return hitValues.reduce((p, c) => p + c, 0) / hitValues.length;
}
render() {
diff --git a/next.config.js b/next.config.js
index f06dad5..344d4be 100644
--- a/next.config.js
+++ b/next.config.js
@@ -4,8 +4,7 @@ module.exports = {
domains: [
'cdn.scoresaber.com',
'bs-overlay.fascinated.cc',
- 'localhost:3000',
- ''
+ 'localhost:3000'
],
}
}
diff --git a/pages/api/beatsaver/map.js b/pages/api/beatsaver/map.js
index fd9ed57..c207926 100644
--- a/pages/api/beatsaver/map.js
+++ b/pages/api/beatsaver/map.js
@@ -4,12 +4,13 @@ export default async function handler(req, res) {
const mapHash = req.query.hash;
const mapData = await Utils.getMapData(mapHash.replace("custom_level_", ""));
- if (mapData === undefined) {
+ if (mapData === undefined) { // Check if a map hash was provided
return res.json({ error: true, message: "Unknown map" })
}
- const data = {
+ const data = { // The maps data from the provided map hash
bsr: mapData.id,
- songArt: "http://" + req.headers.host + "/api/beatsaver/art/" + mapHash + "?ext=" + mapData.versions[0].coverURL.split("/")[3].split(".")[1]
+ songArt: "http://" + req.headers.host + "/api/beatsaver/art/" + mapHash + "?ext=" + mapData.versions[0].coverURL
+ .split("/")[3].split(".")[1]
};
- res.json({ error: false, data: data })
+ res.json({ error: false, data: data });
}
diff --git a/styles/globals.css b/styles/globals.css
index 0dec4c2..58bf0bc 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -175,5 +175,4 @@
.song-time-text {
margin-top: 8px;
font-size: large;
-}
-
+}
\ No newline at end of file
diff --git a/utils/utils.js b/utils/utils.js
index 0ecb9ec..ff004d0 100644
--- a/utils/utils.js
+++ b/utils/utils.js
@@ -3,6 +3,13 @@ import Config from '../config.json';
module.exports = {
BEATSAVER_MAP_API: Config.proxy_url + "/https://api.beatsaver.com/maps/hash/%s",
// todo: cache map data for 12 hrs
+
+ /**
+ * Gets a specified maps data from BeatSaver
+ *
+ * @param {string} hash
+ * @returns The map data
+ */
async getMapData(hash) {
const data = await fetch(this.BEATSAVER_MAP_API.replace("%s", hash), {
headers: {