dsh-gpt-image-playground 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +81 -2
- package/SHARE.md +66 -0
- package/THIRD-PARTY-NOTICES.md +70 -0
- package/cordis.patch.yml +6 -0
- package/docs/screenshot-gallery.png +0 -0
- package/docs/screenshot-header.png +0 -0
- package/docs/screenshot-settings.png +0 -0
- package/install.mjs +102 -0
- package/install.ps1 +55 -0
- package/lib/client.js +434 -0
- package/lib/index.js +756 -0
- package/package.json +80 -3
- package/vendor-app/announcements.json +1 -0
- package/vendor-app/assets/App-q7a4rxqa.js +197 -0
- package/vendor-app/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/vendor-app/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/vendor-app/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/vendor-app/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/vendor-app/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/vendor-app/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/vendor-app/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/vendor-app/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/vendor-app/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/vendor-app/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/vendor-app/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/vendor-app/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/vendor-app/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/vendor-app/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/vendor-app/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/vendor-app/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/vendor-app/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/vendor-app/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/vendor-app/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/vendor-app/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/vendor-app/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/vendor-app/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/vendor-app/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/vendor-app/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/vendor-app/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/vendor-app/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/vendor-app/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/vendor-app/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/vendor-app/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/vendor-app/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/vendor-app/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/vendor-app/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/vendor-app/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/vendor-app/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/vendor-app/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/vendor-app/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/vendor-app/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/vendor-app/assets/harmonyos-sans-sc-78ty70VX.css +1 -0
- package/vendor-app/assets/index-BEECAir2.js +1 -0
- package/vendor-app/assets/index-BugPYPDb.js +16 -0
- package/vendor-app/assets/index-CbdCkTIj.js +1 -0
- package/vendor-app/assets/index-CsiGg4nI.js +1 -0
- package/vendor-app/assets/index-CtXnX3Xp.js +1 -0
- package/vendor-app/assets/index-DNljbSyS.js +1 -0
- package/vendor-app/assets/index-DNpwxtJ4.js +1 -0
- package/vendor-app/assets/index-DsvpNQKY.js +14 -0
- package/vendor-app/assets/index-PLZKjL94.js +263 -0
- package/vendor-app/assets/index-TVJv2SDW.css +1 -0
- package/vendor-app/assets/index-yY_cAGHl.js +50 -0
- package/vendor-app/assets/maple-mono-nf-cn-CkIt5zzM.css +1 -0
- package/vendor-app/assets/mermaid-GHXKKRXX-ZwJVxNkk.js +103 -0
- package/vendor-app/assets/third-party-notices-wN73bzzx.js +14482 -0
- package/vendor-app/color-mode.js +11 -0
- package/vendor-app/index.html +21 -0
- package/vendor-app/manifest.webmanifest +24 -0
- package/vendor-app/pwa-icon.svg +21 -0
- package/vendor-app/pwa-maskable-icon.svg +23 -0
- package/vendor-app/sw.js +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-gpt-image-playground contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# GPT Image Playground for DeepSeek Harness
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/dsh-gpt-image-playground)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](package.json)
|
|
6
|
+
|
|
7
|
+
把 [CookSleep/gpt_image_playground](https://github.com/CookSleep/gpt_image_playground) 的**原版工作台**装进 [DeepSeek Harness](https://github.com/deepseek-ai)(DSH):左栏多一个「生图工作台」,点开就是完整的画廊 / Agent 双模式、参考图与遮罩编辑、多供应商、收藏夹、历史管理。
|
|
8
|
+
|
|
9
|
+
界面与功能来自上游官方构建(v0.8.3,原样 vendor),插件自己只负责**同源托管**和**可选的 API 代理**。
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
### 用 npm 包名(推荐)
|
|
16
|
+
|
|
17
|
+
在 DSH 里打开 **插件 → 安装**,填:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
dsh-gpt-image-playground
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
装完在插件列表里启用,刷新页面(Ctrl+R),左栏出现「相框」图标。
|
|
24
|
+
|
|
25
|
+
命令行等价:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dsh plugin --profile desktop add dsh-gpt-image-playground
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 从 Release 压缩包
|
|
32
|
+
|
|
33
|
+
下载 [最新 Release](https://github.com/southcul/dsh-gpt-image-playground/releases/latest) 里的 `gpt-image-playground-<版本>.zip`,解压后二选一:
|
|
34
|
+
|
|
35
|
+
- DSH 插件页 → 安装 → 填解压目录的**绝对路径**(推荐)
|
|
36
|
+
- 或右键 `install.ps1` → 使用 PowerShell 运行
|
|
37
|
+
|
|
38
|
+
### 从仓库源码
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/southcul/dsh-gpt-image-playground
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
DSH → 插件 → 安装 → 填克隆目录的绝对路径。
|
|
45
|
+
|
|
46
|
+
## 第一次使用
|
|
47
|
+
|
|
48
|
+
1. 打开工作台 → 右上角齿轮 → **API 配置**,填 API URL 与 Key(存在本机浏览器存储,不上传)。
|
|
49
|
+
2. 若提示「接口不支持浏览器跨域请求」:点工作台**左下角 ⚙**(iframe 外的小按钮),填真实 API 地址并保存;再把面板里显示的代理地址复制到应用的「API URL」。
|
|
50
|
+
|
|
51
|
+
代理地址形如 `http://127.0.0.1:13807/plugins/dsh-gpt-image-playground/proxy`,请求由 DSH 主机转发,`Authorization` 与 multipart 图片体原样透传。
|
|
52
|
+
|
|
53
|
+
## 功能
|
|
54
|
+
|
|
55
|
+
完整继承上游:
|
|
56
|
+
|
|
57
|
+
- 画廊 / Agent 双模式;批量生成、迭代、多提示词提交、流式预览
|
|
58
|
+
- 参考图(最多 16 张)、遮罩编辑器、画板标注(画笔/文字/图形/像素橡皮擦)、评论定位
|
|
59
|
+
- 多 API 配置与多供应商(OpenAI 兼容 Images/Responses、sub2api 异步、fal.ai、自定义 HTTP 供应商)
|
|
60
|
+
- 1K/2K/4K 尺寸预设与规整、真实参数与改写后提示词对比
|
|
61
|
+
- 收藏夹、失败重试、框选/侧滑多选、大图预览、ZIP 备份
|
|
62
|
+
- 透明背景(原生 / 本地后处理)、Codex CLI 兼容、提示词防改写、外观与习惯配置
|
|
63
|
+
|
|
64
|
+
## 与上游的差异
|
|
65
|
+
|
|
66
|
+
界面裁剪与信息改写都在 iframe 内用注入的方式完成,**不改上游构建产物**:
|
|
67
|
+
|
|
68
|
+
- 隐藏右上角三个按钮:安装为应用 / 下载客户端 / 操作指南
|
|
69
|
+
- 隐藏设置页的「关于」标签(上游的更新检查与赞助入口;第三方许可仍随包提供,见 `THIRD-PARTY-NOTICES.md`)
|
|
70
|
+
- 设置页右上角的版本徽标改为**本插件版本**(不带提示、不显示上游版本)
|
|
71
|
+
- 关闭上游公告卡(`vendor-app/announcements.json` 为 `[]`)
|
|
72
|
+
- 工作台运行在常驻 iframe 中,因此 DSH 的窗口级快捷键不穿透到应用内部
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+
工作台之所以常驻在 `shell.overlay` 而不是 `main` 面板里:DSH 的 `main` 是 keyed 槽,切换面板会卸载工作台,正在跑的生成请求会随 iframe 一起被销毁。现在占位盒只负责定位,iframe 切走时仅隐藏、不卸载。
|
|
77
|
+
|
|
78
|
+
## 许可与致谢
|
|
79
|
+
|
|
80
|
+
- 本插件:MIT,见 [LICENSE](LICENSE)
|
|
81
|
+
- `vendor-app/` 是 GPT Image Playground 的官方构建,MIT,版权归 **CookSleep**,详见 [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md)
|
|
82
|
+
- 上游项目:https://github.com/CookSleep/gpt_image_playground
|
package/SHARE.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 分享给你的朋友
|
|
2
|
+
|
|
3
|
+
插件已经在 npm 上,所以**最省事的方式只需要一句话**:
|
|
4
|
+
|
|
5
|
+
> DSH → 插件 → 安装 → 填 `dsh-gpt-image-playground`
|
|
6
|
+
|
|
7
|
+
装完在插件列表里启用,刷新页面(Ctrl+R),左栏出现「相框」图标。
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 方式一:让朋友直接装(推荐)
|
|
12
|
+
|
|
13
|
+
DSH 里打开 **插件** 页 → **安装 / 添加插件** → 「包名或地址」填:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
dsh-gpt-image-playground
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
安装后**启用**它,刷新页面即可。
|
|
20
|
+
|
|
21
|
+
**对方需要**:DSH 桌面端(能打开插件页),以及自己的图片 API(工作台里配置)。
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 方式二:发 Release 压缩包(对方网络不便时)
|
|
26
|
+
|
|
27
|
+
1. 从 [Releases](https://github.com/southcul/dsh-gpt-image-playground/releases) 下载 `gpt-image-playground-<版本>.zip` 发给对方。
|
|
28
|
+
2. 对方解压到任意目录(**不要**放进 DSH 安装目录)。
|
|
29
|
+
3. 二选一:
|
|
30
|
+
- DSH 插件页 → 安装 → 填解压目录的**绝对路径**(推荐)
|
|
31
|
+
- 或右键 `install.ps1` → **使用 PowerShell 运行**
|
|
32
|
+
|
|
33
|
+
**对方需要**:已安装并登录过一次 DSH 桌面端;不需要自己装 Node。
|
|
34
|
+
|
|
35
|
+
**卸载**:在解压目录执行 `node install.mjs --uninstall`。
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 方式三:从 GitHub 装
|
|
40
|
+
|
|
41
|
+
让对方在 DSH 插件页填仓库地址:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
https://github.com/southcul/dsh-gpt-image-playground
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
或先 `git clone` 下来,再填本地目录的绝对路径。
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 朋友第一次用会遇到的两件事
|
|
52
|
+
|
|
53
|
+
1. **要配 API**:工作台里点右上角齿轮,填 API URL 与 Key。数据只存在他那台机器的浏览器存储里。
|
|
54
|
+
2. **可能跨域**:如果提示「接口不支持浏览器跨域请求」,点工作台**左下角 ⚙**(iframe 外的小按钮),填真实 API 地址,再把面板里显示的代理地址复制到应用的「API URL」。
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 安装小贴士
|
|
59
|
+
|
|
60
|
+
- 填本地目录时必须是**绝对路径**,且目录里有 `package.json`(zip 解压后的顶层目录正好)。
|
|
61
|
+
- 这种装法会记成 `file:` 依赖,那个目录**别删也别移动**;要挪就重装一次。
|
|
62
|
+
- 插件提供方更新后,非官方包需要先**卸载再安装**(插件管理器会提示)。
|
|
63
|
+
|
|
64
|
+
## 许可
|
|
65
|
+
|
|
66
|
+
MIT;界面来自上游 GPT Image Playground(作者 CookSleep,同为 MIT),详见包内 `THIRD-PARTY-NOTICES.md`。
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
This package redistributes a build of another project. Read this before
|
|
4
|
+
publishing or shipping it.
|
|
5
|
+
|
|
6
|
+
## GPT Image Playground (vendored build)
|
|
7
|
+
|
|
8
|
+
- Project: GPT Image Playground
|
|
9
|
+
- Author: CookSleep
|
|
10
|
+
- Source: https://github.com/CookSleep/gpt_image_playground
|
|
11
|
+
- Build redistributed: `vendor-app/` — the official production build published
|
|
12
|
+
at https://cooksleep.github.io/gpt_image_playground/ (application version
|
|
13
|
+
**v0.8.3**, as shown in its own about panel)
|
|
14
|
+
- License: MIT
|
|
15
|
+
|
|
16
|
+
Changes made to the redistributed build:
|
|
17
|
+
|
|
18
|
+
1. `vendor-app/announcements.json` is replaced with `[]`, which turns off the
|
|
19
|
+
upstream announcement cards. No code was modified for this.
|
|
20
|
+
2. Three header controls ("安装为应用", "下载客户端", "操作指南") are hidden at
|
|
21
|
+
runtime by CSS injected into the frame by `lib/client.js`. The shipped
|
|
22
|
+
JavaScript is untouched.
|
|
23
|
+
|
|
24
|
+
No other files of the build were edited.
|
|
25
|
+
|
|
26
|
+
### MIT License (GPT Image Playground)
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
MIT License
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2026 CookSleep
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
34
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
35
|
+
in the Software without restriction, including without limitation the rights
|
|
36
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
37
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
38
|
+
furnished to do so, subject to the following conditions:
|
|
39
|
+
|
|
40
|
+
The above copyright notice and this permission notice shall be included in all
|
|
41
|
+
copies or substantial portions of the Software.
|
|
42
|
+
|
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
44
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
45
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
46
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
47
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
48
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
49
|
+
SOFTWARE.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## KaTeX fonts (inside `vendor-app/assets/`)
|
|
53
|
+
|
|
54
|
+
Part of the upstream build, used by its math rendering.
|
|
55
|
+
|
|
56
|
+
- Project: KaTeX — https://github.com/KaTeX/KaTeX
|
|
57
|
+
- License: MIT
|
|
58
|
+
|
|
59
|
+
## Fonts loaded at runtime, not bundled
|
|
60
|
+
|
|
61
|
+
The upstream app can load HarmonyOS Sans SC and Maple Mono from a public CDN
|
|
62
|
+
depending on its build settings; those files are **not** part of this package.
|
|
63
|
+
Their licenses (HarmonyOS Sans Fonts License Agreement, SIL OFL 1.1) are
|
|
64
|
+
documented in the upstream repository under `third-party-licenses/`.
|
|
65
|
+
|
|
66
|
+
## Development-only dependencies
|
|
67
|
+
|
|
68
|
+
`preview/vendor/react*.js` (React 18.3.1 UMD, MIT) and `puppeteer-core` (Apache
|
|
69
|
+
2.0) are used by the local preview and test harness only. Neither is part of
|
|
70
|
+
the published `files` list.
|
package/cordis.patch.yml
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/install.mjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install this plugin into a DSH profile and enable it.
|
|
3
|
+
*
|
|
4
|
+
* node install.mjs # junction into the desktop profile
|
|
5
|
+
* node install.mjs --copy # copy the files instead (for a zip)
|
|
6
|
+
* node install.mjs --profile web # another profile (desktop | web | ...)
|
|
7
|
+
* node install.mjs --uninstall
|
|
8
|
+
*
|
|
9
|
+
* `--copy` is what a packaged zip uses: the plugin keeps working even if the
|
|
10
|
+
* extracted folder moves or is deleted. `--link` (default) is for development:
|
|
11
|
+
* edits in this directory are picked up by DSH's HMR.
|
|
12
|
+
*
|
|
13
|
+
* The profile patch layer is watched by the Cordis loader, so enabling the
|
|
14
|
+
* plugin there applies without restarting the app; a page refresh is enough.
|
|
15
|
+
*/
|
|
16
|
+
import { cpSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
17
|
+
import { join } from 'node:path'
|
|
18
|
+
|
|
19
|
+
const PACKAGE = 'dsh-gpt-image-playground'
|
|
20
|
+
const here = import.meta.dirname
|
|
21
|
+
const argv = process.argv.slice(2)
|
|
22
|
+
const has = (flag) => argv.includes(`--${flag}`)
|
|
23
|
+
const arg = (name, fallback) => {
|
|
24
|
+
const index = argv.indexOf(`--${name}`)
|
|
25
|
+
return index >= 0 && argv[index + 1] ? argv[index + 1] : fallback
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const uninstall = has('uninstall')
|
|
29
|
+
const copyMode = has('copy')
|
|
30
|
+
const profileName = arg('profile', 'desktop')
|
|
31
|
+
const dshHome = process.env.DSH_HOME ?? join(process.env.USERPROFILE ?? '', '.dsh')
|
|
32
|
+
const profileDir = join(dshHome, 'profiles', profileName)
|
|
33
|
+
const nodeModules = join(profileDir, 'node_modules')
|
|
34
|
+
const targetPath = join(nodeModules, PACKAGE)
|
|
35
|
+
const packageFile = join(profileDir, 'package.json')
|
|
36
|
+
const patchFile = join(profileDir, 'cordis.patch.yml')
|
|
37
|
+
const SHIPPED = ['lib', 'vendor-app', 'cordis.patch.yml', 'README.md', 'LICENSE', 'THIRD-PARTY-NOTICES.md', 'install.mjs', 'package.json']
|
|
38
|
+
|
|
39
|
+
function backup(file) {
|
|
40
|
+
if (existsSync(file)) copyFileSync(file, `${file}.bak-${Date.now()}`)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!existsSync(profileDir)) {
|
|
44
|
+
console.error(`找不到 DSH profile:${profileDir}\n先启动一次 DSH 桌面端,或用 --profile 指定其它 profile。`)
|
|
45
|
+
process.exit(1)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const existing = lstatSync(targetPath, { throwIfNoEntry: false })
|
|
49
|
+
if (existing) {
|
|
50
|
+
if (existing.isSymbolicLink()) unlinkSync(targetPath)
|
|
51
|
+
else rmSync(targetPath, { recursive: true, force: true })
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!uninstall) {
|
|
55
|
+
mkdirSync(nodeModules, { recursive: true })
|
|
56
|
+
if (copyMode) {
|
|
57
|
+
mkdirSync(targetPath, { recursive: true })
|
|
58
|
+
for (const entry of SHIPPED) {
|
|
59
|
+
const source = join(here, entry)
|
|
60
|
+
if (!existsSync(source)) continue
|
|
61
|
+
cpSync(source, join(targetPath, entry), { recursive: true })
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
symlinkSync(here, targetPath, 'junction')
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// package.json: dependency + bundle selection
|
|
69
|
+
const pkg = JSON.parse(readFileSync(packageFile, 'utf8'))
|
|
70
|
+
backup(packageFile)
|
|
71
|
+
pkg.dependencies = pkg.dependencies ?? {}
|
|
72
|
+
pkg.dsh = pkg.dsh ?? {}
|
|
73
|
+
pkg.dsh.profile = pkg.dsh.profile ?? {}
|
|
74
|
+
pkg.dsh.profile.bundles = pkg.dsh.profile.bundles ?? []
|
|
75
|
+
if (uninstall) {
|
|
76
|
+
delete pkg.dependencies[PACKAGE]
|
|
77
|
+
pkg.dsh.profile.bundles = pkg.dsh.profile.bundles.filter((name) => name !== PACKAGE)
|
|
78
|
+
} else {
|
|
79
|
+
pkg.dependencies[PACKAGE] = copyMode ? 'file:' : `link:${here.replaceAll('\\', '/')}`
|
|
80
|
+
if (!pkg.dsh.profile.bundles.includes(PACKAGE)) pkg.dsh.profile.bundles.push(PACKAGE)
|
|
81
|
+
}
|
|
82
|
+
writeFileSync(packageFile, `${JSON.stringify(pkg, null, 2)}\n`)
|
|
83
|
+
|
|
84
|
+
// profile patch layer: the live-reloadable insertion
|
|
85
|
+
const patch = existsSync(patchFile) ? readFileSync(patchFile, 'utf8') : '[]\n'
|
|
86
|
+
const marker = 'id: gpt-image-playground'
|
|
87
|
+
backup(patchFile)
|
|
88
|
+
if (uninstall) {
|
|
89
|
+
if (patch.includes(marker)) {
|
|
90
|
+
writeFileSync(patchFile, patch.replace(/\n- insert:\n {4}- id: gpt-image-playground\n {6}name: dsh-gpt-image-playground\n {6}config: \{\}\n?/g, '\n'))
|
|
91
|
+
}
|
|
92
|
+
} else if (!patch.includes(marker)) {
|
|
93
|
+
const entry = `- insert:\n - id: gpt-image-playground\n name: ${PACKAGE}\n config: {}\n`
|
|
94
|
+
writeFileSync(patchFile, `${patch.trimEnd()}\n${entry}`)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (uninstall) {
|
|
98
|
+
console.log(`已卸载 ${PACKAGE}(profile: ${profileName})`)
|
|
99
|
+
} else {
|
|
100
|
+
console.log(`已安装 ${PACKAGE} → ${targetPath}(${copyMode ? '复制模式' : '链接模式'})`)
|
|
101
|
+
console.log('刷新 DSH 页面(Ctrl+R),左栏会出现「生图工作台」。')
|
|
102
|
+
}
|
package/install.ps1
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# 一键安装:把本目录的插件装进 DSH 桌面端(复制模式)
|
|
2
|
+
#
|
|
3
|
+
# 右键「使用 PowerShell 运行」,或:
|
|
4
|
+
# powershell -ExecutionPolicy Bypass -File .\install.ps1
|
|
5
|
+
#
|
|
6
|
+
# 会做三件事:复制插件到 profile 的 node_modules、把包加进依赖与
|
|
7
|
+
# dsh.profile.bundles、在 cordis.patch.yml 追加一条启用项。改动前会备份原文件。
|
|
8
|
+
|
|
9
|
+
$ErrorActionPreference = 'Stop'
|
|
10
|
+
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
11
|
+
|
|
12
|
+
Write-Host '==> 查找 DSH 自带的 Node'
|
|
13
|
+
$candidates = @(
|
|
14
|
+
(Join-Path $env:USERPROFILE '.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\node\bin\node.exe'),
|
|
15
|
+
'C:\Program Files\nodejs\node.exe'
|
|
16
|
+
)
|
|
17
|
+
$node = $null
|
|
18
|
+
foreach ($candidate in $candidates) {
|
|
19
|
+
if (Test-Path $candidate) { $node = $candidate; break }
|
|
20
|
+
}
|
|
21
|
+
if (-not $node) {
|
|
22
|
+
$command = Get-Command node -ErrorAction SilentlyContinue
|
|
23
|
+
if ($command) { $node = $command.Source }
|
|
24
|
+
}
|
|
25
|
+
if (-not $node) {
|
|
26
|
+
Write-Host '找不到 node.exe。请先启动一次 DSH 桌面端(它会带上运行时),或安装 Node.js 后重试。' -ForegroundColor Red
|
|
27
|
+
Read-Host '按回车退出'
|
|
28
|
+
exit 1
|
|
29
|
+
}
|
|
30
|
+
Write-Host " 使用:$node"
|
|
31
|
+
|
|
32
|
+
$profileDir = if ($env:DSH_HOME) {
|
|
33
|
+
Join-Path $env:DSH_HOME 'profiles\desktop'
|
|
34
|
+
} else {
|
|
35
|
+
Join-Path $env:USERPROFILE '.dsh\profiles\desktop'
|
|
36
|
+
}
|
|
37
|
+
if (-not (Test-Path $profileDir)) {
|
|
38
|
+
Write-Host "找不到桌面端 profile:$profileDir" -ForegroundColor Red
|
|
39
|
+
Write-Host '请先启动并登录一次 DSH 桌面端,再运行本脚本。' -ForegroundColor Yellow
|
|
40
|
+
Read-Host '按回车退出'
|
|
41
|
+
exit 1
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Write-Host '==> 安装插件'
|
|
45
|
+
Push-Location $here
|
|
46
|
+
try {
|
|
47
|
+
& $node 'install.mjs' '--copy'
|
|
48
|
+
} finally {
|
|
49
|
+
Pop-Location
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Write-Host ''
|
|
53
|
+
Write-Host '完成。打开(或刷新)DSH:左栏会多出一个「生图工作台」图标。' -ForegroundColor Green
|
|
54
|
+
Write-Host '第一次进去先点右上角齿轮配置 API URL 与 Key;若提示跨域,用工作台左下角 ⚙ 配代理。'
|
|
55
|
+
Read-Host '按回车退出'
|