dsh-notify-tray 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +8 -8
- package/README.md +8 -8
- package/README.zh-CN.md +8 -8
- package/lib/client.js +77 -84
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -6,16 +6,16 @@ Get notified when tasks finish, fail, or need your attention. On macOS / Linux,
|
|
|
6
6
|
|
|
7
7
|
## Get started
|
|
8
8
|
|
|
9
|
-
1. Install and enable the plugin, then
|
|
9
|
+
1. Install and enable the plugin, then open **Settings → Whale Notify Station** in DSH. The whale icon in the main sidebar opens the same settings.
|
|
10
10
|
2. Under notifications, choose which events should alert you and whether to play a sound.
|
|
11
11
|
3. On macOS / Linux, enable the status-bar whale. macOS also offers text, a count, or just the icon beside the whale.
|
|
12
12
|
4. Changes **save automatically**, about half a second after you stop editing. A **Settings saved** banner confirms success; there is no Save button.
|
|
13
13
|
|
|
14
14
|
Failed saves retain your changes and offer **Retry saving**. Correct invalid input before saving. Leaving this page does not discard queued changes.
|
|
15
15
|
|
|
16
|
-
The plugin detail page contains this user guide in Chinese by default, with a link to this English version. Notification, status-bar, spend, and plan settings
|
|
16
|
+
The plugin detail page contains this user guide in Chinese by default, with a link to this English version. Notification, status-bar, spend, and plan settings are available under **Settings → Whale Notify Station**.
|
|
17
17
|
|
|
18
|
-
Existing settings and spend records are retained after an update.
|
|
18
|
+
Existing settings and spend records are retained after an update. If the Settings entry is missing, check that the plugin is enabled and restart DSH.
|
|
19
19
|
|
|
20
20
|
## Notifications
|
|
21
21
|
|
|
@@ -47,7 +47,7 @@ Click the whale to see running tasks, pending actions, recent results, daily usa
|
|
|
47
47
|
| Linux (UOS / Deepin / Kylin / KDE and others) | System notifications and a system-tray whale with state colors |
|
|
48
48
|
| Windows | System notifications; this plugin does not provide a Windows tray icon or tray settings |
|
|
49
49
|
|
|
50
|
-
If you hide the whale from its menu, use **Show the status-bar icon again** in the
|
|
50
|
+
If you hide the whale from its menu, use **Show the status-bar icon again** in the whale settings page. No restart is needed. GNOME generally needs an AppIndicator extension to display the tray icon.
|
|
51
51
|
|
|
52
52
|
## Spend and plans
|
|
53
53
|
|
|
@@ -73,7 +73,7 @@ Keep the channel on **Auto** and the DSH window running. The macOS system fallba
|
|
|
73
73
|
|
|
74
74
|
**Why are there no whale icon settings on Windows?**
|
|
75
75
|
|
|
76
|
-
This plugin implements only notifications on Windows. Status-bar features are for macOS / Linux. The
|
|
76
|
+
This plugin implements only notifications on Windows. Status-bar features are for macOS / Linux. The **Settings → Whale Notify Station** entry appears on all three platforms.
|
|
77
77
|
|
|
78
78
|
**Spend or quota looks wrong?**
|
|
79
79
|
|
|
@@ -89,11 +89,11 @@ In DSH, open **Plugins → Add plugin** and enter `dsh-notify-tray`. To select a
|
|
|
89
89
|
|
|
90
90
|
### Online updates
|
|
91
91
|
|
|
92
|
-
The **Updates** card at the bottom of the
|
|
92
|
+
The **Updates** card at the bottom of the whale settings page:
|
|
93
93
|
|
|
94
94
|
- Checks when you open the page, or when you click **Check for updates**.
|
|
95
|
-
-
|
|
96
|
-
-
|
|
95
|
+
- When a compatible stable release is available, **Update in Plugins** saves pending settings and opens Whale Notify Station in DSH’s built-in plugin manager.
|
|
96
|
+
- Under **Versions**, select the release and confirm. DSH shows progress, the result, and any restart prompt there. The whale’s sidebar entry can disappear while DSH replaces the old version. Wait for completion before restarting.
|
|
97
97
|
- Explains why local-directory and Git installations cannot use this update path. Once a release is published to npm, switch to an npm installation through plugin management to enable online updates.
|
|
98
98
|
|
|
99
99
|
If the settings page in 0.1.8 or 0.1.9 says that plugin update access or APIs are unavailable, open **Plugins → Whale Notify Station → Versions** in DSH. Expand the version list and select the release to install. Restart DSH when prompted.
|
package/README.md
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
## 从这里开始
|
|
8
8
|
|
|
9
|
-
1.
|
|
9
|
+
1. 安装并启用插件后,打开 DSH **「设置 → 小鲸鱼通知站」**。也可以点击主侧栏的鲸鱼图标打开同一份设置。
|
|
10
10
|
2. 在「提醒我」中选择需要的通知类型,按需开启提示音。
|
|
11
11
|
3. macOS / Linux 用户可以开启「显示小鲸鱼」;macOS 还可选择鲸鱼旁边显示文字、数字或只显示图标。
|
|
12
12
|
4. 修改后会**自动保存**,连续输入停止约半秒后提交。保存成功时会出现「设置已保存」小横幅,无需点击保存按钮。
|
|
13
13
|
|
|
14
14
|
保存失败会保留修改,并显示「重试保存」。输入无效时请先修正;离开设置页不会丢弃尚在排队的修改。
|
|
15
15
|
|
|
16
|
-
「插件 →
|
|
16
|
+
「插件 → 小鲸鱼通知站」详情页只显示这份使用说明。在「设置 → 小鲸鱼通知站」可以调整通知、状态栏、花费和套餐。
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
从旧版更新后,原有设置和花费记录会继续使用,无需重新填写。若设置列表里未出现「小鲸鱼通知站」,请确认插件已启用并重启 DSH。
|
|
19
19
|
|
|
20
20
|
## 通知怎么用
|
|
21
21
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
| Linux(UOS / Deepin / 麒麟 / KDE 等) | 系统通知、系统托盘鲸鱼,以颜色区分状态 |
|
|
48
48
|
| Windows | 系统通知;本插件不提供 Windows 托盘图标,设置页也不显示托盘选项 |
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
若从鲸鱼菜单隐藏了图标,可在小鲸鱼设置页点击「重新显示状态栏图标」,无需重启。GNOME 通常需要 AppIndicator 扩展才能显示托盘图标。
|
|
51
51
|
|
|
52
52
|
## 花费与套餐
|
|
53
53
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
**为什么 Windows 没有鲸鱼图标设置?**
|
|
75
75
|
|
|
76
|
-
本插件在 Windows 上仅实现通知,状态栏功能仅用于 macOS / Linux;DSH
|
|
76
|
+
本插件在 Windows 上仅实现通知,状态栏功能仅用于 macOS / Linux;DSH「设置 → 小鲸鱼通知站」入口在三个平台都会显示。
|
|
77
77
|
|
|
78
78
|
**花费或额度不准确?**
|
|
79
79
|
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
|
|
90
90
|
### 在线更新
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
小鲸鱼设置页底部提供「版本更新」卡片:
|
|
93
93
|
|
|
94
94
|
- 打开设置页时自动检查,也可以点击「检查更新」。
|
|
95
|
-
-
|
|
96
|
-
-
|
|
95
|
+
- 发现兼容的正式版后,点击「在插件管理中更新」。小鲸鱼会先保存设置,再打开 DSH 自带的小鲸鱼插件详情。
|
|
96
|
+
- 展开「版本」,选择目标版本并确认。更新进度、结果和重启提示都显示在 DSH 插件管理页。旧版卸载时,小鲸鱼的侧栏入口会暂时消失,请等安装完成后再按提示重启。
|
|
97
97
|
- 本地目录、Git 等非 npm 安装不支持这条在线更新流程,会显示原因。需等正式版发布到 npm 后,通过插件管理页改为 npm 安装。
|
|
98
98
|
|
|
99
99
|
使用 0.1.8 或 0.1.9 时,如果设置页提示「当前 DSH 未提供可用的插件更新权限或接口」,请打开 DSH「插件 → 小鲸鱼通知站 → 版本」,展开版本列表并选择要更新到的版本。提示需要重启时,请重启 DSH。
|
package/README.zh-CN.md
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
## 从这里开始
|
|
8
8
|
|
|
9
|
-
1.
|
|
9
|
+
1. 安装并启用插件后,打开 DSH **「设置 → 小鲸鱼通知站」**。也可以点击主侧栏的鲸鱼图标打开同一份设置。
|
|
10
10
|
2. 在「提醒我」中选择需要的通知类型,按需开启提示音。
|
|
11
11
|
3. macOS / Linux 用户可以开启「显示小鲸鱼」;macOS 还可选择鲸鱼旁边显示文字、数字或只显示图标。
|
|
12
12
|
4. 修改后会**自动保存**,连续输入停止约半秒后提交。保存成功时会出现「设置已保存」小横幅,无需点击保存按钮。
|
|
13
13
|
|
|
14
14
|
保存失败会保留修改,并显示「重试保存」。输入无效时请先修正;离开设置页不会丢弃尚在排队的修改。
|
|
15
15
|
|
|
16
|
-
「插件 →
|
|
16
|
+
「插件 → 小鲸鱼通知站」详情页只显示这份使用说明。在「设置 → 小鲸鱼通知站」可以调整通知、状态栏、花费和套餐。
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
从旧版更新后,原有设置和花费记录会继续使用,无需重新填写。若设置列表里未出现「小鲸鱼通知站」,请确认插件已启用并重启 DSH。
|
|
19
19
|
|
|
20
20
|
## 通知怎么用
|
|
21
21
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
| Linux(UOS / Deepin / 麒麟 / KDE 等) | 系统通知、系统托盘鲸鱼,以颜色区分状态 |
|
|
48
48
|
| Windows | 系统通知;本插件不提供 Windows 托盘图标,设置页也不显示托盘选项 |
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
若从鲸鱼菜单隐藏了图标,可在小鲸鱼设置页点击「重新显示状态栏图标」,无需重启。GNOME 通常需要 AppIndicator 扩展才能显示托盘图标。
|
|
51
51
|
|
|
52
52
|
## 花费与套餐
|
|
53
53
|
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
|
|
74
74
|
**为什么 Windows 没有鲸鱼图标设置?**
|
|
75
75
|
|
|
76
|
-
本插件在 Windows 上仅实现通知,状态栏功能仅用于 macOS / Linux;DSH
|
|
76
|
+
本插件在 Windows 上仅实现通知,状态栏功能仅用于 macOS / Linux;DSH「设置 → 小鲸鱼通知站」入口在三个平台都会显示。
|
|
77
77
|
|
|
78
78
|
**花费或额度不准确?**
|
|
79
79
|
|
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
|
|
90
90
|
### 在线更新
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
小鲸鱼设置页底部提供「版本更新」卡片:
|
|
93
93
|
|
|
94
94
|
- 打开设置页时自动检查,也可以点击「检查更新」。
|
|
95
|
-
-
|
|
96
|
-
-
|
|
95
|
+
- 发现兼容的正式版后,点击「在插件管理中更新」。小鲸鱼会先保存设置,再打开 DSH 自带的小鲸鱼插件详情。
|
|
96
|
+
- 展开「版本」,选择目标版本并确认。更新进度、结果和重启提示都显示在 DSH 插件管理页。旧版卸载时,小鲸鱼的侧栏入口会暂时消失,请等安装完成后再按提示重启。
|
|
97
97
|
- 本地目录、Git 等非 npm 安装不支持这条在线更新流程,会显示原因。需等正式版发布到 npm 后,通过插件管理页改为 npm 安装。
|
|
98
98
|
|
|
99
99
|
使用 0.1.8 或 0.1.9 时,如果设置页提示「当前 DSH 未提供可用的插件更新权限或接口」,请打开 DSH「插件 → 小鲸鱼通知站 → 版本」,展开版本列表并选择要更新到的版本。提示需要重启时,请重启 DSH。
|
package/lib/client.js
CHANGED
|
@@ -42,12 +42,12 @@ window.__ModuleLoader__.load({
|
|
|
42
42
|
return true
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// Settings mount
|
|
45
|
+
// Settings entries mount when their slots and the host namespace are ready.
|
|
46
46
|
var inject = ['uiWorkspace', 'sessions', 'slots', 'locale', 'configForms']
|
|
47
47
|
|
|
48
48
|
// ------------------------------------------------------------------------
|
|
49
|
-
// Settings
|
|
50
|
-
//
|
|
49
|
+
// Settings and the main sidebar share a form over the `notify-tray`
|
|
50
|
+
// settings namespace (the `.volatile()` fields of
|
|
51
51
|
// lib/index.js Config, served by @deepseek-ai/dsh-settings), grouped into
|
|
52
52
|
// sections with toggles, segmented choices and number fields, saved automatically.
|
|
53
53
|
// Plain React.createElement, so no build step is needed.
|
|
@@ -112,23 +112,19 @@ window.__ModuleLoader__.load({
|
|
|
112
112
|
fixSettings: '请检查输入后自动保存',
|
|
113
113
|
retrySave: '重试保存',
|
|
114
114
|
updateTitle: '版本更新',
|
|
115
|
-
updateHint: '
|
|
115
|
+
updateHint: '打开此页会自动检查。在 DSH 插件详情的「版本」中确认更新并查看进度。',
|
|
116
116
|
checkUpdate: '检查更新',
|
|
117
|
-
|
|
117
|
+
openPluginUpdate: '在插件管理中更新',
|
|
118
118
|
update_idle: '准备检查更新',
|
|
119
119
|
update_checking: '正在检查新版本…',
|
|
120
120
|
update_available: '发现可用的新版本',
|
|
121
121
|
update_current: '已是最新正式版',
|
|
122
122
|
update_blocked: '有新版本,但暂无适合当前 DSH 的正式版',
|
|
123
123
|
update_unavailable: '此页无法检查更新,请在 DSH 的「插件」页查看。',
|
|
124
|
+
update_manual: '请打开 DSH「插件 → 小鲸鱼通知站 → 版本」,选择要更新到的版本。',
|
|
124
125
|
update_local: '当前插件来自本地目录或 Git 等来源。此页仅检查 npm 安装的插件。',
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
update_restart: '更新已安装,重启 DSH 后生效',
|
|
128
|
-
update_error: '检查或更新失败,可重新检查后再试',
|
|
129
|
-
update_unknown: '更新结果尚未确认,请到插件管理页查看,避免重复操作。',
|
|
130
|
-
update_restored: '更新失败,DSH 已恢复旧版本;如提示需要重启,请重启 DSH。',
|
|
131
|
-
update_broken: '更新与恢复均未完成,请到插件管理页处理。',
|
|
126
|
+
update_opening: '正在打开插件管理…',
|
|
127
|
+
update_error: '版本检查失败,请重试',
|
|
132
128
|
updateSaveFirst: '设置尚未保存,请先检查输入或重试保存。',
|
|
133
129
|
installedVersion: '当前版本',
|
|
134
130
|
newVersion: '新版本',
|
|
@@ -293,23 +289,19 @@ window.__ModuleLoader__.load({
|
|
|
293
289
|
fixSettings: 'Check your input to save automatically',
|
|
294
290
|
retrySave: 'Retry saving',
|
|
295
291
|
updateTitle: 'Updates',
|
|
296
|
-
updateHint: 'Checks when you open this page.
|
|
292
|
+
updateHint: 'Checks when you open this page. Confirm the update and follow its progress under Versions in DSH’s plugin details.',
|
|
297
293
|
checkUpdate: 'Check for updates',
|
|
298
|
-
|
|
294
|
+
openPluginUpdate: 'Update in Plugins',
|
|
299
295
|
update_idle: 'Ready to check for updates',
|
|
300
296
|
update_checking: 'Checking for updates…',
|
|
301
297
|
update_available: 'A new version is available',
|
|
302
298
|
update_current: 'You have the latest stable version',
|
|
303
299
|
update_blocked: 'Newer versions exist, but no compatible stable release is available',
|
|
304
300
|
update_unavailable: 'Open the DSH Plugins page to check for updates.',
|
|
301
|
+
update_manual: 'Open Plugins → Whale Notify Station → Versions in DSH and choose the version to install.',
|
|
305
302
|
update_local: 'This plugin was installed from a local directory, Git, or another source. This page checks npm installations only.',
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
update_restart: 'Update installed. Restart DSH to use it.',
|
|
309
|
-
update_error: 'Check or update failed. Check again to retry.',
|
|
310
|
-
update_unknown: 'The update outcome is unknown. Check plugin management before trying again.',
|
|
311
|
-
update_restored: 'Update failed; DSH restored the previous version. Restart DSH if requested.',
|
|
312
|
-
update_broken: 'Update and recovery did not complete. Open plugin management to resolve this.',
|
|
303
|
+
update_opening: 'Opening Plugins…',
|
|
304
|
+
update_error: 'Version check failed. Check again to retry.',
|
|
313
305
|
updateSaveFirst: 'Settings are not saved. Check your input or retry saving first.',
|
|
314
306
|
installedVersion: 'Installed',
|
|
315
307
|
newVersion: 'New version',
|
|
@@ -620,8 +612,9 @@ window.__ModuleLoader__.load({
|
|
|
620
612
|
// All update decisions and package mutations belong to DSH's plugin manager.
|
|
621
613
|
// The browser never runs a shell or chooses an unverified registry version.
|
|
622
614
|
class UpdateController {
|
|
623
|
-
constructor(getManager, flush) {
|
|
615
|
+
constructor(getManager, flush, openBundle) {
|
|
624
616
|
this.getManager = getManager
|
|
617
|
+
this.openBundle = openBundle
|
|
625
618
|
this.flush = flush
|
|
626
619
|
this.listeners = new Set()
|
|
627
620
|
this.snapshot = { phase: 'idle' }
|
|
@@ -639,10 +632,10 @@ window.__ModuleLoader__.load({
|
|
|
639
632
|
}
|
|
640
633
|
|
|
641
634
|
async check() {
|
|
642
|
-
if (this.disposed || ['checking', '
|
|
635
|
+
if (this.disposed || ['checking', 'opening'].includes(this.snapshot.phase)) return
|
|
643
636
|
const manager = this.getManager()
|
|
644
637
|
this.patch({ phase: 'checking', candidate: undefined, error: undefined })
|
|
645
|
-
if (!manager?.listBundles || !manager.listVersions
|
|
638
|
+
if (!manager?.listBundles || !manager.listVersions) return this.patch({ phase: 'unavailable' })
|
|
646
639
|
try {
|
|
647
640
|
const inventory = await manager.listBundles()
|
|
648
641
|
if (!inventory.ok) throw new Error(inventory.error?.message || 'Plugin inventory unavailable')
|
|
@@ -659,33 +652,23 @@ window.__ModuleLoader__.load({
|
|
|
659
652
|
const list = answer.value
|
|
660
653
|
if (list.status !== 'listed') throw new Error(list.reason || 'Version check refused')
|
|
661
654
|
const candidate = list.versions.find(v => v.bundle && !v.incompatible && !v.deprecated && !v.prerelease)
|
|
662
|
-
this.patch({ phase: candidate ? 'available' : list.versions.length ? 'blocked' : 'current', installed: list.installed, candidate: candidate?.version
|
|
655
|
+
this.patch({ phase: candidate ? 'available' : list.versions.length ? 'blocked' : 'current', installed: list.installed, candidate: candidate?.version })
|
|
663
656
|
} catch (error) {
|
|
664
657
|
this.patch({ phase: 'error', error: String(error.message || error) })
|
|
665
658
|
}
|
|
666
659
|
}
|
|
667
660
|
|
|
668
|
-
async
|
|
661
|
+
async open() {
|
|
669
662
|
if (this.disposed || this.snapshot.phase !== 'available') return
|
|
670
|
-
|
|
671
|
-
this.patch({ phase: 'updating', error: undefined })
|
|
663
|
+
this.patch({ phase: 'opening', error: undefined })
|
|
672
664
|
try {
|
|
673
665
|
if (!await this.flush()) return this.patch({ phase: 'available', error: 'updateSaveFirst' })
|
|
674
666
|
if (this.disposed) return
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
const result = answer.value
|
|
679
|
-
const application = result.result?.application
|
|
680
|
-
if (application === 'applied' || application === 'restart-required') {
|
|
681
|
-
this.patch({ phase: application === 'restart-required' ? 'restart' : 'updated', installed: candidate, candidate: undefined })
|
|
682
|
-
} else {
|
|
683
|
-
const restored = result.restore?.application
|
|
684
|
-
this.patch({ phase: restored === 'applied' || restored === 'restart-required' ? 'restored' : restored ? 'broken' : 'error', error: result.result?.error?.diagnostic || result.result?.error?.code || application })
|
|
685
|
-
}
|
|
667
|
+
if (!this.openBundle()) return this.patch({ phase: 'manual' })
|
|
668
|
+
this.patch({ phase: 'available' })
|
|
669
|
+
return true
|
|
686
670
|
} catch (error) {
|
|
687
|
-
|
|
688
|
-
this.patch({ phase: 'unknown', error: String(error.message || error) })
|
|
671
|
+
this.patch({ phase: 'manual', error: String(error.message || error) })
|
|
689
672
|
}
|
|
690
673
|
}
|
|
691
674
|
|
|
@@ -726,10 +709,15 @@ window.__ModuleLoader__.load({
|
|
|
726
709
|
React.useEffect(() => {
|
|
727
710
|
const fn = () => bump(n => n + 1)
|
|
728
711
|
live.listeners.add(fn)
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
712
|
+
if (live.listeners.size === 1) {
|
|
713
|
+
loadCatalog()
|
|
714
|
+
loadState()
|
|
715
|
+
live.timer = setInterval(loadState, LIVE_MS)
|
|
716
|
+
}
|
|
717
|
+
return () => {
|
|
718
|
+
live.listeners.delete(fn)
|
|
719
|
+
if (!live.listeners.size) clearInterval(live.timer)
|
|
720
|
+
}
|
|
733
721
|
}, [])
|
|
734
722
|
return live
|
|
735
723
|
}
|
|
@@ -787,14 +775,14 @@ window.__ModuleLoader__.load({
|
|
|
787
775
|
h(ui.Switch, { checked: field.text === 'on', disabled, label: t(name), onChange: next => edit(name, next ? 'on' : 'off') })))
|
|
788
776
|
}
|
|
789
777
|
|
|
790
|
-
function ChoiceRow({ t, name, field, options, disabled, edit, resetField, hint }) {
|
|
778
|
+
function ChoiceRow({ t, name, idPrefix, field, options, disabled, edit, resetField, hint }) {
|
|
791
779
|
return h('div', { style: { ...S.row, flexWrap: 'wrap' } },
|
|
792
780
|
h('div', { style: S.rowText },
|
|
793
781
|
h('div', { style: S.label }, t(name), h(Overridden, { t, field, disabled, onReset: () => resetField(name) })),
|
|
794
782
|
hint ? h('p', { style: S.hint }, t(hint)) : null),
|
|
795
783
|
h('div', { style: S.control },
|
|
796
784
|
h(ui.SegmentedControl, {
|
|
797
|
-
id:
|
|
785
|
+
id: `${idPrefix}-${name}`,
|
|
798
786
|
label: t(name),
|
|
799
787
|
value: field.text,
|
|
800
788
|
disabled,
|
|
@@ -816,9 +804,9 @@ window.__ModuleLoader__.load({
|
|
|
816
804
|
ui.Checkbox ? null : h('span', null, t(name))))))
|
|
817
805
|
}
|
|
818
806
|
|
|
819
|
-
function ValueField({ t, name, field, disabled, edit, resetField, numeric, placeholder, hint }) {
|
|
807
|
+
function ValueField({ t, name, idPrefix, field, disabled, edit, resetField, numeric, placeholder, hint }) {
|
|
820
808
|
return h(ui.SettingsValueField, {
|
|
821
|
-
id:
|
|
809
|
+
id: `${idPrefix}-${name}`,
|
|
822
810
|
label: t(name),
|
|
823
811
|
hint: hint === undefined ? t(`${name}Hint`) : hint,
|
|
824
812
|
overriddenLabel: t('overridden'),
|
|
@@ -838,9 +826,9 @@ window.__ModuleLoader__.load({
|
|
|
838
826
|
const TextField = props => h(ValueField, { ...props, numeric: false })
|
|
839
827
|
|
|
840
828
|
/** A bare dropdown (its row carries the label). */
|
|
841
|
-
function Select({ t, name, field, options, disabled, onChange }) {
|
|
829
|
+
function Select({ t, name, idPrefix, field, options, disabled, onChange }) {
|
|
842
830
|
return h('select', {
|
|
843
|
-
id:
|
|
831
|
+
id: `${idPrefix}-${name}`,
|
|
844
832
|
style: S.select,
|
|
845
833
|
value: field.text,
|
|
846
834
|
disabled,
|
|
@@ -994,8 +982,8 @@ window.__ModuleLoader__.load({
|
|
|
994
982
|
? h('p', { style: S.hint }, links.map(([key, url], i) => h(React.Fragment || 'span', { key }, i ? ' · ' : '', h('a', { href: url, target: '_blank', rel: 'noreferrer', style: S.link }, `${t(`${key}Page`)} ↗`))))
|
|
995
983
|
: h('p', { style: S.hint }, t('myPlanHint'))),
|
|
996
984
|
h('div', { style: { ...S.control, display: 'flex', gap: 8, flexWrap: 'wrap' } },
|
|
997
|
-
h(Select, {
|
|
998
|
-
providerId !== 'none' && plans.length ? h(Select, {
|
|
985
|
+
h(Select, { ...common, name: 'planProvider', field: f.planProvider, options: providerOptions, onChange: chooseProvider }),
|
|
986
|
+
providerId !== 'none' && plans.length ? h(Select, { ...common, name: 'planId', field: f.planId, options: planOptions, onChange: choosePlan }) : null))]
|
|
999
987
|
if (providerId === 'none') return children
|
|
1000
988
|
|
|
1001
989
|
// ---- remaining quota: the key reference and a refresh, when the provider has an endpoint ----
|
|
@@ -1074,9 +1062,11 @@ window.__ModuleLoader__.load({
|
|
|
1074
1062
|
}
|
|
1075
1063
|
|
|
1076
1064
|
const PAGE_CSS = `
|
|
1077
|
-
.dnt-page { --dnt-accent: #5085b2; --dnt-border: color-mix(in srgb, currentColor 11%, transparent);
|
|
1078
|
-
|
|
1065
|
+
.dnt-page { --dnt-accent: #5085b2; --dnt-border: color-mix(in srgb, currentColor 11%, transparent); }
|
|
1066
|
+
.dnt-panel { flex: 1; min-height: 0; overflow-y: auto; }
|
|
1067
|
+
html[data-platform='darwin'] .dnt-panel { margin-top: var(--dsh-frame-top-clearance, 0px); }
|
|
1079
1068
|
.dnt-content { max-width: 1040px; margin: auto; padding: 30px 26px 48px; }
|
|
1069
|
+
.dnt-settings .dnt-content { padding: 0; }
|
|
1080
1070
|
.dnt-hero { display: flex; align-items: center; gap: 18px; padding: 22px; margin-bottom: 24px; border-radius: 20px; background: linear-gradient(115deg, color-mix(in srgb, var(--dnt-accent) 12%, transparent), color-mix(in srgb, var(--dnt-accent) 2%, transparent)); border: 1px solid var(--dnt-border); }
|
|
1081
1071
|
.dnt-mascot { box-sizing: border-box; width: 80px; height: 80px; padding: 8px; flex: none; border-radius: 22px; border: 1px solid var(--dnt-border); background: var(--dsw-alias-bg-layer-1, #fff); box-shadow: 0 3px 10px #00000006; }
|
|
1082
1072
|
.dnt-mascot-window { width: 100%; height: 100%; overflow: hidden; border-radius: 15px; background: #050505; }
|
|
@@ -1129,7 +1119,7 @@ window.__ModuleLoader__.load({
|
|
|
1129
1119
|
const state = props.useNotifyTray(snapshot => snapshot)
|
|
1130
1120
|
const busy = state.saving || state.dirty
|
|
1131
1121
|
const status = !state.available ? 'unavailable' : !state.writable ? 'readOnly' : state.notice?.kind === 'saveFailed' ? 'saveFailed' : state.invalid ? 'fixSettings' : state.saving ? 'saving' : state.dirty ? 'pendingSave' : 'autoSave'
|
|
1132
|
-
return h('div', { className: 'dnt-page' },
|
|
1122
|
+
return h('div', { className: props.close ? 'dnt-page dnt-settings' : 'dnt-page dnt-panel' },
|
|
1133
1123
|
h('style', null, PAGE_CSS),
|
|
1134
1124
|
h('div', { className: 'dnt-content' },
|
|
1135
1125
|
h('header', { className: 'dnt-hero' },
|
|
@@ -1160,7 +1150,10 @@ window.__ModuleLoader__.load({
|
|
|
1160
1150
|
const t = props.t
|
|
1161
1151
|
const state = props.useNotifyUpdate(snapshot => snapshot)
|
|
1162
1152
|
React.useEffect(() => { props.checkUpdate() }, [])
|
|
1163
|
-
const
|
|
1153
|
+
const openUpdate = async () => {
|
|
1154
|
+
if (await props.openPluginUpdate()) props.close?.()
|
|
1155
|
+
}
|
|
1156
|
+
const busy = state.phase === 'checking' || state.phase === 'opening'
|
|
1164
1157
|
return h(Section, { title: t('updateTitle'), icon: 'update' },
|
|
1165
1158
|
h('div', { className: 'dnt-update-row' },
|
|
1166
1159
|
h('div', { style: { flex: '1 1 240px', minWidth: 0 } },
|
|
@@ -1170,9 +1163,9 @@ window.__ModuleLoader__.load({
|
|
|
1170
1163
|
h('p', { className: 'dnt-note', role: 'status' }, t(`update_${state.phase}`)),
|
|
1171
1164
|
state.error ? h('p', { className: 'dnt-note', style: S.error, role: 'alert' }, state.error === 'updateSaveFirst' ? t(state.error) : state.error) : null),
|
|
1172
1165
|
h('div', { className: 'dnt-update-actions' },
|
|
1173
|
-
h('button', { type: 'button', style: S.button, disabled: busy
|
|
1174
|
-
state.phase === 'available' ? h('button', { type: 'button', style: { ...S.button, background: 'var(--dnt-accent)', color: '#fff', borderColor: 'transparent' }, onClick:
|
|
1175
|
-
|
|
1166
|
+
h('button', { type: 'button', style: S.button, disabled: busy, onClick: props.checkUpdate }, t('checkUpdate')),
|
|
1167
|
+
state.phase === 'available' ? h('button', { type: 'button', style: { ...S.button, background: 'var(--dnt-accent)', color: '#fff', borderColor: 'transparent' }, onClick: openUpdate }, t('openPluginUpdate')) : null)),
|
|
1168
|
+
['unavailable', 'manual', 'local'].includes(state.phase) ? null : h('p', { className: 'dnt-note', style: { marginTop: 12 } }, t('updateHint')))
|
|
1176
1169
|
}
|
|
1177
1170
|
|
|
1178
1171
|
function WhaleIcon({ size = 16 }) {
|
|
@@ -1188,7 +1181,8 @@ window.__ModuleLoader__.load({
|
|
|
1188
1181
|
const features = (platform && FEATURES[platform]) || ALL_FEATURES
|
|
1189
1182
|
const t = platformT(props.t, platform)
|
|
1190
1183
|
const disabled = !state.writable
|
|
1191
|
-
const
|
|
1184
|
+
const idPrefix = props.close ? 'notify-tray-settings' : 'notify-tray'
|
|
1185
|
+
const common = { t, disabled, idPrefix, edit: props.edit, resetField: props.resetField, flush: props.flush }
|
|
1192
1186
|
const f = state.fields
|
|
1193
1187
|
const toggle = name => h(ToggleRow, { key: name, name, field: f[name], ...common })
|
|
1194
1188
|
const titleStyle = f.titleStyle.text || 'text'
|
|
@@ -1216,31 +1210,30 @@ window.__ModuleLoader__.load({
|
|
|
1216
1210
|
const t = ctx.locale.bind(LOCALE_NS)
|
|
1217
1211
|
ctx.effect(() => ctx.locale.register(LOCALE_NS, { zh: { ...zh, CNY: '¥ 人民币', USD: '$ 美元' }, en: { ...en, CNY: '¥ CNY', USD: '$ USD' } }), 'notify-tray: settings dictionaries')
|
|
1218
1212
|
const card = new Controller(ctx.configForms.get(NS))
|
|
1219
|
-
|
|
1213
|
+
// The native Plugins panel outlives this bundle when DSH unloads it mid-update.
|
|
1214
|
+
const updater = new UpdateController(() => ctx.get?.('remote.pluginManager') || ctx.remote?.pluginManager, () => card.flush(), () => {
|
|
1215
|
+
const navigation = ctx.get?.('pluginNavigation')
|
|
1216
|
+
if (!navigation?.openBundle) return false
|
|
1217
|
+
navigation.openBundle('dsh-notify-tray')
|
|
1218
|
+
return true
|
|
1219
|
+
})
|
|
1220
1220
|
ctx.effect(() => () => updater.dispose(), 'notify-tray: updates')
|
|
1221
1221
|
ctx.effect(() => () => card.dispose(), 'notify-tray: settings form')
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
id: PANEL_ID,
|
|
1238
|
-
order: 11,
|
|
1239
|
-
label: () => t('title'),
|
|
1240
|
-
}, WhaleIcon))
|
|
1241
|
-
return () => { stopSidebar(); stopMain() }
|
|
1242
|
-
}), 'notify-tray: sidebar settings')
|
|
1243
|
-
})
|
|
1222
|
+
const injectPage = () => {
|
|
1223
|
+
const face = card.inject()
|
|
1224
|
+
return { ...face, hooks: { ...face.hooks, notifyUpdate: updater.store }, checkUpdate: () => updater.check(), openPluginUpdate: () => updater.open() }
|
|
1225
|
+
}
|
|
1226
|
+
const label = () => t('title')
|
|
1227
|
+
ctx.effect(() => ctx.configForms.whileServed([NS], () => {
|
|
1228
|
+
const register = (options, component) => ctx.slots.inject(options.name, () => ctx.slots.register(options, component))
|
|
1229
|
+
const stops = [
|
|
1230
|
+
register({ name: 'settings.section', id: PANEL_ID, order: 8, label, locale: LOCALE_NS, inject: injectPage }, Page),
|
|
1231
|
+
register({ name: 'settings.section.icon', id: PANEL_ID }, WhaleIcon),
|
|
1232
|
+
register({ name: 'main', key: PANEL_ID, locale: LOCALE_NS, inject: injectPage }, Page),
|
|
1233
|
+
register({ name: 'sidebar.panellist', id: PANEL_ID, order: 11, label }, WhaleIcon),
|
|
1234
|
+
]
|
|
1235
|
+
return () => { for (const stop of stops.reverse()) stop() }
|
|
1236
|
+
}), 'notify-tray: settings entries')
|
|
1244
1237
|
}
|
|
1245
1238
|
|
|
1246
1239
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-notify-tray",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "DeepSeek Harness 通知 + 状态栏插件:任务完成、需要输入、需要选择时弹系统通知(macOS / Windows / Linux);macOS 与 Linux(含 UOS、Deepin、麒麟)状态栏常驻小图标,显示任务进度与花费。Windows 没有状态栏,只弹通知。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek",
|