feat(electron-shell): 新增插件目录选择接口并将版本升至 1.10.0
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
# 更新日志
|
||||
|
||||
## 1.10.0(2026-10-29)
|
||||
|
||||
### 新增
|
||||
|
||||
- 本机接口 `POST /api/dialog/directory`:插件 UI 可调起原生「选择文件夹」对话框并拿到绝对路径
|
||||
(仅登录态可用,只返回路径、不读文件),插件里的目录类参数不再只能手输
|
||||
- 首个接入:CRM数据导出(xq0048)「保存目录」旁新增「选择」按钮
|
||||
|
||||
## 1.9.3(2026-10-29)
|
||||
|
||||
### 改进
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "37du-electron-shell",
|
||||
"productName": "37du 自动化工作台",
|
||||
"version": "1.9.3",
|
||||
"version": "1.10.0",
|
||||
"description": "37du 执行机 Node/Electron 客户端(替代 Python webhost 底座,插件保持 Python 子进程执行)",
|
||||
"main": "electron/main.js",
|
||||
"private": true,
|
||||
|
||||
Reference in New Issue
Block a user