Skip to content

Commit

Permalink
fix: nyan
Browse files Browse the repository at this point in the history
  • Loading branch information
Esurio committed Jul 5, 2024
1 parent 0c22213 commit 8b71697
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 41 deletions.
1 change: 1 addition & 0 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"@fastify/express": "3.0.0",
"@fastify/http-proxy": "9.5.0",
"@fastify/multipart": "8.2.0",
"@fastify/rate-limit": "^9.1.0",
"@fastify/static": "7.0.3",
"@fastify/view": "9.1.0",
"@google-cloud/logging": "^10.5.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/src/server/oauth/OAuth2ProviderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import oauth2orize, { type OAuth2, AuthorizationError, ValidateFunctionArity2, O
import oauth2Pkce from 'oauth2orize-pkce';
import fastifyCors from '@fastify/cors';
import fastifyView from '@fastify/view';
import rateLimit from '@fastify/rate-limit';
import pug from 'pug';
import bodyParser from 'body-parser';
import fastifyExpress from '@fastify/express';
Expand Down Expand Up @@ -393,6 +394,11 @@ export class OAuth2ProviderService {
},
});

fastify.register(rateLimit, {
max: 100,
timeWindow: '1 hour'
});

await fastify.register(fastifyExpress);
fastify.use('/authorize', this.#server.authorize(((areq, done) => {
(async (): Promise<Parameters<typeof done>> => {
Expand Down
Loading

0 comments on commit 8b71697

Please sign in to comment.