Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions stage_strike_app/build/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<meta charset="utf-8" />
<link rel="icon" href="/stage_strike_app/build/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="TournamentStreamHelper Stage Strike App" />
<link rel="apple-touch-icon" href="/stage_strike_app/build/logo192.png" />
<link rel="manifest" href="/stage_strike_app/build/manifest.json" />
<title>Stage Strike</title>
<script type="module" crossorigin src="/stage_strike_app/build/assets/index-Dz-oB4d5.js"></script>
<link rel="stylesheet" crossorigin href="/stage_strike_app/build/assets/index-763GEsmS.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
/>
<meta charset="utf-8" />
<link rel="icon" href="/stage_strike_app/build/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="TournamentStreamHelper Stage Strike App" />
<link rel="apple-touch-icon" href="/stage_strike_app/build/logo192.png" />
<link rel="manifest" href="/stage_strike_app/build/manifest.json" />
<title>Stage Strike</title>
<script type="module" crossorigin src="/stage_strike_app/build/assets/index-BqLb1482.js"></script>
<link rel="stylesheet" crossorigin href="/stage_strike_app/build/assets/index-B7Ogu5fT.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
Expand Down
4 changes: 2 additions & 2 deletions stage_strike_app/src/CountrySelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import TextField from "./ScoreboardPage/TextField";
import i18n from "./i18n/config";
import React from "react";
import {Autocomplete, createFilterOptions, InputAdornment} from "@mui/material";
import {BACKEND_PORT, inlineFlagWidth} from "./env";
import {BACKEND_PORT, PROTOCOL, inlineFlagWidth} from "./env";
import {useSelector} from "react-redux";

/**
Expand All @@ -28,7 +28,7 @@ export function CountrySelector({
return null;
}

return `http://${window.location.hostname}:${BACKEND_PORT}/assets/country_flag/${c.code.toLowerCase()}.png`
return `${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/assets/country_flag/${c.code.toLowerCase()}.png`
};

const countryDisplayName = (/** TSHCountry */ country) => {
Expand Down
8 changes: 4 additions & 4 deletions stage_strike_app/src/CountryStateSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import TextField from "./ScoreboardPage/TextField";
import i18n from "./i18n/config";
import React, {useEffect, useState} from "react";
import {Autocomplete, InputAdornment} from "@mui/material";
import {BACKEND_PORT, inlineFlagWidth} from "./env";
import {BACKEND_PORT, PROTOCOL, inlineFlagWidth} from "./env";

/**
* @param {?string} countryCode
Expand Down Expand Up @@ -35,7 +35,7 @@ export function CountryStateSelector({

useEffect(() => {
if (isValidCountryCode) {
fetch(`http://${window.location.hostname}:${BACKEND_PORT}/states?countryCode=${countryCode}`)
fetch(`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/states?countryCode=${countryCode}`)
.then(d => d.json())
.then(j => setStateData({
states: j,
Expand All @@ -58,9 +58,9 @@ export function CountryStateSelector({

let stateAsset = stData?.asset;
if (stateAsset && stateAsset[0] === ".") {
return `http://${window.location.hostname}:${BACKEND_PORT}${stateAsset.slice(1)}`;
return `${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}${stateAsset.slice(1)}`;
} else {
return `http://${window.location.hostname}:${BACKEND_PORT}/assets/state_flag/${countryCode}/${stData.code}.png`;
return `${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/assets/state_flag/${countryCode}/${stData.code}.png`;
}
}

Expand Down
6 changes: 3 additions & 3 deletions stage_strike_app/src/ScoreboardPage/CharSelector.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Autocomplete, MenuItem, Stack} from "@mui/material";
import TextField from "./TextField";
import i18n from "i18next";
import {BACKEND_PORT} from "../env";
import {BACKEND_PORT, PROTOCOL} from "../env";
import {useSelector} from "react-redux";

/**
Expand Down Expand Up @@ -53,7 +53,7 @@ export function CharSelector({
return <li key={key} {..._props}>
{skimage
? <img height="32" alt={`Skin ${charSkin}`}
src={`http://${window.location.hostname}:${BACKEND_PORT}/${skimage}`}/>
src={`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/${skimage}`}/>
: <div style={{height: '32px', width: '32px'}}/>
}
<span style={{marginLeft: '16px'}}>
Expand Down Expand Up @@ -151,6 +151,6 @@ function getSkinAssetUrl(skin) {
return "about:_blank";
}

return `http://${window.location.hostname}:${BACKEND_PORT}/${asset.asset.slice(2)}`;
return `${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/${asset.asset.slice(2)}`;
}

6 changes: 3 additions & 3 deletions stage_strike_app/src/ScoreboardPage/CurrentSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import SetScore from "./SetScore";
import Team from "./Team";
import {ExpandMore} from "@mui/icons-material";
import {useTheme} from "@mui/material/styles";
import {BACKEND_PORT} from "../env";
import {BACKEND_PORT, PROTOCOL} from "../env";
import {useSelector} from "react-redux";
import {Grid} from "@mui/system";

Expand Down Expand Up @@ -50,12 +50,12 @@ export default function CurrentSet({scoreboardNumber}) {
}

const clearScoreboard = () => {
fetch(`http://${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-clear-all`)
fetch(`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-clear-all`)
.catch(console.error);
}

const swapTeams = () => {
fetch(`http://${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-swap-teams`)
fetch(`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-swap-teams`)
.catch(console.error)
}

Expand Down
6 changes: 3 additions & 3 deletions stage_strike_app/src/ScoreboardPage/SetScore.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import TextField from "./TextField";
import {Stack} from "@mui/material";
import i18n from "i18next";
import {BACKEND_PORT} from "../env";
import {BACKEND_PORT, PROTOCOL} from "../env";
import {NumberInput} from "../NumberInput";

/**
Expand Down Expand Up @@ -69,7 +69,7 @@ export default class SetScore extends React.Component {

submitScore = (scoreboardNumber) => {
return (
fetch(`http://${window.location.hostname}:${BACKEND_PORT}/score`,
fetch(`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/score`,
{
method: 'POST',
headers: {'content-type': 'application/json'},
Expand All @@ -86,7 +86,7 @@ export default class SetScore extends React.Component {

submitSetInfo = (scoreboardNumber) => {
return (
fetch(`http://${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-set?` + new URLSearchParams({
fetch(`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-set?` + new URLSearchParams({
"best-of": this.state.bestOf,
"phase": this.state.phase,
"match": this.state.match,
Expand Down
6 changes: 3 additions & 3 deletions stage_strike_app/src/ScoreboardPage/Team.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import {Checkbox, FormControlLabel, FormGroup, Paper, Stack} from "@mui/material";
import Player from "./Player";
import {Box} from "@mui/system";
import {BACKEND_PORT} from "../env";
import {BACKEND_PORT, PROTOCOL} from "../env";

export default React.forwardRef(
/**
Expand Down Expand Up @@ -56,7 +56,7 @@ export default React.forwardRef(
return Promise.all(
[
(
fetch(`http://${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-set?` + new URLSearchParams({
fetch(`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/scoreboard${scoreboardNumber}-set?` + new URLSearchParams({
losers: state.inLosers,
team: tshTeamId
}).toString())
Expand All @@ -68,7 +68,7 @@ export default React.forwardRef(
console.log("team update payload", body);

return fetch(
`http://${window.location.hostname}:${BACKEND_PORT}`
`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}`
+ `/scoreboard${scoreboardNumber}-update-team-${tshTeamId}-${teamKey}`,
{
method: 'POST',
Expand Down
6 changes: 3 additions & 3 deletions stage_strike_app/src/ScoreboardPage/UpcomingSets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import i18n from "../i18n/config";
import TextField from "./TextField";
import {alpha} from "@mui/material/styles";
import {ExpandMore} from "@mui/icons-material";
import {BACKEND_PORT} from "../env";
import {BACKEND_PORT, PROTOCOL} from "../env";


/**
Expand Down Expand Up @@ -50,7 +50,7 @@ export default class UpcomingSets extends React.Component {
isLoading: true,
});

fetch("http://" + window.location.hostname + `:${BACKEND_PORT}/get-sets?_foo=${this.state.showFinished ? "&getFinished=true" : ""}&`)
fetch(PROTOCOL + "//" + window.location.hostname + `:${BACKEND_PORT}/get-sets?_foo=${this.state.showFinished ? "&getFinished=true" : ""}&`)
.then((res) => res.json())
.then(( /** {Array.<tourney_set>} */ data) => {
this.setState({
Expand All @@ -69,7 +69,7 @@ export default class UpcomingSets extends React.Component {
});

fetch(
"http://" + window.location.hostname + `:${BACKEND_PORT}/scoreboard1-load-set?set=${this.state.selectedSet?.id}`,
PROTOCOL + "//" + window.location.hostname + `:${BACKEND_PORT}/scoreboard1-load-set?set=${this.state.selectedSet?.id}`,
)
.then((resp) => {resp.text()})
.then((respText) => {
Expand Down
4 changes: 2 additions & 2 deletions stage_strike_app/src/ScoreboardPage/websocketInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "../redux/tshState";
import { tshStore } from "../redux/store";
import socketConnection from "../websocketConnection";
import {BACKEND_PORT} from "../env";
import {BACKEND_PORT, PROTOCOL} from "../env";

let initialized = false;

Expand Down Expand Up @@ -90,7 +90,7 @@ export default function websocketInit() {
// Todo, maybe move this to a thunk or something.
const loadCountriesFile = () => {
fetch(
`http://${window.location.hostname}:${BACKEND_PORT}/assets/data_countries.json`
`${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}/assets/data_countries.json`
).then(
(resp) => resp.json()
).then((json) => {
Expand Down
4 changes: 2 additions & 2 deletions stage_strike_app/src/StageStrikePage/postActions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {BACKEND_PORT, BASE_URL} from "../env";
import {BACKEND_PORT, PROTOCOL, BASE_URL} from "../env";

export function ConfirmClicked() {
fetch(
Expand Down Expand Up @@ -68,7 +68,7 @@ export function Redo() {

export function ReportRpsWin(/** number */ winner) {
fetch(
"http://" +
PROTOCOL + "//" +
window.location.hostname +
`:${BACKEND_PORT}/stage_strike_rps_win`,
{
Expand Down
4 changes: 3 additions & 1 deletion stage_strike_app/src/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
// In dev, the Vite proxy forwards backend requests to TSH_PORT, so same-origin works there too.
export const BACKEND_PORT = window.location.port;

export const BASE_URL = `http://${window.location.hostname}:${BACKEND_PORT}`
export const PROTOCOL = window.location.protocol;

export const BASE_URL = `${PROTOCOL}//${window.location.hostname}:${BACKEND_PORT}`


export const inlineFlagWidth = 24;
2 changes: 1 addition & 1 deletion stage_strike_app/src/websocketConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class SocketSingleton {

instance(): Socket {
if (this._instance == null) {
this._instance = io(`ws://${window.location.hostname}:${BACKEND_PORT}/`, {
this._instance = io(`${window.location.hostname}:${BACKEND_PORT}/`, {
transports: ['websocket', 'webtransport'],
timeout: 5000,
reconnectionDelay: 500,
Expand Down