diff --git a/apps/web/src/app/api/(proxy)/app/check-upload/route.ts b/apps/web/src/app/api/(proxy)/app/check-upload/route.ts index 05645b2..18ceaf4 100644 --- a/apps/web/src/app/api/(proxy)/app/check-upload/route.ts +++ b/apps/web/src/app/api/(proxy)/app/check-upload/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/storage/check-upload`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/storage/check-upload`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/configs/route.ts b/apps/web/src/app/api/(proxy)/app/configs/route.ts index a21632b..5428703 100644 --- a/apps/web/src/app/api/(proxy)/app/configs/route.ts +++ b/apps/web/src/app/api/(proxy)/app/configs/route.ts @@ -1,10 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); - const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + const url = `${API_BASE_URL}/app/configs`; - const apiRes = await fetch(`${API_BASE_URL}/app/configs`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/disk-space/route.ts b/apps/web/src/app/api/(proxy)/app/disk-space/route.ts index d753ce9..997c69c 100644 --- a/apps/web/src/app/api/(proxy)/app/disk-space/route.ts +++ b/apps/web/src/app/api/(proxy)/app/disk-space/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/storage/disk-space`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/storage/disk-space`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/health/route.ts b/apps/web/src/app/api/(proxy)/app/health/route.ts index 4366da6..e5da712 100644 --- a/apps/web/src/app/api/(proxy)/app/health/route.ts +++ b/apps/web/src/app/api/(proxy)/app/health/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/health`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/health`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/info/route.ts b/apps/web/src/app/api/(proxy)/app/info/route.ts index c443cd5..c1fd045 100644 --- a/apps/web/src/app/api/(proxy)/app/info/route.ts +++ b/apps/web/src/app/api/(proxy)/app/info/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/app/info`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/app/info`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/remove-logo/route.ts b/apps/web/src/app/api/(proxy)/app/remove-logo/route.ts index e1a7172..3d3429a 100644 --- a/apps/web/src/app/api/(proxy)/app/remove-logo/route.ts +++ b/apps/web/src/app/api/(proxy)/app/remove-logo/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/app/logo`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/app/logo`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/test-smtp/route.ts b/apps/web/src/app/api/(proxy)/app/test-smtp/route.ts index 1aaf5f7..c1e35c8 100644 --- a/apps/web/src/app/api/(proxy)/app/test-smtp/route.ts +++ b/apps/web/src/app/api/(proxy)/app/test-smtp/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/app/test-smtp`; const body = await req.text(); - const apiRes = await fetch(`${process.env.API_BASE_URL}/app/test-smtp`, { + const apiRes = await fetch(url, { method: "POST", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/app/upload-logo/route.ts b/apps/web/src/app/api/(proxy)/app/upload-logo/route.ts index 284ba95..9a48498 100644 --- a/apps/web/src/app/api/(proxy)/app/upload-logo/route.ts +++ b/apps/web/src/app/api/(proxy)/app/upload-logo/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/app/logo`; const formData = await req.formData(); - const apiRes = await fetch(`${process.env.API_BASE_URL}/app/logo`, { + const apiRes = await fetch(url, { method: "POST", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/auth/forgot-password/route.ts b/apps/web/src/app/api/(proxy)/auth/forgot-password/route.ts index 38eeaef..50a1e35 100644 --- a/apps/web/src/app/api/(proxy)/auth/forgot-password/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/forgot-password/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const body = await req.text(); + const url = `${API_BASE_URL}/auth/forgot-password`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/auth/forgot-password`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/login/route.ts b/apps/web/src/app/api/(proxy)/auth/login/route.ts index 99ee519..ed5a42b 100644 --- a/apps/web/src/app/api/(proxy)/auth/login/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/login/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const body = await req.text(); + const url = `${API_BASE_URL}/auth/login`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/auth/login`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/logout/route.ts b/apps/web/src/app/api/(proxy)/auth/logout/route.ts index bdffe0a..bbdf567 100644 --- a/apps/web/src/app/api/(proxy)/auth/logout/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/logout/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/auth/logout`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/auth/logout`, { + const apiRes = await fetch(url, { method: "POST", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/auth/me/route.ts b/apps/web/src/app/api/(proxy)/auth/me/route.ts index 424545d..df5a5ac 100644 --- a/apps/web/src/app/api/(proxy)/auth/me/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/me/route.ts @@ -2,8 +2,10 @@ import { NextRequest, NextResponse } from "next/server"; export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + const url = `${API_BASE_URL}/auth/me`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/auth/me`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/auth/providers/[provider]/authorize/route.ts b/apps/web/src/app/api/(proxy)/auth/providers/[provider]/authorize/route.ts index e3cddc8..993bd08 100644 --- a/apps/web/src/app/api/(proxy)/auth/providers/[provider]/authorize/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/providers/[provider]/authorize/route.ts @@ -7,11 +7,11 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{ const { provider } = await params; const url = new URL(request.url); const queryString = url.search; - const originalHost = request.headers.get("host") || url.host; const originalProtocol = request.headers.get("x-forwarded-proto") || url.protocol.replace(":", ""); + const authorizeUrl = `${API_BASE_URL}/auth/providers/${provider}/authorize${queryString}`; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers/${provider}/authorize${queryString}`, { + const apiRes = await fetch(authorizeUrl, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/providers/[provider]/callback/route.ts b/apps/web/src/app/api/(proxy)/auth/providers/[provider]/callback/route.ts index e62be50..89acf86 100644 --- a/apps/web/src/app/api/(proxy)/auth/providers/[provider]/callback/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/providers/[provider]/callback/route.ts @@ -7,11 +7,11 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{ const { provider } = await params; const url = new URL(request.url); const queryString = url.search; - const originalHost = request.headers.get("host") || url.host; const originalProtocol = request.headers.get("x-forwarded-proto") || url.protocol.replace(":", ""); + const callbackUrl = `${API_BASE_URL}/auth/providers/${provider}/callback${queryString}`; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers/${provider}/callback${queryString}`, { + const apiRes = await fetch(callbackUrl, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/providers/all/route.ts b/apps/web/src/app/api/(proxy)/auth/providers/all/route.ts index 35739e8..fd1986a 100644 --- a/apps/web/src/app/api/(proxy)/auth/providers/all/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/providers/all/route.ts @@ -3,8 +3,9 @@ import { NextRequest, NextResponse } from "next/server"; const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; export async function GET(request: NextRequest) { + const url = `${API_BASE_URL}/auth/providers/all`; try { - const apiRes = await fetch(`${API_BASE_URL}/auth/providers/all`, { + const apiRes = await fetch(url, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/providers/manage/[id]/route.ts b/apps/web/src/app/api/(proxy)/auth/providers/manage/[id]/route.ts index e19c54e..3f4bf56 100644 --- a/apps/web/src/app/api/(proxy)/auth/providers/manage/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/providers/manage/[id]/route.ts @@ -6,8 +6,9 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{ try { const body = await request.json(); const { id } = await params; + const updateUrl = `${API_BASE_URL}/auth/providers/${id}`; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers/${id}`, { + const apiRes = await fetch(updateUrl, { method: "PUT", headers: { "Content-Type": "application/json", @@ -37,7 +38,9 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{ export async function DELETE(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { try { const { id } = await params; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers/${id}`, { + const deleteUrl = `${API_BASE_URL}/auth/providers/${id}`; + + const apiRes = await fetch(deleteUrl, { method: "DELETE", headers: { ...Object.fromEntries( diff --git a/apps/web/src/app/api/(proxy)/auth/providers/order/route.ts b/apps/web/src/app/api/(proxy)/auth/providers/order/route.ts index efa3790..97f796f 100644 --- a/apps/web/src/app/api/(proxy)/auth/providers/order/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/providers/order/route.ts @@ -5,8 +5,9 @@ const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; export async function PUT(request: NextRequest) { try { const body = await request.json(); + const url = `${API_BASE_URL}/auth/providers/order`; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers/order`, { + const apiRes = await fetch(url, { method: "PUT", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/providers/route.ts b/apps/web/src/app/api/(proxy)/auth/providers/route.ts index bcbe38f..53b05bb 100644 --- a/apps/web/src/app/api/(proxy)/auth/providers/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/providers/route.ts @@ -9,8 +9,9 @@ export async function GET(request: NextRequest) { const originalHost = request.headers.get("host") || url.host; const originalProtocol = request.headers.get("x-forwarded-proto") || url.protocol.replace(":", ""); + const listUrl = `${API_BASE_URL}/auth/providers${queryString}`; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers${queryString}`, { + const apiRes = await fetch(listUrl, { method: "GET", headers: { "Content-Type": "application/json", @@ -38,8 +39,9 @@ export async function GET(request: NextRequest) { export async function POST(request: NextRequest) { try { const body = await request.json(); + const createUrl = `${API_BASE_URL}/auth/providers`; - const apiRes = await fetch(`${API_BASE_URL}/auth/providers`, { + const apiRes = await fetch(createUrl, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/auth/reset-password/route.ts b/apps/web/src/app/api/(proxy)/auth/reset-password/route.ts index 3d704ac..706778e 100644 --- a/apps/web/src/app/api/(proxy)/auth/reset-password/route.ts +++ b/apps/web/src/app/api/(proxy)/auth/reset-password/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const body = await req.text(); + const url = `${API_BASE_URL}/auth/reset-password`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/auth/reset-password`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/config/update/[key]/route.ts b/apps/web/src/app/api/(proxy)/config/update/[key]/route.ts index 9db9c1b..2930861 100644 --- a/apps/web/src/app/api/(proxy)/config/update/[key]/route.ts +++ b/apps/web/src/app/api/(proxy)/config/update/[key]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ key: string }> }) { const { key } = await params; const body = await req.text(); const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/app/configs/${key}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/app/configs/${key}`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/config/update/bulk/route.ts b/apps/web/src/app/api/(proxy)/config/update/bulk/route.ts index 294f8c7..e81f7fc 100644 --- a/apps/web/src/app/api/(proxy)/config/update/bulk/route.ts +++ b/apps/web/src/app/api/(proxy)/config/update/bulk/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest) { const body = await req.text(); const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/app/configs`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/app/configs`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/files/[id]/route.ts b/apps/web/src/app/api/(proxy)/files/[id]/route.ts index a193506..7fa94f2 100644 --- a/apps/web/src/app/api/(proxy)/files/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/files/[id]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { id } = await params; + const url = `${API_BASE_URL}/files/${id}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/files/${id}`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { "Content-Type": "application/json", @@ -35,8 +38,9 @@ export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/files/${id}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/files/${id}`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/files/check/route.ts b/apps/web/src/app/api/(proxy)/files/check/route.ts index a77b5e5..46a0ebe 100644 --- a/apps/web/src/app/api/(proxy)/files/check/route.ts +++ b/apps/web/src/app/api/(proxy)/files/check/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const body = await req.text(); const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/files/check`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/files/check`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/files/download/[...objectPath]/route.ts b/apps/web/src/app/api/(proxy)/files/download/[...objectPath]/route.ts index b3218ed..eb017a5 100644 --- a/apps/web/src/app/api/(proxy)/files/download/[...objectPath]/route.ts +++ b/apps/web/src/app/api/(proxy)/files/download/[...objectPath]/route.ts @@ -1,12 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ objectPath: string[] }> }) { const { objectPath } = await params; const cookieHeader = req.headers.get("cookie"); - const objectName = objectPath.join("/"); - - const url = `${process.env.API_BASE_URL}/files/${encodeURIComponent(objectName)}/download`; + const url = `${API_BASE_URL}/files/${encodeURIComponent(objectName)}/download`; const apiRes = await fetch(url, { method: "GET", diff --git a/apps/web/src/app/api/(proxy)/files/presigned-url/route.ts b/apps/web/src/app/api/(proxy)/files/presigned-url/route.ts index 8aeadfc..60e5dc5 100644 --- a/apps/web/src/app/api/(proxy)/files/presigned-url/route.ts +++ b/apps/web/src/app/api/(proxy)/files/presigned-url/route.ts @@ -1,9 +1,11 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const searchParams = req.nextUrl.searchParams.toString(); - const url = `${process.env.API_BASE_URL}/files/presigned-url${searchParams ? `?${searchParams}` : ""}`; + const url = `${API_BASE_URL}/files/presigned-url${searchParams ? `?${searchParams}` : ""}`; const apiRes = await fetch(url, { method: "GET", diff --git a/apps/web/src/app/api/(proxy)/files/route.ts b/apps/web/src/app/api/(proxy)/files/route.ts index a585580..a63b2d9 100644 --- a/apps/web/src/app/api/(proxy)/files/route.ts +++ b/apps/web/src/app/api/(proxy)/files/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; +const url = `${API_BASE_URL}/files`; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); - const apiRes = await fetch(`${process.env.API_BASE_URL}/files`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", @@ -31,7 +34,7 @@ export async function POST(req: NextRequest) { const body = await req.text(); const cookieHeader = req.headers.get("cookie"); - const apiRes = await fetch(`${process.env.API_BASE_URL}/files`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts b/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts index 66858c7..f462faa 100644 --- a/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts +++ b/apps/web/src/app/api/(proxy)/filesystem/download/[token]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ token: string }> }) { const { token } = await params; const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/filesystem/download/${token}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/filesystem/download/${token}`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts b/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts index 6b7b9fc..f8260fe 100644 --- a/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts +++ b/apps/web/src/app/api/(proxy)/filesystem/upload/[token]/route.ts @@ -1,15 +1,17 @@ import { NextRequest, NextResponse } from "next/server"; -export const maxDuration = 300; +export const maxDuration = 3000; export const dynamic = "force-dynamic"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PUT(req: NextRequest, { params }: { params: Promise<{ token: string }> }) { const { token } = await params; const cookieHeader = req.headers.get("cookie"); - const body = await req.arrayBuffer(); + const url = `${API_BASE_URL}/filesystem/upload/${token}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/filesystem/upload/${token}`, { + const apiRes = await fetch(url, { method: "PUT", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/[reverseShareId]/alias/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/[reverseShareId]/alias/route.ts index 03afc49..f21cbe4 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/[reverseShareId]/alias/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/[reverseShareId]/alias/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ reverseShareId: string }> }) { const { reverseShareId } = await params; const body = await req.text(); const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/reverse-shares/${reverseShareId}/alias`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${reverseShareId}/alias`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/activate/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/activate/[id]/route.ts index aaf4dc9..8633362 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/activate/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/activate/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/reverse-shares/${id}/activate`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${id}/activate`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/presigned-url/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/presigned-url/route.ts index 25a567f..034daf2 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/presigned-url/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/presigned-url/route.ts @@ -1,12 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ alias: string }> }) { const { searchParams } = new URL(req.url); const password = searchParams.get("password"); const body = await req.text(); const { alias } = await params; - let url = `${process.env.API_BASE_URL}/reverse-shares/alias/${alias}/presigned-url`; + let url = `${API_BASE_URL}/reverse-shares/alias/${alias}/presigned-url`; if (password) { url += `?password=${encodeURIComponent(password)}`; } diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/register-file/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/register-file/route.ts index 3642729..87efd28 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/register-file/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/register-file/route.ts @@ -1,12 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ alias: string }> }) { const { searchParams } = new URL(req.url); const password = searchParams.get("password"); const body = await req.text(); const { alias } = await params; - let url = `${process.env.API_BASE_URL}/reverse-shares/alias/${alias}/register-file`; + let url = `${API_BASE_URL}/reverse-shares/alias/${alias}/register-file`; if (password) { url += `?password=${encodeURIComponent(password)}`; } diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/upload/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/upload/route.ts index e60b4ad..057bb26 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/upload/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/alias/[alias]/upload/route.ts @@ -1,11 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ alias: string }> }) { const { searchParams } = new URL(req.url); const password = searchParams.get("password"); const { alias } = await params; - let url = `${process.env.API_BASE_URL}/reverse-shares/alias/${alias}/upload`; + let url = `${API_BASE_URL}/reverse-shares/alias/${alias}/upload`; if (password) { url += `?password=${encodeURIComponent(password)}`; } diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/check-password/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/check-password/[id]/route.ts index fef7f26..e004e77 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/check-password/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/check-password/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const body = await req.text(); const { id } = await params; + const url = `${API_BASE_URL}/reverse-shares/${id}/check-password`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${id}/check-password`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/create/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/create/route.ts index 6b72297..d7ebc75 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/create/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/create/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); + const url = `${API_BASE_URL}/reverse-shares`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/deactivate/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/deactivate/[id]/route.ts index 0bd93cd..5fa9d47 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/deactivate/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/deactivate/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/reverse-shares/${id}/deactivate`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${id}/deactivate`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/delete/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/delete/[id]/route.ts index b99137c..b23ac64 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/delete/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/delete/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/reverse-shares/${id}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${id}`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/details/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/details/[id]/route.ts index 6856a7a..d76b2ee 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/details/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/details/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/reverse-shares/${id}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${id}`, { + const apiRes = await fetch(url, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/copy/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/copy/route.ts index b9b34d1..42d97a5 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/copy/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/copy/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ fileId: string }> }) { const { fileId } = await params; const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/reverse-shares/files/${fileId}/copy`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/files/${fileId}/copy`, { + const apiRes = await fetch(url, { method: "POST", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/route.ts index 6909fb2..9d2ef1a 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/files/[fileId]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ fileId: string }> }) { const cookieHeader = req.headers.get("cookie"); const { fileId } = await params; + const url = `${API_BASE_URL}/reverse-shares/files/${fileId}/download`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/files/${fileId}/download`, { + const apiRes = await fetch(url, { method: "GET", headers: { "Content-Type": "application/json", @@ -34,8 +37,9 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ file const cookieHeader = req.headers.get("cookie"); const { fileId } = await params; const body = await req.json(); + const url = `${API_BASE_URL}/reverse-shares/files/${fileId}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/files/${fileId}`, { + const apiRes = await fetch(url, { method: "PUT", headers: { "Content-Type": "application/json", @@ -65,8 +69,9 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ file export async function DELETE(req: NextRequest, { params }: { params: Promise<{ fileId: string }> }) { const cookieHeader = req.headers.get("cookie"); const { fileId } = await params; + const url = `${API_BASE_URL}/reverse-shares/files/${fileId}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/files/${fileId}`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/files/delete/[fileId]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/files/delete/[fileId]/route.ts index 909e869..d614570 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/files/delete/[fileId]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/files/delete/[fileId]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest, { params }: { params: Promise<{ fileId: string }> }) { const cookieHeader = req.headers.get("cookie"); const { fileId } = await params; + const url = `${API_BASE_URL}/reverse-shares/files/${fileId}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/files/${fileId}`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/files/download/[fileId]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/files/download/[fileId]/route.ts index b52253e..efbd7ed 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/files/download/[fileId]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/files/download/[fileId]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ fileId: string }> }) { const cookieHeader = req.headers.get("cookie"); const { fileId } = await params; + const url = `${API_BASE_URL}/reverse-shares/files/${fileId}/download`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/files/${fileId}/download`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/list/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/list/route.ts index e1637c4..93b0bfa 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/list/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/list/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/reverse-shares`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares`, { + const apiRes = await fetch(url, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/password/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/password/[id]/route.ts index 0bcbf4a..f7095a7 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/password/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/password/[id]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PUT(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { id } = await params; + const url = `${API_BASE_URL}/reverse-shares/${id}/password`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares/${id}/password`, { + const apiRes = await fetch(url, { method: "PUT", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/presigned-url/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/presigned-url/[id]/route.ts index 8862da3..2b5fb81 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/presigned-url/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/presigned-url/[id]/route.ts @@ -1,12 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const { searchParams } = new URL(req.url); const password = searchParams.get("password"); const body = await req.text(); const { id } = await params; - let url = `${process.env.API_BASE_URL}/reverse-shares/${id}/presigned-url`; + let url = `${API_BASE_URL}/reverse-shares/${id}/presigned-url`; if (password) { url += `?password=${encodeURIComponent(password)}`; } diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/register-upload/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/register-upload/[id]/route.ts index 9cced70..fe65746 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/register-upload/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/register-upload/[id]/route.ts @@ -1,12 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const { searchParams } = new URL(req.url); const password = searchParams.get("password"); const body = await req.text(); const { id } = await params; - let url = `${process.env.API_BASE_URL}/reverse-shares/${id}/register-file`; + let url = `${API_BASE_URL}/reverse-shares/${id}/register-file`; if (password) { url += `?password=${encodeURIComponent(password)}`; } diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/update/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/update/route.ts index 8b528aa..3e65b29 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/update/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/update/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PUT(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); + const url = `${API_BASE_URL}/reverse-shares`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/reverse-shares`, { + const apiRes = await fetch(url, { method: "PUT", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/reverse-shares/upload/[id]/route.ts b/apps/web/src/app/api/(proxy)/reverse-shares/upload/[id]/route.ts index 8082430..bd6ea59 100644 --- a/apps/web/src/app/api/(proxy)/reverse-shares/upload/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/reverse-shares/upload/[id]/route.ts @@ -1,11 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const { searchParams } = new URL(req.url); const password = searchParams.get("password"); const { id } = await params; - let url = `${process.env.API_BASE_URL}/reverse-shares/${id}/upload`; + let url = `${API_BASE_URL}/reverse-shares/${id}/upload`; if (password) { url += `?password=${encodeURIComponent(password)}`; } diff --git a/apps/web/src/app/api/(proxy)/shares/alias/create/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/alias/create/[shareId]/route.ts index 1acd5ba..5e03d70 100644 --- a/apps/web/src/app/api/(proxy)/shares/alias/create/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/alias/create/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const body = await req.text(); const cookieHeader = req.headers.get("cookie"); const { shareId } = await params; + const url = `${API_BASE_URL}/shares/${shareId}/alias`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/alias`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/alias/get/[alias]/route.ts b/apps/web/src/app/api/(proxy)/shares/alias/get/[alias]/route.ts index 4684460..7abb184 100644 --- a/apps/web/src/app/api/(proxy)/shares/alias/get/[alias]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/alias/get/[alias]/route.ts @@ -1,11 +1,15 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ alias: string }> }) { const cookieHeader = req.headers.get("cookie"); const url = new URL(req.url); const queryParams = url.search; const { alias } = await params; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/alias/${alias}${queryParams}`, { + const fetchUrl = `${API_BASE_URL}/shares/alias/${alias}${queryParams}`; + + const apiRes = await fetch(fetchUrl, { method: "GET", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/create/route.ts b/apps/web/src/app/api/(proxy)/shares/create/route.ts index 1575733..ddde0f0 100644 --- a/apps/web/src/app/api/(proxy)/shares/create/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/create/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); + const url = `${API_BASE_URL}/shares`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/delete/[id]/route.ts b/apps/web/src/app/api/(proxy)/shares/delete/[id]/route.ts index 6086461..94699fe 100644 --- a/apps/web/src/app/api/(proxy)/shares/delete/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/delete/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/shares/${id}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${id}`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/shares/details/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/details/[shareId]/route.ts index e8ee9db..f738741 100644 --- a/apps/web/src/app/api/(proxy)/shares/details/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/details/[shareId]/route.ts @@ -1,12 +1,15 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const url = new URL(req.url); const searchParams = url.searchParams.toString(); const { shareId } = await params; + const fetchUrl = `${API_BASE_URL}/shares/${shareId}${searchParams ? `?${searchParams}` : ""}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}${searchParams ? `?${searchParams}` : ""}`, { + const apiRes = await fetch(fetchUrl, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/shares/files/add/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/files/add/[shareId]/route.ts index 4a6e948..30a6346 100644 --- a/apps/web/src/app/api/(proxy)/shares/files/add/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/files/add/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { shareId } = await params; + const url = `${API_BASE_URL}/shares/${shareId}/files`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/files`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/files/remove/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/files/remove/[shareId]/route.ts index e8e23a6..31dfe41 100644 --- a/apps/web/src/app/api/(proxy)/shares/files/remove/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/files/remove/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { shareId } = await params; + const url = `${API_BASE_URL}/shares/${shareId}/files`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/files`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/list/route.ts b/apps/web/src/app/api/(proxy)/shares/list/route.ts index 4a67118..aa96a8e 100644 --- a/apps/web/src/app/api/(proxy)/shares/list/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/list/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/shares/me`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/me`, { + const apiRes = await fetch(url, { method: "GET", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/shares/password/update/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/password/update/[shareId]/route.ts index 5f13039..94af776 100644 --- a/apps/web/src/app/api/(proxy)/shares/password/update/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/password/update/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { shareId } = await params; + const url = `${API_BASE_URL}/shares/${shareId}/password`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/password`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/recipients/add/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/recipients/add/[shareId]/route.ts index 203e43e..27c87a8 100644 --- a/apps/web/src/app/api/(proxy)/shares/recipients/add/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/recipients/add/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { shareId } = await params; + const url = `${API_BASE_URL}/shares/${shareId}/recipients`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/recipients`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/recipients/notify/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/recipients/notify/[shareId]/route.ts index aaaf9f2..080b8f6 100644 --- a/apps/web/src/app/api/(proxy)/shares/recipients/notify/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/recipients/notify/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const { shareId } = await params; const body = await req.text(); + const url = `${API_BASE_URL}/shares/${shareId}/notify`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/notify`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/recipients/remove/[shareId]/route.ts b/apps/web/src/app/api/(proxy)/shares/recipients/remove/[shareId]/route.ts index 2c27033..95837da 100644 --- a/apps/web/src/app/api/(proxy)/shares/recipients/remove/[shareId]/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/recipients/remove/[shareId]/route.ts @@ -1,11 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest, { params }: { params: Promise<{ shareId: string }> }) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); const { shareId } = await params; + const url = `${API_BASE_URL}/shares/${shareId}/recipients`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares/${shareId}/recipients`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/shares/update/route.ts b/apps/web/src/app/api/(proxy)/shares/update/route.ts index 691a60c..74348b5 100644 --- a/apps/web/src/app/api/(proxy)/shares/update/route.ts +++ b/apps/web/src/app/api/(proxy)/shares/update/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PUT(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const body = await req.text(); + const url = `${API_BASE_URL}/shares`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/shares`, { + const apiRes = await fetch(url, { method: "PUT", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/users/activate/[id]/route.ts b/apps/web/src/app/api/(proxy)/users/activate/[id]/route.ts index 33dc33b..b897da4 100644 --- a/apps/web/src/app/api/(proxy)/users/activate/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/users/activate/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/users/${id}/activate`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users/${id}/activate`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/users/avatar/remove/route.ts b/apps/web/src/app/api/(proxy)/users/avatar/remove/route.ts index 0b240bf..33c789e 100644 --- a/apps/web/src/app/api/(proxy)/users/avatar/remove/route.ts +++ b/apps/web/src/app/api/(proxy)/users/avatar/remove/route.ts @@ -1,9 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/users/avatar`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users/avatar`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/users/avatar/upload/route.ts b/apps/web/src/app/api/(proxy)/users/avatar/upload/route.ts index fadbbb4..a5fd0fd 100644 --- a/apps/web/src/app/api/(proxy)/users/avatar/upload/route.ts +++ b/apps/web/src/app/api/(proxy)/users/avatar/upload/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const formData = await req.formData(); + const url = `${API_BASE_URL}/users/avatar`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users/avatar`, { + const apiRes = await fetch(url, { method: "POST", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/users/deactivate/[id]/route.ts b/apps/web/src/app/api/(proxy)/users/deactivate/[id]/route.ts index b3383c5..3a40794 100644 --- a/apps/web/src/app/api/(proxy)/users/deactivate/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/users/deactivate/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/users/${id}/deactivate`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users/${id}/deactivate`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/users/delete/[id]/route.ts b/apps/web/src/app/api/(proxy)/users/delete/[id]/route.ts index 3319bb8..304d354 100644 --- a/apps/web/src/app/api/(proxy)/users/delete/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/users/delete/[id]/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; + const url = `${API_BASE_URL}/users/${id}`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users/${id}`, { + const apiRes = await fetch(url, { method: "DELETE", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/users/details/[id]/route.ts b/apps/web/src/app/api/(proxy)/users/details/[id]/route.ts index 7e52cec..d36cbac 100644 --- a/apps/web/src/app/api/(proxy)/users/details/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/users/details/[id]/route.ts @@ -1,11 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const searchParams = req.nextUrl.searchParams.toString(); const { id } = await params; - - const url = `${process.env.API_BASE_URL}/users/${id}${searchParams ? `?${searchParams}` : ""}`; + const url = `${API_BASE_URL}/users/${id}${searchParams ? `?${searchParams}` : ""}`; const apiRes = await fetch(url, { method: "GET", diff --git a/apps/web/src/app/api/(proxy)/users/list/route.ts b/apps/web/src/app/api/(proxy)/users/list/route.ts index b2d2b5f..aa595a1 100644 --- a/apps/web/src/app/api/(proxy)/users/list/route.ts +++ b/apps/web/src/app/api/(proxy)/users/list/route.ts @@ -1,10 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function GET(req: NextRequest) { const cookieHeader = req.headers.get("cookie"); const searchParams = req.nextUrl.searchParams.toString(); - const url = `${process.env.API_BASE_URL}/users${searchParams ? `?${searchParams}` : ""}`; + const url = `${API_BASE_URL}/users${searchParams ? `?${searchParams}` : ""}`; const apiRes = await fetch(url, { method: "GET", diff --git a/apps/web/src/app/api/(proxy)/users/register/route.ts b/apps/web/src/app/api/(proxy)/users/register/route.ts index 48d730d..8a40a06 100644 --- a/apps/web/src/app/api/(proxy)/users/register/route.ts +++ b/apps/web/src/app/api/(proxy)/users/register/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function POST(req: NextRequest) { const body = await req.text(); const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/auth/register`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/auth/register`, { + const apiRes = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/apps/web/src/app/api/(proxy)/users/update-image/[id]/route.ts b/apps/web/src/app/api/(proxy)/users/update-image/[id]/route.ts index e722939..21c4a5b 100644 --- a/apps/web/src/app/api/(proxy)/users/update-image/[id]/route.ts +++ b/apps/web/src/app/api/(proxy)/users/update-image/[id]/route.ts @@ -1,12 +1,14 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const cookieHeader = req.headers.get("cookie"); const { id } = await params; - const body = await req.formData(); + const url = `${API_BASE_URL}/users/${id}/avatar`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users/${id}/avatar`, { + const apiRes = await fetch(url, { method: "PATCH", headers: { cookie: cookieHeader || "", diff --git a/apps/web/src/app/api/(proxy)/users/update/route.ts b/apps/web/src/app/api/(proxy)/users/update/route.ts index af1e9e3..2567430 100644 --- a/apps/web/src/app/api/(proxy)/users/update/route.ts +++ b/apps/web/src/app/api/(proxy)/users/update/route.ts @@ -1,10 +1,13 @@ import { NextRequest, NextResponse } from "next/server"; +const API_BASE_URL = process.env.API_BASE_URL || "http://localhost:3333"; + export async function PUT(req: NextRequest) { const body = await req.text(); const cookieHeader = req.headers.get("cookie"); + const url = `${API_BASE_URL}/users`; - const apiRes = await fetch(`${process.env.API_BASE_URL}/users`, { + const apiRes = await fetch(url, { method: "PUT", headers: { "Content-Type": "application/json",