mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
perf: limit number of antennas
This commit is contained in:
parent
788d54af6f
commit
dae4461402
@ -23,6 +23,12 @@ export const meta = {
|
||||
code: "NO_SUCH_USER_GROUP",
|
||||
id: "aa3c0b9a-8cae-47c0-92ac-202ce5906682",
|
||||
},
|
||||
|
||||
tooManyAntennas: {
|
||||
message: "Too many antennas.",
|
||||
code: "TOO_MANY_ANTENNAS",
|
||||
id: "c3a5a51e-04d4-11ee-be56-0242ac120002",
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@ -97,6 +103,14 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
let userList;
|
||||
let userGroupJoining;
|
||||
|
||||
const antennas = await Antennas.findBy({
|
||||
userId: user.id,
|
||||
});
|
||||
if (antennas.length > 5 && !user.isAdmin) {
|
||||
throw new ApiError(meta.errors.tooManyAntennas)
|
||||
}
|
||||
|
||||
|
||||
if (ps.src === "list" && ps.userListId) {
|
||||
userList = await UserLists.findOneBy({
|
||||
id: ps.userListId,
|
||||
|
Loading…
Reference in New Issue
Block a user