woah man
This commit is contained in:
@@ -54,15 +54,11 @@ export async function authenticate(c: Context<HonoEnv>, nxt: Next) {
|
||||
} else return c.json(genericResponse(false, "Authorization required"), 401);
|
||||
}
|
||||
|
||||
export enum GalvanicErrors {
|
||||
jex = "jex", // Error in account creation, check platform
|
||||
sploot = "sploot", // Error in account creation, steamid was not valid or profile could not be created
|
||||
export function recNetResult(success: boolean, error?: string) {
|
||||
return {success, error};
|
||||
}
|
||||
export function galvanicError(code: GalvanicErrors) {
|
||||
return {success: false, error:`Galvanic Error (code: ${code})`};
|
||||
}
|
||||
export function recNetError(err: string) {
|
||||
return {success:false, error: err};
|
||||
export function recNetResultResponse(c: Context<HonoEnv>, status: HTTPStatus, success: boolean, error?: string) {
|
||||
return c.json(recNetResult(success, error), status as ContentfulStatusCode);
|
||||
}
|
||||
|
||||
export function generateRandomString(length: number) {
|
||||
@@ -126,7 +122,7 @@ export class RateLimiter {
|
||||
this.#addressIncrement(address);
|
||||
|
||||
const hits = this.#getAddressHits(address);
|
||||
if (hits && hits > this.#hitLimit) return c.json(recNetError("Rate Limited. Please try again later."), 429);
|
||||
if (hits && hits > this.#hitLimit) return c.json(recNetResult(false, "Rate Limited. Please try again later."), 429);
|
||||
else return next();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user