Files
forumlify/.next/dev/server/chunks/[root-of-the-server]__01lxv6s._.js
T
lezi-fun 9e407d0a2d ci: GHCR docker build for Lite branch + compose updates
- .github/workflows/docker-lite.yml: build & push ghcr.io/lezi-fun/
  forumlify-deploy:lite on Lite branch push (linux/amd64+arm64)
- docker-compose.yml: pull :lite image from GHCR, add PORT / ENABLE_
  CAPTCHA env, restart: unless-stopped on both services
2026-08-12 09:21:12 +08:00

175 lines
8.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
module.exports = [
"[externals]/next/dist/compiled/@opentelemetry/api [external] (next/dist/compiled/@opentelemetry/api, cjs)", ((__turbopack_context__, module, exports) => {
var 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) => {
var 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/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) => {
var 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/server/app-render/work-async-storage.external.js [external] (next/dist/server/app-render/work-async-storage.external.js, cjs)", ((__turbopack_context__, module, exports) => {
var 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/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) => {
var 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/runtime-reacts.external.js [external] (next/dist/server/runtime-reacts.external.js, cjs)", ((__turbopack_context__, module, exports) => {
var mod = __turbopack_context__.x("next/dist/server/runtime-reacts.external.js", () => require("next/dist/server/runtime-reacts.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) => {
var 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]/node:stream [external] (node:stream, cjs)", ((__turbopack_context__, module, exports) => {
var mod = __turbopack_context__.x("node:stream", () => require("node:stream"));
module.exports = mod;
}),
"[project]/app/api/users/profile/[username]/route.js [app-route] (ecmascript)", ((__turbopack_context__) => {
"use strict";
return __turbopack_context__.a(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try {
__turbopack_context__.s([
"GET",
()=>GET
]);
// GET /api/users/profile/:username — 用户公开信息(无需登录,用于用户主页)
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/db.js [app-route] (ecmascript)");
var __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$http$2d$cache$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/lib/http-cache.js [app-route] (ecmascript)");
var __turbopack_async_dependencies__ = __turbopack_handle_async_dependencies__([
__TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__
]);
[__TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__] = __turbopack_async_dependencies__.then ? (await __turbopack_async_dependencies__)() : __turbopack_async_dependencies__;
;
;
async function GET(req, { params }) {
const { username } = await params;
if (!username) {
return Response.json({
error: '缺少用户名'
}, {
status: 400
});
}
try {
const r = await __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$db$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["default"].query('SELECT id, username, avatar_url, bio, role, signature, created_at FROM users WHERE username = $1', [
username
]);
if (r.rows.length === 0) {
return Response.json({
error: '用户不存在'
}, {
status: 404
});
}
return (0, __TURBOPACK__imported__module__$5b$project$5d2f$lib$2f$http$2d$cache$2e$js__$5b$app$2d$route$5d$__$28$ecmascript$29$__["jsonWithEtag"])(req, r.rows[0]);
} catch {
return Response.json({
error: '服务器错误'
}, {
status: 500
});
}
}
__turbopack_async_result__();
} catch(e) { __turbopack_async_result__(e); } }, false);}),
"[project]/lib/db.js [app-route] (ecmascript)", ((__turbopack_context__) => {
"use strict";
return __turbopack_context__.a(async (__turbopack_handle_async_dependencies__, __turbopack_async_result__) => { try {
__turbopack_context__.s([
"default",
()=>__TURBOPACK__default__export__
]);
// PostgreSQL 连接池单例 (Route Handlers 共享)
// - 传统部署:常规连接池
// - Serverless(Vercel 等):每个函数实例复用全局池,限制最大连接数
var __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$node_modules$2f$pg$29$__ = __turbopack_context__.i("[externals]/pg [external] (pg, esm_import, [project]/node_modules/pg)");
var __turbopack_async_dependencies__ = __turbopack_handle_async_dependencies__([
__TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$node_modules$2f$pg$29$__
]);
[__TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$node_modules$2f$pg$29$__] = __turbopack_async_dependencies__.then ? (await __turbopack_async_dependencies__)() : __turbopack_async_dependencies__;
;
const isServerless = !!process.env.VERCEL || !!process.env.AWS_LAMBDA_FUNCTION_NAME || !!process.env.CF_PAGES;
const pool = new __TURBOPACK__imported__module__$5b$externals$5d2f$pg__$5b$external$5d$__$28$pg$2c$__esm_import$2c$__$5b$project$5d2f$node_modules$2f$pg$29$__["Pool"]({
connectionString: process.env.DATABASE_URL || 'postgresql://forumlify:123456@localhost:5432/forumlify',
...isServerless ? {
max: 1,
idleTimeoutMillis: 5000,
connectionTimeoutMillis: 10000,
maxUses: 7500
} : {}
});
// 开发热重载时避免连接池泄漏
if (("TURBOPACK compile-time value", "development") !== 'production' && !globalThis.__forumlifyPool) {
globalThis.__forumlifyPool = pool;
}
const __TURBOPACK__default__export__ = isServerless ? pool : globalThis.__forumlifyPool || pool;
__turbopack_async_result__();
} catch(e) { __turbopack_async_result__(e); } }, false);}),
"[project]/lib/http-cache.js [app-route] (ecmascript)", ((__turbopack_context__) => {
"use strict";
__turbopack_context__.s([
"jsonWithEtag",
()=>jsonWithEtag
]);
const REVALIDATE_CACHE_CONTROL = 'public, max-age=0, must-revalidate';
function matchesEtag(ifNoneMatch, etag) {
if (!ifNoneMatch) return false;
const normalized = etag.replace(/^W\//, '');
return ifNoneMatch.split(',').some((candidate)=>{
const value = candidate.trim();
return value === '*' || value.replace(/^W\//, '') === normalized;
});
}
async function createEtag(body) {
const bytes = new TextEncoder().encode(body);
const digest = await crypto.subtle.digest('SHA-256', bytes);
const hash = Array.from(new Uint8Array(digest), (byte)=>byte.toString(16).padStart(2, '0')).join('');
return `"${hash}"`;
}
async function jsonWithEtag(req, data, init = {}) {
const body = JSON.stringify(data);
const etag = await createEtag(body);
const headers = new Headers(init.headers);
headers.set('Cache-Control', REVALIDATE_CACHE_CONTROL);
headers.set('ETag', etag);
if (matchesEtag(req.headers.get('if-none-match'), etag)) {
return new Response(null, {
status: 304,
headers
});
}
headers.set('Content-Type', 'application/json; charset=utf-8');
return new Response(body, {
...init,
headers
});
}
}),
];
//# sourceMappingURL=%5Broot-of-the-server%5D__01lxv6s._.js.map