131 lines
6.1 KiB
JavaScript
131 lines
6.1 KiB
JavaScript
module.exports = [
|
|
"[externals]/next/dist/compiled/next-server/app-route-turbo.runtime.dev.js [external] (next/dist/compiled/next-server/app-route-turbo.runtime.dev.js, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/compiled/next-server/app-route-turbo.runtime.dev.js", () => require("next/dist/compiled/next-server/app-route-turbo.runtime.dev.js"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[externals]/next/dist/compiled/@opentelemetry/api [external] (next/dist/compiled/@opentelemetry/api, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/compiled/@opentelemetry/api", () => require("next/dist/compiled/@opentelemetry/api"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[externals]/next/dist/compiled/next-server/app-page-turbo.runtime.dev.js [external] (next/dist/compiled/next-server/app-page-turbo.runtime.dev.js, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/compiled/next-server/app-page-turbo.runtime.dev.js", () => require("next/dist/compiled/next-server/app-page-turbo.runtime.dev.js"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[externals]/next/dist/server/app-render/work-unit-async-storage.external.js [external] (next/dist/server/app-render/work-unit-async-storage.external.js, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/server/app-render/work-unit-async-storage.external.js", () => require("next/dist/server/app-render/work-unit-async-storage.external.js"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[externals]/next/dist/server/app-render/work-async-storage.external.js [external] (next/dist/server/app-render/work-async-storage.external.js, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/server/app-render/work-async-storage.external.js", () => require("next/dist/server/app-render/work-async-storage.external.js"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[externals]/next/dist/shared/lib/no-fallback-error.external.js [external] (next/dist/shared/lib/no-fallback-error.external.js, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/shared/lib/no-fallback-error.external.js", () => require("next/dist/shared/lib/no-fallback-error.external.js"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[externals]/next/dist/server/app-render/after-task-async-storage.external.js [external] (next/dist/server/app-render/after-task-async-storage.external.js, cjs)", ((__turbopack_context__, module, exports) => {
|
|
|
|
const mod = __turbopack_context__.x("next/dist/server/app-render/after-task-async-storage.external.js", () => require("next/dist/server/app-render/after-task-async-storage.external.js"));
|
|
|
|
module.exports = mod;
|
|
}),
|
|
"[project]/Documents/00 - projet/plumeia/src/app/api/auth/[...path]/route.ts [app-route] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"GET",
|
|
()=>GET,
|
|
"POST",
|
|
()=>POST
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/00 - projet/plumeia/node_modules/next/server.js [app-route] (ecmascript)");
|
|
;
|
|
const NCB_BASE = 'https://app.nocodebackend.com';
|
|
const NCB_INSTANCE = process.env.NCB_INSTANCE || '54770_plumeia';
|
|
async function GET(request, { params }) {
|
|
const { path } = await params;
|
|
return proxyToNCB(request, path);
|
|
}
|
|
async function POST(request, { params }) {
|
|
const { path } = await params;
|
|
return proxyToNCB(request, path);
|
|
}
|
|
async function proxyToNCB(request, pathSegments) {
|
|
const subPath = pathSegments.join('/');
|
|
const url = new URL(`/api/user-auth/${subPath}`, NCB_BASE);
|
|
// Forward query params
|
|
request.nextUrl.searchParams.forEach((value, key)=>{
|
|
url.searchParams.set(key, value);
|
|
});
|
|
// Append Instance
|
|
url.searchParams.set('Instance', NCB_INSTANCE);
|
|
// Forward headers
|
|
const headers = new Headers();
|
|
headers.set('Content-Type', 'application/json');
|
|
headers.set('Origin', 'https://app.nocodebackend.com');
|
|
// Forward cookies
|
|
const cookie = request.headers.get('cookie');
|
|
if (cookie) {
|
|
headers.set('Cookie', cookie);
|
|
}
|
|
// Build fetch options
|
|
const fetchOptions = {
|
|
method: request.method,
|
|
headers,
|
|
redirect: 'manual'
|
|
};
|
|
if (request.method !== 'GET' && request.method !== 'HEAD') {
|
|
try {
|
|
const body = await request.text();
|
|
if (body) fetchOptions.body = body;
|
|
} catch {
|
|
// No body
|
|
}
|
|
}
|
|
try {
|
|
const response = await fetch(url.toString(), fetchOptions);
|
|
// Build response headers
|
|
const responseHeaders = new Headers();
|
|
response.headers.forEach((value, key)=>{
|
|
// Forward relevant headers
|
|
if (key.toLowerCase() === 'content-type') {
|
|
responseHeaders.set(key, value);
|
|
}
|
|
});
|
|
// Handle Set-Cookie headers from NCB
|
|
const setCookieHeaders = response.headers.getSetCookie?.() || [];
|
|
for (const cookie of setCookieHeaders){
|
|
// Adjust cookies for localhost: fix SameSite
|
|
const adjusted = cookie.replace(/; samesite=none/gi, '; SameSite=Lax');
|
|
responseHeaders.append('Set-Cookie', adjusted);
|
|
}
|
|
const body = await response.text();
|
|
return new __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["NextResponse"](body, {
|
|
status: response.status,
|
|
headers: responseHeaders
|
|
});
|
|
} catch (error) {
|
|
console.error('Auth proxy error:', error);
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$00__$2d$__projet$2f$plumeia$2f$node_modules$2f$next$2f$server$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["NextResponse"].json({
|
|
error: 'Proxy error'
|
|
}, {
|
|
status: 502
|
|
});
|
|
}
|
|
}
|
|
}),
|
|
];
|
|
|
|
//# sourceMappingURL=%5Broot-of-the-server%5D__77763f52._.js.map
|