Embed base images into binary
Include resource directory Ran `deno fmt` with 4 space indent, that changed every file (!!!!!) various changes
This commit is contained in:
@@ -5,16 +5,23 @@ import Profile from "../../data/profiles.ts";
|
||||
export const route = APIUtils.createRouter("/account");
|
||||
|
||||
interface CreateAccountRequestBody {
|
||||
platform: string,
|
||||
platformId: string,
|
||||
deviceId: string
|
||||
platform: string;
|
||||
platformId: string;
|
||||
deviceId: string;
|
||||
}
|
||||
|
||||
route.router.post('/create',
|
||||
const rateLimit = new APIUtils.RateLimiter(25, 5);
|
||||
|
||||
APIUtils.UserAuthentication,
|
||||
route.router.post("/create",
|
||||
|
||||
rateLimit.middle(),
|
||||
APIUtils.Authentication,
|
||||
express.urlencoded({ extended: true }),
|
||||
APIUtils.checkBodyTypes<CreateAccountRequestBody>({platform: "", platformId: "", deviceId: ""}),
|
||||
APIUtils.checkBodyTypes<CreateAccountRequestBody>({
|
||||
platform: "",
|
||||
platformId: "",
|
||||
deviceId: "",
|
||||
}),
|
||||
|
||||
async (_rq, rs) => {
|
||||
const newAcc = await Profile.init();
|
||||
@@ -23,8 +30,43 @@ route.router.post('/create',
|
||||
|
||||
rs.json({
|
||||
success: true,
|
||||
value: await newAcc.export()
|
||||
value: await newAcc.export(),
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
);
|
||||
route.router.get("/bulk",
|
||||
|
||||
rateLimit.middle(),
|
||||
|
||||
async (rq: express.Request, rs: express.Response) => {
|
||||
|
||||
if (typeof rq.query.id == "object") {
|
||||
|
||||
const ids = Object.values(rq.query.id).filter((val) => typeof val == "string").map((val) => parseInt(val, 10)).filter((val) => !isNaN(val));
|
||||
rs.json([...await Profile.getExportAccountsBulk(ids)]);
|
||||
|
||||
} else if (typeof rq.query.id == "string") {
|
||||
|
||||
const id = parseInt(rq.query.id, 10);
|
||||
if (isNaN(id)) {
|
||||
rs.json(
|
||||
APIUtils.genericResponseFormat(true, "Query data error"),
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
rs.json(
|
||||
[await Profile.getExportAccount(id)].filter((val) =>
|
||||
val !== null
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
rs.json([]);
|
||||
return;
|
||||
}
|
||||
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user