@lenorin/dsh-tauri-launcher 1.0.0 → 1.0.2
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/LICENSE +1 -1
- package/README.en.md +162 -0
- package/README.md +155 -102
- package/launcher/bin/dsh-launcher.exe +0 -0
- package/lib/client.js +16 -5
- package/lib/index.js +66 -33
- package/package.json +2 -2
- package/launcher/build.ps1 +0 -44
- package/launcher/src-tauri/Cargo.toml +0 -20
- package/launcher/src-tauri/build.rs +0 -3
- package/launcher/src-tauri/capabilities/default.json +0 -9
- package/launcher/src-tauri/icons/128x128.png +0 -0
- package/launcher/src-tauri/icons/128x128@2x.png +0 -0
- package/launcher/src-tauri/icons/32x32.png +0 -0
- package/launcher/src-tauri/icons/Square107x107Logo.png +0 -0
- package/launcher/src-tauri/icons/Square142x142Logo.png +0 -0
- package/launcher/src-tauri/icons/Square150x150Logo.png +0 -0
- package/launcher/src-tauri/icons/Square284x284Logo.png +0 -0
- package/launcher/src-tauri/icons/Square30x30Logo.png +0 -0
- package/launcher/src-tauri/icons/Square310x310Logo.png +0 -0
- package/launcher/src-tauri/icons/Square44x44Logo.png +0 -0
- package/launcher/src-tauri/icons/Square71x71Logo.png +0 -0
- package/launcher/src-tauri/icons/Square89x89Logo.png +0 -0
- package/launcher/src-tauri/icons/StoreLogo.png +0 -0
- package/launcher/src-tauri/icons/icon.icns +0 -0
- package/launcher/src-tauri/icons/icon.ico +0 -0
- package/launcher/src-tauri/icons/icon.png +0 -0
- package/launcher/src-tauri/src/dsh.rs +0 -286
- package/launcher/src-tauri/src/lib.rs +0 -727
- package/launcher/src-tauri/src/main.rs +0 -6
- package/launcher/src-tauri/tauri.conf.json +0 -38
- package/launcher/ui/index.html +0 -64
- package/launcher/ui/main.js +0 -122
- package/launcher/ui/settings.css +0 -157
- package/launcher/ui/settings.html +0 -71
- package/launcher/ui/settings.js +0 -83
- package/launcher/ui/styles.css +0 -212
package/LICENSE
CHANGED
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# DSH Tauri Launcher
|
|
2
|
+
|
|
3
|
+
<div align="right">
|
|
4
|
+
|
|
5
|
+
**[简体中文](./README.md)**
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
[](#platform-support)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
Following DeepSeek Harness's "everything-is-a-plugin" architecture, this project
|
|
13
|
+
abstracts desktop launch, exit confirmation, and desktop-shortcut management into a
|
|
14
|
+
standard Web plugin. From **Settings → Desktop Launcher** you can bring up the Tauri
|
|
15
|
+
desktop app in one click — enjoying both the deep integration of the plugin ecosystem
|
|
16
|
+
and a native desktop experience. The repository also ships the full Tauri desktop-app
|
|
17
|
+
source plus a GitHub Release automation pipeline.
|
|
18
|
+
|
|
19
|
+
## Platform Support
|
|
20
|
+
|
|
21
|
+
| Platform | Status |
|
|
22
|
+
| -------- | ------------------------------------- |
|
|
23
|
+
| Windows | ✅ Supported (incl. `.lnk` shortcut) |
|
|
24
|
+
| Linux | 🚧 Planned |
|
|
25
|
+
| macOS | 🚧 Planned |
|
|
26
|
+
|
|
27
|
+
The Web plugin core (host/client JS) is cross-platform; the Windows-specific pieces are
|
|
28
|
+
the desktop-shortcut creation and the loopback process-control implementation. Linux
|
|
29
|
+
and macOS support are on the roadmap — feel free to open an issue with your use case.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Desktop launch toggle**: one-click start/stop of the desktop app, with instant status feedback;
|
|
34
|
+
- **Shortcut integration**: auto-create a desktop shortcut on enable, auto-remove on disable; manual re-create is available while running;
|
|
35
|
+
- **Shutdown confirmation dialog**: confirmation popup before exit (with a notice that the shortcut will be removed);
|
|
36
|
+
- **Live status indicator**: running 🟢 / stopped ⚪ / unknown 🟡, plus diagnostic info on errors;
|
|
37
|
+
- **Dark-mode aware**: all colors flow through DSH theme tokens and adapt to light/dark automatically;
|
|
38
|
+
- **Custom settings icon**: replaces the default gear with a vector monitor icon (sharp at any size).
|
|
39
|
+
|
|
40
|
+
## Screenshots
|
|
41
|
+
|
|
42
|
+
<table>
|
|
43
|
+
<tr>
|
|
44
|
+
<td align="center" width="50%">
|
|
45
|
+
|
|
46
|
+
**Web settings panel (plugin section)**
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
After install, DSH Settings → Desktop Launcher shows the launch toggle, runtime status, and shortcut-link indicator.
|
|
51
|
+
|
|
52
|
+
</td>
|
|
53
|
+
<td align="center" width="50%">
|
|
54
|
+
|
|
55
|
+
**Desktop-app settings panel**
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
The Tauri desktop app's own settings: login autostart, global hotkey, desktop shortcut, and exit policy.
|
|
60
|
+
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
</table>
|
|
64
|
+
|
|
65
|
+
## How It Works (Summary)
|
|
66
|
+
|
|
67
|
+
The Web plugin's host half talks to the browser half over `/api/dsh-tauri-launcher/*`
|
|
68
|
+
loopback routes, and controls the desktop app via a sentinel-file protocol (see
|
|
69
|
+
[docs/architecture.md](docs/architecture.md)):
|
|
70
|
+
|
|
71
|
+
- `.dsh-heartbeat`: the desktop app writes a timestamp every second; the plugin uses it to detect liveness;
|
|
72
|
+
- `.dsh-quit`: writing `1` makes the desktop app exit **only itself** (the Harness host process keeps running); the sentinel is self-deleting on consumption.
|
|
73
|
+
|
|
74
|
+
## Directory Layout
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
dsh-tauri-launcher/
|
|
78
|
+
├── README.md # Chinese README
|
|
79
|
+
├── README.en.md # English README
|
|
80
|
+
├── package.json # dsh.bundle + dsh.client dual manifest
|
|
81
|
+
├── cordis.patch.yml # composition patch (inserts the plugin row)
|
|
82
|
+
├── lib/
|
|
83
|
+
│ ├── index.js # host half: loopback routes + control logic (configurable)
|
|
84
|
+
│ └── client.js # browser half: settings section UI
|
|
85
|
+
├── launcher/ # Tauri desktop-app project (source + one-shot build; Windows only for now)
|
|
86
|
+
├── .github/workflows/ # CI: tag-driven Windows exe build + Release publish
|
|
87
|
+
└── docs/ # architecture & release docs (Chinese)
|
|
88
|
+
└── screenshots/ # screenshots referenced by the READMEs
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Install (Web Plugin)
|
|
92
|
+
|
|
93
|
+
> **About `<profile>`**: it refers to a DSH **profile** — a launchable plugin composition,
|
|
94
|
+
> located at `$DSH_HOME/profiles/<name>/`. `<profile>` is a placeholder; **replace it with
|
|
95
|
+
> the actual profile name you want to install into**. On most local setups the relevant
|
|
96
|
+
> profile is `web` (the profile that starts the DSH Web GUI). List existing profiles:
|
|
97
|
+
> `dir %USERPROFILE%\.dsh\profiles` (or `ls ~/.dsh/profiles`).
|
|
98
|
+
> In the commands below, swap `<profile>` for `web` — e.g. `dsh plugin --profile web add ...`.
|
|
99
|
+
|
|
100
|
+
Pick one of the three installation methods:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# 1) npm (after publish)
|
|
104
|
+
dsh plugin --profile web add @lenorin/dsh-tauri-launcher
|
|
105
|
+
|
|
106
|
+
# 2) GitHub (git install; pure JS, zero build, no allowBuilds grant required)
|
|
107
|
+
dsh plugin --profile web add github:cilis/dsh-tauri-launcher
|
|
108
|
+
|
|
109
|
+
# 3) Local checkout / tarball
|
|
110
|
+
dsh plugin --profile web add ./dsh-tauri-launcher
|
|
111
|
+
dsh plugin --profile web add ./dsh-tauri-launcher-1.0.1.tgz
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> If you have multiple profiles, replace `web` in the commands with the target profile name.
|
|
115
|
+
|
|
116
|
+
Verify the plugin layer is active (you should see the `dsh-tauri-launcher` row):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
dsh --profile web --dump-config
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Restart the DSH Web process and the "Desktop Launcher" section appears under Settings.
|
|
123
|
+
Uninstall (replace `web` with your profile name):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
dsh plugin --profile web remove @lenorin/dsh-tauri-launcher
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
The plugin row supports the following configuration keys (no hard-coded tunables; defaults
|
|
132
|
+
fit common deployments):
|
|
133
|
+
|
|
134
|
+
```yaml
|
|
135
|
+
- id: desktop-launcher
|
|
136
|
+
name: '@lenorin/dsh-tauri-launcher'
|
|
137
|
+
config:
|
|
138
|
+
launcherExe: '' # absolute path to the desktop-app exe; empty = auto-detect
|
|
139
|
+
launcherDirs: [] # candidate exe directories; empty = built-in defaults
|
|
140
|
+
freshSecs: 4 # heartbeat "freshness window" in seconds (must be > write interval)
|
|
141
|
+
shortcutName: 'DeepSeek Harness.lnk' # desktop-shortcut file name
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Desktop App Build & Release
|
|
145
|
+
|
|
146
|
+
- The npm package ships a pre-built exe (`launcher/bin/dsh-launcher.exe`); the plugin auto-detects it on install — ready to use out of the box;
|
|
147
|
+
- Local build: `pwsh -File launcher/build.ps1` (optional `-Offline -CargoHome <dir>`);
|
|
148
|
+
- ⚠️ Maintenance rule: **after editing Rust sources under `launcher/src-tauri`, you must
|
|
149
|
+
rebuild and re-sync `launcher/bin/dsh-launcher.exe`** (see [docs/release.md](docs/release.md)),
|
|
150
|
+
or the shipped exe will drift from the sources; keep the version in `package.json` /
|
|
151
|
+
`Cargo.toml` / `tauri.conf.json` in sync.
|
|
152
|
+
- GitHub Release: push a `v*` tag; CI auto-builds the Windows exe and publishes it
|
|
153
|
+
(Linux/macOS builds are not enabled yet — see [docs/release.md](docs/release.md)).
|
|
154
|
+
|
|
155
|
+
## Documentation
|
|
156
|
+
|
|
157
|
+
- [docs/architecture.md](docs/architecture.md) — architecture & sentinel-file protocol (Chinese)
|
|
158
|
+
- [docs/release.md](docs/release.md) — install, build, release, uninstall & configuration reference (Chinese)
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
[MIT](LICENSE)
|
package/README.md
CHANGED
|
@@ -1,102 +1,155 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
# DSH Tauri Launcher
|
|
2
|
+
|
|
3
|
+
<div align="right">
|
|
4
|
+
|
|
5
|
+
**[English](./README.en.md)**
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
[](#平台支持)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
沿用 DeepSeek Harness「一切皆插件」的架构哲学,把桌面端启停、退出确认、桌面快捷方式联动
|
|
13
|
+
全部抽象为标准 Web 插件——用户在 **设置 → 桌面启动** 中即可一键唤起 Tauri 桌面应用,既
|
|
14
|
+
享受插件生态的深度集成,也保留原生桌面体验。本仓库同时附带 Tauri 桌面应用完整源码与
|
|
15
|
+
GitHub Release 自动构建流程。
|
|
16
|
+
|
|
17
|
+
## 平台支持
|
|
18
|
+
|
|
19
|
+
| 平台 | 状态 |
|
|
20
|
+
| -------- | ----------------------------- |
|
|
21
|
+
| Windows | ✅ 已支持(含桌面快捷方式 .lnk) |
|
|
22
|
+
| Linux | 🚧 规划中 |
|
|
23
|
+
| macOS | 🚧 规划中 |
|
|
24
|
+
|
|
25
|
+
Web 插件本体(host/client JS)跨平台;目前 Windows 专属的实现集中在桌面快捷方式创建与
|
|
26
|
+
回环进程控制上。Linux/macOS 适配已在路线图中,欢迎在 issue 里提出你的需求与场景。
|
|
27
|
+
|
|
28
|
+
## 功能
|
|
29
|
+
|
|
30
|
+
- **桌面端启动开关**:一键启动/退出桌面应用(点击即反馈,秒级状态同步);
|
|
31
|
+
- **快捷方式联动**:开启时自动创建桌面快捷方式、关闭时自动删除;运行中可手动补建;
|
|
32
|
+
- **关闭确认弹窗**:关闭前弹窗确认(含快捷方式将被删除的提示);
|
|
33
|
+
- **状态可视**:运行中 🟢 / 已停止 ⚪ / 状态未知 🟡 + 出错时显示诊断信息;
|
|
34
|
+
- **深色模式适配**:全部颜色走 DSH 主题令牌,深浅色自动适配;
|
|
35
|
+
- **设置导航显示器图标**:替换默认齿轮图标(矢量绘制,任意缩放锐利)。
|
|
36
|
+
|
|
37
|
+
## 界面截图
|
|
38
|
+
|
|
39
|
+
<table>
|
|
40
|
+
<tr>
|
|
41
|
+
<td align="center" width="50%">
|
|
42
|
+
|
|
43
|
+
**Web 设置面板(插件分区)**
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
|
|
47
|
+
安装后,DSH 设置 → 桌面启动 即可看到启动开关、运行状态、快捷方式联动提示。
|
|
48
|
+
|
|
49
|
+
</td>
|
|
50
|
+
<td align="center" width="50%">
|
|
51
|
+
|
|
52
|
+
**桌面应用设置面板**
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
Tauri 桌面应用自身设置:开机启动、全局快捷键、桌面快捷方式、退出策略。
|
|
57
|
+
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
</table>
|
|
61
|
+
|
|
62
|
+
## 工作原理(摘要)
|
|
63
|
+
|
|
64
|
+
Web 插件(宿主半)通过 `/api/dsh-tauri-launcher/*` 回环路由与浏览器半通信,
|
|
65
|
+
并使用标记文件协议控制桌面应用(详见 [docs/architecture.md](docs/architecture.md)):
|
|
66
|
+
|
|
67
|
+
- `.dsh-heartbeat`:桌面应用每秒写入时间戳,插件以此探测运行状态;
|
|
68
|
+
- `.dsh-quit`:写入 `1` 后桌面应用仅退出自身(保留 Harness 进程),消费时自删。
|
|
69
|
+
|
|
70
|
+
## 目录结构
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
dsh-tauri-launcher/
|
|
74
|
+
├── README.md # 中文 README
|
|
75
|
+
├── README.en.md # 英文 README
|
|
76
|
+
├── package.json # dsh.bundle + dsh.client 双 manifest
|
|
77
|
+
├── cordis.patch.yml # 组合补丁(插入插件行)
|
|
78
|
+
├── lib/
|
|
79
|
+
│ ├── index.js # 宿主半:回环路由 + 控制逻辑(可配置)
|
|
80
|
+
│ └── client.js # 浏览器半:设置分区 UI
|
|
81
|
+
├── launcher/ # Tauri 桌面应用工程(源码 + 一键构建;当前仅 Windows)
|
|
82
|
+
├── .github/workflows/ # CI:打 tag 自动构建 Windows exe 并发布 Release
|
|
83
|
+
└── docs/ # 架构与发布文档
|
|
84
|
+
└── screenshots/ # README 引用的界面截图
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 安装(Web 插件)
|
|
88
|
+
|
|
89
|
+
> **关于 `<profile>`**:它指 DSH 的**配置档(profile)**——一套可启动的插件组合,
|
|
90
|
+
> 位于 `$DSH_HOME/profiles/<名字>/`。`<profile>` 是占位符,**需要替换成你实际
|
|
91
|
+
> 要装进的 profile 名**。本机常见配置档名为 `web`(启动 DSH Web GUI 的档);
|
|
92
|
+
> 查看已有档:`dir %USERPROFILE%\.dsh\profiles`(或 `ls ~/.dsh/profiles`)。
|
|
93
|
+
> 下面的命令示例中,把 `<profile>` 换成 `web` 即可,例如 `dsh plugin --profile web add ...`。
|
|
94
|
+
|
|
95
|
+
三种方式任选(任选其一):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# 1) npm(发布后)
|
|
99
|
+
dsh plugin --profile web add @lenorin/dsh-tauri-launcher
|
|
100
|
+
|
|
101
|
+
# 2) GitHub(git 安装;纯 JS 零构建,无需 allowBuilds 授权)
|
|
102
|
+
dsh plugin --profile web add github:cilis/dsh-tauri-launcher
|
|
103
|
+
|
|
104
|
+
# 3) 本地 checkout / tarball
|
|
105
|
+
dsh plugin --profile web add ./dsh-tauri-launcher
|
|
106
|
+
dsh plugin --profile web add ./dsh-tauri-launcher-1.0.1.tgz
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> 如果你有多个 profile,把命令里的 `web` 换成目标 profile 名即可。
|
|
110
|
+
|
|
111
|
+
验证层已生效(应能看到 `dsh-tauri-launcher` 层):
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
dsh --profile web --dump-config
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
重启 DSH Web 进程后,设置面板即出现「桌面启动」分区。卸载(`web` 换成你的 profile 名):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
dsh plugin --profile web remove @lenorin/dsh-tauri-launcher
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 配置
|
|
124
|
+
|
|
125
|
+
插件行支持以下配置(无硬编码可调参数;默认值适配常见部署):
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
- id: desktop-launcher
|
|
129
|
+
name: '@lenorin/dsh-tauri-launcher'
|
|
130
|
+
config:
|
|
131
|
+
launcherExe: '' # 桌面应用 exe 绝对路径;空 = 自动探测
|
|
132
|
+
launcherDirs: [] # 候选 exe 目录列表;空 = 内置默认候选
|
|
133
|
+
freshSecs: 4 # 心跳“新鲜窗口”(秒),须大于心跳写入周期
|
|
134
|
+
shortcutName: 'DeepSeek Harness.lnk' # 桌面快捷方式文件名
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 桌面应用构建与发布
|
|
138
|
+
|
|
139
|
+
- npm 包自带预编译 exe(`launcher/bin/dsh-launcher.exe`),插件安装后自动探测、装上即用;
|
|
140
|
+
- 本地自行构建:`pwsh -File launcher/build.ps1`(可选 `-Offline -CargoHome <dir>`);
|
|
141
|
+
- ⚠️ 维护纪律:**修改 `launcher/src-tauri` 下的 Rust 源码后,必须重新构建并同步
|
|
142
|
+
`launcher/bin/dsh-launcher.exe`**(发布流程见 [docs/release.md](docs/release.md)),
|
|
143
|
+
否则 npm 包内 exe 与源码漂移;版本号需在 `package.json` / `Cargo.toml` /
|
|
144
|
+
`tauri.conf.json` 三处同步。
|
|
145
|
+
- GitHub Release:推送 `v*` tag,CI 自动构建 Windows exe 并发布(Linux/macOS 构建
|
|
146
|
+
尚未启用,见 [docs/release.md](docs/release.md))。
|
|
147
|
+
|
|
148
|
+
## 文档
|
|
149
|
+
|
|
150
|
+
- [docs/architecture.md](docs/architecture.md) — 架构与标记文件协议
|
|
151
|
+
- [docs/release.md](docs/release.md) — 安装、构建、发布、卸载与配置参考
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
[MIT](LICENSE)
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -64,22 +64,28 @@ window.__ModuleLoader__.load({
|
|
|
64
64
|
`
|
|
65
65
|
|
|
66
66
|
const API_BASE = '/api/dsh-tauri-launcher'
|
|
67
|
+
/** 自定义请求头:同源 fetch 可带,跨站 form POST 无法伪造(CSRF 防线)。 */
|
|
68
|
+
const CSRF_HEADERS = { 'x-requested-with': 'dsh-tauri-launcher' }
|
|
67
69
|
|
|
68
70
|
const api = {
|
|
69
71
|
async state() {
|
|
70
|
-
const response = await fetch(API_BASE + '/state')
|
|
72
|
+
const response = await fetch(API_BASE + '/state', { headers: CSRF_HEADERS })
|
|
71
73
|
return response.json()
|
|
72
74
|
},
|
|
73
75
|
async setDesktop(enabled) {
|
|
74
76
|
const response = await fetch(API_BASE + '/set-desktop', {
|
|
75
77
|
method: 'POST',
|
|
76
|
-
headers: { 'content-type': 'application/json' },
|
|
78
|
+
headers: { ...CSRF_HEADERS, 'content-type': 'application/json' },
|
|
77
79
|
body: JSON.stringify({ enabled }),
|
|
78
80
|
})
|
|
79
81
|
return response.json()
|
|
80
82
|
},
|
|
81
83
|
async setShortcut() {
|
|
82
|
-
const response = await fetch(API_BASE + '/set-shortcut', { method: 'POST' })
|
|
84
|
+
const response = await fetch(API_BASE + '/set-shortcut', { method: 'POST', headers: CSRF_HEADERS })
|
|
85
|
+
return response.json()
|
|
86
|
+
},
|
|
87
|
+
async diagnose() {
|
|
88
|
+
const response = await fetch(API_BASE + '/diagnose', { headers: CSRF_HEADERS })
|
|
83
89
|
return response.json()
|
|
84
90
|
},
|
|
85
91
|
}
|
|
@@ -105,9 +111,14 @@ window.__ModuleLoader__.load({
|
|
|
105
111
|
async function fetchState() {
|
|
106
112
|
try {
|
|
107
113
|
const state = await api.state()
|
|
108
|
-
return { desktop: state.desktop, shortcut: Boolean(state.shortcut), error: '', diag:
|
|
114
|
+
return { desktop: state.desktop, shortcut: Boolean(state.shortcut), error: '', diag: '' }
|
|
109
115
|
} catch (error) {
|
|
110
|
-
|
|
116
|
+
let diag = ''
|
|
117
|
+
try {
|
|
118
|
+
const diagnosed = await api.diagnose()
|
|
119
|
+
diag = (diagnosed && diagnosed.diag) || ''
|
|
120
|
+
} catch { /* 诊断失败不影响错误展示 */ }
|
|
121
|
+
return { desktop: null, shortcut: false, error: '读取状态失败:' + errText(error), diag }
|
|
111
122
|
}
|
|
112
123
|
}
|
|
113
124
|
|