Skip to content

Commit 445ffa7

Browse files
authored
Merge pull request ZToolsCenter#545 from me1dlinger/plugin/fileshare
Update plugin 文件共享 v1.2.1
2 parents acdd267 + fc2d84f commit 445ffa7

8 files changed

Lines changed: 32 additions & 421 deletions

File tree

‎plugins/fileshare/CHANGELOG.md‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.2.1 - 2026-09-07
4+
5+
### 修复
6+
- 修复私密对话删除消息后列表不刷新的问题:删除的消息仍停留在页面,需重新进入会话才消失。现消息列表与服务端实时对账,本机或对方删除的消息立即从对话中移除
7+
38
## 1.2.0 - 2026-09-06
49

510
### 新增
@@ -9,10 +14,6 @@
914
- 本机/远程访问识别:Web 页面识别是否在插件宿主机浏览器访问,头部显示「本机访问 / 远程访问」标识
1015
- 本机管理控制台:本机浏览器访问 Web 页面时,通过左侧「文件 / 消息」菜单切换到与插件端一致的点对点对话管理与查看;页面可查看下载/上传日志、管理 IP 白名单
1116

12-
### 根据提交记录补充
13-
14-
- 修复P2P聊天客户端刷新后历史消息丢失和主机端对话区域滚动问题
15-
1617
## 1.1.1 - 2026-08-18
1718

1819
### 新增
@@ -24,10 +25,6 @@
2425
### 修复
2526
- 修复手动关闭共享服务后,关闭页面再重新进入(插件后台仍在运行)时服务被意外自动重启的问题:现通过内存标志区分「插件首次加载」与「用户手动关闭后重新进入」,手动关闭后重新进入页面保持关闭状态,插件彻底关闭再重新打开时恢复默认自动启动
2627

27-
### 根据提交记录补充
28-
29-
- 修复TypeScript 关键字识别失效
30-
3128
## 1.1.0 - 2026-08-13
3229

3330
### 安全修复

‎plugins/fileshare/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "z-share",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "局域网共享文件",
55
"type": "module",
66
"scripts": {

‎plugins/fileshare/public/plugin.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"$schema": "node_modules/@ztools-center/ztools-api-types/resource/ztools.schema.json",
33
"name": "fileshare",
44
"title": "文件共享",
5-
"description": "局域网文件共享,支持在线预览文本、代码、Markdown、音视频",
5+
"description": "局域网文件共享,支持公开/点对点共享,支持在线预览文本、代码、Markdown、音视频",
66
"author": "meidlinger",
7-
"version": "1.2.0",
7+
"version": "1.2.1",
88
"main": "index.html",
99
"preload": "preload/services.js",
1010
"logo": "logo.png",

‎plugins/fileshare/public/preload/services.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,20 @@ function createServer(port, ip) {
540540
return
541541
}
542542

543+
// --- Route: GET /logo.png (favicon) ---
544+
if (pathname === '/logo.png' && req.method === 'GET') {
545+
const logoPath = path.join(__dirname, '..', 'logo.png')
546+
try {
547+
const logoBuf = fs.readFileSync(logoPath)
548+
res.writeHead(200, { 'Content-Type': 'image/png', 'Cache-Control': 'public, max-age=86400' })
549+
res.end(logoBuf)
550+
} catch (_e) {
551+
res.writeHead(404)
552+
res.end()
553+
}
554+
return
555+
}
556+
543557
// --- Route: GET /api/list ---
544558
if (pathname === '/api/list' && req.method === 'GET') {
545559
const scopePath = urlObj.searchParams.get('path') || ''

‎plugins/fileshare/public/web/index.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<head>
55
<meta charset="utf-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="icon" type="image/png" href="/logo.png">
78
<title>文件共享</title>
89
<style>
910
/* ===== CSS Variables ===== */

‎plugins/fileshare/src/Share/P2pCenter.vue‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,19 @@ function loadSessions() {
4444
function loadMessages() {
4545
if (!selectedId.value) return
4646
const next = window.services.getP2pMessages(selectedId.value, msgSince.value)
47+
let appended = false
4748
if (next.length > 0) {
4849
messages.value = messages.value.concat(next)
4950
msgSince.value = next[next.length - 1].seq
50-
scrollToBottom()
51+
appended = true
5152
}
53+
// Reconcile deletions (host or peer removed a message while this chat was open):
54+
// drop any locally-held message that no longer exists on the server store.
55+
const alive = new Set(window.services.getP2pMessages(selectedId.value, 0).map(m => m.id))
56+
if (messages.value.some(m => !alive.has(m.id))) {
57+
messages.value = messages.value.filter(m => alive.has(m.id))
58+
}
59+
if (appended) scrollToBottom()
5260
// While this conversation is open, keep its unread badge cleared.
5361
window.services.markP2pRead(selectedId.value)
5462
loadSessions()

‎plugins/fileshare/test/gui-harness.cjs‎

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)