feat: 添加编辑模式支持,重定向到指定文件夹路径
This commit is contained in:
@@ -68,12 +68,20 @@ const getAiProxy = async (req: IncomingMessage, res: ServerResponse, opts: Proxy
|
|||||||
const password = params.get('p');
|
const password = params.get('p');
|
||||||
const hash = params.get('hash');
|
const hash = params.get('hash');
|
||||||
let dir = !!params.get('dir');
|
let dir = !!params.get('dir');
|
||||||
|
const edit = !!params.get('edit');
|
||||||
const recursive = !!params.get('recursive');
|
const recursive = !!params.get('recursive');
|
||||||
const showStat = !!params.get('stat');
|
const showStat = !!params.get('stat');
|
||||||
const { objectName, app, owner, loginUser, isOwner } = await getObjectName(req);
|
const { objectName, app, owner, loginUser, isOwner } = await getObjectName(req);
|
||||||
if (!dir && _u.pathname.endsWith('/')) {
|
if (!dir && _u.pathname.endsWith('/')) {
|
||||||
dir = true; // 如果是目录请求,强制设置为true
|
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);
|
logger.debug(`proxy request: ${objectName}`, dir);
|
||||||
try {
|
try {
|
||||||
if (dir) {
|
if (dir) {
|
||||||
|
|||||||
Reference in New Issue
Block a user