feat: 添加编辑模式支持,重定向到指定文件夹路径

This commit is contained in:
xiongxiao
2026-03-18 16:54:38 +08:00
committed by cnb
parent 9be5eb00f5
commit 08884b7e4b

View File

@@ -68,12 +68,20 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
const password = params.get('p');
const hash = params.get('hash');
let dir = !!params.get('dir');
const edit = !!params.get('edit');
const recursive = !!params.get('recursive');
const showStat = !!params.get('stat');
const { objectName, app, owner, loginUser, isOwner } = await getObjectName(req);
if (!dir && _u.pathname.endsWith('/')) {
dir = true; // 如果是目录请求强制设置为true
}
if (edit) {
// 重定向root/codepod/#folder=路径
const redirectUrl = `/root/codepod/#folder=${_u.pathname}`;
res.writeHead(302, { Location: redirectUrl });
res.end();
return true;
}
logger.debug(`proxy request: ${objectName}`, dir);
try {
if (dir) {