3 files changed
+4
-7
No files matched your search
@@ -1,5 +1,4 @@
|
|||||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||||
import { NextRequest } from "next/server";
|
|
||||||
|
|
||||||
// The Manager must not load the business Auth.js module even if a stale
|
// The Manager must not load the business Auth.js module even if a stale
|
||||||
// client requests `/api/auth/session`.
|
// client requests `/api/auth/session`.
|
||||||
@@ -20,7 +19,7 @@ describe("Manager business-auth boundary", () => {
|
|||||||
it("returns 404 without importing business Auth.js", async () => {
|
it("returns 404 without importing business Auth.js", async () => {
|
||||||
process.env.MANAGER_MODE = "true";
|
process.env.MANAGER_MODE = "true";
|
||||||
|
|
||||||
const response = await GET(new NextRequest("https://manager.example.com/api/auth/session"));
|
const response = await GET(new Request("https://manager.example.com/api/auth/session"));
|
||||||
|
|
||||||
expect(response.status).toBe(404);
|
expect(response.status).toBe(404);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { NextRequest } from "next/server";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Business Auth.js is intentionally unavailable in the standalone Manager
|
* Business Auth.js is intentionally unavailable in the standalone Manager
|
||||||
* deployment. Keeping this check before the dynamic import prevents a stale
|
* deployment. Keeping this check before the dynamic import prevents a stale
|
||||||
@@ -9,13 +7,13 @@ function managerAuthDisabled() {
|
|||||||
return process.env.MANAGER_MODE === "true";
|
return process.env.MANAGER_MODE === "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
export async function GET(request: Request) {
|
||||||
if (managerAuthDisabled()) return new Response(null, { status: 404 });
|
if (managerAuthDisabled()) return new Response(null, { status: 404 });
|
||||||
const { handlers } = await import("@/auth");
|
const { handlers } = await import("@/auth");
|
||||||
return handlers.GET(request);
|
return handlers.GET(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function POST(request: NextRequest) {
|
export async function POST(request: Request) {
|
||||||
if (managerAuthDisabled()) return new Response(null, { status: 404 });
|
if (managerAuthDisabled()) return new Response(null, { status: 404 });
|
||||||
const { handlers } = await import("@/auth");
|
const { handlers } = await import("@/auth");
|
||||||
return handlers.POST(request);
|
return handlers.POST(request);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const EXTENSION_MIME_TYPES: Record<string, string> = {
|
|||||||
export const MEDIA_MAX_UPLOAD_BYTES = Number(process.env.MEDIA_MAX_UPLOAD_BYTES ?? 5_000_000);
|
export const MEDIA_MAX_UPLOAD_BYTES = Number(process.env.MEDIA_MAX_UPLOAD_BYTES ?? 5_000_000);
|
||||||
|
|
||||||
/** Overridable so a non-Docker deployment can point this somewhere else; defaults to a directory next to the app, outside public/. */
|
/** Overridable so a non-Docker deployment can point this somewhere else; defaults to a directory next to the app, outside public/. */
|
||||||
const MEDIA_ROOT = path.resolve(process.env.MEDIA_STORAGE_ROOT || "storage/media");
|
const MEDIA_ROOT = path.resolve(process.env.MEDIA_STORAGE_ROOT || path.join(/*turbopackIgnore: true*/ process.cwd(), "storage", "media"));
|
||||||
|
|
||||||
export const MEDIA_URL_PREFIX = "/api/media/";
|
export const MEDIA_URL_PREFIX = "/api/media/";
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user