Skip to content

Commit 9d15663

Browse files
committed
eslint fixes:
1 parent c4338d4 commit 9d15663

File tree

10 files changed

+76
-75
lines changed

10 files changed

+76
-75
lines changed

wrongsecrets-balancer/package-lock.json

Lines changed: 2 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wrongsecrets-balancer/ui/src/Layout.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const WSLogo = styled.img`
3131

3232
WSLogo.defaultProps = {
3333
src: wrongsecretsLogo,
34-
}
34+
};
3535

3636
const HeaderCard = styled(Card)`
37-
width: ${props => props.wide ? "70vw" : "50vw"};
37+
width: ${(props) => (props.wide ? '70vw' : '50vw')};
3838
display: flex;
3939
justify-content: space-evenly;
4040
align-items: center;
@@ -120,7 +120,7 @@ const SiteHeader = styled.h1`
120120
margin-top: 16px;
121121
margin-bottom: 0;
122122
}
123-
`
123+
`;
124124

125125
export function Layout({ children, footer, siteHeader = null, wide = false }) {
126126
return (
@@ -129,13 +129,9 @@ export function Layout({ children, footer, siteHeader = null, wide = false }) {
129129
<Wrapper>
130130
<Header>
131131
<HeaderCard wide={wide}>
132-
<WSLogo alt="WrongSecretsLogo"/> WrongSecrets CTF, powered by
132+
<WSLogo alt="WrongSecretsLogo" /> WrongSecrets CTF, powered by
133133
<MJLogo alt="MultiJuicer Logo" />
134-
{siteHeader ? (
135-
<SiteHeader>
136-
WrongSecrets CTF, powered by{siteHeader}
137-
</SiteHeader>
138-
) : null}
134+
{siteHeader ? <SiteHeader>WrongSecrets CTF, powered by{siteHeader}</SiteHeader> : null}
139135
</HeaderCard>
140136
</Header>
141137
<Body>

wrongsecrets-balancer/ui/src/Spinner.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ const StyledSpinner = styled.svg`
3636

3737
export const Spinner = () => (
3838
<StyledSpinner viewBox="0 0 30 30">
39-
<circle
40-
className="path"
41-
cx="15"
42-
cy="15"
43-
r="13"
44-
fill="none"
45-
strokeWidth="2"
46-
/>
39+
<circle className="path" cx="15" cy="15" r="13" fill="none" strokeWidth="2" />
4740
</StyledSpinner>
4841
);

wrongsecrets-balancer/ui/src/cards/InstanceStatusCard.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ export const InstanceStatusCard = ({ teamname }) => {
8787
<FormattedMessage id="instance_status_start_hacking" defaultMessage="Start Hacking" />
8888
</LinkButton>
8989
<LinkButton data-test-id="start-desktop-button" href="/?desktop" target="_blank">
90-
<FormattedMessage id="instance_status_start_vm" defaultMessage="Start your Webtop, might require refresh" />
90+
<FormattedMessage
91+
id="instance_status_start_vm"
92+
defaultMessage="Start your Webtop, might require refresh"
93+
/>
9194
</LinkButton>
9295
</BodyCard>
9396
);

wrongsecrets-balancer/ui/src/cards/TeamDisplayCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const PasscodeResetButton = ({ teamname }) => {
5454

5555
async function resetPasscode() {
5656
const { data } = await axios.post('/balancer/teams/reset-passcode');
57-
navigate(`/teams/${teamname}/joined/`, { state: { passcode: data.passcode, reset: true }});
57+
navigate(`/teams/${teamname}/joined/`, { state: { passcode: data.passcode, reset: true } });
5858
}
5959

6060
return (

wrongsecrets-balancer/ui/src/pages/AdminPage.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ function RestartInstanceButton({ team }) {
112112
);
113113
}
114114

115-
116115
function RestartDesktopInstanceButton({ team }) {
117116
const [restarting, setRestarting] = useState(false);
118117

@@ -132,7 +131,6 @@ function RestartDesktopInstanceButton({ team }) {
132131
);
133132
}
134133

135-
136134
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
137135

138136
function DeleteInstanceButton({ team }) {
@@ -235,8 +233,10 @@ export default function AdminPage() {
235233
cell: ({ team }) => {
236234
return (
237235
<>
238-
<DeleteInstanceButton team={team} /><br/>
239-
<RestartInstanceButton team={team} /><br/>
236+
<DeleteInstanceButton team={team} />
237+
<br />
238+
<RestartInstanceButton team={team} />
239+
<br />
240240
<RestartDesktopInstanceButton team={team} />
241241
</>
242242
);

wrongsecrets-balancer/ui/src/pages/JoinPage.js

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ const messages = defineMessages({
1818
});
1919

2020
const CenterLogo = styled.img`
21-
display: block;
22-
margin-left: auto;
23-
margin-right: auto;
24-
width: 50%;
21+
display: block;
22+
margin-left: auto;
23+
margin-right: auto;
24+
width: 50%;
2525
`;
2626

27-
2827
export const JoinPage = injectIntl(({ intl }) => {
2928
const [teamname, setTeamname] = useState('');
3029
const [failed, setFailed] = useState(false);
@@ -51,7 +50,7 @@ export const JoinPage = injectIntl(({ intl }) => {
5150
passcode,
5251
});
5352

54-
navigate(`/teams/${teamname}/joined/`, { state: { passcode: data.passcode }});
53+
navigate(`/teams/${teamname}/joined/`, { state: { passcode: data.passcode } });
5554
} catch (error) {
5655
if (
5756
error.response.status === 401 &&
@@ -69,7 +68,8 @@ export const JoinPage = injectIntl(({ intl }) => {
6968
sendJoinRequest({ teamname });
7069
}
7170

72-
const initialDynamics = { // type all the fields you need
71+
const initialDynamics = {
72+
// type all the fields you need
7373
react_gif_logo: 'https://i.gifer.com/9kGQ.gif',
7474
heroku_wrongsecret_ctf_url: process.env['REACT_APP_HEROKU_WRONGSECRETS_URL'],
7575
ctfd_url: process.env['REACT_APP_CTFD_URL'],
@@ -78,19 +78,15 @@ export const JoinPage = injectIntl(({ intl }) => {
7878

7979
const [dynamics, setDynamics] = useState(initialDynamics);
8080
useEffect(() => {
81-
axios.get('/balancer/dynamics')
82-
.then((response) => {
83-
setDynamics(response.data)
84-
})
85-
.catch((err) => {
86-
console.error(`Failed to wait parse values: ${err}`);
87-
});
88-
},[]);
89-
90-
91-
92-
93-
81+
axios
82+
.get('/balancer/dynamics')
83+
.then((response) => {
84+
setDynamics(response.data);
85+
})
86+
.catch((err) => {
87+
console.error(`Failed to wait parse values: ${err}`);
88+
});
89+
}, []);
9490

9591
return (
9692
<>
@@ -103,28 +99,43 @@ export const JoinPage = injectIntl(({ intl }) => {
10399
) : null}
104100

105101
<BodyCard>
106-
<CenterLogo src={dynamics.react_gif_logo}/>
102+
<CenterLogo src={dynamics.react_gif_logo} />
107103
<H2>
108104
<FormattedMessage id="welcome_title" defaultMessage="Welcome!" />
109105
</H2>
110-
<FormattedMessage id="welcome_text" defaultMessage={`
106+
<FormattedMessage
107+
id="welcome_text"
108+
defaultMessage={`
111109
Welcome to the WrongSecrets CTF Party! This CTF uses 3 domains:
112110
`}
113-
values={{
114-
strong: (msg) => <strong>{msg}</strong>,
115-
}}/>
111+
values={{
112+
strong: (msg) => <strong>{msg}</strong>,
113+
}}
114+
/>
116115
<ul>
117116
<li>This domain: here is where you can do your exercises</li>
118-
<li>The domain where you provide your responses in exchange for a CTF key: <a href={dynamics.heroku_wrongsecret_ctf_url}>{dynamics.heroku_wrongsecret_ctf_url}</a></li>
119-
<li>The domain where you provide your CTF key: <a href={dynamics.ctfd_url}>{dynamics.ctfd_url}</a></li>
120-
<li>Optionally: the storage bucket with Terraform state for the cloud challneges: <a href={dynamics.s3_bucket_url}>{dynamics.s3_bucket_url}</a></li>
117+
<li>
118+
The domain where you provide your responses in exchange for a CTF key:{' '}
119+
<a href={dynamics.heroku_wrongsecret_ctf_url}>{dynamics.heroku_wrongsecret_ctf_url}</a>
120+
</li>
121+
<li>
122+
The domain where you provide your CTF key:{' '}
123+
<a href={dynamics.ctfd_url}>{dynamics.ctfd_url}</a>
124+
</li>
125+
<li>
126+
Optionally: the storage bucket with Terraform state for the cloud challneges:{' '}
127+
<a href={dynamics.s3_bucket_url}>{dynamics.s3_bucket_url}</a>
128+
</li>
121129
</ul>
122-
<FormattedMessage id="welcome_text_2" defaultMessage={`
130+
<FormattedMessage
131+
id="welcome_text_2"
132+
defaultMessage={`
123133
We need multiple domains, as you will be able to steal the CTF key after a few challenges.
124134
`}
125-
values={{
126-
strong: (msg) => <strong>{msg}</strong>,
127-
}}/>
135+
values={{
136+
strong: (msg) => <strong>{msg}</strong>,
137+
}}
138+
/>
128139

129140
<H2>
130141
<FormattedMessage id="getting_started" defaultMessage="Getting Started" />

wrongsecrets-balancer/ui/src/pages/JoinedPage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { InstanceStatusCard } from '../cards/InstanceStatusCard';
66
import { PasscodeDisplayCard } from '../cards/PassCodeDisplayCard';
77

88
export const JoinedPage = () => {
9-
const location = useLocation()
10-
const { team } = useParams()
9+
const location = useLocation();
10+
const { team } = useParams();
1111

1212
return (
1313
<>

wrongsecrets-balancer/ui/src/pages/JoiningPage.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import { BodyCard, H2, Label, Input, Form, Button } from '../Components';
88
export const JoiningPage = () => {
99
const [passcode, setPasscode] = useState('');
1010
const [failed, setFailed] = useState(false);
11-
const navigate = useNavigate()
12-
const { team } = useParams()
13-
11+
const navigate = useNavigate();
12+
const { team } = useParams();
1413

1514
async function sendJoinRequest() {
1615
try {

wrongsecrets-balancer/ui/src/pages/ScoreBoard.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ function PlaceDisplay({ place }) {
162162
case 3:
163163
return <ThirdPlace height="32" />;
164164
default:
165-
return <><small>#</small>{place}</>;
165+
return (
166+
<>
167+
<small>#</small>
168+
{place}
169+
</>
170+
);
166171
}
167172
}
168173

@@ -175,14 +180,14 @@ export const ScoreBoard = injectIntl(() => {
175180
const [teams, setTeams] = useState([]);
176181
useEffect(() => {
177182
fetch('/balancer/score-board/top')
178-
.then(response => response.json())
179-
.then(({ teams }) => {
180-
setTeams(teams);
181-
});
183+
.then((response) => response.json())
184+
.then(({ teams }) => {
185+
setTeams(teams);
186+
});
182187

183188
const timer = setInterval(() => {
184189
fetch('/balancer/score-board/top')
185-
.then(response => response.json())
190+
.then((response) => response.json())
186191
.then(({ teams }) => {
187192
setTeams(teams);
188193
});
@@ -191,7 +196,7 @@ export const ScoreBoard = injectIntl(() => {
191196
return () => {
192197
clearInterval(timer);
193198
};
194-
}, [])
199+
}, []);
195200

196201
return (
197202
<>

0 commit comments

Comments
 (0)