Updated proxy

This commit is contained in:
Liam 2022-10-17 12:58:07 +01:00
parent 7c713a99ab
commit 2ff4ae7e10
4 changed files with 19 additions and 20 deletions

@ -4,5 +4,5 @@
"description": "Free, simple, and easy to use beat saber overlay for OBS",
"color": "#0EBFE9",
"url": "https://bs-overlay.fascinated.cc",
"proxy_url": "https://bangor375.herokuapp.com"
"proxy_url": "https://proxy.fascinated.cc"
}

@ -1,4 +1,3 @@
// 1. import `NextUIProvider` component
import { NextUIProvider } from "@nextui-org/react";
import { NextSeo } from "next-seo";
import Head from "next/head";
@ -9,7 +8,6 @@ import "../styles/globals.css";
function MyApp({ Component, pageProps }) {
return (
// 2. Use at the root of your app
<NextUIProvider>
<NextSeo
title={Config.name}

@ -3,8 +3,8 @@ import { Component } from "react";
import PlayerStats from "../src/components/PlayerStats";
import ScoreStats from "../src/components/ScoreStats";
import SongInfo from "../src/components/SongInfo";
import Utils from "../src/utils/utils";
import styles from "../styles/overlay.module.css";
export default class Overlay extends Component {
@ -12,12 +12,11 @@ export default class Overlay extends Component {
constructor(props) {
super(props);
this.state = {
loading: true,
isConnectedToSocket: false,
id: undefined,
isValidSteamId: true,
isValidSteamId: false,
websiteType: "ScoreSaber",
data: undefined,
showPlayerStats: true,
@ -145,11 +144,13 @@ export default class Overlay extends Component {
*/
async updateData(id) {
const data = await fetch(
new Utils()
.getWebsiteApi(id == "test" ? "Test" : this.state.websiteType)
.ApiUrl.replace("%s", id),
Utils.getWebsiteApi(
id == "test" ? "Test" : this.state.websiteType
).ApiUrl.replace("%s", id),
{
mode: "cors",
headers: {
"X-Requested-With": "BeatSaber Overlay",
},
}
);
const json = await data.json();
@ -158,7 +159,7 @@ export default class Overlay extends Component {
this.setState({ loading: false, isValidSteamId: false });
return;
}
this.setState({ loading: false, id: id, data: json });
this.setState({ loading: false, id: id, data: json, isValidSteamId: true });
}
/**
@ -183,10 +184,10 @@ export default class Overlay extends Component {
});
socket.addEventListener("close", () => {
console.log(
"Attempting to re-connect to the HTTP Status socket in 10 seconds."
"Attempting to re-connect to the HTTP Status socket in 60 seconds."
);
this.setState({ isConnectedToSocket: false });
setTimeout(() => this.connectSocket(), 10_000);
setTimeout(() => this.connectSocket(), 60_000);
});
socket.addEventListener("message", (message) => {
const json = JSON.parse(message.data);

@ -9,7 +9,7 @@ export default class Utils {
* @param {WebsiteTypes} website
* @returns The website type's information.
*/
getWebsiteApi(website) {
static getWebsiteApi(website) {
return WebsiteTypes[website];
}
}