fix(promptlib): 1.4.5 nonce + 老 cover 解析
validate / validate (push) Canceled after 0s

This commit is contained in:
qiqi committed 2026-11-21 22:43:42 +08:00
1 parent 3d21bf6457
commit 8523120f6c
2 files changed
+9 -5

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@iwb-plugin/promptlib",
"private": true,
"version": "1.4.2",
"version": "1.4.5",
"description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供",
"ibwPlugin": {
"id": "promptlib",
+8 -4
View File
@@ -141,8 +141,9 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
if (document.querySelector('style[data-plugin="promptlib-inline"]')) return
var n = document.createElement('style')
n.setAttribute('data-plugin', 'promptlib-inline')
try { const n0 = document.querySelector('style[nonce], link[nonce]'); if (n0 && n0.nonce) n.setAttribute('nonce', n0.nonce) } catch (e) { /* ignore */ }
n.textContent = PLP_CSS
document.head.appendChild(n)
;(document.body || document.head).appendChild(n)
} catch (e) { /* ignore */ }
}
ensureStyle()
@@ -343,7 +344,10 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
var coverPending = {}
function coverOf (p) {
if (!p || !p.cover) return ''
var ck = (p.cover && typeof p.cover === 'object') ? ('b:' + String(p.cover.__blob || p.cover.__cache || 'obj')) : ('s:' + String(p.cover).slice(-32))
var cov = p.cover
if (typeof cov === 'string' && cov.charAt(0) === '{') { try { cov = JSON.parse(cov) } catch (e) { cov = '' } }
if (!cov) return ''
var ck = (typeof cov === 'object') ? ('b:' + String(cov.__blob || cov.__cache || 'obj')) : ('s:' + String(cov).slice(-32))
var key = p.id + '|' + ck
var hit = coverCache[key]
if (hit) return hit
@@ -351,7 +355,7 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
if (!coverPending[key]) {
coverPending[key] = 1
try {
Promise.resolve(api.coverUrl(p.cover)).then(function (r) {
Promise.resolve(api.coverUrl(cov)).then(function (r) {
delete coverPending[key]
if (r && r.ok && r.url) { coverCache[key] = r.url; render() }
}).catch(function () { delete coverPending[key] })
@@ -729,7 +733,7 @@ var PLP_CSS = '/* promptlib(提示词库)自带样式\n 作用域全部带
global.IWBPluginHost.register({
id: 'promptlib',
name: '提示词库',
version: '1.4.2',
version: '1.4.5',
apiVersion: 1,
capabilities: ['panels', 'promptlib'],
data: { schemaVersion: 1, maxBytes: 65536 },