From 592f408daa5d63029be9adf8e59537b5f09ae154 Mon Sep 17 00:00:00 2001 From: mradigen <55953083+mradigen@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:29:22 +0530 Subject: [PATCH 1/3] chore: Fix typos --- src/app/challenge/page.tsx | 2 +- src/app/challenges/page.tsx | 208 ++++++++++++++++++------------------ src/lib/constants.ts | 4 +- 3 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/app/challenge/page.tsx b/src/app/challenge/page.tsx index 62adaf1..f5bf703 100644 --- a/src/app/challenge/page.tsx +++ b/src/app/challenge/page.tsx @@ -11,7 +11,7 @@ import { BACKEND_URL, CHALLENGE_IP } from "~/lib/constants"; import axios from "axios"; const challengeTypes = [ - "Miscellanious", + "Miscellaneous", "Forensics", "Web", "Binary", diff --git a/src/app/challenges/page.tsx b/src/app/challenges/page.tsx index 910f307..b1b9ff9 100644 --- a/src/app/challenges/page.tsx +++ b/src/app/challenges/page.tsx @@ -7,123 +7,123 @@ import Text from "~/components/text"; import { BACKEND_URL } from "~/lib/constants"; const challengeTypes = [ - "Miscellanious", - "Forensics", - "Web", - "Binary", - "Reversing", - "Crypto", - "OSINT", + "Miscellaneous", + "Forensics", + "Web", + "Binary", + "Reversing", + "Crypto", + "OSINT", ]; interface ChallengeData extends ChallengeItem { - id: string; + id: string; } function getTypesFromMask(mask: number) { - const result = []; + const result = []; - for (let i = 0; i < challengeTypes.length; i++) { - if (mask & (1 << i)) { - result.push(challengeTypes[i]); - } - } + for (let i = 0; i < challengeTypes.length; i++) { + if (mask & (1 << i)) { + result.push(challengeTypes[i]); + } + } - return result; + return result; } export default function ChallengesPage() { - const [type, setType] = useState("all"); - const [challenges, setChallenges] = useState([]); + const [type, setType] = useState("all"); + const [challenges, setChallenges] = useState([]); - useEffect(() => { - if (!window.localStorage.getItem("token")) { - window.location.href = "/signin"; - return; - } + useEffect(() => { + if (!window.localStorage.getItem("token")) { + window.location.href = "/signin"; + return; + } - void axios - .get(`${BACKEND_URL}/ctf/list`, { - headers: { - Authorization: `Bearer ${window.localStorage.getItem("token")}`, - }, - }) - .then((res) => { - const data = res.data as { - id: string; - name: string; - description: string; - points: string; - author: string; - tags: number; - }[]; - const challenges = data.map((challenge) => { - return { - id: challenge.id, - description: challenge.description, - points: challenge.points, - title: challenge.name, - types: getTypesFromMask(challenge.tags), - } as unknown as ChallengeData; - }); - setChallenges(challenges); - }); - }, []); + void axios + .get(`${BACKEND_URL}/ctf/list`, { + headers: { + Authorization: `Bearer ${window.localStorage.getItem("token")}`, + }, + }) + .then((res) => { + const data = res.data as { + id: string; + name: string; + description: string; + points: string; + author: string; + tags: number; + }[]; + const challenges = data.map((challenge) => { + return { + id: challenge.id, + description: challenge.description, + points: challenge.points, + title: challenge.name, + types: getTypesFromMask(challenge.tags), + } as unknown as ChallengeData; + }); + setChallenges(challenges); + }); + }, []); - const setChallenge = (id: string) => { - window.localStorage.setItem("challenge", id); - window.location.href = `/challenge`; - }; + const setChallenge = (id: string) => { + window.localStorage.setItem("challenge", id); + window.location.href = `/challenge`; + }; - return ( -
- -
-
- - CHALLENGES - - {/* a select menu for filtering by type */} - -
-
- {challenges.length === 0 && ( - - Loading... - - )} - {challenges - .filter((c) => - type === "all" - ? true - : c.types.filter((v) => - v.toLowerCase().includes(type.toLowerCase()), - ), - ) - .map((challenge, index) => ( - setChallenge(challenge.id)} - /> - ))} -
-
-
- ); + return ( +
+ +
+
+ + CHALLENGES + + {/* a select menu for filtering by type */} + +
+
+ {challenges.length === 0 && ( + + Loading... + + )} + {challenges + .filter((c) => + type === "all" + ? true + : c.types.filter((v) => + v.toLowerCase().includes(type.toLowerCase()), + ), + ) + .map((challenge, index) => ( + setChallenge(challenge.id)} + /> + ))} +
+
+
+ ); } diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 8143b03..8d5ba8d 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,2 +1,2 @@ -export const BACKEND_URL = "http://pwncore.lugvitc.net:11000/api"; -export const CHALLENGE_IP = "192.168.0.0"; +export const BACKEND_URL = "https://pwncore.lugvitc.net/api"; +export const CHALLENGE_IP = "ctf.lugvitc.net"; From 56a56105b0a419d981cb6e1221041adc64875a89 Mon Sep 17 00:00:00 2001 From: mradigen <55953083+mradigen@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:30:43 +0530 Subject: [PATCH 2/3] Revert "chore: Fix typos" This reverts commit 592f408daa5d63029be9adf8e59537b5f09ae154. --- src/app/challenge/page.tsx | 2 +- src/app/challenges/page.tsx | 208 ++++++++++++++++++------------------ src/lib/constants.ts | 4 +- 3 files changed, 107 insertions(+), 107 deletions(-) diff --git a/src/app/challenge/page.tsx b/src/app/challenge/page.tsx index f5bf703..62adaf1 100644 --- a/src/app/challenge/page.tsx +++ b/src/app/challenge/page.tsx @@ -11,7 +11,7 @@ import { BACKEND_URL, CHALLENGE_IP } from "~/lib/constants"; import axios from "axios"; const challengeTypes = [ - "Miscellaneous", + "Miscellanious", "Forensics", "Web", "Binary", diff --git a/src/app/challenges/page.tsx b/src/app/challenges/page.tsx index b1b9ff9..910f307 100644 --- a/src/app/challenges/page.tsx +++ b/src/app/challenges/page.tsx @@ -7,123 +7,123 @@ import Text from "~/components/text"; import { BACKEND_URL } from "~/lib/constants"; const challengeTypes = [ - "Miscellaneous", - "Forensics", - "Web", - "Binary", - "Reversing", - "Crypto", - "OSINT", + "Miscellanious", + "Forensics", + "Web", + "Binary", + "Reversing", + "Crypto", + "OSINT", ]; interface ChallengeData extends ChallengeItem { - id: string; + id: string; } function getTypesFromMask(mask: number) { - const result = []; + const result = []; - for (let i = 0; i < challengeTypes.length; i++) { - if (mask & (1 << i)) { - result.push(challengeTypes[i]); - } - } + for (let i = 0; i < challengeTypes.length; i++) { + if (mask & (1 << i)) { + result.push(challengeTypes[i]); + } + } - return result; + return result; } export default function ChallengesPage() { - const [type, setType] = useState("all"); - const [challenges, setChallenges] = useState([]); + const [type, setType] = useState("all"); + const [challenges, setChallenges] = useState([]); - useEffect(() => { - if (!window.localStorage.getItem("token")) { - window.location.href = "/signin"; - return; - } + useEffect(() => { + if (!window.localStorage.getItem("token")) { + window.location.href = "/signin"; + return; + } - void axios - .get(`${BACKEND_URL}/ctf/list`, { - headers: { - Authorization: `Bearer ${window.localStorage.getItem("token")}`, - }, - }) - .then((res) => { - const data = res.data as { - id: string; - name: string; - description: string; - points: string; - author: string; - tags: number; - }[]; - const challenges = data.map((challenge) => { - return { - id: challenge.id, - description: challenge.description, - points: challenge.points, - title: challenge.name, - types: getTypesFromMask(challenge.tags), - } as unknown as ChallengeData; - }); - setChallenges(challenges); - }); - }, []); + void axios + .get(`${BACKEND_URL}/ctf/list`, { + headers: { + Authorization: `Bearer ${window.localStorage.getItem("token")}`, + }, + }) + .then((res) => { + const data = res.data as { + id: string; + name: string; + description: string; + points: string; + author: string; + tags: number; + }[]; + const challenges = data.map((challenge) => { + return { + id: challenge.id, + description: challenge.description, + points: challenge.points, + title: challenge.name, + types: getTypesFromMask(challenge.tags), + } as unknown as ChallengeData; + }); + setChallenges(challenges); + }); + }, []); - const setChallenge = (id: string) => { - window.localStorage.setItem("challenge", id); - window.location.href = `/challenge`; - }; + const setChallenge = (id: string) => { + window.localStorage.setItem("challenge", id); + window.location.href = `/challenge`; + }; - return ( -
- -
-
- - CHALLENGES - - {/* a select menu for filtering by type */} - -
-
- {challenges.length === 0 && ( - - Loading... - - )} - {challenges - .filter((c) => - type === "all" - ? true - : c.types.filter((v) => - v.toLowerCase().includes(type.toLowerCase()), - ), - ) - .map((challenge, index) => ( - setChallenge(challenge.id)} - /> - ))} -
-
-
- ); + return ( +
+ +
+
+ + CHALLENGES + + {/* a select menu for filtering by type */} + +
+
+ {challenges.length === 0 && ( + + Loading... + + )} + {challenges + .filter((c) => + type === "all" + ? true + : c.types.filter((v) => + v.toLowerCase().includes(type.toLowerCase()), + ), + ) + .map((challenge, index) => ( + setChallenge(challenge.id)} + /> + ))} +
+
+
+ ); } diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 8d5ba8d..8143b03 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,2 +1,2 @@ -export const BACKEND_URL = "https://pwncore.lugvitc.net/api"; -export const CHALLENGE_IP = "ctf.lugvitc.net"; +export const BACKEND_URL = "http://pwncore.lugvitc.net:11000/api"; +export const CHALLENGE_IP = "192.168.0.0"; From 22e163a93d68b75fe4fdb98fe94bc4dee2cc3f7c Mon Sep 17 00:00:00 2001 From: mradigen <55953083+mradigen@users.noreply.github.com> Date: Mon, 16 Sep 2024 01:32:02 +0530 Subject: [PATCH 3/3] chore: Fix identation --- src/app/challenge/page.tsx | 2 +- src/app/challenges/page.tsx | 2 +- src/lib/constants.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/challenge/page.tsx b/src/app/challenge/page.tsx index 62adaf1..f5bf703 100644 --- a/src/app/challenge/page.tsx +++ b/src/app/challenge/page.tsx @@ -11,7 +11,7 @@ import { BACKEND_URL, CHALLENGE_IP } from "~/lib/constants"; import axios from "axios"; const challengeTypes = [ - "Miscellanious", + "Miscellaneous", "Forensics", "Web", "Binary", diff --git a/src/app/challenges/page.tsx b/src/app/challenges/page.tsx index 910f307..686d699 100644 --- a/src/app/challenges/page.tsx +++ b/src/app/challenges/page.tsx @@ -7,7 +7,7 @@ import Text from "~/components/text"; import { BACKEND_URL } from "~/lib/constants"; const challengeTypes = [ - "Miscellanious", + "Miscellaneous", "Forensics", "Web", "Binary", diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 8143b03..8d5ba8d 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1,2 +1,2 @@ -export const BACKEND_URL = "http://pwncore.lugvitc.net:11000/api"; -export const CHALLENGE_IP = "192.168.0.0"; +export const BACKEND_URL = "https://pwncore.lugvitc.net/api"; +export const CHALLENGE_IP = "ctf.lugvitc.net";