New formatting

This commit is contained in:
2023-10-19 16:50:21 -04:00
parent 0b5e82bfcc
commit 026d1ca06d
30 changed files with 76 additions and 76 deletions

View File

@ -4,7 +4,7 @@ import tokenPrefixes from "../../../data/token_prefixes.json";
async function generateTokenHash(token: string): Promise<string> {
const hash = await crypto.subtle.digest(
"SHA-512",
new TextEncoder().encode(token)
new TextEncoder().encode(token),
);
return btoa(String.fromCharCode(...new Uint8Array(hash)))
.replace(/\+/g, "-")
@ -62,7 +62,7 @@ export async function onRequestGet(context: RequestContext) {
}).toString(),
headers: {
authorization: `Basic ${btoa(
context.env.DISCORD_ID + ":" + context.env.DISCORD_SECRET
context.env.DISCORD_ID + ":" + context.env.DISCORD_SECRET,
)}`,
"content-type": "application/x-www-form-urlencoded",
},
@ -114,7 +114,7 @@ export async function onRequestGet(context: RequestContext) {
headers: {
authorization: `Bearer ${tokenData.access_token}`,
},
}
},
);
const memberData: { [k: string]: any } = await serverMemberReq.json();
@ -133,7 +133,7 @@ export async function onRequestGet(context: RequestContext) {
selectedTokenStart +
`${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}${crypto.randomUUID()}`.replaceAll(
"-",
""
"",
);
const tokenHash = await generateTokenHash(authToken);