diff --git a/promptlib/package.json b/promptlib/package.json index 8eec7b4..9174ecd 100644 --- a/promptlib/package.json +++ b/promptlib/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/promptlib", "private": true, - "version": "1.4.2", + "version": "1.4.5", "description": "提示词库:右栏提示词列表(搜索/分组/收藏/新建编辑/插入画布/复制/删除),数据由宿主 promptlib 能力提供", "ibwPlugin": { "id": "promptlib", diff --git a/promptlib/src/index.js b/promptlib/src/index.js index 6a28d3b..406bc3e 100644 --- a/promptlib/src/index.js +++ b/promptlib/src/index.js @@ -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 },