feat(plugins): 同步提示词库 promptlib v1.9.2(分享封面开关)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 45s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 45s
This commit is contained in:
1 parent
7e99b2ba42
commit
b45d6b2712
3 files changed
+20
-8
No files matched your search
+2
-2
@@ -44,9 +44,9 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.9.1",
|
||||
"version": "1.9.2",
|
||||
"files": {
|
||||
"main.js": "9743c44630a5190f43921060dee1296052c96d9d958b2c95f53e70a1ab63603b",
|
||||
"main.js": "e27a20c73d099903eaf090544a2f4a1fe3d8bc583155ae7f6d6c9e8c7417bef6",
|
||||
"styles.css": "d799321065172c2844c565cea9abc69053663ef9ec962e35911e0331bcff85aa"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -162,9 +162,16 @@
|
||||
if (!item || typeof item.text !== 'string' || !item.text.trim()) return null
|
||||
return item
|
||||
}
|
||||
// 分享是否附带封面图:后台设置页开关,默认带图(兼容老行为);关掉后分享文本只有文字,短很多。
|
||||
// 从 ctx.settings 读,manifest 里声明了 default:true —— 老客户端/未设置时也按“带图”走。
|
||||
function shareWithCover () {
|
||||
var S = (PLP_CTX || {}).settings
|
||||
return !S || typeof S.get !== 'function' || S.get('shareWithCover') !== false
|
||||
}
|
||||
function plpSharePayload (p) {
|
||||
var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: detectVars(p.text || ''), group: p.group || '', tags: p.tags || [] } }
|
||||
if (!shareWithCover()) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body))
|
||||
return plpCoverUrl(p).then(function (cv) {
|
||||
var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: detectVars(p.text || ''), group: p.group || '', tags: p.tags || [] } }
|
||||
if (cv && cv.length < 300000) body.sharing.cover = cv
|
||||
return SHARE_TAG + '\n' + JSON.stringify(body)
|
||||
})
|
||||
@@ -1304,8 +1311,10 @@
|
||||
// 分享格式刻意做成「可读的 JSON 文本」,直接粘到微信/QQ 也能看懂;导入时两种都认:
|
||||
// ① 带 IWB-PROMPT 头的整段文本 ② 直接是 {kind:'prompt-share'} 的 JSON
|
||||
function sharePayload (p) {
|
||||
var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: varsOf(p), group: p.group || '', tags: p.tags || [] } }
|
||||
// v1.9.2:后台「分享时附带封面图片」关掉后,连封面读取都跳过——分享文本只留文字,内容最少。
|
||||
if (!shareWithCover()) return Promise.resolve(SHARE_TAG + '\n' + JSON.stringify(body))
|
||||
return coverToDataUrl(p).then(function (cv) {
|
||||
var body = { app: 'image-workbench', kind: 'prompt-share', version: 1, sharing: { name: p.name || '', text: p.text || '', vars: varsOf(p), group: p.group || '', tags: p.tags || [] } }
|
||||
if (cv && cv.length < 300000) body.sharing.cover = cv
|
||||
return SHARE_TAG + '\n' + JSON.stringify(body)
|
||||
})
|
||||
@@ -1870,11 +1879,14 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.9.1',
|
||||
version: '1.9.2',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib', 'nodeTypes', 'canvas', 'canvasWrite'],
|
||||
data: { schemaVersion: 3, maxBytes: 4 * 1024 * 1024 },
|
||||
settings: { panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings } },
|
||||
settings: {
|
||||
shareWithCover: { type: 'boolean', label: '分享时附带封面图片(关闭后分享内容更短)', default: true },
|
||||
panel: { type: 'custom', label: '分组与备份', render: renderPluginSettings },
|
||||
},
|
||||
}, function (ctx) {
|
||||
PLP_CTX = ctx
|
||||
// v1.5.0:插件激活时就把旧数据迁到插件目录(不等面板打开),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.9.1",
|
||||
"version": "1.9.2",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "9743c44630a5190f43921060dee1296052c96d9d958b2c95f53e70a1ab63603b",
|
||||
"main.js": "e27a20c73d099903eaf090544a2f4a1fe3d8bc583155ae7f6d6c9e8c7417bef6",
|
||||
"styles.css": "d799321065172c2844c565cea9abc69053663ef9ec962e35911e0331bcff85aa"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user