koishi-plugin-fimtale-api 1.0.7 → 1.0.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 +17 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -195,13 +195,28 @@ function apply(ctx, config) {
|
|
|
195
195
|
const displayTitle = isChapter && parent ? parent.Title : info.Title;
|
|
196
196
|
let displayCover = info.Background || extractImage(info.Content);
|
|
197
197
|
if (!displayCover && parent) {
|
|
198
|
-
displayCover = parent.Background
|
|
198
|
+
displayCover = parent.Background;
|
|
199
|
+
if (!displayCover) {
|
|
200
|
+
if (parent.Content) {
|
|
201
|
+
displayCover = extractImage(parent.Content);
|
|
202
|
+
} else {
|
|
203
|
+
try {
|
|
204
|
+
const parentRes = await fetchThread(parent.ID.toString());
|
|
205
|
+
if (parentRes.valid && parentRes.data) {
|
|
206
|
+
displayCover = parentRes.data.Background || extractImage(parentRes.data.Content);
|
|
207
|
+
}
|
|
208
|
+
} catch (e) {
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
199
212
|
}
|
|
200
213
|
const displayTagsObj = isChapter && parent ? parent.Tags : info.Tags;
|
|
201
214
|
const subTitle = isChapter ? info.Title : null;
|
|
202
215
|
const bgStyle = displayCover ? `background-image: url('${displayCover}');` : `background: ${generateGradient(displayTitle)};`;
|
|
203
216
|
let summary = stripHtml(info.Content);
|
|
204
|
-
if (summary.length < 10 && parent && isChapter)
|
|
217
|
+
if (summary.length < 10 && parent && isChapter) {
|
|
218
|
+
summary = stripHtml(parent.Content);
|
|
219
|
+
}
|
|
205
220
|
if (summary.length > 150) summary = summary.substring(0, 150) + "...";
|
|
206
221
|
if (!summary) summary = "暂无简介";
|
|
207
222
|
const tagsArr = [];
|