fix(promptlib): 封面改内联压缩图(3.26.0 / 1.3.0)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m33s
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 2m33s
This commit is contained in:
1 parent
8aac499e11
commit
f8635d4e19
16 files changed
+103
-42
No files matched your search
+2
-2
@@ -44,9 +44,9 @@
|
||||
"dir": "promptlib",
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.0",
|
||||
"files": {
|
||||
"main.js": "f8a34ed142868e6c6101ce544f89b5dee9ccb048ec8197c18535dad4cb0aadde",
|
||||
"main.js": "43f228e4e3e8791d389a077ca46a543316c27f2ab349aa47cfed6fe3a1f244e0",
|
||||
"styles.css": "eddcbf6a0c503d22ab3bbaeb0e4d3f89e55aa7a5d949108cfe893789638d00af"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -430,7 +430,8 @@
|
||||
var coverPending = {}
|
||||
function coverOf (p) {
|
||||
if (!p || !p.cover) return ''
|
||||
var key = p.id + '|' + p.cover
|
||||
var ck = (p.cover && typeof p.cover === 'object') ? ('b:' + String(p.cover.__blob || p.cover.__cache || 'obj')) : ('s:' + String(p.cover).slice(-32))
|
||||
var key = p.id + '|' + ck
|
||||
var hit = coverCache[key]
|
||||
if (hit) return hit
|
||||
// 只缓存成功结果;失败/未解析的下一帧会再试(之前缓存空串导致封面永远不刷新)
|
||||
@@ -568,7 +569,7 @@
|
||||
|
||||
function paintCoverInto (node, p) {
|
||||
node.textContent = ''
|
||||
var url = coverOf(p)
|
||||
var url = p && p._coverUrl ? p._coverUrl : coverOf(p)
|
||||
node.style.background = url ? 'var(--iwb-plugin-inset)' : gradOf(p)
|
||||
if (url) node.appendChild(el('img', { class: 'iwb-plp-cover', src: url, alt: '' }))
|
||||
}
|
||||
@@ -638,8 +639,11 @@
|
||||
dirty = true
|
||||
Object.keys(coverCache).forEach(function (k) { if (k.indexOf(draft.id + '|') === 0) delete coverCache[k] })
|
||||
Promise.resolve(api.coverUrl(r.ref)).then(function (u) {
|
||||
if (u && u.url) coverCache[draft.id + '|' + r.ref] = u.url
|
||||
repaint(); notify('封面已更新')
|
||||
if (u && u.url) {
|
||||
draft._coverUrl = u.url
|
||||
coverCache[draft.id + '|s:' + String(r.ref).slice(-32)] = u.url
|
||||
}
|
||||
repaint(); render(); notify('封面已更新')
|
||||
})
|
||||
}).catch(function () { notify('封面上传失败', 'err') })
|
||||
}
|
||||
@@ -833,7 +837,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'promptlib',
|
||||
name: '提示词库',
|
||||
version: '1.2.1',
|
||||
version: '1.3.0',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'promptlib'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "promptlib",
|
||||
"name": "提示词库",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.0",
|
||||
"apiVersion": 1,
|
||||
"main": "main.js",
|
||||
"style": "styles.css",
|
||||
@@ -13,7 +13,7 @@
|
||||
"提示词"
|
||||
],
|
||||
"files": {
|
||||
"main.js": "f8a34ed142868e6c6101ce544f89b5dee9ccb048ec8197c18535dad4cb0aadde",
|
||||
"main.js": "43f228e4e3e8791d389a077ca46a543316c27f2ab349aa47cfed6fe3a1f244e0",
|
||||
"styles.css": "eddcbf6a0c503d22ab3bbaeb0e4d3f89e55aa7a5d949108cfe893789638d00af"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user