Skip to content

Commit 1d48082

Browse files
authored
Merge pull request #96 from ctfguide-tech/dev
Hide broken features + other QOL improvements.
2 parents f33d2aa + 6617bbe commit 1d48082

File tree

3 files changed

+89
-87
lines changed

3 files changed

+89
-87
lines changed

src/components/groups/studentView.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import request from '@/utils/request';
1111
import StudentNav from '@/components/groups/studentNav';
1212

1313
const defaultImages = [
14-
'https://robohash.org/pranavramesh',
15-
'https://robohash.org/laphatize',
16-
'https://robohash.org/stevewilkers',
17-
'https://robohash.org/rickast',
18-
'https://robohash.org/picoarc',
19-
'https://robohash.org/jasoncalcanis',
14+
'/DefaultKana.png',
15+
'/CuteKana.png',
16+
'/FancyKana.png',
17+
'/ConfusedKana.png',
18+
'/TophatKana.png',
19+
2020
];
2121

2222
export default function StudentView({ group }) {

src/pages/assignments/[code]/submissions/[id].jsx

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default function id() {
8484
});
8585

8686
setLoading(false);
87-
} catch(err) {
87+
} catch (err) {
8888
console.log(err);
8989
}
9090
}
@@ -106,15 +106,15 @@ export default function id() {
106106
async function getJson() {
107107
try {
108108
let jwt = getCookie();
109-
if(!jwt) {
109+
if (!jwt) {
110110
console.log("User is not authenticated");
111111
return;
112112
}
113113
const uid = user.uid;
114114
let url = `${process.env.NEXT_PUBLIC_TERM_URL}get/json?jwtToken=${jwt}&assignmentID=${assignment.id}&uid=${uid}`;
115115
let requestOptions = { method: 'GET' };
116116
let response = await fetch(url, requestOptions);
117-
if(!response.ok) {
117+
if (!response.ok) {
118118
console.log('Error fetching kana log');
119119
return;
120120
}
@@ -131,27 +131,27 @@ export default function id() {
131131
result = await reader.read();
132132
}
133133

134-
if(!data) {
134+
if (!data) {
135135
console.log('Error parsing kana log');
136136
return;
137137
}
138138

139139
let events = data.events;
140140

141-
for(let i = 0; i < events.length; i++) {
141+
for (let i = 0; i < events.length; i++) {
142142
events[i].seconds = convert(events[i].timestamp);
143143
}
144144

145145
setKanaError(true);
146146

147147
setKanaLog(events); // []
148-
} catch(err) {
148+
} catch (err) {
149149
console.log(err);
150150
}
151151
}
152152

153153
useEffect(() => {
154-
if(!loading) {
154+
if (!loading) {
155155
getJson();
156156
console.log("penguins")
157157
console.log(router.query.key)
@@ -302,21 +302,14 @@ export default function id() {
302302
<StandardNav />
303303
<div className=" min-h-screen ">
304304
<div className="mx-auto mt-4">
305-
<a
306-
href="/groups/122ctfguide"
307-
className="hidden text-neutral-200 hover:text-neutral-500"
308-
>
309-
<i className="fas fa-long-arrow-alt-left"></i> Return Home
310-
</a>
311-
312305
<div className="w-full bg-gradient-to-r from-blue-800 via-blue-900 to-blue-800 px-4 py-4 ">
313306
<div className="mx-auto px-2">
314307
<div className="flex">
315308
<div>
316309
<h1 className="text-3xl font-semibold text-white">
317310
{
318311
submission && assignment ? <span>{submission.user.firstName} {submission.user.lastName}'s Submission</span>
319-
: <span>... Submission</span>
312+
: <span>... Submission</span>
320313
}
321314
</h1>
322315

@@ -333,11 +326,16 @@ export default function id() {
333326
)}
334327

335328
</div>
336-
329+
<a
330+
href="/groups/{classroom.id}/home"
331+
className=" text-neutral-200 hover:text-neutral-500 ml-auto "
332+
>
333+
<i className="fas fa-long-arrow-alt-left text-white"></i> <span className='text-white'>Return Home</span>
334+
</a>
337335
<div className="ml-auto">
338336
<div className="rounded-md bg-white px-3 py-1 text-center gap-y-0">
339337
<h1 className="text-4xl font-bold text-blue-600 text-center mb-0 pb-0 ">
340-
{ submission ? submission.grade : '00' }%
338+
{submission ? submission.grade : '00'}%
341339
</h1>
342340
</div>
343341
</div>
@@ -410,7 +408,7 @@ export default function id() {
410408
>
411409
<div className="absolute -start-1.5 mt-1.5 h-3 w-3 rounded-full border border-neutral-800 bg-blue-500 "></div>
412410
<time className="mb-1 text-sm font-normal leading-none text-neutral-400 ">
413-
{item.timestamp}
411+
{item.timestamp}
414412
</time>
415413
<h3 className="text-md font-semibold text-blue-400 ">
416414
{item.header}
@@ -442,61 +440,61 @@ export default function id() {
442440

443441

444442
<Transition.Root show={open} as={Fragment}>
445-
<Dialog as="div" className="relative z-10" onClose={setOpen}>
446-
<Transition.Child
447-
as={Fragment}
448-
enter="ease-out duration-300"
449-
enterFrom="opacity-0"
450-
enterTo="opacity-100"
451-
leave="ease-in duration-200"
452-
leaveFrom="opacity-100"
453-
leaveTo="opacity-0"
454-
>
455-
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity" />
456-
</Transition.Child>
457-
458-
<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
459-
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
460-
<Transition.Child
461-
as={Fragment}
462-
enter="ease-out duration-300"
463-
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
464-
enteredo="opacity-100 translate-y-0 sm:scale-100"
465-
leave="ease-in duration-200"
466-
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
467-
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
468-
>
469-
<Dialog.Panel className="max-w-6xl relative transform overflow-hidden rounded-lg bg-neutral-900 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6">
470-
<div>
471-
<div className="mt-3 sm:mt-5">
472-
<Dialog.Title as="h3" className=" font-semibold leading-6 text-xl text-white">
473-
Penalty Explanation
474-
</Dialog.Title>
475-
<div className="mt-2 mb-5">
476-
<p className="text-md text-white">
477-
When configuring this assignment, you requested that attempting to guess locations was prohibited.
478-
Typically, the student wouldn't have been penalized for changing to a directory that doesn't exist. But, because they attempted to cd into a folder that they knew wasn't there after running <span className='bg-black px-4'>ls</span>, it can be assumed that they were attempting to guess the location. As a result I gave a 5 point penalty.
479-
</p>
480-
481-
482-
<h1 className='text-md font-semibold text-white mt-4'>Was my penalty appropriate?</h1>
483-
<button className='mt-3 text-white bg-green-700 px-4 py-1 rounded-lg'>Yes</button>
484-
<button className='ml-2 text-white bg-red-700 px-4 py-1 rounded-lg'>No</button>
485-
486-
<h1 className='text-md font-semibold text-white mt-4'>Do you have any feedback? The AI will try to improve its grading strategy.</h1>
487-
<textarea className='bg-neutral-800 text-white w-full rounded-lg px-4 py-2 mt-2 border-none' placeholder='Enter feedback here...'></textarea>
488-
<button className='mt-3 text-white bg-blue-700 px-4 py-1 rounded-lg'>Submit Feedback</button>
443+
<Dialog as="div" className="relative z-10" onClose={setOpen}>
444+
<Transition.Child
445+
as={Fragment}
446+
enter="ease-out duration-300"
447+
enterFrom="opacity-0"
448+
enterTo="opacity-100"
449+
leave="ease-in duration-200"
450+
leaveFrom="opacity-100"
451+
leaveTo="opacity-0"
452+
>
453+
<div className="fixed inset-0 bg-black bg-opacity-75 transition-opacity" />
454+
</Transition.Child>
455+
456+
<div className="fixed inset-0 z-10 w-screen overflow-y-auto">
457+
<div className="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0">
458+
<Transition.Child
459+
as={Fragment}
460+
enter="ease-out duration-300"
461+
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
462+
enteredo="opacity-100 translate-y-0 sm:scale-100"
463+
leave="ease-in duration-200"
464+
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
465+
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
466+
>
467+
<Dialog.Panel className="max-w-6xl relative transform overflow-hidden rounded-lg bg-neutral-900 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:p-6">
468+
<div>
469+
<div className="mt-3 sm:mt-5">
470+
<Dialog.Title as="h3" className=" font-semibold leading-6 text-xl text-white">
471+
Penalty Explanation
472+
</Dialog.Title>
473+
<div className="mt-2 mb-5">
474+
<p className="text-md text-white">
475+
When configuring this assignment, you requested that attempting to guess locations was prohibited.
476+
Typically, the student wouldn't have been penalized for changing to a directory that doesn't exist. But, because they attempted to cd into a folder that they knew wasn't there after running <span className='bg-black px-4'>ls</span>, it can be assumed that they were attempting to guess the location. As a result I gave a 5 point penalty.
477+
</p>
478+
479+
480+
<h1 className='text-md font-semibold text-white mt-4'>Was my penalty appropriate?</h1>
481+
<button className='mt-3 text-white bg-green-700 px-4 py-1 rounded-lg'>Yes</button>
482+
<button className='ml-2 text-white bg-red-700 px-4 py-1 rounded-lg'>No</button>
483+
484+
<h1 className='text-md font-semibold text-white mt-4'>Do you have any feedback? The AI will try to improve its grading strategy.</h1>
485+
<textarea className='bg-neutral-800 text-white w-full rounded-lg px-4 py-2 mt-2 border-none' placeholder='Enter feedback here...'></textarea>
486+
<button className='mt-3 text-white bg-blue-700 px-4 py-1 rounded-lg'>Submit Feedback</button>
487+
488+
</div>
489+
</div>
490+
</div>
489491

492+
</Dialog.Panel>
493+
</Transition.Child>
494+
</div>
490495
</div>
491-
</div>
492-
</div>
493-
494-
</Dialog.Panel>
495-
</Transition.Child>
496-
</div>
497-
</div>
498-
</Dialog>
499-
</Transition.Root>
496+
</Dialog>
497+
</Transition.Root>
500498
</div>
501499
</div>
502500
</div>

src/pages/challenges/[id].jsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ export default function Challenge() {
507507
<div className="mx-auto mt-6 max-w-6xl text-left">
508508
<div className="mb-2 flex place-items-center justify-between">
509509
<div>
510-
<h1 className="inline-block text-3xl font-semibold text-white">
510+
<h1 className="inline-block text-2xl font-semibold text-white">
511511
{' '}
512512
Challenge Description{' '}
513513
</h1>
@@ -518,7 +518,7 @@ export default function Challenge() {
518518
onClick={likeChallenge}
519519
className="card-body m-1 flex rounded-md bg-neutral-800 px-10 py-2 hover:bg-neutral-700"
520520
>
521-
<h1 className=" mr-4 bg-gradient-to-br from-orange-400 to-yellow-400 bg-clip-text text-2xl font-semibold text-transparent">
521+
<h1 className=" mr-4 bg-gradient-to-br from-orange-400 to-yellow-400 bg-clip-text text-xl font-semibold text-transparent">
522522
<HeartIcon className="h-8 w-8 text-red-500" />
523523
</h1>
524524
<p className=" text-2xl text-white">{likeCount}</p>
@@ -555,8 +555,8 @@ export default function Challenge() {
555555

556556
<div
557557
id="challengeDetails"
558-
style={{ color: '#8c8c8c' }}
559-
className="w-full whitespace-pre-wrap border-l-4 border-blue-700 bg-neutral-800/50 px-4 py-2 text-lg text-white"
558+
559+
className="w-full text-white whitespace-pre-wrap border-blue-700 bg-neutral-800/50 px-4 py-2 text-lg text-white"
560560
>
561561
<div>
562562
<MarkdownViewer content={challenge.content} />
@@ -581,16 +581,20 @@ export default function Challenge() {
581581
Submit Flag
582582
</button>
583583
<button
584-
hidden={!hintMessages}
584+
//hidden={!hintMessages}
585585
onClick={() => setHintOpen(true)}
586-
className="ml-2 mt-4 rounded-lg bg-black bg-yellow-700 px-4 py-1 text-white text-yellow-300 hover:bg-yellow-900"
586+
className="hidden ml-2 mt-4 rounded-lg bg-black bg-yellow-700 px-4 py-1 text-white text-yellow-300 hover:bg-yellow-900"
587587
>
588588
Stuck?
589589
</button>
590590
</div>
591591
</div>
592592
</div>
593593
</div>
594+
595+
<div className='bg-neutral-800 px-2 py-4 mt-10 mb-10'>
596+
<h1 className='text-white text-center'>Public terminals are temporarily unavaliable. Some challenges that require pre-configured enviroments may not be solvable.</h1>
597+
</div>
594598
<div className="mt-6 grid hidden gap-10 sm:grid-cols-1 lg:grid-cols-3">
595599
<div
596600
style={{ backgroundColor: '#212121' }}
@@ -628,7 +632,7 @@ export default function Challenge() {
628632
</div>
629633
</div>
630634
</div>
631-
<div id="terminal" className=" mx-auto mt-6 max-w-6xl">
635+
<div id="terminal" className="hidden mx-auto mt-6 max-w-6xl">
632636
<div className="hint mb-2 text-gray-400">
633637
<span className="font-semibold text-white ">
634638
{' '}
@@ -713,8 +717,8 @@ export default function Challenge() {
713717
</div>
714718
}
715719
</div>
716-
<div className="mt-10 rounded-lg px-5 pb-20">
717-
<h1 className="text-3xl font-semibold text-white">Comments</h1>
720+
<div className="mt-10 rounded-lg pb-20">
721+
<h1 className="text-2xl font-semibold text-white">Comments</h1>
718722
<textarea
719723
id="comment"
720724
onChange={commentChange}
@@ -986,7 +990,7 @@ export default function Challenge() {
986990
</div>
987991
</Dialog>
988992
</Transition.Root>
989-
<p className="mx-auto mt-1.5 w-3/5 rounded-lg bg-neutral-800 px-4 py-0.5 text-sm text-gray-200">
993+
<p className="hidden mx-auto mt-1.5 w-3/5 rounded-lg bg-neutral-800 px-4 py-0.5 text-sm text-gray-200">
990994
ℹ We provide accessible environments for everyone to run cybersecurity
991995
tools. Abuse and unnecessary computation is prohibited.
992996
</p>

0 commit comments

Comments
 (0)