koishi-plugin-memesluna 0.2.7 → 0.2.8
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/lib/index.js +64 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1388,6 +1388,39 @@ function buildAdminHtml(basePath) {
|
|
|
1388
1388
|
color: #64748b;
|
|
1389
1389
|
}
|
|
1390
1390
|
|
|
1391
|
+
.folder-card .folder-desc {
|
|
1392
|
+
font-size: 0.78rem;
|
|
1393
|
+
color: #94a3b8;
|
|
1394
|
+
margin-top: 2px;
|
|
1395
|
+
overflow: hidden;
|
|
1396
|
+
text-overflow: ellipsis;
|
|
1397
|
+
white-space: nowrap;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
.folder-card .folder-path {
|
|
1401
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
1402
|
+
font-size: 0.72rem;
|
|
1403
|
+
color: #a5b4fc;
|
|
1404
|
+
margin-top: 2px;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
.desc-editor {
|
|
1408
|
+
display: flex;
|
|
1409
|
+
align-items: center;
|
|
1410
|
+
gap: 0.5rem;
|
|
1411
|
+
margin-bottom: 0.8rem;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
.desc-editor input {
|
|
1415
|
+
flex: 1;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
.desc-display {
|
|
1419
|
+
font-size: 0.88rem;
|
|
1420
|
+
color: #64748b;
|
|
1421
|
+
margin-bottom: 0.5rem;
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1391
1424
|
.image-grid {
|
|
1392
1425
|
display: grid;
|
|
1393
1426
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
@@ -1488,6 +1521,11 @@ function buildAdminHtml(basePath) {
|
|
|
1488
1521
|
<button id="delete-collection" class="btn btn-sm btn-outline-danger">删除合集</button>
|
|
1489
1522
|
</div>
|
|
1490
1523
|
</div>
|
|
1524
|
+
<div id="detail-path" class="desc-display" style="font-family:monospace;color:#a5b4fc;font-size:0.82rem"></div>
|
|
1525
|
+
<div class="desc-editor">
|
|
1526
|
+
<input id="desc-input" class="form-control form-control-sm" placeholder="为这个合集添加描述,例如:千恋万花的丛雨表情包" />
|
|
1527
|
+
<button id="save-desc" class="btn btn-sm btn-outline-primary">保存描述</button>
|
|
1528
|
+
</div>
|
|
1491
1529
|
|
|
1492
1530
|
<div class="row g-3 mb-3">
|
|
1493
1531
|
<div class="col-md-6">
|
|
@@ -1601,6 +1639,17 @@ function buildAdminHtml(basePath) {
|
|
|
1601
1639
|
nameEl.className = 'folder-name'
|
|
1602
1640
|
nameEl.textContent = col.name
|
|
1603
1641
|
info.appendChild(nameEl)
|
|
1642
|
+
if (col.description) {
|
|
1643
|
+
var descEl = document.createElement('div')
|
|
1644
|
+
descEl.className = 'folder-desc'
|
|
1645
|
+
descEl.textContent = col.description
|
|
1646
|
+
descEl.title = col.description
|
|
1647
|
+
info.appendChild(descEl)
|
|
1648
|
+
}
|
|
1649
|
+
var pathEl = document.createElement('div')
|
|
1650
|
+
pathEl.className = 'folder-path'
|
|
1651
|
+
pathEl.textContent = BASE_PATH + '/' + col.name
|
|
1652
|
+
info.appendChild(pathEl)
|
|
1604
1653
|
var meta = document.createElement('div')
|
|
1605
1654
|
meta.className = 'folder-meta'
|
|
1606
1655
|
meta.textContent = '本地 ' + (col.localCount || 0) + ' / 外链 ' + (col.linkCount || 0)
|
|
@@ -1615,6 +1664,9 @@ function buildAdminHtml(basePath) {
|
|
|
1615
1664
|
byId('view-folders').style.display = 'none'
|
|
1616
1665
|
byId('view-detail').style.display = 'block'
|
|
1617
1666
|
byId('detail-title').textContent = name
|
|
1667
|
+
byId('detail-path').textContent = '端点路径: ' + BASE_PATH + '/' + name
|
|
1668
|
+
var col = state.collections.find(function(c) { return c.name === name })
|
|
1669
|
+
byId('desc-input').value = (col && col.description) ? col.description : ''
|
|
1618
1670
|
refreshCollectionResources()
|
|
1619
1671
|
}
|
|
1620
1672
|
|
|
@@ -1810,6 +1862,18 @@ function buildAdminHtml(basePath) {
|
|
|
1810
1862
|
|
|
1811
1863
|
byId('back-to-folders').addEventListener('click', backToFolders)
|
|
1812
1864
|
|
|
1865
|
+
byId('save-desc').addEventListener('click', async function() {
|
|
1866
|
+
if (!state.selectedCollection) return
|
|
1867
|
+
var desc = byId('desc-input').value.trim()
|
|
1868
|
+
await request(BASE_PATH + '/api/admin/collections/' + encodeURIComponent(state.selectedCollection) + '/description', {
|
|
1869
|
+
method: 'PATCH',
|
|
1870
|
+
body: JSON.stringify({ description: desc }),
|
|
1871
|
+
})
|
|
1872
|
+
var col = state.collections.find(function(c) { return c.name === state.selectedCollection })
|
|
1873
|
+
if (col) col.description = desc
|
|
1874
|
+
showAlert('描述已保存', 'success')
|
|
1875
|
+
})
|
|
1876
|
+
|
|
1813
1877
|
byId('refresh-resources').addEventListener('click', function() {
|
|
1814
1878
|
refreshCollectionResources()
|
|
1815
1879
|
showAlert('已刷新', 'success')
|
package/package.json
CHANGED