// limiter.js // Copyright (C) 2024 DTP Technologies, LLC // All Rights Reserved 'use strict'; const ONE_SECOND = 1000; const ONE_MINUTE = ONE_SECOND * 60; const ONE_HOUR = ONE_MINUTE * 60; const ONE_DAY = ONE_HOUR * 24; export default { /* * AuthController */ auth: { postOtpEnable: { total: 5, expire: ONE_MINUTE * 30, message: 'You are enabling One-Time Passwords too quickly. Please try again later', }, postOtpAuthenticate: { total: 5, expire: ONE_MINUTE, message: 'You are trying One-Time Passwords too quickly. Please try again later', }, postForgotPassword: { total: 5, expire: ONE_DAY, message: 'Password reset has been locked for one day. Please try again later.', }, postPasswordReset: { total: 3, expire: ONE_DAY, message: 'Password reset has been locked for one day. Please try again later.', }, postLogin: { total: 5, expire: ONE_MINUTE, message: 'You are logging in too quickly', }, getPersonalApiToken: { total: 20, expire: ONE_MINUTE, message: 'You are requesting tokens too quickly', }, getSocketToken: { total: 20, expire: ONE_MINUTE, message: 'You are requesting tokens too quickly', }, getForgotPasswordForm: { total: 3, expire: ONE_HOUR, message: 'Password reset has been locked for one day. Please try again later.', }, getResetPasswordForm: { total: 5, expire: ONE_DAY, message: 'Password reset has been locked for one day. Please try again later.', }, getLogout: { total: 10, expire: ONE_MINUTE, message: 'You are logging out too quickly', }, }, /* * ClientController */ client: { postProjectUpdate: { total: 100, expire: ONE_HOUR, message: "You are updating projects too quickly", }, postProjectCreate: { total: 10, expire: ONE_HOUR, message: "You are creating projects too quickly", }, postClientUpdate: { total: 10, expire: ONE_HOUR, message: "You are updating clients too quickly", }, postClientCreate: { total: 10, expire: ONE_HOUR, message: "You are creating clients too quickly", }, getProjectCreate: { total: 30, expire: ONE_HOUR, message: "You are creating projects too quickly", }, getProjectEditor: { total: 250, expire: ONE_HOUR, message: "You are editing projects too quickly", }, getProjectView: { total: 250, expire: ONE_HOUR, message: "You are viewing projects too quickly", }, getClientEditor: { total: 100, expire: ONE_HOUR, message: "You are creating or editing clients too quickly", }, getClientView: { total: 250, expire: ONE_HOUR, message: "You are viewing clients too quickly", }, getHome: { total: 250, expire: ONE_HOUR, message: "You are accessing the clients dashboard too quickly", }, }, /* * EmailController */ email: { postEmailVerify: { total: 10, expire: ONE_HOUR, message: "You are posting email verifications too quickly", }, getEmailOptOut: { total: 10, expire: ONE_HOUR, message: "You are opting out too quickly", }, getEmailVerify: { total: 10, expire: ONE_HOUR, message: "You are requesting the email verification form too quickly", }, }, /* * HomeController */ home: { getHome: { total: 20, expire: ONE_MINUTE, message: 'You are loading the home page too quickly', } }, /* * ImageController */ image: { postCreateImage: { total: 5, expire: ONE_MINUTE, message: 'You are uploading images too quickly', }, getProxyImage: { total: 50, expire: ONE_SECOND * 6, message: 'You are requesting proxy images too quickly', }, getImage: { total: 500, expire: ONE_SECOND * 10, message: 'You are requesting images too quickly', }, deleteImage: { total: 60, expire: ONE_MINUTE, message: 'You are deleting images too quickly', }, }, /* * ManifestController */ manifest: { getManifest: { total: 60, expire: ONE_MINUTE, message: 'You are fetching application manifests too quickly', } }, /* * TaskController */ task: { postStartTaskSession: { total: 12, expire: ONE_HOUR, message: 'You are starting task work sessions too quickly', }, postTaskSessionScreenshot: { total: 20, expire: ONE_HOUR, message: 'You are uploading session screenshots too quickly', }, postTaskSessionStatus: { total: 100, expire: ONE_HOUR, message: 'You are changing task work session status too quickly', }, postCloseTaskSession: { total: 12, expire: ONE_HOUR, message: 'You are closing work sessions too quickly', }, postStartTask: { total: 60, expire: ONE_HOUR, message: 'You are starting tasks too quickly', }, postCloseTask: { total: 60, expire: ONE_HOUR, message: 'You are closing tasks too quickly', }, postCreateTask: { total: 60, expire: ONE_HOUR, message: 'You are creating tasks too quickly', }, getTaskSessionView: { total: 20, expire: ONE_MINUTE, message: 'You are opening sessions too quickly', }, getTaskView: { total: 20, expire: ONE_MINUTE, message: 'You are opening tasks too quickly', }, }, /* * UserController */ user: { postCreateUser: { total: 4, expire: ONE_HOUR * 4, message: 'You are creating accounts too quickly', }, postProfilePhoto: { total: 5, expire: ONE_MINUTE * 5, message: 'You are updating your profile photo too quickly', }, postUpdateSettings: { total: 12, expire: ONE_MINUTE, message: 'You are updating account settings too quickly', }, postBlockUser: { total: 10, expire: ONE_HOUR, message: 'You are blocking people too quickly', }, getResendWelcomeEmail: { total: 3, expire: ONE_HOUR, message: 'You are sending welcome emails too often', }, getOtpSetup: { total: 10, expire: ONE_MINUTE, message: 'You are configuring two-factor authentication too quickly', }, getOtpDisable: { total: 10, expire: ONE_MINUTE, message: 'You are disabling two-factor authentication too quickly', }, getStripeCustomerPortal: { total: 4, expire: ONE_MINUTE, message: 'You are accessing the Stripe Customer Portal too quickly', }, getSettings: { total: 8, expire: ONE_MINUTE, message: 'You are requesting user settings too quickly', }, getBlockView: { total: 10, expire: ONE_MINUTE, message: 'You are loading your block list too quickly', }, getUserProfile: { total: 12, expire: ONE_MINUTE, message: 'You are requesting user profiles too quickly', }, deleteProfilePhoto: { total: 5, expire: ONE_MINUTE * 5, message: 'You are deleting your profile photo too quickly', }, deleteBlockedUser: { total: 30, expire: ONE_HOUR, message: 'You are un-blocking people too quickly', }, }, /* * VideoController */ video: { getVideoMedia: { total: 60, expire: ONE_HOUR, message: 'You are loading videos too quickly', }, }, /* * WelcomeController */ welcome: { total: 12, expire: ONE_MINUTE, message: 'You are loading these pages too quickly', }, };