koishi-plugin-fimtale-api 1.0.6 → 1.0.7
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 +3 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -66,7 +66,7 @@ function apply(ctx, config) {
|
|
|
66
66
|
}, "stripHtml");
|
|
67
67
|
const extractImage = /* @__PURE__ */ __name((html) => {
|
|
68
68
|
if (!html) return null;
|
|
69
|
-
const match = html.match(/<img[^>]+src
|
|
69
|
+
const match = html.match(/<img[^>]+src\s*=\s*["']([^"']+)["']/i);
|
|
70
70
|
return match ? match[1] : null;
|
|
71
71
|
}, "extractImage");
|
|
72
72
|
const generateGradient = /* @__PURE__ */ __name((str) => {
|
|
@@ -194,7 +194,7 @@ function apply(ctx, config) {
|
|
|
194
194
|
const isChapter = info.IsChapter || !!parent && parent.ID !== info.ID;
|
|
195
195
|
const displayTitle = isChapter && parent ? parent.Title : info.Title;
|
|
196
196
|
let displayCover = info.Background || extractImage(info.Content);
|
|
197
|
-
if (!displayCover &&
|
|
197
|
+
if (!displayCover && parent) {
|
|
198
198
|
displayCover = parent.Background || extractImage(parent.Content);
|
|
199
199
|
}
|
|
200
200
|
const displayTagsObj = isChapter && parent ? parent.Tags : info.Tags;
|
|
@@ -538,7 +538,7 @@ function apply(ctx, config) {
|
|
|
538
538
|
});
|
|
539
539
|
ctx.middleware(async (session, next) => {
|
|
540
540
|
if (!config.autoParseLink) return next();
|
|
541
|
-
const matches = [...session.content.matchAll(/fimtale\.com\/t\/(\d+)/g)];
|
|
541
|
+
const matches = [...session.content.matchAll(/fimtale\.(?:com|net)\/t\/(\d+)/g)];
|
|
542
542
|
if (matches.length === 0) return next();
|
|
543
543
|
const uniqueIds = [...new Set(matches.map((m) => m[1]))];
|
|
544
544
|
if (session.userId === session.selfId) return next();
|