Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugins/ssh-batch-exec/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
.vite/
*.tsbuildinfo

# DBX 是独立项目,不属于 ZTools 插件源码
/dbx/

# 本地 AI 文档
/.trae/

# 其他
*.log
.DS_Store
Expand Down
15 changes: 11 additions & 4 deletions plugins/ssh-batch-exec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Changelog

## 1.0.3 - 2026-11-27

- 新增服务器配置导出:可在服务器管理页将现有服务器配置导出为 JSON,便于备份或迁移
- 导出时剔除 PouchDB 内部字段,保留服务器 ID、连接信息、认证方式与凭据
- 增加明文凭据保管提示,提醒导出文件妥善保存并在迁移后及时删除
- 整理历史更新日志,按版本号与时间顺序排列

## 1.0.2 - 2026-10-17

- 修复 macOS 市场安装版启动后「测试连接」报错、执行永远卡在连接中的问题:根因为构建产物缺失 preload 的 Node 依赖(node_modules/ssh2 未被包含进插件包),导致 preload.js 加载即抛 Cannot find module、window.services 未挂载
- 修复 .gitignore 规则:原 `node_modules/` 误排除所有子目录依赖,改为仅排除项目根目录,确保 public/node_modules 与 dist/node_modules 随仓库提交并进入发布包
- 构建时向 dist 写入的 plugin.json 移除 development 覆盖,避免开发模式安装时强制加载 localhost:5173 导致白屏

## 1.0.1 - 2026-09-21

- 维护版本:修复若干已知问题并优化性能

## 1.0.0 - 2026-09-11

- 首个正式版本,基于 ZTools 插件平台 + Vue 3 + Vite + ssh2 实现一键批量执行服务器命令
Expand All @@ -18,7 +29,3 @@
- 终端式结果展示:stdout / stderr 分区着色
- 执行记录:每次独立持久化,默认保留 10 条可自定义
- 三栏布局首页,明暗主题适配

## 1.0.1 - 2026-09-21

- 修复了一些 bug,优化了一些性能
2 changes: 1 addition & 1 deletion plugins/ssh-batch-exec/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ssh-batch-exec",
"title": "批量命令执行",
"description": "一键批量执行服务器命令:服务器配置管理、快捷命令库、多服务器快捷指令,支持实时输出与结果统计",
"version": "1.0.2",
"version": "1.0.3",
"author": "木子",
"main": "index.html",
"logo": "logo.png",
Expand Down
28 changes: 28 additions & 0 deletions plugins/ssh-batch-exec/src/components/ServerManager.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
// 作者:木子
import { onMounted, ref } from "vue";
import { listByPrefix, putDoc, removeDoc, uid, svc, zt } from "../api";
import type { Server } from "../types";
Expand All @@ -13,6 +14,31 @@ async function load() {
}
onMounted(load);

function exportServers() {
const docs = servers.value.map((s) => {
const doc = JSON.parse(JSON.stringify(s)) as Record<string, unknown>;
delete doc._rev;
delete doc._deleted;
return doc;
});
const payload = {
app: "ztools",
type: "servers",
version: 1,
exportedAt: new Date().toISOString(),
docs,
};
const blob = new Blob([JSON.stringify(payload, null, 2)], { type: "application/json" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "ztools-servers.json";
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
}

function blank(): Partial<Server> {
return { name: "", host: "", port: 22, username: "root", authType: "password", password: "", privateKey: "", passphrase: "" };
}
Expand Down Expand Up @@ -95,8 +121,10 @@ async function pickKeyFile() {
<div>
<div class="toolbar">
<span class="muted">共 {{ servers.length }} 台服务器</span>
<button class="btn btn-ghost" :disabled="!servers.length" @click="exportServers">导出服务器配置</button>
<button class="btn btn-primary" @click="add">新增服务器</button>
</div>
<p class="muted tip">导出文件包含明文密码/私钥,仅供迁移到 DBX 使用,请妥善保管并及时删除。</p>

<div v-if="!servers.length" class="card empty">还没有服务器,点击「新增服务器」添加第一台。</div>

Expand Down
Loading