Skip to content

Commit

Permalink
Make frontend count time properly again. Fixes #11.
Browse files Browse the repository at this point in the history
  • Loading branch information
Emzi0767 committed Oct 5, 2020
1 parent 7923854 commit 7a92d86
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 36 deletions.
49 changes: 28 additions & 21 deletions config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
"forwardHeaders": {
"enable": true,
"limit": 1,
"networks": [ "10.0.0.0/8" ]
"networks": [
"10.0.0.0/8"
]
},
"listen": [
{
Expand Down Expand Up @@ -50,25 +52,30 @@
123456789123456789
]
},
{
"type": "custom",
"id": "ctftime",
"name": "CTFtime",
"colour": "#FF0000",
"clientId": "Your event ID",
"clientSecret": "Your client secret from event management interface",
"authorizeUrl": "https://oauth.ctftime.org/authorize",
"tokenUrl": "https://oauth.ctftime.org/token",
"refreshUrl": "Optional, if the provider supports refreshing.",
"revokeUrl": "Optional, if the provider supports revocations.",
"userUrl": "https://oauth.ctftime.org/user",
"scopes": [ "profile:read" ],
"hostnames": [ "oauth.ctftime.org", "ctftime.org" ],
"mappings": {
"userId": "id",
"username": "username"
}
}
{
"type": "custom",
"id": "ctftime",
"name": "CTFtime",
"colour": "#FF0000",
"clientId": "Your event ID",
"clientSecret": "Your client secret from event management interface",
"authorizeUrl": "https://oauth.ctftime.org/authorize",
"tokenUrl": "https://oauth.ctftime.org/token",
"refreshUrl": "Optional, if the provider supports refreshing.",
"revokeUrl": "Optional, if the provider supports revocations.",
"userUrl": "https://oauth.ctftime.org/user",
"scopes": [
"profile:read"
],
"hostnames": [
"oauth.ctftime.org",
"ctftime.org"
],
"mappings": {
"userId": "id",
"username": "username"
}
}
]
}
},
Expand All @@ -77,4 +84,4 @@
"memory": -1,
"iterations": -1
}
}
}
1 change: 0 additions & 1 deletion event.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,3 @@ scoring: jeopardy
host: tcp.myrosettactfinstance.xyz
port: 42000
baseScore: 500

8 changes: 4 additions & 4 deletions src/RosettaCTF.UI/src/app/challenges/challenges.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ export class ChallengesComponent implements OnInit, OnDestroy {
round: true,
largest: 3,
unitMeasures: {
d: 172_800_000,
h: 3_600_000,
m: 60_000,
s: 1_000
d: 86_400_000,
h: 3_600_000,
m: 60_000,
s: 1_000
}
});
}
Expand Down
21 changes: 15 additions & 6 deletions src/RosettaCTF.UI/src/app/landing/landing.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,17 @@ export class LandingComponent implements OnInit, OnDestroy {
const end = parseZone(cfg.endTime);
const start = parseZone(cfg.startTime);

const dur = duration(end.diff(start));
return dur.humanize({ h: 48, m: 60, s: 60, ss: 5 });
return this.humanizer.humanize(end.diff(start), {
units: ["d", "h", "m", "s"],
round: true,
largest: 3,
unitMeasures: {
d: 86_400_000,
h: 3_600_000,
m: 60_000,
s: 1_000
}
});
}

private stopTimer(): void {
Expand All @@ -100,10 +109,10 @@ export class LandingComponent implements OnInit, OnDestroy {
round: true,
largest: 3,
unitMeasures: {
d: 172_800_000,
h: 3_600_000,
m: 60_000,
s: 1_000
d: 86_400_000,
h: 3_600_000,
m: 60_000,
s: 1_000
}
});
}
Expand Down
8 changes: 4 additions & 4 deletions src/RosettaCTF.UI/src/app/not-yet/not-yet.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ export class NotYetComponent implements OnInit, OnDestroy {
round: true,
largest: 3,
unitMeasures: {
d: 172_800_000,
h: 3_600_000,
m: 60_000,
s: 1_000
d: 86_400_000,
h: 3_600_000,
m: 60_000,
s: 1_000
}
});
}
Expand Down

0 comments on commit 7a92d86

Please sign in to comment.