misc: addressed comments

This commit is contained in:
Sheen Capadngan
2025-09-19 01:58:33 +08:00
parent 88176daf47
commit 1ff205916e
3 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -4,7 +4,7 @@ import { RelaysSchema } from "@app/db/schemas";
import { getConfig } from "@app/lib/config/env"; import { getConfig } from "@app/lib/config/env";
import { crypto } from "@app/lib/crypto/cryptography"; import { crypto } from "@app/lib/crypto/cryptography";
import { UnauthorizedError } from "@app/lib/errors"; import { UnauthorizedError } from "@app/lib/errors";
import { writeLimit } from "@app/server/config/rateLimiter"; import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas"; import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth"; import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type"; import { AuthMode } from "@app/services/auth/auth-type";
@@ -107,6 +107,9 @@ export const registerRelayRouter = async (server: FastifyZodProvider) => {
200: RelaysSchema.array() 200: RelaysSchema.array()
} }
}, },
config: {
rateLimit: readLimit
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]), onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
handler: async (req) => { handler: async (req) => {
return server.services.relay.getRelays({ return server.services.relay.getRelays({
@@ -1083,7 +1083,7 @@ export const relayServiceFactory = ({
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionRelayActions.DeleteRelays, OrgPermissionSubjects.Relay); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionRelayActions.DeleteRelays, OrgPermissionSubjects.Relay);
const relay = await relayDAL.findById(id); const relay = await relayDAL.findById(id);
if (!relay || relay.orgId !== actorOrgId) { if (!relay || relay.orgId !== actorOrgId || relay.orgId === null) {
throw new NotFoundError({ message: "Relay not found" }); throw new NotFoundError({ message: "Relay not found" });
} }
@@ -163,7 +163,7 @@ export const OrgRelayPermissionRow = ({ isEditable, control, setValue }: Props)
} }
field.onChange(e); field.onChange(e);
}} }}
id={`permissions.relays.${action}`} id={`permissions.relay.${action}`}
> >
{label} {label}
</Checkbox> </Checkbox>