Skip to content

Commit

Permalink
Upgrade dependencies, fix style checks
Browse files Browse the repository at this point in the history
  • Loading branch information
andgein committed Jul 22, 2023
1 parent c447276 commit a9c6d96
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 32 deletions.
10 changes: 7 additions & 3 deletions scoreboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scoreboard/src/compactscoreboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CompactScoreboard extends Component<CompactScoreboardProps> {
lineHeight: place_size + "px"
}}>{i + 1}</div>
</td>
<td><img height={img_height} width={img_height} src={model.getLogo(team.team_id)}/></td>
<td><img height={img_height} width={img_height} src={model.getLogo(team.team_id)} alt="Team logo"/></td>
<td>
<div className="compactTeamName" style={{"width": width - 230}}>{team.name}</div>
</td>
Expand Down
4 changes: 2 additions & 2 deletions scoreboard/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
6 changes: 3 additions & 3 deletions scoreboard/src/scoreboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class Scoreboard extends Component<ScoreboardProps> {
<div className="min">/round</div>
</div>}
{this.logo && <div className={"contest-logo"}>
<img src={this.logo}/>
<img src={this.logo} alt="Contest logo"/>
</div>}
{this.model.services.slice(0, this.model.servicesCount).map((service, i) => {
if (!this.model!.active_services.includes(parseInt(service.id, 10)))
Expand Down Expand Up @@ -314,7 +314,7 @@ class Scoreboard extends Component<ScoreboardProps> {
serviceInfo.phase &&
<React.Fragment>
{
serviceInfo.phase !== "DYING" && serviceInfo.phase !== "REMOVED" && serviceInfo.phase != "NOT_RELEASED" &&
serviceInfo.phase !== "DYING" && serviceInfo.phase !== "REMOVED" && serviceInfo.phase !== "NOT_RELEASED" &&
<Timer seconds={phaseDuration!}
direction={isGameActive ? "forward" : "none"}
title={"Time from the beginning of the " + servicePhase + " phase"}
Expand All @@ -328,7 +328,7 @@ class Scoreboard extends Component<ScoreboardProps> {
/>
}
{
serviceInfo.phase != "NOT_RELEASED" &&
serviceInfo.phase !== "NOT_RELEASED" &&
<div className={"phase phase_" + serviceInfo.phase} title={"Base flag price"}>
{ serviceInfo.flag_base_amount?.toFixed(2) }
{ serviceInfo.phase === "HEATING" && serviceInfo.flag_base_amount !== maxFlagPrice && <span className="mdi mdi-arrow-up-bold" title="HEATING phase"/> }
Expand Down
4 changes: 2 additions & 2 deletions scoreboard/src/serviceblock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class Serviceblock extends Component<ServiceblockProps> {
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";
}
})

Expand Down
26 changes: 6 additions & 20 deletions scoreboard/src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -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}));
};
2 changes: 1 addition & 1 deletion scoreboard/src/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Team extends Component<TeamProps, TeamComponentState> {
<div className="team_summary">
<div className="place"><span>{team.n}</span><span className="suffix">&thinsp;{suffix}</span>
</div>
<div className="team_logo team_border"><img className="img" src={logo}/></div>
<div className="team_logo team_border"><img className="img" src={logo} alt="Team logo"/></div>
<div className="team_info team_border">
<div className="team_name" title={team.name}>{team.name}</div>
<div className="tags">
Expand Down

0 comments on commit a9c6d96

Please sign in to comment.