koishi-plugin-bilibili-notify 3.6.4 → 3.6.6
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/dist/index.js +1 -1
- package/lib/index.cjs +939 -1473
- package/lib/index.mjs +940 -1473
- package/package.json +4 -4
- package/lib/font/HYZhengYuan-75W.ttf +0 -0
package/lib/index.cjs
CHANGED
|
@@ -42,7 +42,6 @@ let koishi = require("koishi");
|
|
|
42
42
|
require("@koishijs/plugin-notifier");
|
|
43
43
|
let _koishijs_plugin_console = require("@koishijs/plugin-console");
|
|
44
44
|
let node_path = require("node:path");
|
|
45
|
-
node_path = __toESM(node_path);
|
|
46
45
|
require("@koishijs/plugin-help");
|
|
47
46
|
let blive_message_listener = require("blive-message-listener");
|
|
48
47
|
let qrcode = require("qrcode");
|
|
@@ -759,9 +758,9 @@ var ComRegister = class ComRegister {
|
|
|
759
758
|
preInitConfig(subs) {
|
|
760
759
|
for (const sub of Object.values(subs)) {
|
|
761
760
|
if (sub.customLiveMsg.enable) {
|
|
762
|
-
if (!sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
763
|
-
if (!sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
764
|
-
if (!sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
761
|
+
if (sub.customLiveMsg.customLiveStart && !sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
762
|
+
if (sub.customLiveMsg.customLiveEnd && !sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
763
|
+
if (sub.customLiveMsg.customLive && !sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
765
764
|
} else {
|
|
766
765
|
sub.customLiveMsg.enable = false;
|
|
767
766
|
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
@@ -769,10 +768,10 @@ var ComRegister = class ComRegister {
|
|
|
769
768
|
sub.customLiveMsg.customLive = this.config.customLive;
|
|
770
769
|
}
|
|
771
770
|
if (sub.customGuardBuy.enable) {
|
|
772
|
-
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
773
|
-
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
774
|
-
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
775
|
-
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
771
|
+
if (sub.customGuardBuy.guardBuyMsg && !sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
772
|
+
if (sub.customGuardBuy.captainImgUrl && !sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
773
|
+
if (sub.customGuardBuy.supervisorImgUrl && !sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
774
|
+
if (sub.customGuardBuy.governorImgUrl && !sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
776
775
|
} else if (this.config.customGuardBuy.enable) {
|
|
777
776
|
sub.customGuardBuy.enable = true;
|
|
778
777
|
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
@@ -929,7 +928,7 @@ var ComRegister = class ComRegister {
|
|
|
929
928
|
if (this.loginTimer) this.loginTimer();
|
|
930
929
|
if (this.dynamicJob) this.dynamicJob.stop();
|
|
931
930
|
if (this.liveAPIJob) this.liveAPIJob.stop();
|
|
932
|
-
for (const [roomId, timer] of this.liveWSManager) {
|
|
931
|
+
if (this.liveWSManager || this.liveWSManager.size > 0) for (const [roomId, timer] of this.liveWSManager) {
|
|
933
932
|
this.ctx["bilibili-notify-live"].closeListener(roomId);
|
|
934
933
|
if (timer) timer();
|
|
935
934
|
}
|
|
@@ -2058,877 +2057,261 @@ const ADDITIONAL_TYPE_RESERVE = "ADDITIONAL_TYPE_RESERVE";
|
|
|
2058
2057
|
var GenerateImg = class GenerateImg extends koishi.Service {
|
|
2059
2058
|
static inject = ["puppeteer"];
|
|
2060
2059
|
giConfig;
|
|
2061
|
-
fontPath;
|
|
2062
2060
|
constructor(ctx, config) {
|
|
2063
2061
|
super(ctx, "bilibili-notify-generate-img");
|
|
2064
2062
|
this.giConfig = config;
|
|
2065
|
-
this.fontPath = node_path.default.resolve(__dirname, "font/HYZhengYuan-75W.ttf");
|
|
2066
2063
|
}
|
|
2067
2064
|
numberToStr(num) {
|
|
2068
2065
|
return num > 1e4 ? `${(num / 1e4).toFixed(1)}万` : num.toString();
|
|
2069
2066
|
}
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2067
|
+
CARD_STYLES = {
|
|
2068
|
+
large: {
|
|
2069
|
+
avatarSize: "70px",
|
|
2070
|
+
upNameFont: "27px",
|
|
2071
|
+
pubTimeFont: "20px",
|
|
2072
|
+
dressUpFont: "17px",
|
|
2073
|
+
cardDetailsFont: "22px",
|
|
2074
|
+
forwardUserinfoHeight: "35px",
|
|
2075
|
+
forwardUsernameFont: "20px",
|
|
2076
|
+
forwardAvatarSize: "25px",
|
|
2077
|
+
videoCardHeight: "147px",
|
|
2078
|
+
dynTitleFont: "20px",
|
|
2079
|
+
upInfoHeight: "70px",
|
|
2080
|
+
dynamicCardRight: "67px",
|
|
2081
|
+
dynamicCardTop: "24px"
|
|
2082
|
+
},
|
|
2083
|
+
normal: {
|
|
2084
|
+
avatarSize: "50px",
|
|
2085
|
+
upNameFont: "20px",
|
|
2086
|
+
pubTimeFont: "12px",
|
|
2087
|
+
dressUpFont: "12px",
|
|
2088
|
+
cardDetailsFont: "14px",
|
|
2089
|
+
forwardUserinfoHeight: "30px",
|
|
2090
|
+
forwardUsernameFont: "15px",
|
|
2091
|
+
forwardAvatarSize: "20px",
|
|
2092
|
+
videoCardHeight: "132px",
|
|
2093
|
+
dynTitleFont: "20px",
|
|
2094
|
+
upInfoHeight: "50px",
|
|
2095
|
+
dynamicCardRight: "37px",
|
|
2096
|
+
dynamicCardTop: "5px"
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
generateCardStyle(isLargeFont, cardColorStart, cardColorEnd, cardBasePlateBorder, cardBasePlateColor, dynamicCardColor) {
|
|
2100
|
+
const style = isLargeFont ? this.CARD_STYLES.large : this.CARD_STYLES.normal;
|
|
2101
|
+
return `
|
|
2102
|
+
* {
|
|
2103
|
+
margin: 0;
|
|
2104
|
+
padding: 0;
|
|
2105
|
+
box-sizing: border-box;
|
|
2106
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2107
|
+
}
|
|
2103
2108
|
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
font-family: "${this.giConfig.font}", "NotoColorEmoji", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2109
|
-
}
|
|
2110
|
-
|
|
2111
|
-
html {
|
|
2112
|
-
width: 800px;
|
|
2113
|
-
height: auto;
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
.background {
|
|
2117
|
-
width: 100%;
|
|
2118
|
-
height: auto;
|
|
2119
|
-
padding: 15px;
|
|
2120
|
-
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2121
|
-
overflow: hidden;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
.base-plate {
|
|
2125
|
-
width: 100%;
|
|
2126
|
-
height: auto;
|
|
2127
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2128
|
-
padding: ${cardBasePlateBorder};
|
|
2129
|
-
border-radius: 10px;
|
|
2130
|
-
background-color: ${cardBasePlateColor};
|
|
2131
|
-
}
|
|
2109
|
+
html {
|
|
2110
|
+
width: 800px;
|
|
2111
|
+
height: auto;
|
|
2112
|
+
}
|
|
2132
2113
|
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
}
|
|
2114
|
+
.background {
|
|
2115
|
+
width: 100%;
|
|
2116
|
+
height: auto;
|
|
2117
|
+
padding: 15px;
|
|
2118
|
+
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2119
|
+
overflow: hidden;
|
|
2120
|
+
}
|
|
2141
2121
|
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2122
|
+
.base-plate {
|
|
2123
|
+
width: 100%;
|
|
2124
|
+
height: auto;
|
|
2125
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2126
|
+
padding: ${cardBasePlateBorder};
|
|
2127
|
+
border-radius: 10px;
|
|
2128
|
+
background-color: ${cardBasePlateColor};
|
|
2129
|
+
}
|
|
2149
2130
|
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2131
|
+
.card {
|
|
2132
|
+
width: 100%;
|
|
2133
|
+
height: auto;
|
|
2134
|
+
border-radius: 5px;
|
|
2135
|
+
padding: 15px;
|
|
2136
|
+
overflow: hidden;
|
|
2137
|
+
background-color: #fff;
|
|
2138
|
+
}
|
|
2157
2139
|
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2140
|
+
.card-body {
|
|
2141
|
+
display: flex;
|
|
2142
|
+
padding: 15px;
|
|
2143
|
+
}
|
|
2161
2144
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2145
|
+
.card .anchor-avatar {
|
|
2146
|
+
max-width: ${style.avatarSize};
|
|
2147
|
+
max-height: ${style.avatarSize};
|
|
2148
|
+
margin-right: 20px;
|
|
2149
|
+
border-radius: 10px;
|
|
2150
|
+
}
|
|
2166
2151
|
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
margin-bottom: 10px;
|
|
2171
|
-
}
|
|
2152
|
+
.card .card-body .card-content {
|
|
2153
|
+
width: 100%;
|
|
2154
|
+
}
|
|
2172
2155
|
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
}
|
|
2156
|
+
.card .card-body .card-content .card-header {
|
|
2157
|
+
width: 100%;
|
|
2158
|
+
display: flex;
|
|
2159
|
+
justify-content: space-between;
|
|
2160
|
+
}
|
|
2179
2161
|
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2162
|
+
.card .up-info {
|
|
2163
|
+
display: flex;
|
|
2164
|
+
flex-direction: column;
|
|
2165
|
+
justify-content: space-between;
|
|
2166
|
+
height: ${style.upInfoHeight};
|
|
2167
|
+
}
|
|
2186
2168
|
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
}
|
|
2169
|
+
.card .up-info .up-name {
|
|
2170
|
+
font-size: ${style.upNameFont};
|
|
2171
|
+
}
|
|
2191
2172
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
font-size: 20px;
|
|
2197
|
-
margin-top: 10px;
|
|
2198
|
-
margin-bottom: 10px;
|
|
2199
|
-
}
|
|
2200
|
-
</style>
|
|
2201
|
-
</head>
|
|
2202
|
-
<body>
|
|
2203
|
-
<div class="background">
|
|
2204
|
-
<div ${this.giConfig.removeBorder ? "" : "class=\"base-plate\""}>
|
|
2205
|
-
<div class="card">
|
|
2206
|
-
<img src="${cover ? data.user_cover : data.keyframe}"
|
|
2207
|
-
alt="封面">
|
|
2208
|
-
<div class="card-body">
|
|
2209
|
-
<div class="card-header">
|
|
2210
|
-
<h1 class="card-title">${data.title}</h1>
|
|
2211
|
-
<div class="live-broadcast-info">
|
|
2212
|
-
<!-- 主播头像 -->
|
|
2213
|
-
<img style="border-radius: 10px; margin-left: 10px" class="anchor-avatar"
|
|
2214
|
-
src="${userface}" alt="主播头像">
|
|
2215
|
-
<span class="broadcast-message">${username}${titleStatus}</span>
|
|
2216
|
-
</div>
|
|
2217
|
-
</div>
|
|
2218
|
-
${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
|
|
2219
|
-
<p class="card-link">
|
|
2220
|
-
<span>${liveStatus === 3 ? `本场直播点赞数:${this.numberToStr(+liveData.likedNum)}` : `人气:${this.numberToStr(data.online)}`}</span>
|
|
2221
|
-
<span>分区名称:${data.area_name}</span>
|
|
2222
|
-
</p>
|
|
2223
|
-
<p class="card-link">
|
|
2224
|
-
<span>${liveTime}</span>
|
|
2225
|
-
${this.giConfig.followerDisplay ? `
|
|
2226
|
-
<span>
|
|
2227
|
-
${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
|
|
2228
|
-
</span>` : ""}
|
|
2229
|
-
</p>
|
|
2230
|
-
</div>
|
|
2231
|
-
</div>
|
|
2232
|
-
</div>
|
|
2233
|
-
</div>
|
|
2234
|
-
</body>
|
|
2235
|
-
</html>
|
|
2236
|
-
`;
|
|
2237
|
-
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2238
|
-
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2239
|
-
});
|
|
2240
|
-
}
|
|
2241
|
-
static BG_COLOR = {
|
|
2242
|
-
[blive_message_listener.GuardLevel.None]: ["#4ebcec", "#F9CCDF"],
|
|
2243
|
-
[blive_message_listener.GuardLevel.Jianzhang]: ["#4ebcec", "#b494e5"],
|
|
2244
|
-
[blive_message_listener.GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
|
|
2245
|
-
[blive_message_listener.GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
|
|
2246
|
-
};
|
|
2247
|
-
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
|
|
2248
|
-
const bgColor = GenerateImg.BG_COLOR[guardLevel];
|
|
2249
|
-
const desc = {
|
|
2250
|
-
[blive_message_listener.GuardLevel.Jianzhang]: () => {
|
|
2251
|
-
return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
|
|
2252
|
-
},
|
|
2253
|
-
[blive_message_listener.GuardLevel.Tidu]: () => {
|
|
2254
|
-
return `"${uname}"就任<br/>"${masterName}"大航海舰队提督!`;
|
|
2255
|
-
},
|
|
2256
|
-
[blive_message_listener.GuardLevel.Zongdu]: () => {
|
|
2257
|
-
return `"${uname}"上任<br/>"${masterName}"大航海舰队总督!`;
|
|
2258
|
-
}
|
|
2259
|
-
};
|
|
2260
|
-
const html = `
|
|
2261
|
-
<!DOCTYPE html>
|
|
2262
|
-
<html>
|
|
2173
|
+
.card .pub-time {
|
|
2174
|
+
font-size: ${style.pubTimeFont};
|
|
2175
|
+
color: grey;
|
|
2176
|
+
}
|
|
2263
2177
|
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
@font-face {
|
|
2268
|
-
font-family: "NotoColorEmoji";
|
|
2269
|
-
src: url('file://${this.fontPath}') format('truetype');
|
|
2270
|
-
font-display: swap;
|
|
2271
|
-
}
|
|
2178
|
+
.card .card-header img {
|
|
2179
|
+
height: 50px;
|
|
2180
|
+
}
|
|
2272
2181
|
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
font-family: "${this.giConfig.font}", "NotoColorEmoji", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2278
|
-
}
|
|
2182
|
+
.card .dress-up {
|
|
2183
|
+
position: relative;
|
|
2184
|
+
font-size: ${style.dressUpFont};
|
|
2185
|
+
}
|
|
2279
2186
|
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2187
|
+
.card .dress-up img {
|
|
2188
|
+
max-width: 100%;
|
|
2189
|
+
max-height: 100%;
|
|
2190
|
+
}
|
|
2284
2191
|
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
background: linear-gradient(to right bottom, ${bgColor[0]}, ${bgColor[1]});
|
|
2292
|
-
}
|
|
2192
|
+
.card .dress-up span {
|
|
2193
|
+
position: absolute;
|
|
2194
|
+
color: ${dynamicCardColor};
|
|
2195
|
+
right: ${style.dynamicCardRight};
|
|
2196
|
+
top: ${style.dynamicCardTop};
|
|
2197
|
+
}
|
|
2293
2198
|
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
border-radius: 10px;
|
|
2299
|
-
width: 410px;
|
|
2300
|
-
height: 200px;
|
|
2301
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2302
|
-
background-color: rgba(255, 255, 255, 0.65);
|
|
2303
|
-
backdrop-filter: blur(10px);
|
|
2304
|
-
}
|
|
2199
|
+
.card .dyn-title {
|
|
2200
|
+
font-size: ${style.dynTitleFont};
|
|
2201
|
+
margin-bottom: 10px;
|
|
2202
|
+
}
|
|
2305
2203
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2204
|
+
.card .card-topic {
|
|
2205
|
+
display: flex;
|
|
2206
|
+
align-items: center;
|
|
2207
|
+
margin-top: 10px;
|
|
2208
|
+
font-size: 20px;
|
|
2209
|
+
color: #008AC5;
|
|
2210
|
+
gap: 3px;
|
|
2211
|
+
}
|
|
2314
2212
|
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2213
|
+
.card .card-details {
|
|
2214
|
+
margin-top: 5px;
|
|
2215
|
+
margin-bottom: 15px;
|
|
2216
|
+
font-size: ${style.cardDetailsFont};
|
|
2217
|
+
width: 90%;
|
|
2218
|
+
}
|
|
2319
2219
|
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
}
|
|
2220
|
+
.card .card-major {
|
|
2221
|
+
display: flex;
|
|
2222
|
+
flex-wrap: wrap;
|
|
2223
|
+
gap: 5px;
|
|
2224
|
+
}
|
|
2326
2225
|
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2226
|
+
.card .card-major .photo-item {
|
|
2227
|
+
border-radius: 10px;
|
|
2228
|
+
overflow: hidden;
|
|
2229
|
+
width: 170px;
|
|
2230
|
+
height: 170px;
|
|
2231
|
+
object-fit: cover;
|
|
2232
|
+
}
|
|
2333
2233
|
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2234
|
+
.card .card-major .single-photo-mask {
|
|
2235
|
+
position: absolute;
|
|
2236
|
+
text-align: center;
|
|
2237
|
+
width: 100%;
|
|
2238
|
+
height: 100%;
|
|
2239
|
+
top: 0;
|
|
2240
|
+
left: 0;
|
|
2241
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 30%);
|
|
2242
|
+
}
|
|
2341
2243
|
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
overflow: hidden;
|
|
2352
|
-
}
|
|
2244
|
+
.card .card-major .single-photo-mask-text {
|
|
2245
|
+
position: absolute;
|
|
2246
|
+
color: #fff;
|
|
2247
|
+
font-size: 24px;
|
|
2248
|
+
right: 0;
|
|
2249
|
+
bottom: 66px;
|
|
2250
|
+
left: 0;
|
|
2251
|
+
text-align: center;
|
|
2252
|
+
}
|
|
2353
2253
|
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2254
|
+
.card .card-major .single-photo-mask-arrow {
|
|
2255
|
+
position: absolute;
|
|
2256
|
+
width: 70px;
|
|
2257
|
+
height: 70px;
|
|
2258
|
+
bottom: 7px;
|
|
2259
|
+
left: 50%;
|
|
2260
|
+
transform: translateX(-50%);
|
|
2261
|
+
}
|
|
2362
2262
|
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
border: solid 2px white;
|
|
2371
|
-
overflow: hidden;
|
|
2372
|
-
}
|
|
2263
|
+
.card .card-major .single-photo-container {
|
|
2264
|
+
position: relative;
|
|
2265
|
+
max-width: 500px;
|
|
2266
|
+
max-height: 1000px;
|
|
2267
|
+
border-radius: 10px;
|
|
2268
|
+
overflow: hidden;
|
|
2269
|
+
}
|
|
2373
2270
|
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
background-size: cover;
|
|
2380
|
-
}
|
|
2271
|
+
.card .card-major .single-photo-item {
|
|
2272
|
+
max-width: 500px;
|
|
2273
|
+
border-radius: 10px;
|
|
2274
|
+
overflow: hidden;
|
|
2275
|
+
}
|
|
2381
2276
|
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
margin-right: 5px;
|
|
2391
|
-
}
|
|
2277
|
+
.card .card-major .four-photo-item {
|
|
2278
|
+
width: 170px;
|
|
2279
|
+
height: 170px;
|
|
2280
|
+
object-fit: cover;
|
|
2281
|
+
border-radius: 10px;
|
|
2282
|
+
overflow: hidden;
|
|
2283
|
+
flex-basis: 20%;
|
|
2284
|
+
}
|
|
2392
2285
|
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2286
|
+
.card .card-stat {
|
|
2287
|
+
display: flex;
|
|
2288
|
+
justify-content: space-between;
|
|
2289
|
+
width: 90%;
|
|
2290
|
+
margin-top: 15px;
|
|
2291
|
+
color: gray;
|
|
2292
|
+
font-size: 14px;
|
|
2293
|
+
}
|
|
2400
2294
|
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
}
|
|
2407
|
-
</style>
|
|
2408
|
-
</head>
|
|
2295
|
+
.card .card-stat .stat-item {
|
|
2296
|
+
display: flex;
|
|
2297
|
+
align-items: center;
|
|
2298
|
+
gap: 3px;
|
|
2299
|
+
}
|
|
2409
2300
|
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
</div>
|
|
2418
|
-
<div class="user-info">
|
|
2419
|
-
<div class="name-badge">
|
|
2420
|
-
<span>${uname}</span>
|
|
2421
|
-
</div>
|
|
2422
|
-
<div class="accompany">
|
|
2423
|
-
<div class="master-avatar"></div><span>${isAdmin ? "房管" : masterName}</span>
|
|
2424
|
-
</div>
|
|
2425
|
-
</div>
|
|
2426
|
-
</div>
|
|
2427
|
-
<div class="desc">
|
|
2428
|
-
${desc[guardLevel]()}
|
|
2429
|
-
</div>
|
|
2430
|
-
</div>
|
|
2431
|
-
<div class="captain"></div>
|
|
2432
|
-
</div>
|
|
2433
|
-
</div>
|
|
2434
|
-
</body>
|
|
2301
|
+
.card .card-video {
|
|
2302
|
+
display: flex;
|
|
2303
|
+
overflow: hidden;
|
|
2304
|
+
border-radius: 5px 0 0 5px;
|
|
2305
|
+
margin-top: 10px;
|
|
2306
|
+
height: ${style.videoCardHeight};
|
|
2307
|
+
}
|
|
2435
2308
|
|
|
2436
|
-
</html>
|
|
2437
|
-
`;
|
|
2438
|
-
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2439
|
-
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2440
|
-
});
|
|
2441
|
-
}
|
|
2442
|
-
richTextParser(rt, title) {
|
|
2443
|
-
const richText = rt.reduce((accumulator, currentValue) => {
|
|
2444
|
-
if (currentValue.emoji) return `${accumulator}<img style="width:28px; height:28px;" src="${currentValue.emoji.icon_url}"/>`;
|
|
2445
|
-
return accumulator + currentValue.text;
|
|
2446
|
-
}, "");
|
|
2447
|
-
if (this.giConfig.filter.enable) {
|
|
2448
|
-
if (this.giConfig.filter.regex) {
|
|
2449
|
-
if (new RegExp(this.giConfig.filter.regex).test(richText)) throw new Error("出现关键词,屏蔽该动态");
|
|
2450
|
-
}
|
|
2451
|
-
if (this.giConfig.filter.keywords.length !== 0 && this.giConfig.filter.keywords.some((keyword) => richText.includes(keyword))) throw new Error("出现关键词,屏蔽该动态");
|
|
2452
|
-
}
|
|
2453
|
-
const text = richText.replace(/\n/g, "<br>");
|
|
2454
|
-
return `
|
|
2455
|
-
<div class="card-details">
|
|
2456
|
-
${title ? `<h1 class="dyn-title">${title}</h1>` : ""}
|
|
2457
|
-
${text}
|
|
2458
|
-
</div>
|
|
2459
|
-
`;
|
|
2460
|
-
}
|
|
2461
|
-
async generateDynamicImg(data, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
2462
|
-
const module_author = data.modules.module_author;
|
|
2463
|
-
const avatarUrl = module_author.face;
|
|
2464
|
-
const upName = module_author.name;
|
|
2465
|
-
let pubTime = this.unixTimestampToString(module_author.pub_ts);
|
|
2466
|
-
let dynamicCardUrl;
|
|
2467
|
-
let dynamicCardId;
|
|
2468
|
-
let dynamicCardColor;
|
|
2469
|
-
if (module_author.decorate) {
|
|
2470
|
-
dynamicCardUrl = module_author.decorate.card_url;
|
|
2471
|
-
dynamicCardId = module_author.decorate.fan.num_str;
|
|
2472
|
-
dynamicCardColor = module_author.decorate.fan.color;
|
|
2473
|
-
}
|
|
2474
|
-
const module_stat = data.modules.module_stat;
|
|
2475
|
-
const comment = module_stat.comment.count;
|
|
2476
|
-
const forward = module_stat.forward.count;
|
|
2477
|
-
const like = module_stat.like.count;
|
|
2478
|
-
const topic = data.modules.module_dynamic.topic ? data.modules.module_dynamic.topic.name : "";
|
|
2479
|
-
const getDynamicMajor = async (dynamic, forward$1) => {
|
|
2480
|
-
let main$1 = "";
|
|
2481
|
-
let forwardInfo;
|
|
2482
|
-
const basicDynamic = () => {
|
|
2483
|
-
const module_dynamic = dynamic.modules.module_dynamic;
|
|
2484
|
-
if (module_dynamic?.desc?.rich_text_nodes) {
|
|
2485
|
-
const content = this.richTextParser(module_dynamic.desc.rich_text_nodes);
|
|
2486
|
-
main$1 += content;
|
|
2487
|
-
}
|
|
2488
|
-
if (module_dynamic?.major?.opus?.summary?.rich_text_nodes) {
|
|
2489
|
-
const content = this.richTextParser(module_dynamic.major.opus.summary.rich_text_nodes, module_dynamic.major.opus.title);
|
|
2490
|
-
main$1 += content;
|
|
2491
|
-
}
|
|
2492
|
-
let major = "";
|
|
2493
|
-
const arrowImg = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "img/arrow.png"));
|
|
2494
|
-
if (module_dynamic?.major?.opus?.pics) {
|
|
2495
|
-
if (module_dynamic.major.opus.pics.length === 1) if (module_dynamic.major.opus.pics[0].height > 3e3) major += `
|
|
2496
|
-
<div class="single-photo-container">
|
|
2497
|
-
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2498
|
-
<div class="single-photo-mask">
|
|
2499
|
-
<span class="single-photo-mask-text">点击链接浏览全部</span>
|
|
2500
|
-
</div>
|
|
2501
|
-
<img class="single-photo-mask-arrow" src="${arrowImg}"/>
|
|
2502
|
-
</div>
|
|
2503
|
-
`;
|
|
2504
|
-
else major += `
|
|
2505
|
-
<div class="single-photo-container">
|
|
2506
|
-
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2507
|
-
</div>
|
|
2508
|
-
`;
|
|
2509
|
-
else if (module_dynamic.major.opus.pics.length === 4) major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2510
|
-
return `${acc}<img class="four-photo-item" src="${cV.url}"/>`;
|
|
2511
|
-
}, "");
|
|
2512
|
-
else major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2513
|
-
return `${acc}<img class="photo-item" src="${cV.url}"/>`;
|
|
2514
|
-
}, "");
|
|
2515
|
-
main$1 += `
|
|
2516
|
-
<div class="card-major">
|
|
2517
|
-
${major}
|
|
2518
|
-
</div>
|
|
2519
|
-
`;
|
|
2520
|
-
}
|
|
2521
|
-
};
|
|
2522
|
-
switch (dynamic.type) {
|
|
2523
|
-
case DYNAMIC_TYPE_WORD:
|
|
2524
|
-
case DYNAMIC_TYPE_DRAW:
|
|
2525
|
-
case DYNAMIC_TYPE_FORWARD:
|
|
2526
|
-
basicDynamic();
|
|
2527
|
-
if (dynamic.type === DYNAMIC_TYPE_FORWARD) {
|
|
2528
|
-
if (this.giConfig.filter.enable && this.giConfig.filter.forward) throw new Error("已屏蔽转发动态");
|
|
2529
|
-
const forward_module_author = dynamic.orig.modules.module_author;
|
|
2530
|
-
const forwardUserAvatarUrl = forward_module_author.face;
|
|
2531
|
-
const forwardUserName = forward_module_author.name;
|
|
2532
|
-
const [forwardMain, forwardInfo$1] = await getDynamicMajor(dynamic.orig, true);
|
|
2533
|
-
main$1 += `
|
|
2534
|
-
<div class="card-forward">
|
|
2535
|
-
<div class="forward-userinfo">
|
|
2536
|
-
<img class="forward-avatar" src="${forwardUserAvatarUrl}" alt="avatar">
|
|
2537
|
-
<span class="forward-username">${forwardUserName} ${forwardInfo$1 ? forwardInfo$1 : ""}</span>
|
|
2538
|
-
</div>
|
|
2539
|
-
<div class="forward-main">
|
|
2540
|
-
${forwardMain}
|
|
2541
|
-
</div>
|
|
2542
|
-
</div>
|
|
2543
|
-
`;
|
|
2544
|
-
}
|
|
2545
|
-
if (dynamic.modules.module_dynamic.additional) {
|
|
2546
|
-
const additional = dynamic.modules.module_dynamic.additional;
|
|
2547
|
-
switch (additional.type) {
|
|
2548
|
-
case ADDITIONAL_TYPE_RESERVE: {
|
|
2549
|
-
const reserve = additional.reserve;
|
|
2550
|
-
let button;
|
|
2551
|
-
if (reserve.button.uncheck.text === "已结束") button = `
|
|
2552
|
-
<button class="reserve-button-end">
|
|
2553
|
-
<span>${reserve.button.uncheck.text}</span>
|
|
2554
|
-
</button>
|
|
2555
|
-
`;
|
|
2556
|
-
else button = `
|
|
2557
|
-
<button class="reserve-button-ing">
|
|
2558
|
-
<svg class="bili-dyn-card-reserve__action__icon" style="width: 16px; height: 16px;"
|
|
2559
|
-
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
2560
|
-
viewBox="0 0 16 16" width="16" height="16">
|
|
2561
|
-
<path
|
|
2562
|
-
d="M3.0000133333333334 6.999199999999999C3.0000133333333334 4.23776 5.2385866666666665 1.9991866666666667 8 1.9991866666666667C10.761433333333333 1.9991866666666667 13 4.23776 13 6.999199999999999L13 9.860933333333332C13 9.923533333333333 13.024899999999999 9.983633333333334 13.069199999999999 10.027933333333333L13.588366666666666 10.5471C14.389533333333333 11.348299999999998 13.914133333333334 12.734533333333333 12.754199999999999 12.8183C11.535999999999998 12.906233333333333 9.818933333333334 12.999199999999998 8 12.999199999999998C6.181073333333334 12.999199999999998 4.464026666666666 12.906233333333333 3.2458266666666664 12.8183C2.0859066666666664 12.734533333333333 1.61046 11.348299999999998 2.4116466666666665 10.547133333333333L2.93084 10.027933333333333C2.975133333333333 9.983633333333334 3.0000133333333334 9.923533333333333 3.0000133333333334 9.860933333333332L3.0000133333333334 6.999199999999999zM8 2.9991866666666667C5.790873333333334 2.9991866666666667 4.000013333333333 4.790046666666666 4.000013333333333 6.999199999999999L4.000013333333333 9.860933333333332C4.000013333333333 10.1888 3.8697733333333333 10.5032 3.6379466666666667 10.735033333333334L3.1187466666666666 11.254233333333334C2.911966666666667 11.461 3.0317600000000002 11.800199999999998 3.317833333333333 11.820899999999998C4.5211266666666665 11.907766666666667 6.212726666666666 11.999199999999998 8 11.999199999999998C9.787266666666666 11.999199999999998 11.4789 11.907733333333333 12.682199999999998 11.820899999999998C12.968233333333332 11.800199999999998 13.088033333333332 11.461 12.881266666666665 11.254233333333334L12.362066666666665 10.735033333333334C12.130233333333333 10.5032 12 10.1888 12 9.860933333333332L12 6.999199999999999C12 4.790046666666666 10.209166666666667 2.9991866666666667 8 2.9991866666666667z"
|
|
2563
|
-
fill="currentColor"></path>
|
|
2564
|
-
<path
|
|
2565
|
-
d="M8.720066666666666 2.0260466666666668C8.720066666666666 2.42372 8.397666666666666 2.746093333333333 8 2.746093333333333C7.602333333333332 2.746093333333333 7.279933333333333 2.42372 7.279933333333333 2.0260466666666668C7.279933333333333 1.6283666666666667 7.602333333333332 1.3059866666666666 8 1.3059866666666666C8.397666666666666 1.3059866666666666 8.720066666666666 1.6283666666666667 8.720066666666666 2.0260466666666668z"
|
|
2566
|
-
fill="currentColor"></path>
|
|
2567
|
-
<path
|
|
2568
|
-
d="M6.791266666666666 12.499199999999998C6.791266666666666 13.173966666666667 7.335266666666667 13.715866666666665 8 13.715866666666665C8.664766666666665 13.715866666666665 9.208733333333333 13.173966666666667 9.208733333333333 12.499199999999998L10.208733333333333 12.499199999999998C10.208733333333333 13.720566666666667 9.2227 14.715866666666665 8 14.715866666666665C6.777346666666666 14.715866666666665 5.791273333333333 13.720566666666667 5.791273333333333 12.499199999999998L6.791266666666666 12.499199999999998z"
|
|
2569
|
-
fill="currentColor"></path>
|
|
2570
|
-
</svg>
|
|
2571
|
-
<span>${reserve.button.uncheck.text}</span>
|
|
2572
|
-
</button>
|
|
2573
|
-
`;
|
|
2574
|
-
main$1 += `
|
|
2575
|
-
<div class="card-reserve">
|
|
2576
|
-
<div class="reserve-main">
|
|
2577
|
-
<div class="reserve-title">
|
|
2578
|
-
${reserve.title}
|
|
2579
|
-
</div>
|
|
2580
|
-
<div class="reserve-desc">
|
|
2581
|
-
<div class="reserve-info">
|
|
2582
|
-
<span class="reserve-time">${reserve.desc1.text}</span>
|
|
2583
|
-
<span class="reserve-num">${reserve.desc2.text}</span>
|
|
2584
|
-
</div>
|
|
2585
|
-
${reserve.desc3 ? `<div class="reserve-prize">
|
|
2586
|
-
<svg class="bili-dyn-card-reserve__lottery__icon"
|
|
2587
|
-
style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2588
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2589
|
-
height="16">
|
|
2590
|
-
<path
|
|
2591
|
-
d="M2.99998 7.785666666666666C3.2761266666666664 7.785666666666666 3.49998 8.0095 3.49998 8.285666666666666L3.49998 12.285666666666666C3.49998 12.719566666666667 3.8517599999999996 13.071333333333332 4.285693333333333 13.071333333333332L11.714266666666667 13.071333333333332C12.1482 13.071333333333332 12.5 12.719566666666667 12.5 12.285666666666666L12.5 8.285666666666666C12.5 8.0095 12.723833333333333 7.785666666666666 13 7.785666666666666C13.276133333333334 7.785666666666666 13.5 8.0095 13.5 8.285666666666666L13.5 12.285666666666666C13.5 13.271866666666668 12.7005 14.071333333333332 11.714266666666667 14.071333333333332L4.285693333333333 14.071333333333332C3.2994733333333333 14.071333333333332 2.49998 13.271866666666668 2.49998 12.285666666666666L2.49998 8.285666666666666C2.49998 8.0095 2.7238399999999996 7.785666666666666 2.99998 7.785666666666666z"
|
|
2592
|
-
fill="currentColor"></path>
|
|
2593
|
-
<path
|
|
2594
|
-
d="M1.9285533333333333 5.857139999999999C1.9285533333333333 5.107613333333333 2.5361666666666665 4.5 3.285693333333333 4.5L12.714266666666667 4.5C13.463799999999999 4.5 14.071399999999999 5.107613333333333 14.071399999999999 5.857139999999999L14.071399999999999 7.134066666666667C14.071399999999999 7.793799999999999 13.590066666666667 8.373766666666667 12.905000000000001 8.4432C12.058933333333332 8.528966666666665 10.470166666666666 8.642866666666666 8 8.642866666666666C5.529819999999999 8.642866666666666 3.9410399999999997 8.528966666666665 3.09498 8.4432C2.4099066666666666 8.373766666666667 1.9285533333333333 7.793799999999999 1.9285533333333333 7.134066666666667L1.9285533333333333 5.857139999999999zM3.285693333333333 5.5C3.088453333333333 5.5 2.9285533333333333 5.6599 2.9285533333333333 5.857139999999999L2.9285533333333333 7.134066666666667C2.9285533333333333 7.3082 3.0432666666666663 7.432833333333333 3.1958066666666665 7.4483C4.00544 7.530366666666667 5.560420000000001 7.6428666666666665 8 7.6428666666666665C10.439566666666666 7.6428666666666665 11.994533333333333 7.530366666666667 12.804133333333333 7.4483C12.9567 7.432833333333333 13.071399999999999 7.3082 13.071399999999999 7.134066666666667L13.071399999999999 5.857139999999999C13.071399999999999 5.6599 12.911499999999998 5.5 12.714266666666667 5.5L3.285693333333333 5.5z"
|
|
2595
|
-
fill="currentColor"></path>
|
|
2596
|
-
<path
|
|
2597
|
-
d="M4.357126666666666 3.5714733333333335C4.357126666666666 2.506353333333333 5.220573333333333 1.6429066666666667 6.285693333333333 1.6429066666666667C7.350833333333332 1.6429066666666667 8.214266666666667 2.506353333333333 8.214266666666667 3.5714733333333335L8.214266666666667 5.500046666666666L6.285693333333333 5.500046666666666C5.220573333333333 5.500046666666666 4.357126666666666 4.636593333333333 4.357126666666666 3.5714733333333335zM6.285693333333333 2.6429066666666667C5.77286 2.6429066666666667 5.357126666666667 3.0586399999999996 5.357126666666667 3.5714733333333335C5.357126666666667 4.084313333333333 5.77286 4.500046666666666 6.285693333333333 4.500046666666666L7.214266666666667 4.500046666666666L7.214266666666667 3.5714733333333335C7.214266666666667 3.0586399999999996 6.798533333333333 2.6429066666666667 6.285693333333333 2.6429066666666667z"
|
|
2598
|
-
fill="currentColor"></path>
|
|
2599
|
-
<path
|
|
2600
|
-
d="M7.785666666666666 3.5714733333333335C7.785666666666666 2.506353333333333 8.649133333333332 1.6429066666666667 9.714266666666667 1.6429066666666667C10.779399999999999 1.6429066666666667 11.642866666666666 2.506353333333333 11.642866666666666 3.5714733333333335C11.642866666666666 4.636593333333333 10.779399999999999 5.500046666666666 9.714266666666667 5.500046666666666L7.785666666666666 5.500046666666666L7.785666666666666 3.5714733333333335zM9.714266666666667 2.6429066666666667C9.201433333333332 2.6429066666666667 8.785666666666666 3.0586399999999996 8.785666666666666 3.5714733333333335L8.785666666666666 4.500046666666666L9.714266666666667 4.500046666666666C10.2271 4.500046666666666 10.642866666666666 4.084313333333333 10.642866666666666 3.5714733333333335C10.642866666666666 3.0586399999999996 10.2271 2.6429066666666667 9.714266666666667 2.6429066666666667z"
|
|
2601
|
-
fill="currentColor"></path>
|
|
2602
|
-
<path
|
|
2603
|
-
d="M8 3.7856466666666666C8.276133333333332 3.7856466666666666 8.5 4.009499999999999 8.5 4.285646666666667L8.5 13.142800000000001C8.5 13.418933333333332 8.276133333333332 13.642800000000001 8 13.642800000000001C7.723833333333333 13.642800000000001 7.5 13.418933333333332 7.5 13.142800000000001L7.5 4.285646666666667C7.5 4.009499999999999 7.723833333333333 3.7856466666666666 8 3.7856466666666666z"
|
|
2604
|
-
fill="currentColor"></path>
|
|
2605
|
-
</svg>
|
|
2606
|
-
<span>${reserve.desc3.text}</span>
|
|
2607
|
-
<svg style="width: 12px; height: 12px;" xmlns="http://www.w3.org/2000/svg"
|
|
2608
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 12 12" width="12"
|
|
2609
|
-
height="12">
|
|
2610
|
-
<path
|
|
2611
|
-
d="M4.359835 1.609835C4.21339 1.756285 4.21339 1.99372 4.359835 2.140165L8.0429 5.823225C8.140525 5.920875 8.140525 6.079125 8.0429 6.176775L4.359835 9.859825C4.21339 10.006275 4.21339 10.243725 4.359835 10.390175C4.506285 10.5366 4.743725 10.5366 4.89017 10.390175L8.573225 6.7071C8.96375 6.316575 8.96375 5.683425 8.573225 5.2929L4.89017 1.609835C4.743725 1.46339 4.506285 1.46339 4.359835 1.609835z"
|
|
2612
|
-
fill="currentColor"></path>
|
|
2613
|
-
</svg>
|
|
2614
|
-
</div>` : ""}
|
|
2615
|
-
</div>
|
|
2616
|
-
</div>
|
|
2617
|
-
<div class="reserve-button">
|
|
2618
|
-
${button}
|
|
2619
|
-
</div>
|
|
2620
|
-
</div>
|
|
2621
|
-
`;
|
|
2622
|
-
}
|
|
2623
|
-
}
|
|
2624
|
-
}
|
|
2625
|
-
break;
|
|
2626
|
-
case DYNAMIC_TYPE_AV: {
|
|
2627
|
-
basicDynamic();
|
|
2628
|
-
const archive = dynamic.modules.module_dynamic.major.archive;
|
|
2629
|
-
if (archive.badge.text === "投稿视频") if (forward$1) forwardInfo = "投稿了视频";
|
|
2630
|
-
else pubTime = `${pubTime} · 投稿了视频`;
|
|
2631
|
-
main$1 += `
|
|
2632
|
-
<div class="card-video">
|
|
2633
|
-
<div class="video-cover">
|
|
2634
|
-
<img src="${archive.cover}"
|
|
2635
|
-
alt="">
|
|
2636
|
-
<div class="cover-mask"></div>
|
|
2637
|
-
<span>${archive.duration_text}</span>
|
|
2638
|
-
</div>
|
|
2639
|
-
<div class="video-info">
|
|
2640
|
-
<div class="video-info-header">
|
|
2641
|
-
<div class="video-title">
|
|
2642
|
-
${archive.title}
|
|
2643
|
-
</div>
|
|
2644
|
-
<div class="video-introduction">
|
|
2645
|
-
${archive.desc}
|
|
2646
|
-
</div>
|
|
2647
|
-
</div>
|
|
2648
|
-
<div class="video-stat">
|
|
2649
|
-
<div class="video-stat-item">
|
|
2650
|
-
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2651
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2652
|
-
height="16">
|
|
2653
|
-
<path
|
|
2654
|
-
d="M8 3.3320333333333334C6.321186666666667 3.3320333333333334 4.855333333333333 3.4174399999999996 3.820593333333333 3.5013466666666666C3.1014733333333333 3.5596599999999996 2.5440733333333334 4.109013333333333 2.48 4.821693333333333C2.4040466666666664 5.666533333333334 2.333333333333333 6.780666666666666 2.333333333333333 7.998666666666666C2.333333333333333 9.216733333333334 2.4040466666666664 10.330866666666665 2.48 11.175699999999999C2.5440733333333334 11.888366666666666 3.1014733333333333 12.437733333333334 3.820593333333333 12.496066666666666C4.855333333333333 12.579933333333333 6.321186666666667 12.665333333333333 8 12.665333333333333C9.678999999999998 12.665333333333333 11.144933333333334 12.579933333333333 12.179733333333333 12.496033333333333C12.898733333333332 12.4377 13.456 11.888533333333331 13.520066666666667 11.176033333333333C13.595999999999998 10.331533333333333 13.666666666666666 9.217633333333332 13.666666666666666 7.998666666666666C13.666666666666666 6.779766666666667 13.595999999999998 5.665846666666667 13.520066666666667 4.821366666666666C13.456 4.108866666666666 12.898733333333332 3.55968 12.179733333333333 3.5013666666666663C11.144933333333334 3.417453333333333 9.678999999999998 3.3320333333333334 8 3.3320333333333334zM3.7397666666666667 2.50462C4.794879999999999 2.41906 6.288386666666666 2.3320333333333334 8 2.3320333333333334C9.7118 2.3320333333333334 11.2054 2.4190733333333334 12.260533333333331 2.5046399999999998C13.458733333333331 2.6018133333333333 14.407866666666665 3.5285199999999994 14.516066666666667 4.73182C14.593933333333332 5.597933333333334 14.666666666666666 6.7427 14.666666666666666 7.998666666666666C14.666666666666666 9.2547 14.593933333333332 10.399466666666665 14.516066666666667 11.2656C14.407866666666665 12.468866666666665 13.458733333333331 13.395566666666667 12.260533333333331 13.492766666666665C11.2054 13.578333333333333 9.7118 13.665333333333333 8 13.665333333333333C6.288386666666666 13.665333333333333 4.794879999999999 13.578333333333333 3.7397666666666667 13.492799999999999C2.541373333333333 13.395599999999998 1.5922066666666668 12.468633333333333 1.4840200000000001 11.265266666666665C1.4061199999999998 10.3988 1.3333333333333333 9.253866666666667 1.3333333333333333 7.998666666666666C1.3333333333333333 6.743533333333333 1.4061199999999998 5.598579999999999 1.4840200000000001 4.732153333333333C1.5922066666666668 3.5287466666666667 2.541373333333333 2.601793333333333 3.7397666666666667 2.50462z"
|
|
2655
|
-
fill="currentColor"></path>
|
|
2656
|
-
<path
|
|
2657
|
-
d="M9.8092 7.3125C10.338433333333333 7.618066666666666 10.338433333333333 8.382 9.809166666666666 8.687533333333333L7.690799999999999 9.910599999999999C7.161566666666666 10.216133333333332 6.5 9.8342 6.500006666666666 9.223066666666666L6.500006666666666 6.776999999999999C6.500006666666666 6.165873333333334 7.161566666666666 5.783913333333333 7.690799999999999 6.089479999999999L9.8092 7.3125z"
|
|
2658
|
-
fill="currentColor"></path>
|
|
2659
|
-
</svg>
|
|
2660
|
-
<span>${archive.stat.play}</span>
|
|
2661
|
-
</div>
|
|
2662
|
-
<div class="video-stat-item">
|
|
2663
|
-
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2664
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2665
|
-
height="16">
|
|
2666
|
-
<path
|
|
2667
|
-
d="M8 3.3320333333333334C6.321186666666667 3.3320333333333334 4.855333333333333 3.4174399999999996 3.820593333333333 3.5013466666666666C3.1014733333333333 3.5596599999999996 2.5440733333333334 4.109013333333333 2.48 4.821693333333333C2.4040466666666664 5.666533333333334 2.333333333333333 6.780666666666666 2.333333333333333 7.998666666666666C2.333333333333333 9.216733333333334 2.4040466666666664 10.330866666666665 2.48 11.175699999999999C2.5440733333333334 11.888366666666666 3.1014733333333333 12.437733333333334 3.820593333333333 12.496066666666666C4.855333333333333 12.579933333333333 6.321186666666667 12.665333333333333 8 12.665333333333333C9.678999999999998 12.665333333333333 11.144933333333334 12.579933333333333 12.179733333333333 12.496033333333333C12.898733333333332 12.4377 13.456 11.888533333333331 13.520066666666667 11.176033333333333C13.595999999999998 10.331533333333333 13.666666666666666 9.217633333333332 13.666666666666666 7.998666666666666C13.666666666666666 6.779766666666667 13.595999999999998 5.665846666666667 13.520066666666667 4.821366666666666C13.456 4.108866666666666 12.898733333333332 3.55968 12.179733333333333 3.5013666666666663C11.144933333333334 3.417453333333333 9.678999999999998 3.3320333333333334 8 3.3320333333333334zM3.7397666666666667 2.50462C4.794879999999999 2.41906 6.288386666666666 2.3320333333333334 8 2.3320333333333334C9.7118 2.3320333333333334 11.2054 2.4190733333333334 12.260533333333331 2.5046399999999998C13.458733333333331 2.6018133333333333 14.407866666666665 3.5285199999999994 14.516066666666667 4.73182C14.593933333333332 5.597933333333334 14.666666666666666 6.7427 14.666666666666666 7.998666666666666C14.666666666666666 9.2547 14.593933333333332 10.399466666666665 14.516066666666667 11.2656C14.407866666666665 12.468866666666665 13.458733333333331 13.395566666666667 12.260533333333331 13.492766666666665C11.2054 13.578333333333333 9.7118 13.665333333333333 8 13.665333333333333C6.288386666666666 13.665333333333333 4.794879999999999 13.578333333333333 3.7397666666666667 13.492799999999999C2.541373333333333 13.395599999999998 1.5922066666666668 12.468633333333333 1.4840200000000001 11.265266666666665C1.4061199999999998 10.3988 1.3333333333333333 9.253866666666667 1.3333333333333333 7.998666666666666C1.3333333333333333 6.743533333333333 1.4061199999999998 5.598579999999999 1.4840200000000001 4.732153333333333C1.5922066666666668 3.5287466666666667 2.541373333333333 2.601793333333333 3.7397666666666667 2.50462z"
|
|
2668
|
-
fill="currentColor"></path>
|
|
2669
|
-
<path
|
|
2670
|
-
d="M10.583333333333332 7.166666666666666L6.583333333333333 7.166666666666666C6.307193333333332 7.166666666666666 6.083333333333333 6.942799999999999 6.083333333333333 6.666666666666666C6.083333333333333 6.390526666666666 6.307193333333332 6.166666666666666 6.583333333333333 6.166666666666666L10.583333333333332 6.166666666666666C10.859466666666666 6.166666666666666 11.083333333333332 6.390526666666666 11.083333333333332 6.666666666666666C11.083333333333332 6.942799999999999 10.859466666666666 7.166666666666666 10.583333333333332 7.166666666666666z"
|
|
2671
|
-
fill="currentColor"></path>
|
|
2672
|
-
<path
|
|
2673
|
-
d="M11.583333333333332 9.833333333333332L7.583333333333333 9.833333333333332C7.3072 9.833333333333332 7.083333333333333 9.609466666666666 7.083333333333333 9.333333333333332C7.083333333333333 9.0572 7.3072 8.833333333333332 7.583333333333333 8.833333333333332L11.583333333333332 8.833333333333332C11.859466666666666 8.833333333333332 12.083333333333332 9.0572 12.083333333333332 9.333333333333332C12.083333333333332 9.609466666666666 11.859466666666666 9.833333333333332 11.583333333333332 9.833333333333332z"
|
|
2674
|
-
fill="currentColor"></path>
|
|
2675
|
-
<path
|
|
2676
|
-
d="M5.25 6.666666666666666C5.25 6.942799999999999 5.02614 7.166666666666666 4.75 7.166666666666666L4.416666666666666 7.166666666666666C4.140526666666666 7.166666666666666 3.9166666666666665 6.942799999999999 3.9166666666666665 6.666666666666666C3.9166666666666665 6.390526666666666 4.140526666666666 6.166666666666666 4.416666666666666 6.166666666666666L4.75 6.166666666666666C5.02614 6.166666666666666 5.25 6.390526666666666 5.25 6.666666666666666z"
|
|
2677
|
-
fill="currentColor"></path>
|
|
2678
|
-
<path
|
|
2679
|
-
d="M6.25 9.333333333333332C6.25 9.609466666666666 6.02614 9.833333333333332 5.75 9.833333333333332L5.416666666666666 9.833333333333332C5.140526666666666 9.833333333333332 4.916666666666666 9.609466666666666 4.916666666666666 9.333333333333332C4.916666666666666 9.0572 5.140526666666666 8.833333333333332 5.416666666666666 8.833333333333332L5.75 8.833333333333332C6.02614 8.833333333333332 6.25 9.0572 6.25 9.333333333333332z"
|
|
2680
|
-
fill="currentColor"></path>
|
|
2681
|
-
</svg>
|
|
2682
|
-
<span>${archive.stat.danmaku}</span>
|
|
2683
|
-
</div>
|
|
2684
|
-
</div>
|
|
2685
|
-
</div>
|
|
2686
|
-
</div>
|
|
2687
|
-
`;
|
|
2688
|
-
break;
|
|
2689
|
-
}
|
|
2690
|
-
case DYNAMIC_TYPE_LIVE: return [`${upName}发起了直播预约,我暂时无法渲染,请自行查看`];
|
|
2691
|
-
case DYNAMIC_TYPE_MEDIALIST: return [`${upName}分享了收藏夹,我暂时无法渲染,请自行查看`];
|
|
2692
|
-
case DYNAMIC_TYPE_PGC: return [`${upName}发布了剧集(番剧、电影、纪录片),我暂时无法渲染,请自行查看`];
|
|
2693
|
-
case DYNAMIC_TYPE_ARTICLE:
|
|
2694
|
-
if (this.giConfig.filter.enable && this.giConfig.filter.article) throw new Error("已屏蔽专栏动态");
|
|
2695
|
-
return [`${upName}投稿了新专栏,我暂时无法渲染,请自行查看`];
|
|
2696
|
-
case DYNAMIC_TYPE_MUSIC: return [`${upName}发行了新歌,我暂时无法渲染,请自行查看`];
|
|
2697
|
-
case DYNAMIC_TYPE_COMMON_SQUARE: return [`${upName}发布了装扮|剧集|点评|普通分享,我暂时无法渲染,请自行查看`];
|
|
2698
|
-
case DYNAMIC_TYPE_COURSES_SEASON: return [`${upName}发布了新课程,我暂时无法渲染,请自行查看`];
|
|
2699
|
-
case DYNAMIC_TYPE_UGC_SEASON: return [`${upName}更新了合集,我暂时无法渲染,请自行查看`];
|
|
2700
|
-
case DYNAMIC_TYPE_NONE: return [`${upName}发布了一条无效动态`];
|
|
2701
|
-
case DYNAMIC_TYPE_LIVE_RCMD: throw new Error("直播开播动态,不做处理");
|
|
2702
|
-
default: return [`${upName}发布了一条我无法识别的动态,请自行查看`];
|
|
2703
|
-
}
|
|
2704
|
-
return [main$1, forwardInfo];
|
|
2705
|
-
};
|
|
2706
|
-
const [main] = await getDynamicMajor(data, false);
|
|
2707
|
-
let style;
|
|
2708
|
-
if (this.giConfig.enableLargeFont) style = `
|
|
2709
|
-
@font-face {
|
|
2710
|
-
font-family: "NotoColorEmoji";
|
|
2711
|
-
src: url('file://${this.fontPath}') format('truetype');
|
|
2712
|
-
font-display: swap;
|
|
2713
|
-
}
|
|
2714
|
-
|
|
2715
|
-
* {
|
|
2716
|
-
margin: 0;
|
|
2717
|
-
padding: 0;
|
|
2718
|
-
box-sizing: border-box;
|
|
2719
|
-
font-family: "${this.giConfig.font}", "NotoColorEmoji", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2720
|
-
}
|
|
2721
|
-
|
|
2722
|
-
html {
|
|
2723
|
-
width: 800px;
|
|
2724
|
-
height: auto;
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
.background {
|
|
2728
|
-
width: 100%;
|
|
2729
|
-
height: auto;
|
|
2730
|
-
padding: 15px;
|
|
2731
|
-
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2732
|
-
overflow: hidden;
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
.base-plate {
|
|
2736
|
-
width: 100%;
|
|
2737
|
-
height: auto;
|
|
2738
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2739
|
-
padding: ${cardBasePlateBorder};
|
|
2740
|
-
border-radius: 10px;
|
|
2741
|
-
background-color: ${cardBasePlateColor};
|
|
2742
|
-
}
|
|
2743
|
-
|
|
2744
|
-
.card {
|
|
2745
|
-
width: 100%;
|
|
2746
|
-
height: auto;
|
|
2747
|
-
border-radius: 5px;
|
|
2748
|
-
padding: 15px;
|
|
2749
|
-
overflow: hidden;
|
|
2750
|
-
background-color: #fff;
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
.card-body {
|
|
2754
|
-
display: flex;
|
|
2755
|
-
padding: 15px;
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
.card .anchor-avatar {
|
|
2759
|
-
max-width: 70px;
|
|
2760
|
-
/* 设置最大宽度为容器宽度的100% */
|
|
2761
|
-
max-height: 70px;
|
|
2762
|
-
/* 设置最大高度为容器高度的90% */
|
|
2763
|
-
margin-right: 20px;
|
|
2764
|
-
border-radius: 10px;
|
|
2765
|
-
}
|
|
2766
|
-
|
|
2767
|
-
.card .card-body .card-content {
|
|
2768
|
-
width: 100%;
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
.card .card-body .card-content .card-header {
|
|
2772
|
-
width: 100%;
|
|
2773
|
-
display: flex;
|
|
2774
|
-
justify-content: space-between;
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
.card .up-info {
|
|
2778
|
-
display: flex;
|
|
2779
|
-
flex-direction: column;
|
|
2780
|
-
justify-content: space-between;
|
|
2781
|
-
height: 70px;
|
|
2782
|
-
}
|
|
2783
|
-
|
|
2784
|
-
.card .up-info .up-name {
|
|
2785
|
-
font-size: 27px;
|
|
2786
|
-
}
|
|
2787
|
-
|
|
2788
|
-
.card .pub-time {
|
|
2789
|
-
font-size: 20px;
|
|
2790
|
-
color: grey;
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
.card .card-header img {
|
|
2794
|
-
height: 50px;
|
|
2795
|
-
}
|
|
2796
|
-
|
|
2797
|
-
.card .dress-up {
|
|
2798
|
-
position: relative;
|
|
2799
|
-
/* background-image: url('${dynamicCardUrl}');
|
|
2800
|
-
background-size: cover; */
|
|
2801
|
-
font-size: 17px;
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
.card .dress-up img {
|
|
2805
|
-
max-width: 100%;
|
|
2806
|
-
max-height: 100%;
|
|
2807
|
-
}
|
|
2808
|
-
|
|
2809
|
-
.card .dress-up span {
|
|
2810
|
-
position: absolute;
|
|
2811
|
-
color: ${dynamicCardColor};
|
|
2812
|
-
right: 67px;
|
|
2813
|
-
top: 24px;
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
|
-
.card .dyn-title {
|
|
2817
|
-
font-size: 20px;
|
|
2818
|
-
margin-bottom: 10px;
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
.card .card-topic {
|
|
2822
|
-
display: flex;
|
|
2823
|
-
align-items: center;
|
|
2824
|
-
margin-top: 10px;
|
|
2825
|
-
font-size: 20px;
|
|
2826
|
-
color: #008AC5;
|
|
2827
|
-
gap: 3px;
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
|
-
.card .card-details {
|
|
2831
|
-
margin-top: 5px;
|
|
2832
|
-
margin-bottom: 15px;
|
|
2833
|
-
font-size: 22px;
|
|
2834
|
-
width: 90%;
|
|
2835
|
-
}
|
|
2836
|
-
|
|
2837
|
-
.card .card-major {
|
|
2838
|
-
display: flex;
|
|
2839
|
-
flex-wrap: wrap;
|
|
2840
|
-
gap: 5px;
|
|
2841
|
-
}
|
|
2842
|
-
|
|
2843
|
-
.card .card-major .photo-item {
|
|
2844
|
-
border-radius: 10px;
|
|
2845
|
-
overflow: hidden;
|
|
2846
|
-
width: 170px;
|
|
2847
|
-
height: 170px;
|
|
2848
|
-
object-fit: cover;
|
|
2849
|
-
}
|
|
2850
|
-
|
|
2851
|
-
.card .card-major .single-photo-mask {
|
|
2852
|
-
position: absolute;
|
|
2853
|
-
text-align: center;
|
|
2854
|
-
width: 100%;
|
|
2855
|
-
height: 100%;
|
|
2856
|
-
top: 0;
|
|
2857
|
-
left: 0;
|
|
2858
|
-
background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 30%);
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
.card .card-major .single-photo-mask-text {
|
|
2862
|
-
position: absolute;
|
|
2863
|
-
color: #fff;
|
|
2864
|
-
font-size: 24px;
|
|
2865
|
-
right: 0;
|
|
2866
|
-
bottom: 66px;
|
|
2867
|
-
left: 0;
|
|
2868
|
-
text-align: center;
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
.card .card-major .single-photo-mask-arrow {
|
|
2872
|
-
position: absolute;
|
|
2873
|
-
width: 70px;
|
|
2874
|
-
height: 70px;
|
|
2875
|
-
bottom: 7px;
|
|
2876
|
-
left: 50%;
|
|
2877
|
-
transform: translateX(-50%);
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
.card .card-major .single-photo-container {
|
|
2881
|
-
position: relative;
|
|
2882
|
-
max-width: 500px;
|
|
2883
|
-
max-height: 1000px;
|
|
2884
|
-
border-radius: 10px;
|
|
2885
|
-
overflow: hidden;
|
|
2886
|
-
}
|
|
2887
|
-
|
|
2888
|
-
.card .card-major .single-photo-item {
|
|
2889
|
-
max-width: 500px;
|
|
2890
|
-
border-radius: 10px;
|
|
2891
|
-
overflow: hidden;
|
|
2892
|
-
}
|
|
2893
|
-
|
|
2894
|
-
.card .card-major .four-photo-item {
|
|
2895
|
-
width: 170px;
|
|
2896
|
-
height: 170px;
|
|
2897
|
-
object-fit: cover;
|
|
2898
|
-
border-radius: 10px;
|
|
2899
|
-
overflow: hidden;
|
|
2900
|
-
flex-basis: 20%; /* or any value less than 50% */
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
.card .card-stat {
|
|
2904
|
-
display: flex;
|
|
2905
|
-
justify-content: space-between;
|
|
2906
|
-
width: 90%;
|
|
2907
|
-
margin-top: 15px;
|
|
2908
|
-
color: gray;
|
|
2909
|
-
font-size: 14px;
|
|
2910
|
-
}
|
|
2911
|
-
|
|
2912
|
-
.card .card-stat .stat-item {
|
|
2913
|
-
display: flex;
|
|
2914
|
-
align-items: center;
|
|
2915
|
-
gap: 3px;
|
|
2916
|
-
}
|
|
2917
|
-
|
|
2918
|
-
.card .card-video {
|
|
2919
|
-
display: flex;
|
|
2920
|
-
overflow: hidden;
|
|
2921
|
-
border-radius: 5px 0 0 5px;
|
|
2922
|
-
margin-top: 10px;
|
|
2923
|
-
height: 147px;
|
|
2924
|
-
}
|
|
2925
|
-
|
|
2926
2309
|
.card .video-cover {
|
|
2927
2310
|
position: relative;
|
|
2928
2311
|
flex: 2;
|
|
2929
2312
|
overflow: hidden;
|
|
2930
2313
|
}
|
|
2931
|
-
|
|
2314
|
+
|
|
2932
2315
|
.card .video-cover img {
|
|
2933
2316
|
width: 236px;
|
|
2934
2317
|
}
|
|
@@ -2941,7 +2324,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
2941
2324
|
left: 0;
|
|
2942
2325
|
background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 30%);
|
|
2943
2326
|
}
|
|
2944
|
-
|
|
2327
|
+
|
|
2945
2328
|
.card .video-cover span {
|
|
2946
2329
|
position: absolute;
|
|
2947
2330
|
color: #fff;
|
|
@@ -2949,7 +2332,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
2949
2332
|
right: 10px;
|
|
2950
2333
|
bottom: 8px;
|
|
2951
2334
|
}
|
|
2952
|
-
|
|
2335
|
+
|
|
2953
2336
|
.card .video-info {
|
|
2954
2337
|
display: flex;
|
|
2955
2338
|
justify-content: space-between;
|
|
@@ -2961,32 +2344,28 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
2961
2344
|
padding: 12px 16px 10px;
|
|
2962
2345
|
background-color: #fff;
|
|
2963
2346
|
}
|
|
2964
|
-
|
|
2347
|
+
|
|
2965
2348
|
.card .video-info-header .video-title {
|
|
2966
2349
|
font-size: 16px;
|
|
2967
2350
|
}
|
|
2968
|
-
|
|
2351
|
+
|
|
2969
2352
|
.card .video-info-header .video-introduction {
|
|
2970
2353
|
margin-top: 5px;
|
|
2971
2354
|
font-size: 12px;
|
|
2972
2355
|
color: #AAA;
|
|
2973
2356
|
display: -webkit-box;
|
|
2974
|
-
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
2975
2357
|
-webkit-box-orient: vertical;
|
|
2976
|
-
/* 必须设置为 vertical */
|
|
2977
2358
|
-webkit-line-clamp: 2;
|
|
2978
|
-
/* 显示的文本行数 */
|
|
2979
2359
|
overflow: hidden;
|
|
2980
|
-
/* 必须设置为 hidden */
|
|
2981
2360
|
}
|
|
2982
|
-
|
|
2361
|
+
|
|
2983
2362
|
.card .video-stat {
|
|
2984
2363
|
font-size: 12px;
|
|
2985
2364
|
color: #AAA;
|
|
2986
2365
|
display: flex;
|
|
2987
2366
|
gap: 35px
|
|
2988
2367
|
}
|
|
2989
|
-
|
|
2368
|
+
|
|
2990
2369
|
.card .video-stat .video-stat-item {
|
|
2991
2370
|
display: flex;
|
|
2992
2371
|
align-items: center;
|
|
@@ -2998,23 +2377,23 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
2998
2377
|
padding: 12px 10px 14px 10px;
|
|
2999
2378
|
background-color: #F6F7F8;
|
|
3000
2379
|
}
|
|
3001
|
-
|
|
2380
|
+
|
|
3002
2381
|
.card-forward .forward-userinfo {
|
|
3003
2382
|
display: flex;
|
|
3004
2383
|
align-items: center;
|
|
3005
2384
|
gap: 5px;
|
|
3006
|
-
height:
|
|
2385
|
+
height: ${style.forwardUserinfoHeight};
|
|
3007
2386
|
}
|
|
3008
|
-
|
|
2387
|
+
|
|
3009
2388
|
.forward-userinfo img {
|
|
3010
|
-
width:
|
|
3011
|
-
height:
|
|
2389
|
+
width: ${style.forwardAvatarSize};
|
|
2390
|
+
height: ${style.forwardAvatarSize};
|
|
3012
2391
|
border-radius: 50%;
|
|
3013
2392
|
}
|
|
3014
|
-
|
|
2393
|
+
|
|
3015
2394
|
.forward-userinfo span {
|
|
3016
2395
|
color: #61666D;
|
|
3017
|
-
font-size:
|
|
2396
|
+
font-size: ${style.forwardUsernameFont};
|
|
3018
2397
|
}
|
|
3019
2398
|
|
|
3020
2399
|
.card .card-reserve {
|
|
@@ -3026,22 +2405,22 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
3026
2405
|
border-radius: 10px;
|
|
3027
2406
|
background-color: #F6F7F8;
|
|
3028
2407
|
}
|
|
3029
|
-
|
|
2408
|
+
|
|
3030
2409
|
.card-reserve .reserve-title {
|
|
3031
2410
|
font-size: 14px;
|
|
3032
2411
|
color: #18191C;
|
|
3033
2412
|
}
|
|
3034
|
-
|
|
2413
|
+
|
|
3035
2414
|
.card-reserve .reserve-desc {
|
|
3036
2415
|
margin-top: 7px;
|
|
3037
2416
|
font-size: 12px;
|
|
3038
2417
|
color: #9499A0;
|
|
3039
2418
|
}
|
|
3040
|
-
|
|
2419
|
+
|
|
3041
2420
|
.reserve-info .reserve-time {
|
|
3042
2421
|
margin-right: 7px;
|
|
3043
2422
|
}
|
|
3044
|
-
|
|
2423
|
+
|
|
3045
2424
|
.card-reserve .reserve-prize {
|
|
3046
2425
|
display: flex;
|
|
3047
2426
|
align-items: center;
|
|
@@ -3049,7 +2428,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
3049
2428
|
gap: 3px;
|
|
3050
2429
|
color: #00AEEC;
|
|
3051
2430
|
}
|
|
3052
|
-
|
|
2431
|
+
|
|
3053
2432
|
.card .card-reserve .reserve-button button {
|
|
3054
2433
|
border: none;
|
|
3055
2434
|
height: 30px;
|
|
@@ -3057,7 +2436,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
3057
2436
|
font-size: 13px;
|
|
3058
2437
|
border-radius: 7px;
|
|
3059
2438
|
}
|
|
3060
|
-
|
|
2439
|
+
|
|
3061
2440
|
.card .card-reserve .reserve-button .reserve-button-end {
|
|
3062
2441
|
display: flex;
|
|
3063
2442
|
align-items: center;
|
|
@@ -3065,7 +2444,7 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
3065
2444
|
color: #9499A0;
|
|
3066
2445
|
background-color: #E3E5E7;
|
|
3067
2446
|
}
|
|
3068
|
-
|
|
2447
|
+
|
|
3069
2448
|
.card .card-reserve .reserve-button .reserve-button-ing {
|
|
3070
2449
|
display: flex;
|
|
3071
2450
|
align-items: center;
|
|
@@ -3073,384 +2452,640 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
3073
2452
|
color: #FFF;
|
|
3074
2453
|
background-color: #00A0D8;
|
|
3075
2454
|
}
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
2455
|
+
`;
|
|
2456
|
+
}
|
|
2457
|
+
async imgHandler(html) {
|
|
2458
|
+
const htmlPath = `file://${__dirname.replaceAll("\\", "/")}/page/0.html`;
|
|
2459
|
+
const page = await this.ctx.puppeteer.page();
|
|
2460
|
+
await page.goto(htmlPath);
|
|
2461
|
+
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
2462
|
+
const elementHandle = await page.$("html");
|
|
2463
|
+
const boundingBox = await elementHandle.boundingBox();
|
|
2464
|
+
const buffer = await page.screenshot({
|
|
2465
|
+
type: "jpeg",
|
|
2466
|
+
clip: {
|
|
2467
|
+
x: boundingBox.x,
|
|
2468
|
+
y: boundingBox.y,
|
|
2469
|
+
width: boundingBox.width,
|
|
2470
|
+
height: boundingBox.height
|
|
2471
|
+
}
|
|
2472
|
+
});
|
|
2473
|
+
await elementHandle.dispose();
|
|
2474
|
+
await page.close();
|
|
2475
|
+
return buffer;
|
|
2476
|
+
}
|
|
2477
|
+
async generateLiveImg(data, username, userface, liveData, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
2478
|
+
const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
|
|
2479
|
+
const html = `
|
|
2480
|
+
<!DOCTYPE html>
|
|
2481
|
+
<html>
|
|
2482
|
+
<head>
|
|
2483
|
+
<title>直播通知</title>
|
|
2484
|
+
<style>
|
|
2485
|
+
* {
|
|
2486
|
+
margin: 0;
|
|
2487
|
+
padding: 0;
|
|
2488
|
+
box-sizing: border-box;
|
|
2489
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
html {
|
|
2493
|
+
width: 800px;
|
|
2494
|
+
height: auto;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
.background {
|
|
2498
|
+
width: 100%;
|
|
2499
|
+
height: auto;
|
|
2500
|
+
padding: 15px;
|
|
2501
|
+
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2502
|
+
overflow: hidden;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
.base-plate {
|
|
2506
|
+
width: 100%;
|
|
2507
|
+
height: auto;
|
|
2508
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2509
|
+
padding: ${cardBasePlateBorder};
|
|
2510
|
+
border-radius: 10px;
|
|
2511
|
+
background-color: ${cardBasePlateColor};
|
|
2512
|
+
}
|
|
3083
2513
|
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
width: 800px;
|
|
3093
|
-
height: auto;
|
|
3094
|
-
}
|
|
3095
|
-
|
|
3096
|
-
.background {
|
|
3097
|
-
width: 100%;
|
|
3098
|
-
height: auto;
|
|
3099
|
-
padding: 15px;
|
|
3100
|
-
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
3101
|
-
overflow: hidden;
|
|
3102
|
-
}
|
|
2514
|
+
.card {
|
|
2515
|
+
width: 100%;
|
|
2516
|
+
height: auto;
|
|
2517
|
+
border-radius: 5px;
|
|
2518
|
+
padding: 15px;
|
|
2519
|
+
overflow: hidden;
|
|
2520
|
+
background-color: #fff;
|
|
2521
|
+
}
|
|
3103
2522
|
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
2523
|
+
.card img {
|
|
2524
|
+
border-radius: 5px 5px 0 0;
|
|
2525
|
+
max-width: 100%;
|
|
2526
|
+
/* 设置最大宽度为容器宽度的100% */
|
|
2527
|
+
max-height: 80%;
|
|
2528
|
+
/* 设置最大高度为容器高度的90% */
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
.card-header {
|
|
2532
|
+
display: flex;
|
|
2533
|
+
justify-content: space-between;
|
|
2534
|
+
align-items: center;
|
|
2535
|
+
margin-top: 5px;
|
|
2536
|
+
margin-bottom: 10px;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
.card-title {
|
|
2540
|
+
line-height: 50px;
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
.card-body {
|
|
2544
|
+
padding: 2px 16px;
|
|
2545
|
+
margin-bottom: 10px;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
.live-broadcast-info {
|
|
2549
|
+
display: flex;
|
|
2550
|
+
align-items: center;
|
|
2551
|
+
margin-bottom: 10px;
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
.anchor-avatar {
|
|
2555
|
+
width: 50px;
|
|
2556
|
+
/* 主播头像大小 */
|
|
2557
|
+
height: auto;
|
|
2558
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
.broadcast-message {
|
|
2562
|
+
display: inline-block;
|
|
2563
|
+
margin-left: 10px;
|
|
2564
|
+
font-size: 20px;
|
|
2565
|
+
color: #333;
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
.card-text {
|
|
2569
|
+
color: grey;
|
|
2570
|
+
font-size: 20px;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
.card-link {
|
|
2574
|
+
display: flex;
|
|
2575
|
+
justify-content: space-between;
|
|
2576
|
+
text-decoration: none;
|
|
2577
|
+
font-size: 20px;
|
|
2578
|
+
margin-top: 10px;
|
|
2579
|
+
margin-bottom: 10px;
|
|
2580
|
+
}
|
|
2581
|
+
</style>
|
|
2582
|
+
</head>
|
|
2583
|
+
<body>
|
|
2584
|
+
<div class="background">
|
|
2585
|
+
<div ${this.giConfig.removeBorder ? "" : "class=\"base-plate\""}>
|
|
2586
|
+
<div class="card">
|
|
2587
|
+
<img src="${cover ? data.user_cover : data.keyframe}"
|
|
2588
|
+
alt="封面">
|
|
2589
|
+
<div class="card-body">
|
|
2590
|
+
<div class="card-header">
|
|
2591
|
+
<h1 class="card-title">${data.title}</h1>
|
|
2592
|
+
<div class="live-broadcast-info">
|
|
2593
|
+
<!-- 主播头像 -->
|
|
2594
|
+
<img style="border-radius: 10px; margin-left: 10px" class="anchor-avatar"
|
|
2595
|
+
src="${userface}" alt="主播头像">
|
|
2596
|
+
<span class="broadcast-message">${username}${titleStatus}</span>
|
|
2597
|
+
</div>
|
|
2598
|
+
</div>
|
|
2599
|
+
${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
|
|
2600
|
+
<p class="card-link">
|
|
2601
|
+
<span>${liveStatus === 3 ? `本场直播点赞数:${this.numberToStr(+liveData.likedNum)}` : `人气:${this.numberToStr(data.online)}`}</span>
|
|
2602
|
+
<span>分区名称:${data.area_name}</span>
|
|
2603
|
+
</p>
|
|
2604
|
+
<p class="card-link">
|
|
2605
|
+
<span>${liveTime}</span>
|
|
2606
|
+
${this.giConfig.followerDisplay ? `
|
|
2607
|
+
<span>
|
|
2608
|
+
${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
|
|
2609
|
+
</span>` : ""}
|
|
2610
|
+
</p>
|
|
2611
|
+
</div>
|
|
2612
|
+
</div>
|
|
2613
|
+
</div>
|
|
2614
|
+
</div>
|
|
2615
|
+
</body>
|
|
2616
|
+
</html>
|
|
2617
|
+
`;
|
|
2618
|
+
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2619
|
+
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
static BG_COLOR = {
|
|
2623
|
+
[blive_message_listener.GuardLevel.None]: ["#4ebcec", "#F9CCDF"],
|
|
2624
|
+
[blive_message_listener.GuardLevel.Jianzhang]: ["#4ebcec", "#b494e5"],
|
|
2625
|
+
[blive_message_listener.GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
|
|
2626
|
+
[blive_message_listener.GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
|
|
2627
|
+
};
|
|
2628
|
+
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
|
|
2629
|
+
const bgColor = GenerateImg.BG_COLOR[guardLevel];
|
|
2630
|
+
const desc = {
|
|
2631
|
+
[blive_message_listener.GuardLevel.Jianzhang]: () => {
|
|
2632
|
+
return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
|
|
2633
|
+
},
|
|
2634
|
+
[blive_message_listener.GuardLevel.Tidu]: () => {
|
|
2635
|
+
return `"${uname}"就任<br/>"${masterName}"大航海舰队提督!`;
|
|
2636
|
+
},
|
|
2637
|
+
[blive_message_listener.GuardLevel.Zongdu]: () => {
|
|
2638
|
+
return `"${uname}"上任<br/>"${masterName}"大航海舰队总督!`;
|
|
2639
|
+
}
|
|
2640
|
+
};
|
|
2641
|
+
const html = `
|
|
2642
|
+
<!DOCTYPE html>
|
|
2643
|
+
<html>
|
|
3166
2644
|
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
2645
|
+
<head>
|
|
2646
|
+
<title>上舰通知</title>
|
|
2647
|
+
<style>
|
|
2648
|
+
* {
|
|
2649
|
+
margin: 0;
|
|
2650
|
+
padding: 0;
|
|
2651
|
+
box-sizing: border-box;
|
|
2652
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2653
|
+
}
|
|
3176
2654
|
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
2655
|
+
html {
|
|
2656
|
+
width: 430px;
|
|
2657
|
+
height: auto;
|
|
2658
|
+
}
|
|
3181
2659
|
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
2660
|
+
.bg {
|
|
2661
|
+
display: flex;
|
|
2662
|
+
justify-content: center;
|
|
2663
|
+
align-items: center;
|
|
2664
|
+
width: 430px;
|
|
2665
|
+
height: 220px;
|
|
2666
|
+
background: linear-gradient(to right bottom, ${bgColor[0]}, ${bgColor[1]});
|
|
2667
|
+
}
|
|
3188
2668
|
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
2669
|
+
.baseplate {
|
|
2670
|
+
display: flex;
|
|
2671
|
+
justify-content: space-between;
|
|
2672
|
+
align-items: center;
|
|
2673
|
+
border-radius: 10px;
|
|
2674
|
+
width: 410px;
|
|
2675
|
+
height: 200px;
|
|
2676
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2677
|
+
background-color: rgba(255, 255, 255, 0.65);
|
|
2678
|
+
backdrop-filter: blur(10px);
|
|
2679
|
+
}
|
|
3193
2680
|
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
.card .card-details {
|
|
3203
|
-
margin-bottom: 15px;
|
|
3204
|
-
width: 90%;
|
|
3205
|
-
}
|
|
3206
|
-
|
|
3207
|
-
.card .card-major {
|
|
3208
|
-
display: flex;
|
|
3209
|
-
flex-wrap: wrap;
|
|
3210
|
-
gap: 5px;
|
|
3211
|
-
}
|
|
3212
|
-
|
|
3213
|
-
.card .card-major .photo-item {
|
|
3214
|
-
border-radius: 10px;
|
|
3215
|
-
overflow: hidden;
|
|
3216
|
-
width: 170px;
|
|
3217
|
-
height: 170px;
|
|
3218
|
-
object-fit: cover;
|
|
3219
|
-
}
|
|
2681
|
+
.info {
|
|
2682
|
+
flex: 1;
|
|
2683
|
+
height: 100%;
|
|
2684
|
+
display: flex;
|
|
2685
|
+
flex-direction: column;
|
|
2686
|
+
justify-content: space-between;
|
|
2687
|
+
padding: 10px 0 10px 10px;
|
|
2688
|
+
}
|
|
3220
2689
|
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
height: 100%;
|
|
3226
|
-
top: 0;
|
|
3227
|
-
left: 0;
|
|
3228
|
-
background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 30%);
|
|
3229
|
-
}
|
|
2690
|
+
.user {
|
|
2691
|
+
display: flex;
|
|
2692
|
+
gap: 10px;
|
|
2693
|
+
}
|
|
3230
2694
|
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
left: 0;
|
|
3238
|
-
text-align: center;
|
|
3239
|
-
}
|
|
2695
|
+
.avatar {
|
|
2696
|
+
height: 90px;
|
|
2697
|
+
width: 90px;
|
|
2698
|
+
border-radius: 50%;
|
|
2699
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2700
|
+
}
|
|
3240
2701
|
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
transform: translateX(-50%);
|
|
3248
|
-
}
|
|
2702
|
+
.avatar img {
|
|
2703
|
+
width: 100%;
|
|
2704
|
+
height: 100%;
|
|
2705
|
+
border-radius: 50%;
|
|
2706
|
+
border: 3px solid white;
|
|
2707
|
+
}
|
|
3249
2708
|
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
2709
|
+
.user-info {
|
|
2710
|
+
display: flex;
|
|
2711
|
+
flex-direction: column;
|
|
2712
|
+
align-items: flex-start;
|
|
2713
|
+
gap: 7px;
|
|
2714
|
+
margin-top: 10px;
|
|
2715
|
+
}
|
|
3257
2716
|
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
2717
|
+
.name-badge {
|
|
2718
|
+
display: flex;
|
|
2719
|
+
align-items: center;
|
|
2720
|
+
height: 30px;
|
|
2721
|
+
background-color: ${bgColor[0]};
|
|
2722
|
+
border-radius: 25px;
|
|
2723
|
+
color: white;
|
|
2724
|
+
padding: 0 10px;
|
|
2725
|
+
border: solid 2px white;
|
|
2726
|
+
overflow: hidden;
|
|
2727
|
+
}
|
|
3263
2728
|
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
.card .card-stat {
|
|
3274
|
-
display: flex;
|
|
3275
|
-
justify-content: space-between;
|
|
3276
|
-
width: 90%;
|
|
3277
|
-
margin-top: 15px;
|
|
3278
|
-
color: gray;
|
|
3279
|
-
font-size: 14px;
|
|
3280
|
-
}
|
|
3281
|
-
|
|
3282
|
-
.card .card-stat .stat-item {
|
|
3283
|
-
display: flex;
|
|
3284
|
-
align-items: center;
|
|
3285
|
-
gap: 3px;
|
|
3286
|
-
}
|
|
2729
|
+
.name-badge span {
|
|
2730
|
+
max-width: 100px;
|
|
2731
|
+
white-space: nowrap;
|
|
2732
|
+
text-overflow: ellipsis;
|
|
2733
|
+
overflow: hidden;
|
|
2734
|
+
font-weight: bold;
|
|
2735
|
+
font-size: 12px;
|
|
2736
|
+
}
|
|
3287
2737
|
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
flex: 2;
|
|
3299
|
-
overflow: hidden;
|
|
3300
|
-
}
|
|
3301
|
-
|
|
3302
|
-
.card .video-cover img {
|
|
3303
|
-
width: 236px;
|
|
3304
|
-
}
|
|
2738
|
+
.accompany {
|
|
2739
|
+
display: flex;
|
|
2740
|
+
gap: 5px;
|
|
2741
|
+
align-items: center;
|
|
2742
|
+
height: 25px;
|
|
2743
|
+
background-color: ${bgColor[0]};
|
|
2744
|
+
border-radius: 25px;
|
|
2745
|
+
border: solid 2px white;
|
|
2746
|
+
overflow: hidden;
|
|
2747
|
+
}
|
|
3305
2748
|
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
}
|
|
3314
|
-
|
|
3315
|
-
.card .video-cover span {
|
|
3316
|
-
position: absolute;
|
|
3317
|
-
color: #fff;
|
|
3318
|
-
font-size: 14px;
|
|
3319
|
-
right: 10px;
|
|
3320
|
-
bottom: 8px;
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3323
|
-
.card .video-info {
|
|
3324
|
-
display: flex;
|
|
3325
|
-
justify-content: space-between;
|
|
3326
|
-
flex-direction: column;
|
|
3327
|
-
flex: 3;
|
|
3328
|
-
border: #e5e7e9 1px solid;
|
|
3329
|
-
border-left: none;
|
|
3330
|
-
border-radius: 0 5px 5px 0;
|
|
3331
|
-
padding: 12px 16px 10px;
|
|
3332
|
-
background-color: #fff;
|
|
3333
|
-
}
|
|
3334
|
-
|
|
3335
|
-
.card .video-info-header .video-title {
|
|
3336
|
-
font-size: 16px;
|
|
3337
|
-
}
|
|
3338
|
-
|
|
3339
|
-
.card .video-info-header .video-introduction {
|
|
3340
|
-
margin-top: 5px;
|
|
3341
|
-
font-size: 12px;
|
|
3342
|
-
color: #AAA;
|
|
3343
|
-
display: -webkit-box;
|
|
3344
|
-
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
3345
|
-
-webkit-box-orient: vertical;
|
|
3346
|
-
/* 必须设置为 vertical */
|
|
3347
|
-
-webkit-line-clamp: 2;
|
|
3348
|
-
/* 显示的文本行数 */
|
|
3349
|
-
overflow: hidden;
|
|
3350
|
-
/* 必须设置为 hidden */
|
|
3351
|
-
}
|
|
3352
|
-
|
|
3353
|
-
.card .video-stat {
|
|
3354
|
-
font-size: 12px;
|
|
3355
|
-
color: #AAA;
|
|
3356
|
-
display: flex;
|
|
3357
|
-
gap: 35px
|
|
3358
|
-
}
|
|
3359
|
-
|
|
3360
|
-
.card .video-stat .video-stat-item {
|
|
3361
|
-
display: flex;
|
|
3362
|
-
align-items: center;
|
|
3363
|
-
gap: 3px;
|
|
3364
|
-
}
|
|
2749
|
+
.master-avatar {
|
|
2750
|
+
width: 25px;
|
|
2751
|
+
height: 25px;
|
|
2752
|
+
border-radius: 50%;
|
|
2753
|
+
background: url("${masterAvatarUrl}") no-repeat center;
|
|
2754
|
+
background-size: cover;
|
|
2755
|
+
}
|
|
3365
2756
|
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
height: 30px;
|
|
3377
|
-
}
|
|
3378
|
-
|
|
3379
|
-
.forward-userinfo img {
|
|
3380
|
-
width: 20px;
|
|
3381
|
-
height: 20px;
|
|
3382
|
-
border-radius: 50%;
|
|
3383
|
-
}
|
|
3384
|
-
|
|
3385
|
-
.forward-userinfo span {
|
|
3386
|
-
color: #61666D;
|
|
3387
|
-
font-size: 15px;
|
|
3388
|
-
}
|
|
2757
|
+
.accompany span {
|
|
2758
|
+
max-width: 85px;
|
|
2759
|
+
white-space: nowrap;
|
|
2760
|
+
text-overflow: ellipsis;
|
|
2761
|
+
overflow: hidden;
|
|
2762
|
+
color: white;
|
|
2763
|
+
font-size: 10px;
|
|
2764
|
+
font-weight: bold;
|
|
2765
|
+
margin-right: 5px;
|
|
2766
|
+
}
|
|
3389
2767
|
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
2768
|
+
.desc {
|
|
2769
|
+
margin-bottom: 10px;
|
|
2770
|
+
font-size: 16px;
|
|
2771
|
+
font-weight: bold;
|
|
2772
|
+
font-style: italic;
|
|
2773
|
+
color: #333;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
.captain {
|
|
2777
|
+
width: 175px;
|
|
2778
|
+
height: 175px;
|
|
2779
|
+
background: url("${captainImgUrl}") no-repeat center;
|
|
2780
|
+
background-size: cover;
|
|
2781
|
+
}
|
|
2782
|
+
</style>
|
|
2783
|
+
</head>
|
|
2784
|
+
|
|
2785
|
+
<body>
|
|
2786
|
+
<div class="bg">
|
|
2787
|
+
<div class="baseplate">
|
|
2788
|
+
<div class="info">
|
|
2789
|
+
<div class="user">
|
|
2790
|
+
<div class="avatar">
|
|
2791
|
+
<img src="${face}" alt="用户头像">
|
|
2792
|
+
</div>
|
|
2793
|
+
<div class="user-info">
|
|
2794
|
+
<div class="name-badge">
|
|
2795
|
+
<span>${uname}</span>
|
|
2796
|
+
</div>
|
|
2797
|
+
<div class="accompany">
|
|
2798
|
+
<div class="master-avatar"></div><span>${isAdmin ? "房管" : masterName}</span>
|
|
2799
|
+
</div>
|
|
2800
|
+
</div>
|
|
2801
|
+
</div>
|
|
2802
|
+
<div class="desc">
|
|
2803
|
+
${desc[guardLevel]()}
|
|
2804
|
+
</div>
|
|
2805
|
+
</div>
|
|
2806
|
+
<div class="captain"></div>
|
|
2807
|
+
</div>
|
|
2808
|
+
</div>
|
|
2809
|
+
</body>
|
|
2810
|
+
|
|
2811
|
+
</html>
|
|
2812
|
+
`;
|
|
2813
|
+
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2814
|
+
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
richTextParser(rt, title) {
|
|
2818
|
+
const richText = rt.reduce((accumulator, currentValue) => {
|
|
2819
|
+
if (currentValue.emoji) return `${accumulator}<img style="width:17px; height:17px;" src="${currentValue.emoji.icon_url}"/>`;
|
|
2820
|
+
return accumulator + currentValue.text;
|
|
2821
|
+
}, "");
|
|
2822
|
+
if (this.giConfig.filter.enable) {
|
|
2823
|
+
if (this.giConfig.filter.regex) {
|
|
2824
|
+
if (new RegExp(this.giConfig.filter.regex).test(richText)) throw new Error("出现关键词,屏蔽该动态");
|
|
2825
|
+
}
|
|
2826
|
+
if (this.giConfig.filter.keywords.length !== 0 && this.giConfig.filter.keywords.some((keyword) => richText.includes(keyword))) throw new Error("出现关键词,屏蔽该动态");
|
|
2827
|
+
}
|
|
2828
|
+
const text = richText.replace(/\n/g, "<br>");
|
|
2829
|
+
return `
|
|
2830
|
+
<div class="card-details">
|
|
2831
|
+
${title ? `<h1 class="dyn-title">${title}</h1>` : ""}
|
|
2832
|
+
${text}
|
|
2833
|
+
</div>
|
|
2834
|
+
`;
|
|
2835
|
+
}
|
|
2836
|
+
async generateDynamicImg(data, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
2837
|
+
const module_author = data.modules.module_author;
|
|
2838
|
+
const avatarUrl = module_author.face;
|
|
2839
|
+
const upName = module_author.name;
|
|
2840
|
+
let pubTime = this.unixTimestampToString(module_author.pub_ts);
|
|
2841
|
+
let dynamicCardUrl;
|
|
2842
|
+
let dynamicCardId;
|
|
2843
|
+
let dynamicCardColor;
|
|
2844
|
+
if (module_author.decorate) {
|
|
2845
|
+
dynamicCardUrl = module_author.decorate.card_url;
|
|
2846
|
+
dynamicCardId = module_author.decorate.fan.num_str;
|
|
2847
|
+
dynamicCardColor = module_author.decorate.fan.color;
|
|
2848
|
+
}
|
|
2849
|
+
const module_stat = data.modules.module_stat;
|
|
2850
|
+
const comment = module_stat.comment.count;
|
|
2851
|
+
const forward = module_stat.forward.count;
|
|
2852
|
+
const like = module_stat.like.count;
|
|
2853
|
+
const topic = data.modules.module_dynamic.topic ? data.modules.module_dynamic.topic.name : "";
|
|
2854
|
+
const getDynamicMajor = async (dynamic, forward$1) => {
|
|
2855
|
+
let main$1 = "";
|
|
2856
|
+
let forwardInfo;
|
|
2857
|
+
const basicDynamic = () => {
|
|
2858
|
+
const module_dynamic = dynamic.modules.module_dynamic;
|
|
2859
|
+
if (module_dynamic?.desc?.rich_text_nodes) {
|
|
2860
|
+
const content = this.richTextParser(module_dynamic.desc.rich_text_nodes);
|
|
2861
|
+
main$1 += content;
|
|
2862
|
+
}
|
|
2863
|
+
if (module_dynamic?.major?.opus?.summary?.rich_text_nodes) {
|
|
2864
|
+
const content = this.richTextParser(module_dynamic.major.opus.summary.rich_text_nodes, module_dynamic.major.opus.title);
|
|
2865
|
+
main$1 += content;
|
|
2866
|
+
}
|
|
2867
|
+
let major = "";
|
|
2868
|
+
const arrowImg = (0, node_url.pathToFileURL)((0, node_path.resolve)(__dirname, "img/arrow.png"));
|
|
2869
|
+
if (module_dynamic?.major?.opus?.pics) {
|
|
2870
|
+
if (module_dynamic.major.opus.pics.length === 1) if (module_dynamic.major.opus.pics[0].height > 3e3) major += `
|
|
2871
|
+
<div class="single-photo-container">
|
|
2872
|
+
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2873
|
+
<div class="single-photo-mask">
|
|
2874
|
+
<span class="single-photo-mask-text">点击链接浏览全部</span>
|
|
2875
|
+
</div>
|
|
2876
|
+
<img class="single-photo-mask-arrow" src="${arrowImg}"/>
|
|
2877
|
+
</div>
|
|
2878
|
+
`;
|
|
2879
|
+
else major += `
|
|
2880
|
+
<div class="single-photo-container">
|
|
2881
|
+
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2882
|
+
</div>
|
|
2883
|
+
`;
|
|
2884
|
+
else if (module_dynamic.major.opus.pics.length === 4) major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2885
|
+
return `${acc}<img class="four-photo-item" src="${cV.url}"/>`;
|
|
2886
|
+
}, "");
|
|
2887
|
+
else major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2888
|
+
return `${acc}<img class="photo-item" src="${cV.url}"/>`;
|
|
2889
|
+
}, "");
|
|
2890
|
+
main$1 += `
|
|
2891
|
+
<div class="card-major">
|
|
2892
|
+
${major}
|
|
2893
|
+
</div>
|
|
2894
|
+
`;
|
|
2895
|
+
}
|
|
2896
|
+
};
|
|
2897
|
+
switch (dynamic.type) {
|
|
2898
|
+
case DYNAMIC_TYPE_WORD:
|
|
2899
|
+
case DYNAMIC_TYPE_DRAW:
|
|
2900
|
+
case DYNAMIC_TYPE_FORWARD:
|
|
2901
|
+
basicDynamic();
|
|
2902
|
+
if (dynamic.type === DYNAMIC_TYPE_FORWARD) {
|
|
2903
|
+
if (this.giConfig.filter.enable && this.giConfig.filter.forward) throw new Error("已屏蔽转发动态");
|
|
2904
|
+
const forward_module_author = dynamic.orig.modules.module_author;
|
|
2905
|
+
const forwardUserAvatarUrl = forward_module_author.face;
|
|
2906
|
+
const forwardUserName = forward_module_author.name;
|
|
2907
|
+
const [forwardMain, forwardInfo$1] = await getDynamicMajor(dynamic.orig, true);
|
|
2908
|
+
main$1 += `
|
|
2909
|
+
<div class="card-forward">
|
|
2910
|
+
<div class="forward-userinfo">
|
|
2911
|
+
<img class="forward-avatar" src="${forwardUserAvatarUrl}" alt="avatar">
|
|
2912
|
+
<span class="forward-username">${forwardUserName} ${forwardInfo$1 ? forwardInfo$1 : ""}</span>
|
|
2913
|
+
</div>
|
|
2914
|
+
<div class="forward-main">
|
|
2915
|
+
${forwardMain}
|
|
2916
|
+
</div>
|
|
2917
|
+
</div>
|
|
2918
|
+
`;
|
|
2919
|
+
}
|
|
2920
|
+
if (dynamic.modules.module_dynamic.additional) {
|
|
2921
|
+
const additional = dynamic.modules.module_dynamic.additional;
|
|
2922
|
+
switch (additional.type) {
|
|
2923
|
+
case ADDITIONAL_TYPE_RESERVE: {
|
|
2924
|
+
const reserve = additional.reserve;
|
|
2925
|
+
let button;
|
|
2926
|
+
if (reserve.button.uncheck.text === "已结束") button = `
|
|
2927
|
+
<button class="reserve-button-end">
|
|
2928
|
+
<span>${reserve.button.uncheck.text}</span>
|
|
2929
|
+
</button>
|
|
2930
|
+
`;
|
|
2931
|
+
else button = `
|
|
2932
|
+
<button class="reserve-button-ing">
|
|
2933
|
+
<svg class="bili-dyn-card-reserve__action__icon" style="width: 16px; height: 16px;"
|
|
2934
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
2935
|
+
viewBox="0 0 16 16" width="16" height="16">
|
|
2936
|
+
<path
|
|
2937
|
+
d="M3.0000133333333334 6.999199999999999C3.0000133333333334 4.23776 5.2385866666666665 1.9991866666666667 8 1.9991866666666667C10.761433333333333 1.9991866666666667 13 4.23776 13 6.999199999999999L13 9.860933333333332C13 9.923533333333333 13.024899999999999 9.983633333333334 13.069199999999999 10.027933333333333L13.588366666666666 10.5471C14.389533333333333 11.348299999999998 13.914133333333334 12.734533333333333 12.754199999999999 12.8183C11.535999999999998 12.906233333333333 9.818933333333334 12.999199999999998 8 12.999199999999998C6.181073333333334 12.999199999999998 4.464026666666666 12.906233333333333 3.2458266666666664 12.8183C2.0859066666666664 12.734533333333333 1.61046 11.348299999999998 2.4116466666666665 10.547133333333333L2.93084 10.027933333333333C2.975133333333333 9.983633333333334 3.0000133333333334 9.923533333333333 3.0000133333333334 9.860933333333332L3.0000133333333334 6.999199999999999zM8 2.9991866666666667C5.790873333333334 2.9991866666666667 4.000013333333333 4.790046666666666 4.000013333333333 6.999199999999999L4.000013333333333 9.860933333333332C4.000013333333333 10.1888 3.8697733333333333 10.5032 3.6379466666666667 10.735033333333334L3.1187466666666666 11.254233333333334C2.911966666666667 11.461 3.0317600000000002 11.800199999999998 3.317833333333333 11.820899999999998C4.5211266666666665 11.907766666666667 6.212726666666666 11.999199999999998 8 11.999199999999998C9.787266666666666 11.999199999999998 11.4789 11.907733333333333 12.682199999999998 11.820899999999998C12.968233333333332 11.800199999999998 13.088033333333332 11.461 12.881266666666665 11.254233333333334L12.362066666666665 10.735033333333334C12.130233333333333 10.5032 12 10.1888 12 9.860933333333332L12 6.999199999999999C12 4.790046666666666 10.209166666666667 2.9991866666666667 8 2.9991866666666667z"
|
|
2938
|
+
fill="currentColor"></path>
|
|
2939
|
+
<path
|
|
2940
|
+
d="M8.720066666666666 2.0260466666666668C8.720066666666666 2.42372 8.397666666666666 2.746093333333333 8 2.746093333333333C7.602333333333332 2.746093333333333 7.279933333333333 2.42372 7.279933333333333 2.0260466666666668C7.279933333333333 1.6283666666666667 7.602333333333332 1.3059866666666666 8 1.3059866666666666C8.397666666666666 1.3059866666666666 8.720066666666666 1.6283666666666667 8.720066666666666 2.0260466666666668z"
|
|
2941
|
+
fill="currentColor"></path>
|
|
2942
|
+
<path
|
|
2943
|
+
d="M6.791266666666666 12.499199999999998C6.791266666666666 13.173966666666667 7.335266666666667 13.715866666666665 8 13.715866666666665C8.664766666666665 13.715866666666665 9.208733333333333 13.173966666666667 9.208733333333333 12.499199999999998L10.208733333333333 12.499199999999998C10.208733333333333 13.720566666666667 9.2227 14.715866666666665 8 14.715866666666665C6.777346666666666 14.715866666666665 5.791273333333333 13.720566666666667 5.791273333333333 12.499199999999998L6.791266666666666 12.499199999999998z"
|
|
2944
|
+
fill="currentColor"></path>
|
|
2945
|
+
</svg>
|
|
2946
|
+
<span>${reserve.button.uncheck.text}</span>
|
|
2947
|
+
</button>
|
|
2948
|
+
`;
|
|
2949
|
+
main$1 += `
|
|
2950
|
+
<div class="card-reserve">
|
|
2951
|
+
<div class="reserve-main">
|
|
2952
|
+
<div class="reserve-title">
|
|
2953
|
+
${reserve.title}
|
|
2954
|
+
</div>
|
|
2955
|
+
<div class="reserve-desc">
|
|
2956
|
+
<div class="reserve-info">
|
|
2957
|
+
<span class="reserve-time">${reserve.desc1.text}</span>
|
|
2958
|
+
<span class="reserve-num">${reserve.desc2.text}</span>
|
|
2959
|
+
</div>
|
|
2960
|
+
${reserve.desc3 ? `<div class="reserve-prize">
|
|
2961
|
+
<svg class="bili-dyn-card-reserve__lottery__icon"
|
|
2962
|
+
style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2963
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2964
|
+
height="16">
|
|
2965
|
+
<path
|
|
2966
|
+
d="M2.99998 7.785666666666666C3.2761266666666664 7.785666666666666 3.49998 8.0095 3.49998 8.285666666666666L3.49998 12.285666666666666C3.49998 12.719566666666667 3.8517599999999996 13.071333333333332 4.285693333333333 13.071333333333332L11.714266666666667 13.071333333333332C12.1482 13.071333333333332 12.5 12.719566666666667 12.5 12.285666666666666L12.5 8.285666666666666C12.5 8.0095 12.723833333333333 7.785666666666666 13 7.785666666666666C13.276133333333334 7.785666666666666 13.5 8.0095 13.5 8.285666666666666L13.5 12.285666666666666C13.5 13.271866666666668 12.7005 14.071333333333332 11.714266666666667 14.071333333333332L4.285693333333333 14.071333333333332C3.2994733333333333 14.071333333333332 2.49998 13.271866666666668 2.49998 12.285666666666666L2.49998 8.285666666666666C2.49998 8.0095 2.7238399999999996 7.785666666666666 2.99998 7.785666666666666z"
|
|
2967
|
+
fill="currentColor"></path>
|
|
2968
|
+
<path
|
|
2969
|
+
d="M1.9285533333333333 5.857139999999999C1.9285533333333333 5.107613333333333 2.5361666666666665 4.5 3.285693333333333 4.5L12.714266666666667 4.5C13.463799999999999 4.5 14.071399999999999 5.107613333333333 14.071399999999999 5.857139999999999L14.071399999999999 7.134066666666667C14.071399999999999 7.793799999999999 13.590066666666667 8.373766666666667 12.905000000000001 8.4432C12.058933333333332 8.528966666666665 10.470166666666666 8.642866666666666 8 8.642866666666666C5.529819999999999 8.642866666666666 3.9410399999999997 8.528966666666665 3.09498 8.4432C2.4099066666666666 8.373766666666667 1.9285533333333333 7.793799999999999 1.9285533333333333 7.134066666666667L1.9285533333333333 5.857139999999999zM3.285693333333333 5.5C3.088453333333333 5.5 2.9285533333333333 5.6599 2.9285533333333333 5.857139999999999L2.9285533333333333 7.134066666666667C2.9285533333333333 7.3082 3.0432666666666663 7.432833333333333 3.1958066666666665 7.4483C4.00544 7.530366666666667 5.560420000000001 7.6428666666666665 8 7.6428666666666665C10.439566666666666 7.6428666666666665 11.994533333333333 7.530366666666667 12.804133333333333 7.4483C12.9567 7.432833333333333 13.071399999999999 7.3082 13.071399999999999 7.134066666666667L13.071399999999999 5.857139999999999C13.071399999999999 5.6599 12.911499999999998 5.5 12.714266666666667 5.5L3.285693333333333 5.5z"
|
|
2970
|
+
fill="currentColor"></path>
|
|
2971
|
+
<path
|
|
2972
|
+
d="M4.357126666666666 3.5714733333333335C4.357126666666666 2.506353333333333 5.220573333333333 1.6429066666666667 6.285693333333333 1.6429066666666667C7.350833333333332 1.6429066666666667 8.214266666666667 2.506353333333333 8.214266666666667 3.5714733333333335L8.214266666666667 5.500046666666666L6.285693333333333 5.500046666666666C5.220573333333333 5.500046666666666 4.357126666666666 4.636593333333333 4.357126666666666 3.5714733333333335zM6.285693333333333 2.6429066666666667C5.77286 2.6429066666666667 5.357126666666667 3.0586399999999996 5.357126666666667 3.5714733333333335C5.357126666666667 4.084313333333333 5.77286 4.500046666666666 6.285693333333333 4.500046666666666L7.214266666666667 4.500046666666666L7.214266666666667 3.5714733333333335C7.214266666666667 3.0586399999999996 6.798533333333333 2.6429066666666667 6.285693333333333 2.6429066666666667z"
|
|
2973
|
+
fill="currentColor"></path>
|
|
2974
|
+
<path
|
|
2975
|
+
d="M7.785666666666666 3.5714733333333335C7.785666666666666 2.506353333333333 8.649133333333332 1.6429066666666667 9.714266666666667 1.6429066666666667C10.779399999999999 1.6429066666666667 11.642866666666666 2.506353333333333 11.642866666666666 3.5714733333333335C11.642866666666666 4.636593333333333 10.779399999999999 5.500046666666666 9.714266666666667 5.500046666666666L7.785666666666666 5.500046666666666L7.785666666666666 3.5714733333333335zM9.714266666666667 2.6429066666666667C9.201433333333332 2.6429066666666667 8.785666666666666 3.0586399999999996 8.785666666666666 3.5714733333333335L8.785666666666666 4.500046666666666L9.714266666666667 4.500046666666666C10.2271 4.500046666666666 10.642866666666666 4.084313333333333 10.642866666666666 3.5714733333333335C10.642866666666666 3.0586399999999996 10.2271 2.6429066666666667 9.714266666666667 2.6429066666666667z"
|
|
2976
|
+
fill="currentColor"></path>
|
|
2977
|
+
<path
|
|
2978
|
+
d="M8 3.7856466666666666C8.276133333333332 3.7856466666666666 8.5 4.009499999999999 8.5 4.285646666666667L8.5 13.142800000000001C8.5 13.418933333333332 8.276133333333332 13.642800000000001 8 13.642800000000001C7.723833333333333 13.642800000000001 7.5 13.418933333333332 7.5 13.142800000000001L7.5 4.285646666666667C7.5 4.009499999999999 7.723833333333333 3.7856466666666666 8 3.7856466666666666z"
|
|
2979
|
+
fill="currentColor"></path>
|
|
2980
|
+
</svg>
|
|
2981
|
+
<span>${reserve.desc3.text}</span>
|
|
2982
|
+
<svg style="width: 12px; height: 12px;" xmlns="http://www.w3.org/2000/svg"
|
|
2983
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 12 12" width="12"
|
|
2984
|
+
height="12">
|
|
2985
|
+
<path
|
|
2986
|
+
d="M4.359835 1.609835C4.21339 1.756285 4.21339 1.99372 4.359835 2.140165L8.0429 5.823225C8.140525 5.920875 8.140525 6.079125 8.0429 6.176775L4.359835 9.859825C4.21339 10.006275 4.21339 10.243725 4.359835 10.390175C4.506285 10.5366 4.743725 10.5366 4.89017 10.390175L8.573225 6.7071C8.96375 6.316575 8.96375 5.683425 8.573225 5.2929L4.89017 1.609835C4.743725 1.46339 4.506285 1.46339 4.359835 1.609835z"
|
|
2987
|
+
fill="currentColor"></path>
|
|
2988
|
+
</svg>
|
|
2989
|
+
</div>` : ""}
|
|
2990
|
+
</div>
|
|
2991
|
+
</div>
|
|
2992
|
+
<div class="reserve-button">
|
|
2993
|
+
${button}
|
|
2994
|
+
</div>
|
|
2995
|
+
</div>
|
|
2996
|
+
`;
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
}
|
|
3000
|
+
break;
|
|
3001
|
+
case DYNAMIC_TYPE_AV: {
|
|
3002
|
+
basicDynamic();
|
|
3003
|
+
const archive = dynamic.modules.module_dynamic.major.archive;
|
|
3004
|
+
if (archive.badge.text === "投稿视频") if (forward$1) forwardInfo = "投稿了视频";
|
|
3005
|
+
else pubTime = `${pubTime} · 投稿了视频`;
|
|
3006
|
+
main$1 += `
|
|
3007
|
+
<div class="card-video">
|
|
3008
|
+
<div class="video-cover">
|
|
3009
|
+
<img src="${archive.cover}"
|
|
3010
|
+
alt="">
|
|
3011
|
+
<div class="cover-mask"></div>
|
|
3012
|
+
<span>${archive.duration_text}</span>
|
|
3013
|
+
</div>
|
|
3014
|
+
<div class="video-info">
|
|
3015
|
+
<div class="video-info-header">
|
|
3016
|
+
<div class="video-title">
|
|
3017
|
+
${archive.title}
|
|
3018
|
+
</div>
|
|
3019
|
+
<div class="video-introduction">
|
|
3020
|
+
${archive.desc}
|
|
3021
|
+
</div>
|
|
3022
|
+
</div>
|
|
3023
|
+
<div class="video-stat">
|
|
3024
|
+
<div class="video-stat-item">
|
|
3025
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
3026
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
3027
|
+
height="16">
|
|
3028
|
+
<path
|
|
3029
|
+
d="M8 3.3320333333333334C6.321186666666667 3.3320333333333334 4.855333333333333 3.4174399999999996 3.820593333333333 3.5013466666666666C3.1014733333333333 3.5596599999999996 2.5440733333333334 4.109013333333333 2.48 4.821693333333333C2.4040466666666664 5.666533333333334 2.333333333333333 6.780666666666666 2.333333333333333 7.998666666666666C2.333333333333333 9.216733333333334 2.4040466666666664 10.330866666666665 2.48 11.175699999999999C2.5440733333333334 11.888366666666666 3.1014733333333333 12.437733333333334 3.820593333333333 12.496066666666666C4.855333333333333 12.579933333333333 6.321186666666667 12.665333333333333 8 12.665333333333333C9.678999999999998 12.665333333333333 11.144933333333334 12.579933333333333 12.179733333333333 12.496033333333333C12.898733333333332 12.4377 13.456 11.888533333333331 13.520066666666667 11.176033333333333C13.595999999999998 10.331533333333333 13.666666666666666 9.217633333333332 13.666666666666666 7.998666666666666C13.666666666666666 6.779766666666667 13.595999999999998 5.665846666666667 13.520066666666667 4.821366666666666C13.456 4.108866666666666 12.898733333333332 3.55968 12.179733333333333 3.5013666666666663C11.144933333333334 3.417453333333333 9.678999999999998 3.3320333333333334 8 3.3320333333333334zM3.7397666666666667 2.50462C4.794879999999999 2.41906 6.288386666666666 2.3320333333333334 8 2.3320333333333334C9.7118 2.3320333333333334 11.2054 2.4190733333333334 12.260533333333331 2.5046399999999998C13.458733333333331 2.6018133333333333 14.407866666666665 3.5285199999999994 14.516066666666667 4.73182C14.593933333333332 5.597933333333334 14.666666666666666 6.7427 14.666666666666666 7.998666666666666C14.666666666666666 9.2547 14.593933333333332 10.399466666666665 14.516066666666667 11.2656C14.407866666666665 12.468866666666665 13.458733333333331 13.395566666666667 12.260533333333331 13.492766666666665C11.2054 13.578333333333333 9.7118 13.665333333333333 8 13.665333333333333C6.288386666666666 13.665333333333333 4.794879999999999 13.578333333333333 3.7397666666666667 13.492799999999999C2.541373333333333 13.395599999999998 1.5922066666666668 12.468633333333333 1.4840200000000001 11.265266666666665C1.4061199999999998 10.3988 1.3333333333333333 9.253866666666667 1.3333333333333333 7.998666666666666C1.3333333333333333 6.743533333333333 1.4061199999999998 5.598579999999999 1.4840200000000001 4.732153333333333C1.5922066666666668 3.5287466666666667 2.541373333333333 2.601793333333333 3.7397666666666667 2.50462z"
|
|
3030
|
+
fill="currentColor"></path>
|
|
3031
|
+
<path
|
|
3032
|
+
d="M9.8092 7.3125C10.338433333333333 7.618066666666666 10.338433333333333 8.382 9.809166666666666 8.687533333333333L7.690799999999999 9.910599999999999C7.161566666666666 10.216133333333332 6.5 9.8342 6.500006666666666 9.223066666666666L6.500006666666666 6.776999999999999C6.500006666666666 6.165873333333334 7.161566666666666 5.783913333333333 7.690799999999999 6.089479999999999L9.8092 7.3125z"
|
|
3033
|
+
fill="currentColor"></path>
|
|
3034
|
+
</svg>
|
|
3035
|
+
<span>${archive.stat.play}</span>
|
|
3036
|
+
</div>
|
|
3037
|
+
<div class="video-stat-item">
|
|
3038
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
3039
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
3040
|
+
height="16">
|
|
3041
|
+
<path
|
|
3042
|
+
d="M8 3.3320333333333334C6.321186666666667 3.3320333333333334 4.855333333333333 3.4174399999999996 3.820593333333333 3.5013466666666666C3.1014733333333333 3.5596599999999996 2.5440733333333334 4.109013333333333 2.48 4.821693333333333C2.4040466666666664 5.666533333333334 2.333333333333333 6.780666666666666 2.333333333333333 7.998666666666666C2.333333333333333 9.216733333333334 2.4040466666666664 10.330866666666665 2.48 11.175699999999999C2.5440733333333334 11.888366666666666 3.1014733333333333 12.437733333333334 3.820593333333333 12.496066666666666C4.855333333333333 12.579933333333333 6.321186666666667 12.665333333333333 8 12.665333333333333C9.678999999999998 12.665333333333333 11.144933333333334 12.579933333333333 12.179733333333333 12.496033333333333C12.898733333333332 12.4377 13.456 11.888533333333331 13.520066666666667 11.176033333333333C13.595999999999998 10.331533333333333 13.666666666666666 9.217633333333332 13.666666666666666 7.998666666666666C13.666666666666666 6.779766666666667 13.595999999999998 5.665846666666667 13.520066666666667 4.821366666666666C13.456 4.108866666666666 12.898733333333332 3.55968 12.179733333333333 3.5013666666666663C11.144933333333334 3.417453333333333 9.678999999999998 3.3320333333333334 8 3.3320333333333334zM3.7397666666666667 2.50462C4.794879999999999 2.41906 6.288386666666666 2.3320333333333334 8 2.3320333333333334C9.7118 2.3320333333333334 11.2054 2.4190733333333334 12.260533333333331 2.5046399999999998C13.458733333333331 2.6018133333333333 14.407866666666665 3.5285199999999994 14.516066666666667 4.73182C14.593933333333332 5.597933333333334 14.666666666666666 6.7427 14.666666666666666 7.998666666666666C14.666666666666666 9.2547 14.593933333333332 10.399466666666665 14.516066666666667 11.2656C14.407866666666665 12.468866666666665 13.458733333333331 13.395566666666667 12.260533333333331 13.492766666666665C11.2054 13.578333333333333 9.7118 13.665333333333333 8 13.665333333333333C6.288386666666666 13.665333333333333 4.794879999999999 13.578333333333333 3.7397666666666667 13.492799999999999C2.541373333333333 13.395599999999998 1.5922066666666668 12.468633333333333 1.4840200000000001 11.265266666666665C1.4061199999999998 10.3988 1.3333333333333333 9.253866666666667 1.3333333333333333 7.998666666666666C1.3333333333333333 6.743533333333333 1.4061199999999998 5.598579999999999 1.4840200000000001 4.732153333333333C1.5922066666666668 3.5287466666666667 2.541373333333333 2.601793333333333 3.7397666666666667 2.50462z"
|
|
3043
|
+
fill="currentColor"></path>
|
|
3044
|
+
<path
|
|
3045
|
+
d="M10.583333333333332 7.166666666666666L6.583333333333333 7.166666666666666C6.307193333333332 7.166666666666666 6.083333333333333 6.942799999999999 6.083333333333333 6.666666666666666C6.083333333333333 6.390526666666666 6.307193333333332 6.166666666666666 6.583333333333333 6.166666666666666L10.583333333333332 6.166666666666666C10.859466666666666 6.166666666666666 11.083333333333332 6.390526666666666 11.083333333333332 6.666666666666666C11.083333333333332 6.942799999999999 10.859466666666666 7.166666666666666 10.583333333333332 7.166666666666666z"
|
|
3046
|
+
fill="currentColor"></path>
|
|
3047
|
+
<path
|
|
3048
|
+
d="M11.583333333333332 9.833333333333332L7.583333333333333 9.833333333333332C7.3072 9.833333333333332 7.083333333333333 9.609466666666666 7.083333333333333 9.333333333333332C7.083333333333333 9.0572 7.3072 8.833333333333332 7.583333333333333 8.833333333333332L11.583333333333332 8.833333333333332C11.859466666666666 8.833333333333332 12.083333333333332 9.0572 12.083333333333332 9.333333333333332C12.083333333333332 9.609466666666666 11.859466666666666 9.833333333333332 11.583333333333332 9.833333333333332z"
|
|
3049
|
+
fill="currentColor"></path>
|
|
3050
|
+
<path
|
|
3051
|
+
d="M5.25 6.666666666666666C5.25 6.942799999999999 5.02614 7.166666666666666 4.75 7.166666666666666L4.416666666666666 7.166666666666666C4.140526666666666 7.166666666666666 3.9166666666666665 6.942799999999999 3.9166666666666665 6.666666666666666C3.9166666666666665 6.390526666666666 4.140526666666666 6.166666666666666 4.416666666666666 6.166666666666666L4.75 6.166666666666666C5.02614 6.166666666666666 5.25 6.390526666666666 5.25 6.666666666666666z"
|
|
3052
|
+
fill="currentColor"></path>
|
|
3053
|
+
<path
|
|
3054
|
+
d="M6.25 9.333333333333332C6.25 9.609466666666666 6.02614 9.833333333333332 5.75 9.833333333333332L5.416666666666666 9.833333333333332C5.140526666666666 9.833333333333332 4.916666666666666 9.609466666666666 4.916666666666666 9.333333333333332C4.916666666666666 9.0572 5.140526666666666 8.833333333333332 5.416666666666666 8.833333333333332L5.75 8.833333333333332C6.02614 8.833333333333332 6.25 9.0572 6.25 9.333333333333332z"
|
|
3055
|
+
fill="currentColor"></path>
|
|
3056
|
+
</svg>
|
|
3057
|
+
<span>${archive.stat.danmaku}</span>
|
|
3058
|
+
</div>
|
|
3059
|
+
</div>
|
|
3060
|
+
</div>
|
|
3061
|
+
</div>
|
|
3062
|
+
`;
|
|
3063
|
+
break;
|
|
3064
|
+
}
|
|
3065
|
+
case DYNAMIC_TYPE_LIVE: return [`${upName}发起了直播预约,我暂时无法渲染,请自行查看`];
|
|
3066
|
+
case DYNAMIC_TYPE_MEDIALIST: return [`${upName}分享了收藏夹,我暂时无法渲染,请自行查看`];
|
|
3067
|
+
case DYNAMIC_TYPE_PGC: return [`${upName}发布了剧集(番剧、电影、纪录片),我暂时无法渲染,请自行查看`];
|
|
3068
|
+
case DYNAMIC_TYPE_ARTICLE:
|
|
3069
|
+
if (this.giConfig.filter.enable && this.giConfig.filter.article) throw new Error("已屏蔽专栏动态");
|
|
3070
|
+
return [`${upName}投稿了新专栏,我暂时无法渲染,请自行查看`];
|
|
3071
|
+
case DYNAMIC_TYPE_MUSIC: return [`${upName}发行了新歌,我暂时无法渲染,请自行查看`];
|
|
3072
|
+
case DYNAMIC_TYPE_COMMON_SQUARE: return [`${upName}发布了装扮|剧集|点评|普通分享,我暂时无法渲染,请自行查看`];
|
|
3073
|
+
case DYNAMIC_TYPE_COURSES_SEASON: return [`${upName}发布了新课程,我暂时无法渲染,请自行查看`];
|
|
3074
|
+
case DYNAMIC_TYPE_UGC_SEASON: return [`${upName}更新了合集,我暂时无法渲染,请自行查看`];
|
|
3075
|
+
case DYNAMIC_TYPE_NONE: return [`${upName}发布了一条无效动态`];
|
|
3076
|
+
case DYNAMIC_TYPE_LIVE_RCMD: throw new Error("直播开播动态,不做处理");
|
|
3077
|
+
default: return [`${upName}发布了一条我无法识别的动态,请自行查看`];
|
|
3078
|
+
}
|
|
3079
|
+
return [main$1, forwardInfo];
|
|
3080
|
+
};
|
|
3081
|
+
const [main] = await getDynamicMajor(data, false);
|
|
3447
3082
|
const html = `
|
|
3448
3083
|
<!DOCTYPE html>
|
|
3449
3084
|
<html>
|
|
3450
3085
|
<head>
|
|
3451
3086
|
<title>动态通知</title>
|
|
3452
3087
|
<style>
|
|
3453
|
-
${
|
|
3088
|
+
${this.generateCardStyle(this.giConfig.enableLargeFont, cardColorStart, cardColorEnd, cardBasePlateBorder, cardBasePlateColor, dynamicCardColor ?? "#FFFFFF")}
|
|
3454
3089
|
</style>
|
|
3455
3090
|
</head>
|
|
3456
3091
|
<body>
|
|
@@ -3540,17 +3175,11 @@ var GenerateImg = class GenerateImg extends koishi.Service {
|
|
|
3540
3175
|
<meta charset="UTF-8">
|
|
3541
3176
|
<title>高清词云展示</title>
|
|
3542
3177
|
<style>
|
|
3543
|
-
@font-face {
|
|
3544
|
-
font-family: "NotoColorEmoji";
|
|
3545
|
-
src: url('file://${this.fontPath}') format('truetype');
|
|
3546
|
-
font-display: swap;
|
|
3547
|
-
}
|
|
3548
|
-
|
|
3549
3178
|
* {
|
|
3550
3179
|
margin: 0;
|
|
3551
3180
|
padding: 0;
|
|
3552
3181
|
box-sizing: border-box;
|
|
3553
|
-
font-family: "${this.giConfig.font}", "
|
|
3182
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
3554
3183
|
}
|
|
3555
3184
|
|
|
3556
3185
|
html {
|
|
@@ -3833,6 +3462,15 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3833
3462
|
updateJob;
|
|
3834
3463
|
pRetry;
|
|
3835
3464
|
AbortError;
|
|
3465
|
+
RETRY_CONFIG = { retries: 3 };
|
|
3466
|
+
async retryWithLog(fn, methodName) {
|
|
3467
|
+
return this.pRetry(fn, {
|
|
3468
|
+
onFailedAttempt: (error) => {
|
|
3469
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 ${methodName}() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3470
|
+
},
|
|
3471
|
+
...this.RETRY_CONFIG
|
|
3472
|
+
});
|
|
3473
|
+
}
|
|
3836
3474
|
constructor(ctx, config) {
|
|
3837
3475
|
super(ctx, "bilibili-notify-api");
|
|
3838
3476
|
this.apiConfig = config;
|
|
@@ -3902,82 +3540,46 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3902
3540
|
return Buffer.concat([decipher.update(encryptedText), decipher.final()]).toString();
|
|
3903
3541
|
}
|
|
3904
3542
|
async getTheUserWhoIsLiveStreaming() {
|
|
3905
|
-
|
|
3543
|
+
return this.retryWithLog(async () => {
|
|
3906
3544
|
const { data } = await this.client.get(GET_LATEST_UPDATED_UPS);
|
|
3907
3545
|
return data;
|
|
3908
|
-
};
|
|
3909
|
-
return await this.pRetry(run, {
|
|
3910
|
-
onFailedAttempt: (error) => {
|
|
3911
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTheUserWhoIsLiveStreaming() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3912
|
-
},
|
|
3913
|
-
retries: 3
|
|
3914
|
-
});
|
|
3546
|
+
}, "getTheUserWhoIsLiveStreaming");
|
|
3915
3547
|
}
|
|
3916
3548
|
async getLiveRoomInfoStreamKey(roomId) {
|
|
3917
|
-
|
|
3549
|
+
return this.retryWithLog(async () => {
|
|
3918
3550
|
const { data } = await this.client.get(`${GET_LIVE_ROOM_INFO_STREAM_KEY}?id=${roomId}`);
|
|
3919
3551
|
return data;
|
|
3920
|
-
};
|
|
3921
|
-
return await this.pRetry(run, {
|
|
3922
|
-
onFailedAttempt: (error) => {
|
|
3923
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoStreamKey() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3924
|
-
},
|
|
3925
|
-
retries: 3
|
|
3926
|
-
});
|
|
3552
|
+
}, "getLiveRoomInfoStreamKey");
|
|
3927
3553
|
}
|
|
3928
3554
|
async getLiveRoomInfoByUids(uids) {
|
|
3929
|
-
|
|
3555
|
+
return this.retryWithLog(async () => {
|
|
3930
3556
|
const params = uids.map((uid) => `uids[]=${uid}`).join("&");
|
|
3931
3557
|
const { data } = await this.client.get(`${GET_LIVE_ROOMS_INFO}?${params}`);
|
|
3932
3558
|
return data;
|
|
3933
|
-
};
|
|
3934
|
-
return await this.pRetry(run, {
|
|
3935
|
-
onFailedAttempt: (error) => {
|
|
3936
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoByUids() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3937
|
-
},
|
|
3938
|
-
retries: 3
|
|
3939
|
-
});
|
|
3559
|
+
}, "getLiveRoomInfoByUids");
|
|
3940
3560
|
}
|
|
3941
3561
|
async getServerUTCTime() {
|
|
3942
|
-
|
|
3562
|
+
return this.retryWithLog(async () => {
|
|
3943
3563
|
const { data } = await this.client.get(GET_SERVER_UTC_TIME);
|
|
3944
3564
|
const match = data.match(/Date\.UTC\((.*?)\)/);
|
|
3945
3565
|
if (match) return new Function(`return Date.UTC(${match[1]})`)() / 1e3;
|
|
3946
3566
|
throw new this.AbortError("解析服务器时间失败!");
|
|
3947
|
-
};
|
|
3948
|
-
return await this.pRetry(run, {
|
|
3949
|
-
onFailedAttempt: (error) => {
|
|
3950
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getServerUTCTime() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3951
|
-
},
|
|
3952
|
-
retries: 3
|
|
3953
|
-
});
|
|
3567
|
+
}, "getServerUTCTime");
|
|
3954
3568
|
}
|
|
3955
3569
|
async getTimeNow() {
|
|
3956
|
-
|
|
3570
|
+
return this.retryWithLog(async () => {
|
|
3957
3571
|
const { data } = await this.client.get(GET_TIME_NOW);
|
|
3958
3572
|
return data;
|
|
3959
|
-
};
|
|
3960
|
-
return await this.pRetry(run, {
|
|
3961
|
-
onFailedAttempt: (error) => {
|
|
3962
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTimeNow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3963
|
-
},
|
|
3964
|
-
retries: 3
|
|
3965
|
-
});
|
|
3573
|
+
}, "getTimeNow");
|
|
3966
3574
|
}
|
|
3967
3575
|
async getAllGroup() {
|
|
3968
|
-
|
|
3576
|
+
return this.retryWithLog(async () => {
|
|
3969
3577
|
const { data } = await this.client.get(GET_ALL_GROUP);
|
|
3970
3578
|
return data;
|
|
3971
|
-
};
|
|
3972
|
-
return await this.pRetry(run, {
|
|
3973
|
-
onFailedAttempt: (error) => {
|
|
3974
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3975
|
-
},
|
|
3976
|
-
retries: 3
|
|
3977
|
-
});
|
|
3579
|
+
}, "getAllGroup");
|
|
3978
3580
|
}
|
|
3979
3581
|
async removeUserFromGroup(mid) {
|
|
3980
|
-
|
|
3582
|
+
return this.retryWithLog(async () => {
|
|
3981
3583
|
const csrf = this.getCSRF();
|
|
3982
3584
|
const { data } = await this.client.post(MODIFY_GROUP_MEMBER, {
|
|
3983
3585
|
fids: mid,
|
|
@@ -3985,16 +3587,10 @@ var BiliAPI = class extends koishi.Service {
|
|
|
3985
3587
|
csrf
|
|
3986
3588
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
3987
3589
|
return data;
|
|
3988
|
-
};
|
|
3989
|
-
return await this.pRetry(run, {
|
|
3990
|
-
onFailedAttempt: (error) => {
|
|
3991
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 removeUserFromGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3992
|
-
},
|
|
3993
|
-
retries: 3
|
|
3994
|
-
});
|
|
3590
|
+
}, "removeUserFromGroup");
|
|
3995
3591
|
}
|
|
3996
3592
|
async copyUserToGroup(mid, groupId) {
|
|
3997
|
-
|
|
3593
|
+
return this.retryWithLog(async () => {
|
|
3998
3594
|
const csrf = this.getCSRF();
|
|
3999
3595
|
const { data } = await this.client.post(COPY_USER_TO_GROUP, {
|
|
4000
3596
|
fids: mid,
|
|
@@ -4002,67 +3598,37 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4002
3598
|
csrf
|
|
4003
3599
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
4004
3600
|
return data;
|
|
4005
|
-
};
|
|
4006
|
-
return await this.pRetry(run, {
|
|
4007
|
-
onFailedAttempt: (error) => {
|
|
4008
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 copyUserToGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4009
|
-
},
|
|
4010
|
-
retries: 3
|
|
4011
|
-
});
|
|
3601
|
+
}, "copyUserToGroup");
|
|
4012
3602
|
}
|
|
4013
3603
|
async getUserSpaceDynamic(mid) {
|
|
4014
|
-
|
|
3604
|
+
return this.retryWithLog(async () => {
|
|
4015
3605
|
const { data } = await this.client.get(`${GET_USER_SPACE_DYNAMIC_LIST}&host_mid=${mid}`);
|
|
4016
3606
|
return data;
|
|
4017
|
-
};
|
|
4018
|
-
return await this.pRetry(run, {
|
|
4019
|
-
onFailedAttempt: (error) => {
|
|
4020
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserSpaceDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4021
|
-
},
|
|
4022
|
-
retries: 3
|
|
4023
|
-
});
|
|
3607
|
+
}, "getUserSpaceDynamic");
|
|
4024
3608
|
}
|
|
4025
3609
|
async createGroup(tag) {
|
|
4026
|
-
|
|
3610
|
+
return this.retryWithLog(async () => {
|
|
4027
3611
|
const { data } = await this.client.post(CREATE_GROUP, {
|
|
4028
3612
|
tag,
|
|
4029
3613
|
csrf: this.getCSRF()
|
|
4030
3614
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
4031
3615
|
return data;
|
|
4032
|
-
};
|
|
4033
|
-
return await this.pRetry(run, {
|
|
4034
|
-
onFailedAttempt: (error) => {
|
|
4035
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 createGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4036
|
-
},
|
|
4037
|
-
retries: 3
|
|
4038
|
-
});
|
|
3616
|
+
}, "createGroup");
|
|
4039
3617
|
}
|
|
4040
3618
|
async getAllDynamic() {
|
|
4041
|
-
|
|
3619
|
+
return this.retryWithLog(async () => {
|
|
4042
3620
|
const { data } = await this.client.get(GET_ALL_DYNAMIC_LIST);
|
|
4043
3621
|
return data;
|
|
4044
|
-
};
|
|
4045
|
-
return await this.pRetry(run, {
|
|
4046
|
-
onFailedAttempt: (error) => {
|
|
4047
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4048
|
-
},
|
|
4049
|
-
retries: 3
|
|
4050
|
-
});
|
|
3622
|
+
}, "getAllDynamic");
|
|
4051
3623
|
}
|
|
4052
3624
|
async hasNewDynamic(updateBaseline) {
|
|
4053
|
-
|
|
3625
|
+
return this.retryWithLog(async () => {
|
|
4054
3626
|
const { data } = await this.client.get(`${HAS_NEW_DYNAMIC}?update_baseline=${updateBaseline}`);
|
|
4055
3627
|
return data;
|
|
4056
|
-
};
|
|
4057
|
-
return await this.pRetry(run, {
|
|
4058
|
-
onFailedAttempt: (error) => {
|
|
4059
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 hasNewDynamic()时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4060
|
-
},
|
|
4061
|
-
retries: 3
|
|
4062
|
-
});
|
|
3628
|
+
}, "hasNewDynamic");
|
|
4063
3629
|
}
|
|
4064
3630
|
async follow(fid) {
|
|
4065
|
-
|
|
3631
|
+
return this.retryWithLog(async () => {
|
|
4066
3632
|
const { data } = await this.client.post(MODIFY_RELATION, {
|
|
4067
3633
|
fid,
|
|
4068
3634
|
act: 1,
|
|
@@ -4070,43 +3636,25 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4070
3636
|
csrf: this.getCSRF()
|
|
4071
3637
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
4072
3638
|
return data;
|
|
4073
|
-
};
|
|
4074
|
-
return await this.pRetry(run, {
|
|
4075
|
-
onFailedAttempt: (error) => {
|
|
4076
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 follow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4077
|
-
},
|
|
4078
|
-
retries: 3
|
|
4079
|
-
});
|
|
3639
|
+
}, "follow");
|
|
4080
3640
|
}
|
|
4081
3641
|
async getRelationGroupDetail(tagid) {
|
|
4082
|
-
|
|
3642
|
+
return this.retryWithLog(async () => {
|
|
4083
3643
|
const { data } = await this.client.get(`${GET_RELATION_GROUP_DETAIL}?tagid=${tagid}`);
|
|
4084
3644
|
return data;
|
|
4085
|
-
};
|
|
4086
|
-
return await this.pRetry(run, {
|
|
4087
|
-
onFailedAttempt: (error) => {
|
|
4088
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getRelationGroupDetail() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4089
|
-
},
|
|
4090
|
-
retries: 3
|
|
4091
|
-
});
|
|
3645
|
+
}, "getRelationGroupDetail");
|
|
4092
3646
|
}
|
|
4093
3647
|
async getCookieInfo(refreshToken) {
|
|
4094
|
-
|
|
3648
|
+
return this.retryWithLog(async () => {
|
|
4095
3649
|
const { data } = await this.client.get(`${GET_COOKIES_INFO}?csrf=${refreshToken}`).catch((e) => {
|
|
4096
3650
|
this.logger.info(e.message);
|
|
4097
3651
|
return null;
|
|
4098
3652
|
});
|
|
4099
3653
|
return data;
|
|
4100
|
-
};
|
|
4101
|
-
return await this.pRetry(run, {
|
|
4102
|
-
onFailedAttempt: (error) => {
|
|
4103
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getCookieInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4104
|
-
},
|
|
4105
|
-
retries: 3
|
|
4106
|
-
});
|
|
3654
|
+
}, "getCookieInfo");
|
|
4107
3655
|
}
|
|
4108
3656
|
async getUserInfo(mid, grisk_id) {
|
|
4109
|
-
|
|
3657
|
+
return this.retryWithLog(async () => {
|
|
4110
3658
|
if (mid === "11783021") {
|
|
4111
3659
|
console.log("检测到番剧出差UID,跳过远程用户接口访问");
|
|
4112
3660
|
return bangumiTripData;
|
|
@@ -4116,139 +3664,73 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4116
3664
|
const wbi = await this.getWbi(params);
|
|
4117
3665
|
const { data } = await this.client.get(`${GET_USER_INFO}?${wbi}`);
|
|
4118
3666
|
return data;
|
|
4119
|
-
};
|
|
4120
|
-
return await this.pRetry(run, {
|
|
4121
|
-
onFailedAttempt: (error) => {
|
|
4122
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4123
|
-
},
|
|
4124
|
-
retries: 3
|
|
4125
|
-
});
|
|
3667
|
+
}, "getUserInfo");
|
|
4126
3668
|
}
|
|
4127
3669
|
async getWbiKeys() {
|
|
4128
|
-
|
|
3670
|
+
return this.retryWithLog(async () => {
|
|
4129
3671
|
const { data } = await this.client.get("https://api.bilibili.com/x/web-interface/nav");
|
|
4130
3672
|
const { data: { wbi_img: { img_url, sub_url } } } = data;
|
|
4131
3673
|
return {
|
|
4132
3674
|
img_key: img_url.slice(img_url.lastIndexOf("/") + 1, img_url.lastIndexOf(".")),
|
|
4133
3675
|
sub_key: sub_url.slice(sub_url.lastIndexOf("/") + 1, sub_url.lastIndexOf("."))
|
|
4134
3676
|
};
|
|
4135
|
-
};
|
|
4136
|
-
return await this.pRetry(run, {
|
|
4137
|
-
onFailedAttempt: (error) => {
|
|
4138
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getWbiKeys() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4139
|
-
},
|
|
4140
|
-
retries: 3
|
|
4141
|
-
});
|
|
3677
|
+
}, "getWbiKeys");
|
|
4142
3678
|
}
|
|
4143
3679
|
async getMyselfInfo() {
|
|
4144
|
-
|
|
3680
|
+
return this.retryWithLog(async () => {
|
|
4145
3681
|
const { data } = await this.client.get(GET_MYSELF_INFO);
|
|
4146
3682
|
return data;
|
|
4147
|
-
};
|
|
4148
|
-
return await this.pRetry(run, {
|
|
4149
|
-
onFailedAttempt: (error) => {
|
|
4150
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMyselfInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4151
|
-
},
|
|
4152
|
-
retries: 3
|
|
4153
|
-
});
|
|
3683
|
+
}, "getMyselfInfo");
|
|
4154
3684
|
}
|
|
4155
3685
|
async getLoginQRCode() {
|
|
4156
|
-
|
|
3686
|
+
return this.retryWithLog(async () => {
|
|
4157
3687
|
const { data } = await this.client.get(GET_LOGIN_QRCODE);
|
|
4158
3688
|
return data;
|
|
4159
|
-
};
|
|
4160
|
-
return await this.pRetry(run, {
|
|
4161
|
-
onFailedAttempt: (error) => {
|
|
4162
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginQRCode() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4163
|
-
},
|
|
4164
|
-
retries: 3
|
|
4165
|
-
});
|
|
3689
|
+
}, "getLoginQRCode");
|
|
4166
3690
|
}
|
|
4167
3691
|
async getLoginStatus(qrcodeKey) {
|
|
4168
|
-
|
|
3692
|
+
return this.retryWithLog(async () => {
|
|
4169
3693
|
const { data } = await this.client.get(`${GET_LOGIN_STATUS}?qrcode_key=${qrcodeKey}`);
|
|
4170
3694
|
return data;
|
|
4171
|
-
};
|
|
4172
|
-
return await this.pRetry(run, {
|
|
4173
|
-
onFailedAttempt: (error) => {
|
|
4174
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginStatus() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4175
|
-
},
|
|
4176
|
-
retries: 3
|
|
4177
|
-
});
|
|
3695
|
+
}, "getLoginStatus");
|
|
4178
3696
|
}
|
|
4179
3697
|
async getLiveRoomInfo(roomId) {
|
|
4180
|
-
|
|
3698
|
+
return this.retryWithLog(async () => {
|
|
4181
3699
|
const { data } = await this.client.get(`${GET_LIVE_ROOM_INFO}?room_id=${roomId}`);
|
|
4182
3700
|
return data;
|
|
4183
|
-
};
|
|
4184
|
-
return await this.pRetry(run, {
|
|
4185
|
-
onFailedAttempt: (error) => {
|
|
4186
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4187
|
-
},
|
|
4188
|
-
retries: 3
|
|
4189
|
-
});
|
|
3701
|
+
}, "getLiveRoomInfo");
|
|
4190
3702
|
}
|
|
4191
3703
|
async getMasterInfo(mid) {
|
|
4192
|
-
|
|
3704
|
+
return this.retryWithLog(async () => {
|
|
4193
3705
|
const { data } = await this.client.get(`${GET_MASTER_INFO}?uid=${mid}`);
|
|
4194
3706
|
return data;
|
|
4195
|
-
};
|
|
4196
|
-
return await this.pRetry(run, {
|
|
4197
|
-
onFailedAttempt: (error) => {
|
|
4198
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMasterInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4199
|
-
},
|
|
4200
|
-
retries: 3
|
|
4201
|
-
});
|
|
3707
|
+
}, "getMasterInfo");
|
|
4202
3708
|
}
|
|
4203
3709
|
async getOnlineGoldRank(roomId, ruid, page = 1, pageSize = 20) {
|
|
4204
|
-
|
|
3710
|
+
return this.retryWithLog(async () => {
|
|
4205
3711
|
const { data } = await this.client.get(`${GET_ONLINE_GOLD_RANK}?room_id=${roomId}&ruid=${ruid}&page=${page}&page_size=${pageSize}`);
|
|
4206
3712
|
return data;
|
|
4207
|
-
};
|
|
4208
|
-
return await this.pRetry(run, {
|
|
4209
|
-
onFailedAttempt: (error) => {
|
|
4210
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getOnlineGoldRank() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4211
|
-
},
|
|
4212
|
-
retries: 3
|
|
4213
|
-
});
|
|
3713
|
+
}, "getOnlineGoldRank");
|
|
4214
3714
|
}
|
|
4215
3715
|
async getUserInfoInLive(uid, ruid) {
|
|
4216
|
-
|
|
3716
|
+
return this.retryWithLog(async () => {
|
|
4217
3717
|
const { data } = await this.client.get(`${GET_USER_INFO_IN_LIVE}?uid=${uid}&ruid=${ruid}`);
|
|
4218
3718
|
return data;
|
|
4219
|
-
};
|
|
4220
|
-
return await this.pRetry(run, {
|
|
4221
|
-
onFailedAttempt: (error) => {
|
|
4222
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4223
|
-
},
|
|
4224
|
-
retries: 3
|
|
4225
|
-
});
|
|
3719
|
+
}, "getUserInfoInLive");
|
|
4226
3720
|
}
|
|
4227
3721
|
async getUserCardInfo(mid, photo) {
|
|
4228
|
-
|
|
3722
|
+
return this.retryWithLog(async () => {
|
|
4229
3723
|
let url = `${GET_USER_CARD_INFO}?mid=${mid}`;
|
|
4230
3724
|
if (photo) url += "&photo=true";
|
|
4231
3725
|
const { data } = await this.client.get(url);
|
|
4232
3726
|
return data;
|
|
4233
|
-
};
|
|
4234
|
-
return await this.pRetry(run, {
|
|
4235
|
-
onFailedAttempt: (error) => {
|
|
4236
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4237
|
-
},
|
|
4238
|
-
retries: 3
|
|
4239
|
-
});
|
|
3727
|
+
}, "getUserCardInfo");
|
|
4240
3728
|
}
|
|
4241
3729
|
async getCORSContent(url) {
|
|
4242
|
-
|
|
3730
|
+
return this.retryWithLog(async () => {
|
|
4243
3731
|
const { data } = await this.client.get(url);
|
|
4244
3732
|
return data;
|
|
4245
|
-
};
|
|
4246
|
-
return await this.pRetry(run, {
|
|
4247
|
-
onFailedAttempt: (error) => {
|
|
4248
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4249
|
-
},
|
|
4250
|
-
retries: 3
|
|
4251
|
-
});
|
|
3733
|
+
}, "getCORSContent");
|
|
4252
3734
|
}
|
|
4253
3735
|
async chatWithAI(content) {
|
|
4254
3736
|
return await this.aiClient.chat.completions.create({
|
|
@@ -4350,6 +3832,10 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4350
3832
|
getLoginInfoIsLoaded() {
|
|
4351
3833
|
return this.loginInfoIsLoaded;
|
|
4352
3834
|
}
|
|
3835
|
+
parseExpires(expires) {
|
|
3836
|
+
if (!expires || expires === "Infinity") return "Infinity";
|
|
3837
|
+
return luxon.DateTime.fromISO(expires).toJSDate();
|
|
3838
|
+
}
|
|
4353
3839
|
async getLoginInfoFromDB() {
|
|
4354
3840
|
const data = (await this.ctx.database.get("loginBili", 1))[0];
|
|
4355
3841
|
if (data === void 0) {
|
|
@@ -4390,32 +3876,13 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4390
3876
|
this.loginInfoIsLoaded = true;
|
|
4391
3877
|
return;
|
|
4392
3878
|
}
|
|
4393
|
-
|
|
4394
|
-
let
|
|
4395
|
-
let domain;
|
|
4396
|
-
let path$1;
|
|
4397
|
-
let secure;
|
|
4398
|
-
let httpOnly;
|
|
4399
|
-
let sameSite;
|
|
3879
|
+
const biliJctCookie = cookies.find((c) => c.key === "bili_jct");
|
|
3880
|
+
let csrf = biliJctCookie?.value ?? "";
|
|
4400
3881
|
for (const cookieData of cookies) {
|
|
4401
|
-
if (cookieData.key === "bili_jct") {
|
|
4402
|
-
csrf = cookieData.value;
|
|
4403
|
-
expires = cookieData.expires ? luxon.DateTime.fromISO(cookieData.expires).toJSDate() : "Infinity";
|
|
4404
|
-
domain = cookieData.domain;
|
|
4405
|
-
path$1 = cookieData.path;
|
|
4406
|
-
secure = cookieData.secure;
|
|
4407
|
-
httpOnly = cookieData.httpOnly;
|
|
4408
|
-
sameSite = cookieData.sameSite;
|
|
4409
|
-
}
|
|
4410
|
-
const cdExpires = (() => {
|
|
4411
|
-
if (!cookieData.expires) return "Infinity";
|
|
4412
|
-
if (cookieData.expires !== "Infinity") return luxon.DateTime.fromISO(cookieData.expires).toJSDate();
|
|
4413
|
-
return cookieData.expires;
|
|
4414
|
-
})();
|
|
4415
3882
|
const cookie = new tough_cookie.Cookie({
|
|
4416
3883
|
key: cookieData.key,
|
|
4417
3884
|
value: cookieData.value,
|
|
4418
|
-
expires:
|
|
3885
|
+
expires: this.parseExpires(cookieData.expires),
|
|
4419
3886
|
domain: cookieData.domain,
|
|
4420
3887
|
path: cookieData.path,
|
|
4421
3888
|
secure: cookieData.secure,
|
|
@@ -4424,17 +3891,20 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4424
3891
|
});
|
|
4425
3892
|
this.jar.setCookieSync(cookie, `http${cookie.secure ? "s" : ""}://${cookie.domain}${cookie.path}`);
|
|
4426
3893
|
}
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
3894
|
+
if (biliJctCookie) {
|
|
3895
|
+
csrf = biliJctCookie.value;
|
|
3896
|
+
const buvid3Cookie = new tough_cookie.Cookie({
|
|
3897
|
+
key: "buvid3",
|
|
3898
|
+
value: "some_non_empty_value",
|
|
3899
|
+
expires: this.parseExpires(biliJctCookie.expires),
|
|
3900
|
+
domain: biliJctCookie.domain,
|
|
3901
|
+
path: biliJctCookie.path,
|
|
3902
|
+
secure: biliJctCookie.secure,
|
|
3903
|
+
httpOnly: biliJctCookie.httpOnly,
|
|
3904
|
+
sameSite: biliJctCookie.sameSite
|
|
3905
|
+
});
|
|
3906
|
+
this.jar.setCookieSync(buvid3Cookie, `http${buvid3Cookie.secure ? "s" : ""}://${buvid3Cookie.domain}${buvid3Cookie.path}`);
|
|
3907
|
+
}
|
|
4438
3908
|
this.loginInfoIsLoaded = true;
|
|
4439
3909
|
this.checkIfTokenNeedRefresh(refresh_token, csrf);
|
|
4440
3910
|
this.enableRefreshCookiesDetect();
|
|
@@ -4444,10 +3914,8 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4444
3914
|
this.refreshCookieTimer = this.ctx.setInterval(async () => {
|
|
4445
3915
|
const { cookies, refresh_token } = await this.getLoginInfoFromDB();
|
|
4446
3916
|
if (!cookies || !refresh_token) return;
|
|
4447
|
-
const csrf = cookies.find((cookie) =>
|
|
4448
|
-
|
|
4449
|
-
return false;
|
|
4450
|
-
}).value;
|
|
3917
|
+
const csrf = cookies.find((cookie) => cookie.key === "bili_jct")?.value;
|
|
3918
|
+
if (!csrf) return;
|
|
4451
3919
|
this.checkIfTokenNeedRefresh(refresh_token, csrf);
|
|
4452
3920
|
}, 36e5);
|
|
4453
3921
|
}
|
|
@@ -4505,10 +3973,8 @@ var BiliAPI = class extends koishi.Service {
|
|
|
4505
3973
|
bili_cookies: encryptedCookies,
|
|
4506
3974
|
bili_refresh_token: encryptedRefreshToken
|
|
4507
3975
|
}]);
|
|
4508
|
-
const newCsrf = this.jar.serializeSync().cookies.find((cookie) =>
|
|
4509
|
-
|
|
4510
|
-
return false;
|
|
4511
|
-
}).value;
|
|
3976
|
+
const newCsrf = this.jar.serializeSync().cookies.find((cookie) => cookie.key === "bili_jct")?.value;
|
|
3977
|
+
if (!newCsrf) throw new Error("未找到 bili_jct cookie");
|
|
4512
3978
|
const { data: aceeptData } = await this.client.post("https://passport.bilibili.com/x/passport-login/web/confirm/refresh", {
|
|
4513
3979
|
csrf: newCsrf,
|
|
4514
3980
|
refresh_token: refreshToken
|