fix: add sign up hook

This commit is contained in:
David Nguyen
2025-02-13 20:21:23 +11:00
parent 87dcdd44cd
commit ebc2b00067
13 changed files with 55 additions and 96 deletions

View File

@ -33,11 +33,6 @@ export const filesRoute = new Hono<HonoEnv>()
return c.json({ error: 'No file provided' }, 400);
}
// Todo: Do we want to validate the file type?
// if (file.type !== 'application/pdf') {
// return c.json({ error: 'File must be a PDF' }, 400);
// }
// Todo: This is new.
// Add file size validation.
// Convert MB to bytes (1 MB = 1024 * 1024 bytes)

View File

@ -9,9 +9,9 @@ import {
type RequestMetadata,
extractRequestMetadata,
} from '@documenso/lib/universal/extract-request-metadata';
import { AppLogger } from '@documenso/lib/utils/debugger';
import { AppDebugger } from '@documenso/lib/utils/debugger';
const logger = new AppLogger('Middleware');
const debug = new AppDebugger('Middleware');
export type AppContext = {
requestMetadata: RequestMetadata;
@ -27,7 +27,7 @@ export const appContext = async (c: Context, next: Next) => {
const noSessionCookie = extractSessionCookieFromHeaders(request.headers) === null;
if (!isPageRequest(request) || noSessionCookie || blacklistedPathsRegex.test(url.pathname)) {
// logger.log('Pathname ignored', url.pathname);
// debug.log('Pathname ignored', url.pathname);
setAppContext(c, {
requestMetadata: extractRequestMetadata(request),
@ -61,7 +61,7 @@ export const appContext = async (c: Context, next: Next) => {
}
const endTime = Date.now();
logger.log(`Pathname accepted in ${endTime - initTime}ms`, url.pathname);
debug.log(`Pathname accepted in ${endTime - initTime}ms`, url.pathname);
setAppContext(c, {
requestMetadata: extractRequestMetadata(request),

View File

@ -1,9 +1,9 @@
import type { Context, Next } from 'hono';
import { getCookie } from 'hono/cookie';
import { AppLogger } from '@documenso/lib/utils/debugger';
import { AppDebugger } from '@documenso/lib/utils/debugger';
const logger = new AppLogger('Middleware');
const debug = new AppDebugger('Middleware');
/**
* Middleware for initial page loads.
@ -23,7 +23,7 @@ export const appMiddleware = async (c: Context, next: Next) => {
return next();
}
logger.log('Path', path);
debug.log('Path', path);
const preferredTeamUrl = getCookie(c, 'preferred-team-url');
@ -39,7 +39,7 @@ export const appMiddleware = async (c: Context, next: Next) => {
// // Redirect root page to `/documents` or `/t/{preferredTeamUrl}/documents`.
// if (path === '/') {
// logger.log('Redirecting from root to documents');
// debug.log('Redirecting from root to documents');
// const redirectUrlPath = formatDocumentsPath(
// resetPreferredTeamUrl ? undefined : preferredTeamUrl,
@ -58,7 +58,7 @@ export const appMiddleware = async (c: Context, next: Next) => {
// // Clear preferred team url cookie if user accesses a non team page from a team page.
// if (resetPreferredTeamUrl || path === '/documents') {
// logger.log('Resetting preferred team url');
// debug.log('Resetting preferred team url');
// deleteCookie(c, 'preferred-team-url');
// return next();

View File

@ -4,16 +4,6 @@ import { createTrpcContext } from '@documenso/trpc/server/context';
import { appRouter } from '@documenso/trpc/server/router';
import { handleTrpcRouterError } from '@documenso/trpc/utils/trpc-error-handler';
// Todo
// export const config = {
// maxDuration: 120,
// api: {
// bodyParser: {
// sizeLimit: '50mb',
// },
// },
// };
/**
* Trpc server for internal routes like /api/trpc/*
*/