feat(electron-shell): 新增插件目录选择接口并将版本升至 1.10.0

This commit is contained in:
2026-10-30 10:00:18 +08:00
parent c77a26cd99
commit 9c6e77a1f2
337 changed files with 3254 additions and 49349 deletions
+16
View File
@@ -455,6 +455,22 @@ async function route(req, res, url) {
return sendJson(res, 200, data);
}
// ---------- 本机目录选择(插件 UI 用:原生「选择文件夹」对话框,仅返回路径) ----------
if (p === "/api/dialog/directory" && method === "POST") {
session.requireLogin(cookies);
const body = await readJsonBody(req);
const { dialog, BrowserWindow } = require("electron");
const win = BrowserWindow.getAllWindows().find((w) => !w.isDestroyed()) || null;
const opts = {
title: String(body.title || "选择文件夹"),
properties: ["openDirectory", "createDirectory"],
defaultPath: String(body.current || "") || undefined,
};
const r = win ? await dialog.showOpenDialog(win, opts) : await dialog.showOpenDialog(opts);
const picked = (r.filePaths || [])[0] || "";
return sendJson(res, 200, { ok: true, canceled: !!r.canceled || !picked, path: picked });
}
if (p === "/api/plugins/sync" && method === "POST") {
const account = session.requireLogin(cookies);
const result = await pluginSync.withSyncLock(async () => {