diff --git a/scoreboard/package.json b/scoreboard/package.json index 3b88f39..cc2a55e 100644 --- a/scoreboard/package.json +++ b/scoreboard/package.json @@ -3,14 +3,18 @@ "version": "0.1.0", "private": true, "dependencies": { - "d3": "^7.6.1", + "d3": "^7.8.5", "detect-browser": "^5.2.1", "event-emitter-es6": "^1.1.5", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-scripts": "^4.0.3", + "react-scripts": "^5.0.1", "typescript": "^4.4.3", - "underscore": "^1.13.1" + "underscore": "^1.13.1", + "http-proxy-middleware": "^2.0.6" + }, + "overrides": { + "nth-check": "2.0.1" }, "scripts": { "start": "react-scripts start", diff --git a/scoreboard/src/compactscoreboard.tsx b/scoreboard/src/compactscoreboard.tsx index 15d158c..9a5b0e3 100644 --- a/scoreboard/src/compactscoreboard.tsx +++ b/scoreboard/src/compactscoreboard.tsx @@ -29,7 +29,7 @@ class CompactScoreboard extends Component { lineHeight: place_size + "px" }}>{i + 1} - + Team logo
{team.name}
diff --git a/scoreboard/src/model.ts b/scoreboard/src/model.ts index ba84a27..c1763a6 100644 --- a/scoreboard/src/model.ts +++ b/scoreboard/src/model.ts @@ -184,13 +184,13 @@ export class GameModel { getSlaPeriodsForSomeServiceOfSomeTeam() { let team_ids = Object.keys(this.allRoundsSla); - if (team_ids.length == 0) + if (team_ids.length === 0) return []; let team_id = team_ids[0]; let service_ids = Object.keys(this.allRoundsSla[team_id]); - if (service_ids.length == 0) + if (service_ids.length === 0) return []; let service_id = service_ids[0]; diff --git a/scoreboard/src/scoreboard.tsx b/scoreboard/src/scoreboard.tsx index d933123..a67ae73 100644 --- a/scoreboard/src/scoreboard.tsx +++ b/scoreboard/src/scoreboard.tsx @@ -257,7 +257,7 @@ class Scoreboard extends Component {
/round
} {this.logo &&
- + Contest logo
} {this.model.services.slice(0, this.model.servicesCount).map((service, i) => { if (!this.model!.active_services.includes(parseInt(service.id, 10))) @@ -314,7 +314,7 @@ class Scoreboard extends Component { serviceInfo.phase && { - serviceInfo.phase !== "DYING" && serviceInfo.phase !== "REMOVED" && serviceInfo.phase != "NOT_RELEASED" && + serviceInfo.phase !== "DYING" && serviceInfo.phase !== "REMOVED" && serviceInfo.phase !== "NOT_RELEASED" && { /> } { - serviceInfo.phase != "NOT_RELEASED" && + serviceInfo.phase !== "NOT_RELEASED" &&
{ serviceInfo.flag_base_amount?.toFixed(2) } { serviceInfo.phase === "HEATING" && serviceInfo.flag_base_amount !== maxFlagPrice && } diff --git a/scoreboard/src/serviceblock.tsx b/scoreboard/src/serviceblock.tsx index 654864c..15abf4d 100644 --- a/scoreboard/src/serviceblock.tsx +++ b/scoreboard/src/serviceblock.tsx @@ -45,8 +45,8 @@ class Serviceblock extends Component { const maxSla = Math.ceil((service.sla * round + 100 * (roundsCount - round)) / roundsCount); let serviceReleased = true; model.services.forEach((s) => { - if (s.id == service.id.toString()) { - serviceReleased = model.services[service.id - 1].phase != "NOT_RELEASED"; + if (s.id === service.id.toString()) { + serviceReleased = model.services[service.id - 1].phase !== "NOT_RELEASED"; } }) diff --git a/scoreboard/src/setupProxy.js b/scoreboard/src/setupProxy.js index 78eda08..3e7aba7 100644 --- a/scoreboard/src/setupProxy.js +++ b/scoreboard/src/setupProxy.js @@ -1,23 +1,9 @@ -const proxy = require('http-proxy-middleware'); - -/* - "proxy": { - "^/api/events": { - "target": "http://10.60.3.1", - "ws": true, - "changeOrigin": true - }, - "/": { - "target": "http://10.60.3.1", - "changeOrigin": true - } - }, -*/ +const { createProxyMiddleware } = require('http-proxy-middleware'); module.exports = function (app) { - app.use(proxy('/logo.png', {target: 'https://training.ctf.hitb.org/', ws: true, changeOrigin: true})); - app.use(proxy('/api/events', {target: 'https://training.ctf.hitb.org/', ws: true, changeOrigin: true})); - app.use(proxy('/api', {target: 'https://training.ctf.hitb.org/', changeOrigin: true})); - app.use(proxy('/history', {target: 'https://training.ctf.hitb.org/', changeOrigin: true})); - app.use(proxy('/data', {target: 'https://training.ctf.hitb.org/', changeOrigin: true})); + app.use(createProxyMiddleware('/logo.png', {target: 'https://training.ctf.hitb.org/', ws: true, changeOrigin: true})); + app.use(createProxyMiddleware('/api/events', {target: 'https://training.ctf.hitb.org/', ws: true, changeOrigin: true})); + app.use(createProxyMiddleware('/api', {target: 'https://training.ctf.hitb.org/', changeOrigin: true})); + app.use(createProxyMiddleware('/history', {target: 'https://training.ctf.hitb.org/', changeOrigin: true})); + app.use(createProxyMiddleware('/data',{target: 'https://training.ctf.hitb.org/', changeOrigin: true})); }; diff --git a/scoreboard/src/team.tsx b/scoreboard/src/team.tsx index 6aac731..f92fdaa 100644 --- a/scoreboard/src/team.tsx +++ b/scoreboard/src/team.tsx @@ -85,7 +85,7 @@ class Team extends Component {
{team.n} {suffix}
-
+
Team logo
{team.name}