koishi-plugin-bilibili-notify 3.6.5 → 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/lib/index.cjs +928 -1429
- package/lib/index.mjs +928 -1429
- package/package.json +4 -4
package/lib/index.mjs
CHANGED
|
@@ -729,9 +729,9 @@ var ComRegister = class ComRegister {
|
|
|
729
729
|
preInitConfig(subs) {
|
|
730
730
|
for (const sub of Object.values(subs)) {
|
|
731
731
|
if (sub.customLiveMsg.enable) {
|
|
732
|
-
if (!sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
733
|
-
if (!sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
734
|
-
if (!sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
732
|
+
if (sub.customLiveMsg.customLiveStart && !sub.customLiveMsg.customLiveStart.trim()) sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
733
|
+
if (sub.customLiveMsg.customLiveEnd && !sub.customLiveMsg.customLiveEnd.trim()) sub.customLiveMsg.customLiveEnd = this.config.customLiveEnd;
|
|
734
|
+
if (sub.customLiveMsg.customLive && !sub.customLiveMsg.customLive.trim()) sub.customLiveMsg.customLive = this.config.customLive;
|
|
735
735
|
} else {
|
|
736
736
|
sub.customLiveMsg.enable = false;
|
|
737
737
|
sub.customLiveMsg.customLiveStart = this.config.customLiveStart;
|
|
@@ -739,10 +739,10 @@ var ComRegister = class ComRegister {
|
|
|
739
739
|
sub.customLiveMsg.customLive = this.config.customLive;
|
|
740
740
|
}
|
|
741
741
|
if (sub.customGuardBuy.enable) {
|
|
742
|
-
if (!sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
743
|
-
if (!sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
744
|
-
if (!sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
745
|
-
if (!sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
742
|
+
if (sub.customGuardBuy.guardBuyMsg && !sub.customGuardBuy.guardBuyMsg.trim()) sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
743
|
+
if (sub.customGuardBuy.captainImgUrl && !sub.customGuardBuy.captainImgUrl.trim()) sub.customGuardBuy.captainImgUrl = this.config.customGuardBuy.captainImgUrl;
|
|
744
|
+
if (sub.customGuardBuy.supervisorImgUrl && !sub.customGuardBuy.supervisorImgUrl.trim()) sub.customGuardBuy.supervisorImgUrl = this.config.customGuardBuy.supervisorImgUrl;
|
|
745
|
+
if (sub.customGuardBuy.governorImgUrl && !sub.customGuardBuy.governorImgUrl.trim()) sub.customGuardBuy.governorImgUrl = this.config.customGuardBuy.governorImgUrl;
|
|
746
746
|
} else if (this.config.customGuardBuy.enable) {
|
|
747
747
|
sub.customGuardBuy.enable = true;
|
|
748
748
|
sub.customGuardBuy.guardBuyMsg = this.config.customGuardBuy.guardBuyMsg;
|
|
@@ -2035,830 +2035,234 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2035
2035
|
numberToStr(num) {
|
|
2036
2036
|
return num > 1e4 ? `${(num / 1e4).toFixed(1)}万` : num.toString();
|
|
2037
2037
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
width: 100%;
|
|
2080
|
-
height: auto;
|
|
2081
|
-
padding: 15px;
|
|
2082
|
-
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2083
|
-
overflow: hidden;
|
|
2084
|
-
}
|
|
2085
|
-
|
|
2086
|
-
.base-plate {
|
|
2087
|
-
width: 100%;
|
|
2088
|
-
height: auto;
|
|
2089
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2090
|
-
padding: ${cardBasePlateBorder};
|
|
2091
|
-
border-radius: 10px;
|
|
2092
|
-
background-color: ${cardBasePlateColor};
|
|
2093
|
-
}
|
|
2038
|
+
CARD_STYLES = {
|
|
2039
|
+
large: {
|
|
2040
|
+
avatarSize: "70px",
|
|
2041
|
+
upNameFont: "27px",
|
|
2042
|
+
pubTimeFont: "20px",
|
|
2043
|
+
dressUpFont: "17px",
|
|
2044
|
+
cardDetailsFont: "22px",
|
|
2045
|
+
forwardUserinfoHeight: "35px",
|
|
2046
|
+
forwardUsernameFont: "20px",
|
|
2047
|
+
forwardAvatarSize: "25px",
|
|
2048
|
+
videoCardHeight: "147px",
|
|
2049
|
+
dynTitleFont: "20px",
|
|
2050
|
+
upInfoHeight: "70px",
|
|
2051
|
+
dynamicCardRight: "67px",
|
|
2052
|
+
dynamicCardTop: "24px"
|
|
2053
|
+
},
|
|
2054
|
+
normal: {
|
|
2055
|
+
avatarSize: "50px",
|
|
2056
|
+
upNameFont: "20px",
|
|
2057
|
+
pubTimeFont: "12px",
|
|
2058
|
+
dressUpFont: "12px",
|
|
2059
|
+
cardDetailsFont: "14px",
|
|
2060
|
+
forwardUserinfoHeight: "30px",
|
|
2061
|
+
forwardUsernameFont: "15px",
|
|
2062
|
+
forwardAvatarSize: "20px",
|
|
2063
|
+
videoCardHeight: "132px",
|
|
2064
|
+
dynTitleFont: "20px",
|
|
2065
|
+
upInfoHeight: "50px",
|
|
2066
|
+
dynamicCardRight: "37px",
|
|
2067
|
+
dynamicCardTop: "5px"
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
generateCardStyle(isLargeFont, cardColorStart, cardColorEnd, cardBasePlateBorder, cardBasePlateColor, dynamicCardColor) {
|
|
2071
|
+
const style = isLargeFont ? this.CARD_STYLES.large : this.CARD_STYLES.normal;
|
|
2072
|
+
return `
|
|
2073
|
+
* {
|
|
2074
|
+
margin: 0;
|
|
2075
|
+
padding: 0;
|
|
2076
|
+
box-sizing: border-box;
|
|
2077
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2078
|
+
}
|
|
2094
2079
|
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
padding: 15px;
|
|
2100
|
-
overflow: hidden;
|
|
2101
|
-
background-color: #fff;
|
|
2102
|
-
}
|
|
2080
|
+
html {
|
|
2081
|
+
width: 800px;
|
|
2082
|
+
height: auto;
|
|
2083
|
+
}
|
|
2103
2084
|
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2085
|
+
.background {
|
|
2086
|
+
width: 100%;
|
|
2087
|
+
height: auto;
|
|
2088
|
+
padding: 15px;
|
|
2089
|
+
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2090
|
+
overflow: hidden;
|
|
2091
|
+
}
|
|
2111
2092
|
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2093
|
+
.base-plate {
|
|
2094
|
+
width: 100%;
|
|
2095
|
+
height: auto;
|
|
2096
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2097
|
+
padding: ${cardBasePlateBorder};
|
|
2098
|
+
border-radius: 10px;
|
|
2099
|
+
background-color: ${cardBasePlateColor};
|
|
2100
|
+
}
|
|
2119
2101
|
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2102
|
+
.card {
|
|
2103
|
+
width: 100%;
|
|
2104
|
+
height: auto;
|
|
2105
|
+
border-radius: 5px;
|
|
2106
|
+
padding: 15px;
|
|
2107
|
+
overflow: hidden;
|
|
2108
|
+
background-color: #fff;
|
|
2109
|
+
}
|
|
2123
2110
|
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2111
|
+
.card-body {
|
|
2112
|
+
display: flex;
|
|
2113
|
+
padding: 15px;
|
|
2114
|
+
}
|
|
2128
2115
|
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2116
|
+
.card .anchor-avatar {
|
|
2117
|
+
max-width: ${style.avatarSize};
|
|
2118
|
+
max-height: ${style.avatarSize};
|
|
2119
|
+
margin-right: 20px;
|
|
2120
|
+
border-radius: 10px;
|
|
2121
|
+
}
|
|
2134
2122
|
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
height: auto;
|
|
2139
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2140
|
-
}
|
|
2123
|
+
.card .card-body .card-content {
|
|
2124
|
+
width: 100%;
|
|
2125
|
+
}
|
|
2141
2126
|
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
}
|
|
2127
|
+
.card .card-body .card-content .card-header {
|
|
2128
|
+
width: 100%;
|
|
2129
|
+
display: flex;
|
|
2130
|
+
justify-content: space-between;
|
|
2131
|
+
}
|
|
2148
2132
|
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2133
|
+
.card .up-info {
|
|
2134
|
+
display: flex;
|
|
2135
|
+
flex-direction: column;
|
|
2136
|
+
justify-content: space-between;
|
|
2137
|
+
height: ${style.upInfoHeight};
|
|
2138
|
+
}
|
|
2153
2139
|
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
text-decoration: none;
|
|
2158
|
-
font-size: 20px;
|
|
2159
|
-
margin-top: 10px;
|
|
2160
|
-
margin-bottom: 10px;
|
|
2161
|
-
}
|
|
2162
|
-
</style>
|
|
2163
|
-
</head>
|
|
2164
|
-
<body>
|
|
2165
|
-
<div class="background">
|
|
2166
|
-
<div ${this.giConfig.removeBorder ? "" : "class=\"base-plate\""}>
|
|
2167
|
-
<div class="card">
|
|
2168
|
-
<img src="${cover ? data.user_cover : data.keyframe}"
|
|
2169
|
-
alt="封面">
|
|
2170
|
-
<div class="card-body">
|
|
2171
|
-
<div class="card-header">
|
|
2172
|
-
<h1 class="card-title">${data.title}</h1>
|
|
2173
|
-
<div class="live-broadcast-info">
|
|
2174
|
-
<!-- 主播头像 -->
|
|
2175
|
-
<img style="border-radius: 10px; margin-left: 10px" class="anchor-avatar"
|
|
2176
|
-
src="${userface}" alt="主播头像">
|
|
2177
|
-
<span class="broadcast-message">${username}${titleStatus}</span>
|
|
2178
|
-
</div>
|
|
2179
|
-
</div>
|
|
2180
|
-
${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
|
|
2181
|
-
<p class="card-link">
|
|
2182
|
-
<span>${liveStatus === 3 ? `本场直播点赞数:${this.numberToStr(+liveData.likedNum)}` : `人气:${this.numberToStr(data.online)}`}</span>
|
|
2183
|
-
<span>分区名称:${data.area_name}</span>
|
|
2184
|
-
</p>
|
|
2185
|
-
<p class="card-link">
|
|
2186
|
-
<span>${liveTime}</span>
|
|
2187
|
-
${this.giConfig.followerDisplay ? `
|
|
2188
|
-
<span>
|
|
2189
|
-
${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
|
|
2190
|
-
</span>` : ""}
|
|
2191
|
-
</p>
|
|
2192
|
-
</div>
|
|
2193
|
-
</div>
|
|
2194
|
-
</div>
|
|
2195
|
-
</div>
|
|
2196
|
-
</body>
|
|
2197
|
-
</html>
|
|
2198
|
-
`;
|
|
2199
|
-
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2200
|
-
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2201
|
-
});
|
|
2202
|
-
}
|
|
2203
|
-
static BG_COLOR = {
|
|
2204
|
-
[GuardLevel.None]: ["#4ebcec", "#F9CCDF"],
|
|
2205
|
-
[GuardLevel.Jianzhang]: ["#4ebcec", "#b494e5"],
|
|
2206
|
-
[GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
|
|
2207
|
-
[GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
|
|
2208
|
-
};
|
|
2209
|
-
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
|
|
2210
|
-
const bgColor = GenerateImg.BG_COLOR[guardLevel];
|
|
2211
|
-
const desc = {
|
|
2212
|
-
[GuardLevel.Jianzhang]: () => {
|
|
2213
|
-
return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
|
|
2214
|
-
},
|
|
2215
|
-
[GuardLevel.Tidu]: () => {
|
|
2216
|
-
return `"${uname}"就任<br/>"${masterName}"大航海舰队提督!`;
|
|
2217
|
-
},
|
|
2218
|
-
[GuardLevel.Zongdu]: () => {
|
|
2219
|
-
return `"${uname}"上任<br/>"${masterName}"大航海舰队总督!`;
|
|
2220
|
-
}
|
|
2221
|
-
};
|
|
2222
|
-
const html = `
|
|
2223
|
-
<!DOCTYPE html>
|
|
2224
|
-
<html>
|
|
2140
|
+
.card .up-info .up-name {
|
|
2141
|
+
font-size: ${style.upNameFont};
|
|
2142
|
+
}
|
|
2225
2143
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
margin: 0;
|
|
2231
|
-
padding: 0;
|
|
2232
|
-
box-sizing: border-box;
|
|
2233
|
-
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2234
|
-
}
|
|
2144
|
+
.card .pub-time {
|
|
2145
|
+
font-size: ${style.pubTimeFont};
|
|
2146
|
+
color: grey;
|
|
2147
|
+
}
|
|
2235
2148
|
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
}
|
|
2149
|
+
.card .card-header img {
|
|
2150
|
+
height: 50px;
|
|
2151
|
+
}
|
|
2240
2152
|
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
width: 430px;
|
|
2246
|
-
height: 220px;
|
|
2247
|
-
background: linear-gradient(to right bottom, ${bgColor[0]}, ${bgColor[1]});
|
|
2248
|
-
}
|
|
2153
|
+
.card .dress-up {
|
|
2154
|
+
position: relative;
|
|
2155
|
+
font-size: ${style.dressUpFont};
|
|
2156
|
+
}
|
|
2249
2157
|
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
border-radius: 10px;
|
|
2255
|
-
width: 410px;
|
|
2256
|
-
height: 200px;
|
|
2257
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2258
|
-
background-color: rgba(255, 255, 255, 0.65);
|
|
2259
|
-
backdrop-filter: blur(10px);
|
|
2260
|
-
}
|
|
2158
|
+
.card .dress-up img {
|
|
2159
|
+
max-width: 100%;
|
|
2160
|
+
max-height: 100%;
|
|
2161
|
+
}
|
|
2261
2162
|
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
padding: 10px 0 10px 10px;
|
|
2269
|
-
}
|
|
2163
|
+
.card .dress-up span {
|
|
2164
|
+
position: absolute;
|
|
2165
|
+
color: ${dynamicCardColor};
|
|
2166
|
+
right: ${style.dynamicCardRight};
|
|
2167
|
+
top: ${style.dynamicCardTop};
|
|
2168
|
+
}
|
|
2270
2169
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2170
|
+
.card .dyn-title {
|
|
2171
|
+
font-size: ${style.dynTitleFont};
|
|
2172
|
+
margin-bottom: 10px;
|
|
2173
|
+
}
|
|
2275
2174
|
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2175
|
+
.card .card-topic {
|
|
2176
|
+
display: flex;
|
|
2177
|
+
align-items: center;
|
|
2178
|
+
margin-top: 10px;
|
|
2179
|
+
font-size: 20px;
|
|
2180
|
+
color: #008AC5;
|
|
2181
|
+
gap: 3px;
|
|
2182
|
+
}
|
|
2282
2183
|
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2184
|
+
.card .card-details {
|
|
2185
|
+
margin-top: 5px;
|
|
2186
|
+
margin-bottom: 15px;
|
|
2187
|
+
font-size: ${style.cardDetailsFont};
|
|
2188
|
+
width: 90%;
|
|
2189
|
+
}
|
|
2289
2190
|
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
margin-top: 10px;
|
|
2296
|
-
}
|
|
2191
|
+
.card .card-major {
|
|
2192
|
+
display: flex;
|
|
2193
|
+
flex-wrap: wrap;
|
|
2194
|
+
gap: 5px;
|
|
2195
|
+
}
|
|
2297
2196
|
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
padding: 0 10px;
|
|
2306
|
-
border: solid 2px white;
|
|
2307
|
-
overflow: hidden;
|
|
2308
|
-
}
|
|
2197
|
+
.card .card-major .photo-item {
|
|
2198
|
+
border-radius: 10px;
|
|
2199
|
+
overflow: hidden;
|
|
2200
|
+
width: 170px;
|
|
2201
|
+
height: 170px;
|
|
2202
|
+
object-fit: cover;
|
|
2203
|
+
}
|
|
2309
2204
|
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2205
|
+
.card .card-major .single-photo-mask {
|
|
2206
|
+
position: absolute;
|
|
2207
|
+
text-align: center;
|
|
2208
|
+
width: 100%;
|
|
2209
|
+
height: 100%;
|
|
2210
|
+
top: 0;
|
|
2211
|
+
left: 0;
|
|
2212
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 30%);
|
|
2213
|
+
}
|
|
2318
2214
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
}
|
|
2215
|
+
.card .card-major .single-photo-mask-text {
|
|
2216
|
+
position: absolute;
|
|
2217
|
+
color: #fff;
|
|
2218
|
+
font-size: 24px;
|
|
2219
|
+
right: 0;
|
|
2220
|
+
bottom: 66px;
|
|
2221
|
+
left: 0;
|
|
2222
|
+
text-align: center;
|
|
2223
|
+
}
|
|
2329
2224
|
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2225
|
+
.card .card-major .single-photo-mask-arrow {
|
|
2226
|
+
position: absolute;
|
|
2227
|
+
width: 70px;
|
|
2228
|
+
height: 70px;
|
|
2229
|
+
bottom: 7px;
|
|
2230
|
+
left: 50%;
|
|
2231
|
+
transform: translateX(-50%);
|
|
2232
|
+
}
|
|
2337
2233
|
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
font-weight: bold;
|
|
2346
|
-
margin-right: 5px;
|
|
2347
|
-
}
|
|
2234
|
+
.card .card-major .single-photo-container {
|
|
2235
|
+
position: relative;
|
|
2236
|
+
max-width: 500px;
|
|
2237
|
+
max-height: 1000px;
|
|
2238
|
+
border-radius: 10px;
|
|
2239
|
+
overflow: hidden;
|
|
2240
|
+
}
|
|
2348
2241
|
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
color: #333;
|
|
2355
|
-
}
|
|
2242
|
+
.card .card-major .single-photo-item {
|
|
2243
|
+
max-width: 500px;
|
|
2244
|
+
border-radius: 10px;
|
|
2245
|
+
overflow: hidden;
|
|
2246
|
+
}
|
|
2356
2247
|
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2248
|
+
.card .card-major .four-photo-item {
|
|
2249
|
+
width: 170px;
|
|
2250
|
+
height: 170px;
|
|
2251
|
+
object-fit: cover;
|
|
2252
|
+
border-radius: 10px;
|
|
2253
|
+
overflow: hidden;
|
|
2254
|
+
flex-basis: 20%;
|
|
2255
|
+
}
|
|
2365
2256
|
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
<div class="user-info">
|
|
2375
|
-
<div class="name-badge">
|
|
2376
|
-
<span>${uname}</span>
|
|
2377
|
-
</div>
|
|
2378
|
-
<div class="accompany">
|
|
2379
|
-
<div class="master-avatar"></div><span>${isAdmin ? "房管" : masterName}</span>
|
|
2380
|
-
</div>
|
|
2381
|
-
</div>
|
|
2382
|
-
</div>
|
|
2383
|
-
<div class="desc">
|
|
2384
|
-
${desc[guardLevel]()}
|
|
2385
|
-
</div>
|
|
2386
|
-
</div>
|
|
2387
|
-
<div class="captain"></div>
|
|
2388
|
-
</div>
|
|
2389
|
-
</div>
|
|
2390
|
-
</body>
|
|
2257
|
+
.card .card-stat {
|
|
2258
|
+
display: flex;
|
|
2259
|
+
justify-content: space-between;
|
|
2260
|
+
width: 90%;
|
|
2261
|
+
margin-top: 15px;
|
|
2262
|
+
color: gray;
|
|
2263
|
+
font-size: 14px;
|
|
2264
|
+
}
|
|
2391
2265
|
|
|
2392
|
-
</html>
|
|
2393
|
-
`;
|
|
2394
|
-
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2395
|
-
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2396
|
-
});
|
|
2397
|
-
}
|
|
2398
|
-
richTextParser(rt, title) {
|
|
2399
|
-
const richText = rt.reduce((accumulator, currentValue) => {
|
|
2400
|
-
if (currentValue.emoji) return `${accumulator}<img style="width:28px; height:28px;" src="${currentValue.emoji.icon_url}"/>`;
|
|
2401
|
-
return accumulator + currentValue.text;
|
|
2402
|
-
}, "");
|
|
2403
|
-
if (this.giConfig.filter.enable) {
|
|
2404
|
-
if (this.giConfig.filter.regex) {
|
|
2405
|
-
if (new RegExp(this.giConfig.filter.regex).test(richText)) throw new Error("出现关键词,屏蔽该动态");
|
|
2406
|
-
}
|
|
2407
|
-
if (this.giConfig.filter.keywords.length !== 0 && this.giConfig.filter.keywords.some((keyword) => richText.includes(keyword))) throw new Error("出现关键词,屏蔽该动态");
|
|
2408
|
-
}
|
|
2409
|
-
const text = richText.replace(/\n/g, "<br>");
|
|
2410
|
-
return `
|
|
2411
|
-
<div class="card-details">
|
|
2412
|
-
${title ? `<h1 class="dyn-title">${title}</h1>` : ""}
|
|
2413
|
-
${text}
|
|
2414
|
-
</div>
|
|
2415
|
-
`;
|
|
2416
|
-
}
|
|
2417
|
-
async generateDynamicImg(data, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
2418
|
-
const module_author = data.modules.module_author;
|
|
2419
|
-
const avatarUrl = module_author.face;
|
|
2420
|
-
const upName = module_author.name;
|
|
2421
|
-
let pubTime = this.unixTimestampToString(module_author.pub_ts);
|
|
2422
|
-
let dynamicCardUrl;
|
|
2423
|
-
let dynamicCardId;
|
|
2424
|
-
let dynamicCardColor;
|
|
2425
|
-
if (module_author.decorate) {
|
|
2426
|
-
dynamicCardUrl = module_author.decorate.card_url;
|
|
2427
|
-
dynamicCardId = module_author.decorate.fan.num_str;
|
|
2428
|
-
dynamicCardColor = module_author.decorate.fan.color;
|
|
2429
|
-
}
|
|
2430
|
-
const module_stat = data.modules.module_stat;
|
|
2431
|
-
const comment = module_stat.comment.count;
|
|
2432
|
-
const forward = module_stat.forward.count;
|
|
2433
|
-
const like = module_stat.like.count;
|
|
2434
|
-
const topic = data.modules.module_dynamic.topic ? data.modules.module_dynamic.topic.name : "";
|
|
2435
|
-
const getDynamicMajor = async (dynamic, forward$1) => {
|
|
2436
|
-
let main$1 = "";
|
|
2437
|
-
let forwardInfo;
|
|
2438
|
-
const basicDynamic = () => {
|
|
2439
|
-
const module_dynamic = dynamic.modules.module_dynamic;
|
|
2440
|
-
if (module_dynamic?.desc?.rich_text_nodes) {
|
|
2441
|
-
const content = this.richTextParser(module_dynamic.desc.rich_text_nodes);
|
|
2442
|
-
main$1 += content;
|
|
2443
|
-
}
|
|
2444
|
-
if (module_dynamic?.major?.opus?.summary?.rich_text_nodes) {
|
|
2445
|
-
const content = this.richTextParser(module_dynamic.major.opus.summary.rich_text_nodes, module_dynamic.major.opus.title);
|
|
2446
|
-
main$1 += content;
|
|
2447
|
-
}
|
|
2448
|
-
let major = "";
|
|
2449
|
-
const arrowImg = pathToFileURL(resolve(__dirname, "img/arrow.png"));
|
|
2450
|
-
if (module_dynamic?.major?.opus?.pics) {
|
|
2451
|
-
if (module_dynamic.major.opus.pics.length === 1) if (module_dynamic.major.opus.pics[0].height > 3e3) major += `
|
|
2452
|
-
<div class="single-photo-container">
|
|
2453
|
-
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2454
|
-
<div class="single-photo-mask">
|
|
2455
|
-
<span class="single-photo-mask-text">点击链接浏览全部</span>
|
|
2456
|
-
</div>
|
|
2457
|
-
<img class="single-photo-mask-arrow" src="${arrowImg}"/>
|
|
2458
|
-
</div>
|
|
2459
|
-
`;
|
|
2460
|
-
else major += `
|
|
2461
|
-
<div class="single-photo-container">
|
|
2462
|
-
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2463
|
-
</div>
|
|
2464
|
-
`;
|
|
2465
|
-
else if (module_dynamic.major.opus.pics.length === 4) major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2466
|
-
return `${acc}<img class="four-photo-item" src="${cV.url}"/>`;
|
|
2467
|
-
}, "");
|
|
2468
|
-
else major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2469
|
-
return `${acc}<img class="photo-item" src="${cV.url}"/>`;
|
|
2470
|
-
}, "");
|
|
2471
|
-
main$1 += `
|
|
2472
|
-
<div class="card-major">
|
|
2473
|
-
${major}
|
|
2474
|
-
</div>
|
|
2475
|
-
`;
|
|
2476
|
-
}
|
|
2477
|
-
};
|
|
2478
|
-
switch (dynamic.type) {
|
|
2479
|
-
case DYNAMIC_TYPE_WORD:
|
|
2480
|
-
case DYNAMIC_TYPE_DRAW:
|
|
2481
|
-
case DYNAMIC_TYPE_FORWARD:
|
|
2482
|
-
basicDynamic();
|
|
2483
|
-
if (dynamic.type === DYNAMIC_TYPE_FORWARD) {
|
|
2484
|
-
if (this.giConfig.filter.enable && this.giConfig.filter.forward) throw new Error("已屏蔽转发动态");
|
|
2485
|
-
const forward_module_author = dynamic.orig.modules.module_author;
|
|
2486
|
-
const forwardUserAvatarUrl = forward_module_author.face;
|
|
2487
|
-
const forwardUserName = forward_module_author.name;
|
|
2488
|
-
const [forwardMain, forwardInfo$1] = await getDynamicMajor(dynamic.orig, true);
|
|
2489
|
-
main$1 += `
|
|
2490
|
-
<div class="card-forward">
|
|
2491
|
-
<div class="forward-userinfo">
|
|
2492
|
-
<img class="forward-avatar" src="${forwardUserAvatarUrl}" alt="avatar">
|
|
2493
|
-
<span class="forward-username">${forwardUserName} ${forwardInfo$1 ? forwardInfo$1 : ""}</span>
|
|
2494
|
-
</div>
|
|
2495
|
-
<div class="forward-main">
|
|
2496
|
-
${forwardMain}
|
|
2497
|
-
</div>
|
|
2498
|
-
</div>
|
|
2499
|
-
`;
|
|
2500
|
-
}
|
|
2501
|
-
if (dynamic.modules.module_dynamic.additional) {
|
|
2502
|
-
const additional = dynamic.modules.module_dynamic.additional;
|
|
2503
|
-
switch (additional.type) {
|
|
2504
|
-
case ADDITIONAL_TYPE_RESERVE: {
|
|
2505
|
-
const reserve = additional.reserve;
|
|
2506
|
-
let button;
|
|
2507
|
-
if (reserve.button.uncheck.text === "已结束") button = `
|
|
2508
|
-
<button class="reserve-button-end">
|
|
2509
|
-
<span>${reserve.button.uncheck.text}</span>
|
|
2510
|
-
</button>
|
|
2511
|
-
`;
|
|
2512
|
-
else button = `
|
|
2513
|
-
<button class="reserve-button-ing">
|
|
2514
|
-
<svg class="bili-dyn-card-reserve__action__icon" style="width: 16px; height: 16px;"
|
|
2515
|
-
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
2516
|
-
viewBox="0 0 16 16" width="16" height="16">
|
|
2517
|
-
<path
|
|
2518
|
-
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"
|
|
2519
|
-
fill="currentColor"></path>
|
|
2520
|
-
<path
|
|
2521
|
-
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"
|
|
2522
|
-
fill="currentColor"></path>
|
|
2523
|
-
<path
|
|
2524
|
-
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"
|
|
2525
|
-
fill="currentColor"></path>
|
|
2526
|
-
</svg>
|
|
2527
|
-
<span>${reserve.button.uncheck.text}</span>
|
|
2528
|
-
</button>
|
|
2529
|
-
`;
|
|
2530
|
-
main$1 += `
|
|
2531
|
-
<div class="card-reserve">
|
|
2532
|
-
<div class="reserve-main">
|
|
2533
|
-
<div class="reserve-title">
|
|
2534
|
-
${reserve.title}
|
|
2535
|
-
</div>
|
|
2536
|
-
<div class="reserve-desc">
|
|
2537
|
-
<div class="reserve-info">
|
|
2538
|
-
<span class="reserve-time">${reserve.desc1.text}</span>
|
|
2539
|
-
<span class="reserve-num">${reserve.desc2.text}</span>
|
|
2540
|
-
</div>
|
|
2541
|
-
${reserve.desc3 ? `<div class="reserve-prize">
|
|
2542
|
-
<svg class="bili-dyn-card-reserve__lottery__icon"
|
|
2543
|
-
style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2544
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2545
|
-
height="16">
|
|
2546
|
-
<path
|
|
2547
|
-
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"
|
|
2548
|
-
fill="currentColor"></path>
|
|
2549
|
-
<path
|
|
2550
|
-
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"
|
|
2551
|
-
fill="currentColor"></path>
|
|
2552
|
-
<path
|
|
2553
|
-
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"
|
|
2554
|
-
fill="currentColor"></path>
|
|
2555
|
-
<path
|
|
2556
|
-
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"
|
|
2557
|
-
fill="currentColor"></path>
|
|
2558
|
-
<path
|
|
2559
|
-
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"
|
|
2560
|
-
fill="currentColor"></path>
|
|
2561
|
-
</svg>
|
|
2562
|
-
<span>${reserve.desc3.text}</span>
|
|
2563
|
-
<svg style="width: 12px; height: 12px;" xmlns="http://www.w3.org/2000/svg"
|
|
2564
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 12 12" width="12"
|
|
2565
|
-
height="12">
|
|
2566
|
-
<path
|
|
2567
|
-
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"
|
|
2568
|
-
fill="currentColor"></path>
|
|
2569
|
-
</svg>
|
|
2570
|
-
</div>` : ""}
|
|
2571
|
-
</div>
|
|
2572
|
-
</div>
|
|
2573
|
-
<div class="reserve-button">
|
|
2574
|
-
${button}
|
|
2575
|
-
</div>
|
|
2576
|
-
</div>
|
|
2577
|
-
`;
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2581
|
-
break;
|
|
2582
|
-
case DYNAMIC_TYPE_AV: {
|
|
2583
|
-
basicDynamic();
|
|
2584
|
-
const archive = dynamic.modules.module_dynamic.major.archive;
|
|
2585
|
-
if (archive.badge.text === "投稿视频") if (forward$1) forwardInfo = "投稿了视频";
|
|
2586
|
-
else pubTime = `${pubTime} · 投稿了视频`;
|
|
2587
|
-
main$1 += `
|
|
2588
|
-
<div class="card-video">
|
|
2589
|
-
<div class="video-cover">
|
|
2590
|
-
<img src="${archive.cover}"
|
|
2591
|
-
alt="">
|
|
2592
|
-
<div class="cover-mask"></div>
|
|
2593
|
-
<span>${archive.duration_text}</span>
|
|
2594
|
-
</div>
|
|
2595
|
-
<div class="video-info">
|
|
2596
|
-
<div class="video-info-header">
|
|
2597
|
-
<div class="video-title">
|
|
2598
|
-
${archive.title}
|
|
2599
|
-
</div>
|
|
2600
|
-
<div class="video-introduction">
|
|
2601
|
-
${archive.desc}
|
|
2602
|
-
</div>
|
|
2603
|
-
</div>
|
|
2604
|
-
<div class="video-stat">
|
|
2605
|
-
<div class="video-stat-item">
|
|
2606
|
-
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2607
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2608
|
-
height="16">
|
|
2609
|
-
<path
|
|
2610
|
-
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"
|
|
2611
|
-
fill="currentColor"></path>
|
|
2612
|
-
<path
|
|
2613
|
-
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"
|
|
2614
|
-
fill="currentColor"></path>
|
|
2615
|
-
</svg>
|
|
2616
|
-
<span>${archive.stat.play}</span>
|
|
2617
|
-
</div>
|
|
2618
|
-
<div class="video-stat-item">
|
|
2619
|
-
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2620
|
-
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2621
|
-
height="16">
|
|
2622
|
-
<path
|
|
2623
|
-
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"
|
|
2624
|
-
fill="currentColor"></path>
|
|
2625
|
-
<path
|
|
2626
|
-
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"
|
|
2627
|
-
fill="currentColor"></path>
|
|
2628
|
-
<path
|
|
2629
|
-
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"
|
|
2630
|
-
fill="currentColor"></path>
|
|
2631
|
-
<path
|
|
2632
|
-
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"
|
|
2633
|
-
fill="currentColor"></path>
|
|
2634
|
-
<path
|
|
2635
|
-
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"
|
|
2636
|
-
fill="currentColor"></path>
|
|
2637
|
-
</svg>
|
|
2638
|
-
<span>${archive.stat.danmaku}</span>
|
|
2639
|
-
</div>
|
|
2640
|
-
</div>
|
|
2641
|
-
</div>
|
|
2642
|
-
</div>
|
|
2643
|
-
`;
|
|
2644
|
-
break;
|
|
2645
|
-
}
|
|
2646
|
-
case DYNAMIC_TYPE_LIVE: return [`${upName}发起了直播预约,我暂时无法渲染,请自行查看`];
|
|
2647
|
-
case DYNAMIC_TYPE_MEDIALIST: return [`${upName}分享了收藏夹,我暂时无法渲染,请自行查看`];
|
|
2648
|
-
case DYNAMIC_TYPE_PGC: return [`${upName}发布了剧集(番剧、电影、纪录片),我暂时无法渲染,请自行查看`];
|
|
2649
|
-
case DYNAMIC_TYPE_ARTICLE:
|
|
2650
|
-
if (this.giConfig.filter.enable && this.giConfig.filter.article) throw new Error("已屏蔽专栏动态");
|
|
2651
|
-
return [`${upName}投稿了新专栏,我暂时无法渲染,请自行查看`];
|
|
2652
|
-
case DYNAMIC_TYPE_MUSIC: return [`${upName}发行了新歌,我暂时无法渲染,请自行查看`];
|
|
2653
|
-
case DYNAMIC_TYPE_COMMON_SQUARE: return [`${upName}发布了装扮|剧集|点评|普通分享,我暂时无法渲染,请自行查看`];
|
|
2654
|
-
case DYNAMIC_TYPE_COURSES_SEASON: return [`${upName}发布了新课程,我暂时无法渲染,请自行查看`];
|
|
2655
|
-
case DYNAMIC_TYPE_UGC_SEASON: return [`${upName}更新了合集,我暂时无法渲染,请自行查看`];
|
|
2656
|
-
case DYNAMIC_TYPE_NONE: return [`${upName}发布了一条无效动态`];
|
|
2657
|
-
case DYNAMIC_TYPE_LIVE_RCMD: throw new Error("直播开播动态,不做处理");
|
|
2658
|
-
default: return [`${upName}发布了一条我无法识别的动态,请自行查看`];
|
|
2659
|
-
}
|
|
2660
|
-
return [main$1, forwardInfo];
|
|
2661
|
-
};
|
|
2662
|
-
const [main] = await getDynamicMajor(data, false);
|
|
2663
|
-
let style;
|
|
2664
|
-
if (this.giConfig.enableLargeFont) style = `
|
|
2665
|
-
* {
|
|
2666
|
-
margin: 0;
|
|
2667
|
-
padding: 0;
|
|
2668
|
-
box-sizing: border-box;
|
|
2669
|
-
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
|
-
html {
|
|
2673
|
-
width: 800px;
|
|
2674
|
-
height: auto;
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2677
|
-
.background {
|
|
2678
|
-
width: 100%;
|
|
2679
|
-
height: auto;
|
|
2680
|
-
padding: 15px;
|
|
2681
|
-
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2682
|
-
overflow: hidden;
|
|
2683
|
-
}
|
|
2684
|
-
|
|
2685
|
-
.base-plate {
|
|
2686
|
-
width: 100%;
|
|
2687
|
-
height: auto;
|
|
2688
|
-
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2689
|
-
padding: ${cardBasePlateBorder};
|
|
2690
|
-
border-radius: 10px;
|
|
2691
|
-
background-color: ${cardBasePlateColor};
|
|
2692
|
-
}
|
|
2693
|
-
|
|
2694
|
-
.card {
|
|
2695
|
-
width: 100%;
|
|
2696
|
-
height: auto;
|
|
2697
|
-
border-radius: 5px;
|
|
2698
|
-
padding: 15px;
|
|
2699
|
-
overflow: hidden;
|
|
2700
|
-
background-color: #fff;
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
.card-body {
|
|
2704
|
-
display: flex;
|
|
2705
|
-
padding: 15px;
|
|
2706
|
-
}
|
|
2707
|
-
|
|
2708
|
-
.card .anchor-avatar {
|
|
2709
|
-
max-width: 70px;
|
|
2710
|
-
/* 设置最大宽度为容器宽度的100% */
|
|
2711
|
-
max-height: 70px;
|
|
2712
|
-
/* 设置最大高度为容器高度的90% */
|
|
2713
|
-
margin-right: 20px;
|
|
2714
|
-
border-radius: 10px;
|
|
2715
|
-
}
|
|
2716
|
-
|
|
2717
|
-
.card .card-body .card-content {
|
|
2718
|
-
width: 100%;
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
.card .card-body .card-content .card-header {
|
|
2722
|
-
width: 100%;
|
|
2723
|
-
display: flex;
|
|
2724
|
-
justify-content: space-between;
|
|
2725
|
-
}
|
|
2726
|
-
|
|
2727
|
-
.card .up-info {
|
|
2728
|
-
display: flex;
|
|
2729
|
-
flex-direction: column;
|
|
2730
|
-
justify-content: space-between;
|
|
2731
|
-
height: 70px;
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
.card .up-info .up-name {
|
|
2735
|
-
font-size: 27px;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
.card .pub-time {
|
|
2739
|
-
font-size: 20px;
|
|
2740
|
-
color: grey;
|
|
2741
|
-
}
|
|
2742
|
-
|
|
2743
|
-
.card .card-header img {
|
|
2744
|
-
height: 50px;
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
.card .dress-up {
|
|
2748
|
-
position: relative;
|
|
2749
|
-
/* background-image: url('${dynamicCardUrl}');
|
|
2750
|
-
background-size: cover; */
|
|
2751
|
-
font-size: 17px;
|
|
2752
|
-
}
|
|
2753
|
-
|
|
2754
|
-
.card .dress-up img {
|
|
2755
|
-
max-width: 100%;
|
|
2756
|
-
max-height: 100%;
|
|
2757
|
-
}
|
|
2758
|
-
|
|
2759
|
-
.card .dress-up span {
|
|
2760
|
-
position: absolute;
|
|
2761
|
-
color: ${dynamicCardColor};
|
|
2762
|
-
right: 67px;
|
|
2763
|
-
top: 24px;
|
|
2764
|
-
}
|
|
2765
|
-
|
|
2766
|
-
.card .dyn-title {
|
|
2767
|
-
font-size: 20px;
|
|
2768
|
-
margin-bottom: 10px;
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
.card .card-topic {
|
|
2772
|
-
display: flex;
|
|
2773
|
-
align-items: center;
|
|
2774
|
-
margin-top: 10px;
|
|
2775
|
-
font-size: 20px;
|
|
2776
|
-
color: #008AC5;
|
|
2777
|
-
gap: 3px;
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
.card .card-details {
|
|
2781
|
-
margin-top: 5px;
|
|
2782
|
-
margin-bottom: 15px;
|
|
2783
|
-
font-size: 22px;
|
|
2784
|
-
width: 90%;
|
|
2785
|
-
}
|
|
2786
|
-
|
|
2787
|
-
.card .card-major {
|
|
2788
|
-
display: flex;
|
|
2789
|
-
flex-wrap: wrap;
|
|
2790
|
-
gap: 5px;
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
.card .card-major .photo-item {
|
|
2794
|
-
border-radius: 10px;
|
|
2795
|
-
overflow: hidden;
|
|
2796
|
-
width: 170px;
|
|
2797
|
-
height: 170px;
|
|
2798
|
-
object-fit: cover;
|
|
2799
|
-
}
|
|
2800
|
-
|
|
2801
|
-
.card .card-major .single-photo-mask {
|
|
2802
|
-
position: absolute;
|
|
2803
|
-
text-align: center;
|
|
2804
|
-
width: 100%;
|
|
2805
|
-
height: 100%;
|
|
2806
|
-
top: 0;
|
|
2807
|
-
left: 0;
|
|
2808
|
-
background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 30%);
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
|
-
.card .card-major .single-photo-mask-text {
|
|
2812
|
-
position: absolute;
|
|
2813
|
-
color: #fff;
|
|
2814
|
-
font-size: 24px;
|
|
2815
|
-
right: 0;
|
|
2816
|
-
bottom: 66px;
|
|
2817
|
-
left: 0;
|
|
2818
|
-
text-align: center;
|
|
2819
|
-
}
|
|
2820
|
-
|
|
2821
|
-
.card .card-major .single-photo-mask-arrow {
|
|
2822
|
-
position: absolute;
|
|
2823
|
-
width: 70px;
|
|
2824
|
-
height: 70px;
|
|
2825
|
-
bottom: 7px;
|
|
2826
|
-
left: 50%;
|
|
2827
|
-
transform: translateX(-50%);
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
|
-
.card .card-major .single-photo-container {
|
|
2831
|
-
position: relative;
|
|
2832
|
-
max-width: 500px;
|
|
2833
|
-
max-height: 1000px;
|
|
2834
|
-
border-radius: 10px;
|
|
2835
|
-
overflow: hidden;
|
|
2836
|
-
}
|
|
2837
|
-
|
|
2838
|
-
.card .card-major .single-photo-item {
|
|
2839
|
-
max-width: 500px;
|
|
2840
|
-
border-radius: 10px;
|
|
2841
|
-
overflow: hidden;
|
|
2842
|
-
}
|
|
2843
|
-
|
|
2844
|
-
.card .card-major .four-photo-item {
|
|
2845
|
-
width: 170px;
|
|
2846
|
-
height: 170px;
|
|
2847
|
-
object-fit: cover;
|
|
2848
|
-
border-radius: 10px;
|
|
2849
|
-
overflow: hidden;
|
|
2850
|
-
flex-basis: 20%; /* or any value less than 50% */
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
.card .card-stat {
|
|
2854
|
-
display: flex;
|
|
2855
|
-
justify-content: space-between;
|
|
2856
|
-
width: 90%;
|
|
2857
|
-
margin-top: 15px;
|
|
2858
|
-
color: gray;
|
|
2859
|
-
font-size: 14px;
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
2266
|
.card .card-stat .stat-item {
|
|
2863
2267
|
display: flex;
|
|
2864
2268
|
align-items: center;
|
|
@@ -2870,15 +2274,15 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2870
2274
|
overflow: hidden;
|
|
2871
2275
|
border-radius: 5px 0 0 5px;
|
|
2872
2276
|
margin-top: 10px;
|
|
2873
|
-
height:
|
|
2277
|
+
height: ${style.videoCardHeight};
|
|
2874
2278
|
}
|
|
2875
|
-
|
|
2279
|
+
|
|
2876
2280
|
.card .video-cover {
|
|
2877
2281
|
position: relative;
|
|
2878
2282
|
flex: 2;
|
|
2879
2283
|
overflow: hidden;
|
|
2880
2284
|
}
|
|
2881
|
-
|
|
2285
|
+
|
|
2882
2286
|
.card .video-cover img {
|
|
2883
2287
|
width: 236px;
|
|
2884
2288
|
}
|
|
@@ -2891,7 +2295,7 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2891
2295
|
left: 0;
|
|
2892
2296
|
background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 30%);
|
|
2893
2297
|
}
|
|
2894
|
-
|
|
2298
|
+
|
|
2895
2299
|
.card .video-cover span {
|
|
2896
2300
|
position: absolute;
|
|
2897
2301
|
color: #fff;
|
|
@@ -2899,7 +2303,7 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2899
2303
|
right: 10px;
|
|
2900
2304
|
bottom: 8px;
|
|
2901
2305
|
}
|
|
2902
|
-
|
|
2306
|
+
|
|
2903
2307
|
.card .video-info {
|
|
2904
2308
|
display: flex;
|
|
2905
2309
|
justify-content: space-between;
|
|
@@ -2911,32 +2315,28 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2911
2315
|
padding: 12px 16px 10px;
|
|
2912
2316
|
background-color: #fff;
|
|
2913
2317
|
}
|
|
2914
|
-
|
|
2318
|
+
|
|
2915
2319
|
.card .video-info-header .video-title {
|
|
2916
2320
|
font-size: 16px;
|
|
2917
2321
|
}
|
|
2918
|
-
|
|
2322
|
+
|
|
2919
2323
|
.card .video-info-header .video-introduction {
|
|
2920
2324
|
margin-top: 5px;
|
|
2921
2325
|
font-size: 12px;
|
|
2922
2326
|
color: #AAA;
|
|
2923
2327
|
display: -webkit-box;
|
|
2924
|
-
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
2925
2328
|
-webkit-box-orient: vertical;
|
|
2926
|
-
/* 必须设置为 vertical */
|
|
2927
2329
|
-webkit-line-clamp: 2;
|
|
2928
|
-
/* 显示的文本行数 */
|
|
2929
2330
|
overflow: hidden;
|
|
2930
|
-
/* 必须设置为 hidden */
|
|
2931
2331
|
}
|
|
2932
|
-
|
|
2332
|
+
|
|
2933
2333
|
.card .video-stat {
|
|
2934
2334
|
font-size: 12px;
|
|
2935
2335
|
color: #AAA;
|
|
2936
2336
|
display: flex;
|
|
2937
2337
|
gap: 35px
|
|
2938
2338
|
}
|
|
2939
|
-
|
|
2339
|
+
|
|
2940
2340
|
.card .video-stat .video-stat-item {
|
|
2941
2341
|
display: flex;
|
|
2942
2342
|
align-items: center;
|
|
@@ -2948,23 +2348,23 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2948
2348
|
padding: 12px 10px 14px 10px;
|
|
2949
2349
|
background-color: #F6F7F8;
|
|
2950
2350
|
}
|
|
2951
|
-
|
|
2351
|
+
|
|
2952
2352
|
.card-forward .forward-userinfo {
|
|
2953
2353
|
display: flex;
|
|
2954
2354
|
align-items: center;
|
|
2955
2355
|
gap: 5px;
|
|
2956
|
-
height:
|
|
2356
|
+
height: ${style.forwardUserinfoHeight};
|
|
2957
2357
|
}
|
|
2958
|
-
|
|
2358
|
+
|
|
2959
2359
|
.forward-userinfo img {
|
|
2960
|
-
width:
|
|
2961
|
-
height:
|
|
2360
|
+
width: ${style.forwardAvatarSize};
|
|
2361
|
+
height: ${style.forwardAvatarSize};
|
|
2962
2362
|
border-radius: 50%;
|
|
2963
2363
|
}
|
|
2964
|
-
|
|
2364
|
+
|
|
2965
2365
|
.forward-userinfo span {
|
|
2966
2366
|
color: #61666D;
|
|
2967
|
-
font-size:
|
|
2367
|
+
font-size: ${style.forwardUsernameFont};
|
|
2968
2368
|
}
|
|
2969
2369
|
|
|
2970
2370
|
.card .card-reserve {
|
|
@@ -2976,22 +2376,22 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2976
2376
|
border-radius: 10px;
|
|
2977
2377
|
background-color: #F6F7F8;
|
|
2978
2378
|
}
|
|
2979
|
-
|
|
2379
|
+
|
|
2980
2380
|
.card-reserve .reserve-title {
|
|
2981
2381
|
font-size: 14px;
|
|
2982
2382
|
color: #18191C;
|
|
2983
2383
|
}
|
|
2984
|
-
|
|
2384
|
+
|
|
2985
2385
|
.card-reserve .reserve-desc {
|
|
2986
2386
|
margin-top: 7px;
|
|
2987
2387
|
font-size: 12px;
|
|
2988
2388
|
color: #9499A0;
|
|
2989
2389
|
}
|
|
2990
|
-
|
|
2390
|
+
|
|
2991
2391
|
.reserve-info .reserve-time {
|
|
2992
2392
|
margin-right: 7px;
|
|
2993
2393
|
}
|
|
2994
|
-
|
|
2394
|
+
|
|
2995
2395
|
.card-reserve .reserve-prize {
|
|
2996
2396
|
display: flex;
|
|
2997
2397
|
align-items: center;
|
|
@@ -2999,7 +2399,7 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
2999
2399
|
gap: 3px;
|
|
3000
2400
|
color: #00AEEC;
|
|
3001
2401
|
}
|
|
3002
|
-
|
|
2402
|
+
|
|
3003
2403
|
.card .card-reserve .reserve-button button {
|
|
3004
2404
|
border: none;
|
|
3005
2405
|
height: 30px;
|
|
@@ -3007,7 +2407,7 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
3007
2407
|
font-size: 13px;
|
|
3008
2408
|
border-radius: 7px;
|
|
3009
2409
|
}
|
|
3010
|
-
|
|
2410
|
+
|
|
3011
2411
|
.card .card-reserve .reserve-button .reserve-button-end {
|
|
3012
2412
|
display: flex;
|
|
3013
2413
|
align-items: center;
|
|
@@ -3015,7 +2415,7 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
3015
2415
|
color: #9499A0;
|
|
3016
2416
|
background-color: #E3E5E7;
|
|
3017
2417
|
}
|
|
3018
|
-
|
|
2418
|
+
|
|
3019
2419
|
.card .card-reserve .reserve-button .reserve-button-ing {
|
|
3020
2420
|
display: flex;
|
|
3021
2421
|
align-items: center;
|
|
@@ -3023,378 +2423,640 @@ var GenerateImg = class GenerateImg extends Service {
|
|
|
3023
2423
|
color: #FFF;
|
|
3024
2424
|
background-color: #00A0D8;
|
|
3025
2425
|
}
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
2426
|
+
`;
|
|
2427
|
+
}
|
|
2428
|
+
async imgHandler(html) {
|
|
2429
|
+
const htmlPath = `file://${__dirname.replaceAll("\\", "/")}/page/0.html`;
|
|
2430
|
+
const page = await this.ctx.puppeteer.page();
|
|
2431
|
+
await page.goto(htmlPath);
|
|
2432
|
+
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
2433
|
+
const elementHandle = await page.$("html");
|
|
2434
|
+
const boundingBox = await elementHandle.boundingBox();
|
|
2435
|
+
const buffer = await page.screenshot({
|
|
2436
|
+
type: "jpeg",
|
|
2437
|
+
clip: {
|
|
2438
|
+
x: boundingBox.x,
|
|
2439
|
+
y: boundingBox.y,
|
|
2440
|
+
width: boundingBox.width,
|
|
2441
|
+
height: boundingBox.height
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
await elementHandle.dispose();
|
|
2445
|
+
await page.close();
|
|
2446
|
+
return buffer;
|
|
2447
|
+
}
|
|
2448
|
+
async generateLiveImg(data, username, userface, liveData, liveStatus, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
2449
|
+
const [titleStatus, liveTime, cover] = await this.getLiveStatus(data.live_time, liveStatus);
|
|
2450
|
+
const html = `
|
|
2451
|
+
<!DOCTYPE html>
|
|
2452
|
+
<html>
|
|
2453
|
+
<head>
|
|
2454
|
+
<title>直播通知</title>
|
|
2455
|
+
<style>
|
|
2456
|
+
* {
|
|
2457
|
+
margin: 0;
|
|
2458
|
+
padding: 0;
|
|
2459
|
+
box-sizing: border-box;
|
|
2460
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
html {
|
|
2464
|
+
width: 800px;
|
|
2465
|
+
height: auto;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
.background {
|
|
2469
|
+
width: 100%;
|
|
2470
|
+
height: auto;
|
|
2471
|
+
padding: 15px;
|
|
2472
|
+
background: linear-gradient(to right bottom, ${cardColorStart}, ${cardColorEnd});
|
|
2473
|
+
overflow: hidden;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
.base-plate {
|
|
2477
|
+
width: 100%;
|
|
2478
|
+
height: auto;
|
|
2479
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2480
|
+
padding: ${cardBasePlateBorder};
|
|
2481
|
+
border-radius: 10px;
|
|
2482
|
+
background-color: ${cardBasePlateColor};
|
|
2483
|
+
}
|
|
3047
2484
|
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
.card {
|
|
3058
|
-
width: 100%;
|
|
3059
|
-
height: auto;
|
|
3060
|
-
border-radius: 5px;
|
|
3061
|
-
padding: 15px;
|
|
3062
|
-
overflow: hidden;
|
|
3063
|
-
background-color: #fff;
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
.card-body {
|
|
3067
|
-
display: flex;
|
|
3068
|
-
padding: 15px;
|
|
3069
|
-
}
|
|
3070
|
-
|
|
3071
|
-
.card .anchor-avatar {
|
|
3072
|
-
border-radius: 5px 5px 0 0;
|
|
3073
|
-
max-width: 50px;
|
|
3074
|
-
/* 设置最大宽度为容器宽度的100% */
|
|
3075
|
-
max-height: 50px;
|
|
3076
|
-
/* 设置最大高度为容器高度的90% */
|
|
3077
|
-
margin-right: 20px;
|
|
3078
|
-
border-radius: 10px;
|
|
3079
|
-
}
|
|
3080
|
-
|
|
3081
|
-
.card .card-body .card-content {
|
|
3082
|
-
width: 100%;
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
.card .card-body .card-content .card-header {
|
|
3086
|
-
width: 100%;
|
|
3087
|
-
display: flex;
|
|
3088
|
-
justify-content: space-between;
|
|
3089
|
-
}
|
|
3090
|
-
|
|
3091
|
-
.card .up-info {
|
|
3092
|
-
display: flex;
|
|
3093
|
-
flex-direction: column;
|
|
3094
|
-
justify-content: space-between;
|
|
3095
|
-
height: 50px;
|
|
3096
|
-
}
|
|
3097
|
-
|
|
3098
|
-
.card .up-info .up-name {
|
|
3099
|
-
font-size: 20px;
|
|
3100
|
-
}
|
|
3101
|
-
|
|
3102
|
-
.card .pub-time {
|
|
3103
|
-
font-size: 12px;
|
|
3104
|
-
color: grey;
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
|
-
.card .card-header img {
|
|
3108
|
-
height: 50px;
|
|
3109
|
-
}
|
|
2485
|
+
.card {
|
|
2486
|
+
width: 100%;
|
|
2487
|
+
height: auto;
|
|
2488
|
+
border-radius: 5px;
|
|
2489
|
+
padding: 15px;
|
|
2490
|
+
overflow: hidden;
|
|
2491
|
+
background-color: #fff;
|
|
2492
|
+
}
|
|
3110
2493
|
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
2494
|
+
.card img {
|
|
2495
|
+
border-radius: 5px 5px 0 0;
|
|
2496
|
+
max-width: 100%;
|
|
2497
|
+
/* 设置最大宽度为容器宽度的100% */
|
|
2498
|
+
max-height: 80%;
|
|
2499
|
+
/* 设置最大高度为容器高度的90% */
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
.card-header {
|
|
2503
|
+
display: flex;
|
|
2504
|
+
justify-content: space-between;
|
|
2505
|
+
align-items: center;
|
|
2506
|
+
margin-top: 5px;
|
|
2507
|
+
margin-bottom: 10px;
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
.card-title {
|
|
2511
|
+
line-height: 50px;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
.card-body {
|
|
2515
|
+
padding: 2px 16px;
|
|
2516
|
+
margin-bottom: 10px;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
.live-broadcast-info {
|
|
2520
|
+
display: flex;
|
|
2521
|
+
align-items: center;
|
|
2522
|
+
margin-bottom: 10px;
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
.anchor-avatar {
|
|
2526
|
+
width: 50px;
|
|
2527
|
+
/* 主播头像大小 */
|
|
2528
|
+
height: auto;
|
|
2529
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
.broadcast-message {
|
|
2533
|
+
display: inline-block;
|
|
2534
|
+
margin-left: 10px;
|
|
2535
|
+
font-size: 20px;
|
|
2536
|
+
color: #333;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
.card-text {
|
|
2540
|
+
color: grey;
|
|
2541
|
+
font-size: 20px;
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
.card-link {
|
|
2545
|
+
display: flex;
|
|
2546
|
+
justify-content: space-between;
|
|
2547
|
+
text-decoration: none;
|
|
2548
|
+
font-size: 20px;
|
|
2549
|
+
margin-top: 10px;
|
|
2550
|
+
margin-bottom: 10px;
|
|
2551
|
+
}
|
|
2552
|
+
</style>
|
|
2553
|
+
</head>
|
|
2554
|
+
<body>
|
|
2555
|
+
<div class="background">
|
|
2556
|
+
<div ${this.giConfig.removeBorder ? "" : "class=\"base-plate\""}>
|
|
2557
|
+
<div class="card">
|
|
2558
|
+
<img src="${cover ? data.user_cover : data.keyframe}"
|
|
2559
|
+
alt="封面">
|
|
2560
|
+
<div class="card-body">
|
|
2561
|
+
<div class="card-header">
|
|
2562
|
+
<h1 class="card-title">${data.title}</h1>
|
|
2563
|
+
<div class="live-broadcast-info">
|
|
2564
|
+
<!-- 主播头像 -->
|
|
2565
|
+
<img style="border-radius: 10px; margin-left: 10px" class="anchor-avatar"
|
|
2566
|
+
src="${userface}" alt="主播头像">
|
|
2567
|
+
<span class="broadcast-message">${username}${titleStatus}</span>
|
|
2568
|
+
</div>
|
|
2569
|
+
</div>
|
|
2570
|
+
${this.giConfig.hideDesc ? "" : `<p class="card-text">${data.description ? data.description : "这个主播很懒,什么简介都没写"}</p>`}
|
|
2571
|
+
<p class="card-link">
|
|
2572
|
+
<span>${liveStatus === 3 ? `本场直播点赞数:${this.numberToStr(+liveData.likedNum)}` : `人气:${this.numberToStr(data.online)}`}</span>
|
|
2573
|
+
<span>分区名称:${data.area_name}</span>
|
|
2574
|
+
</p>
|
|
2575
|
+
<p class="card-link">
|
|
2576
|
+
<span>${liveTime}</span>
|
|
2577
|
+
${this.giConfig.followerDisplay ? `
|
|
2578
|
+
<span>
|
|
2579
|
+
${liveStatus === 1 ? `当前粉丝数:${liveData.fansNum || "暂未获取到"}` : liveStatus === 2 ? `${liveData.watchedNum !== "API" ? `累计观看人数:${liveData.watchedNum}` : ""}` : liveStatus === 3 ? `粉丝数变化:${liveData.fansChanged}` : ""}
|
|
2580
|
+
</span>` : ""}
|
|
2581
|
+
</p>
|
|
2582
|
+
</div>
|
|
2583
|
+
</div>
|
|
2584
|
+
</div>
|
|
2585
|
+
</div>
|
|
2586
|
+
</body>
|
|
2587
|
+
</html>
|
|
2588
|
+
`;
|
|
2589
|
+
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2590
|
+
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2591
|
+
});
|
|
2592
|
+
}
|
|
2593
|
+
static BG_COLOR = {
|
|
2594
|
+
[GuardLevel.None]: ["#4ebcec", "#F9CCDF"],
|
|
2595
|
+
[GuardLevel.Jianzhang]: ["#4ebcec", "#b494e5"],
|
|
2596
|
+
[GuardLevel.Tidu]: ["#d8a0e6", "#b494e5"],
|
|
2597
|
+
[GuardLevel.Zongdu]: ["#f2a053", "#ef5f5f"]
|
|
2598
|
+
};
|
|
2599
|
+
async generateBoardingImg(captainImgUrl, { guardLevel, uname, face, isAdmin }, { masterAvatarUrl, masterName }) {
|
|
2600
|
+
const bgColor = GenerateImg.BG_COLOR[guardLevel];
|
|
2601
|
+
const desc = {
|
|
2602
|
+
[GuardLevel.Jianzhang]: () => {
|
|
2603
|
+
return `"${uname}号"加入<br/>"${masterName}"大航海舰队!`;
|
|
2604
|
+
},
|
|
2605
|
+
[GuardLevel.Tidu]: () => {
|
|
2606
|
+
return `"${uname}"就任<br/>"${masterName}"大航海舰队提督!`;
|
|
2607
|
+
},
|
|
2608
|
+
[GuardLevel.Zongdu]: () => {
|
|
2609
|
+
return `"${uname}"上任<br/>"${masterName}"大航海舰队总督!`;
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
const html = `
|
|
2613
|
+
<!DOCTYPE html>
|
|
2614
|
+
<html>
|
|
3120
2615
|
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
2616
|
+
<head>
|
|
2617
|
+
<title>上舰通知</title>
|
|
2618
|
+
<style>
|
|
2619
|
+
* {
|
|
2620
|
+
margin: 0;
|
|
2621
|
+
padding: 0;
|
|
2622
|
+
box-sizing: border-box;
|
|
2623
|
+
font-family: "${this.giConfig.font}", "Microsoft YaHei", "Source Han Sans", "Noto Sans CJK", sans-serif;
|
|
2624
|
+
}
|
|
3125
2625
|
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
top: 5px;
|
|
3131
|
-
}
|
|
2626
|
+
html {
|
|
2627
|
+
width: 430px;
|
|
2628
|
+
height: auto;
|
|
2629
|
+
}
|
|
3132
2630
|
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
2631
|
+
.bg {
|
|
2632
|
+
display: flex;
|
|
2633
|
+
justify-content: center;
|
|
2634
|
+
align-items: center;
|
|
2635
|
+
width: 430px;
|
|
2636
|
+
height: 220px;
|
|
2637
|
+
background: linear-gradient(to right bottom, ${bgColor[0]}, ${bgColor[1]});
|
|
2638
|
+
}
|
|
3137
2639
|
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
}
|
|
3150
|
-
|
|
3151
|
-
.card .card-major {
|
|
3152
|
-
display: flex;
|
|
3153
|
-
flex-wrap: wrap;
|
|
3154
|
-
gap: 5px;
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
|
-
.card .card-major .photo-item {
|
|
3158
|
-
border-radius: 10px;
|
|
3159
|
-
overflow: hidden;
|
|
3160
|
-
width: 170px;
|
|
3161
|
-
height: 170px;
|
|
3162
|
-
object-fit: cover;
|
|
3163
|
-
}
|
|
2640
|
+
.baseplate {
|
|
2641
|
+
display: flex;
|
|
2642
|
+
justify-content: space-between;
|
|
2643
|
+
align-items: center;
|
|
2644
|
+
border-radius: 10px;
|
|
2645
|
+
width: 410px;
|
|
2646
|
+
height: 200px;
|
|
2647
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2648
|
+
background-color: rgba(255, 255, 255, 0.65);
|
|
2649
|
+
backdrop-filter: blur(10px);
|
|
2650
|
+
}
|
|
3164
2651
|
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
}
|
|
2652
|
+
.info {
|
|
2653
|
+
flex: 1;
|
|
2654
|
+
height: 100%;
|
|
2655
|
+
display: flex;
|
|
2656
|
+
flex-direction: column;
|
|
2657
|
+
justify-content: space-between;
|
|
2658
|
+
padding: 10px 0 10px 10px;
|
|
2659
|
+
}
|
|
3174
2660
|
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
right: 0;
|
|
3180
|
-
bottom: 66px;
|
|
3181
|
-
left: 0;
|
|
3182
|
-
text-align: center;
|
|
3183
|
-
}
|
|
2661
|
+
.user {
|
|
2662
|
+
display: flex;
|
|
2663
|
+
gap: 10px;
|
|
2664
|
+
}
|
|
3184
2665
|
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
transform: translateX(-50%);
|
|
3192
|
-
}
|
|
2666
|
+
.avatar {
|
|
2667
|
+
height: 90px;
|
|
2668
|
+
width: 90px;
|
|
2669
|
+
border-radius: 50%;
|
|
2670
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
|
|
2671
|
+
}
|
|
3193
2672
|
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
}
|
|
2673
|
+
.avatar img {
|
|
2674
|
+
width: 100%;
|
|
2675
|
+
height: 100%;
|
|
2676
|
+
border-radius: 50%;
|
|
2677
|
+
border: 3px solid white;
|
|
2678
|
+
}
|
|
3201
2679
|
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
2680
|
+
.user-info {
|
|
2681
|
+
display: flex;
|
|
2682
|
+
flex-direction: column;
|
|
2683
|
+
align-items: flex-start;
|
|
2684
|
+
gap: 7px;
|
|
2685
|
+
margin-top: 10px;
|
|
2686
|
+
}
|
|
3207
2687
|
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
justify-content: space-between;
|
|
3220
|
-
width: 90%;
|
|
3221
|
-
margin-top: 15px;
|
|
3222
|
-
color: gray;
|
|
3223
|
-
font-size: 14px;
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
.card .card-stat .stat-item {
|
|
3227
|
-
display: flex;
|
|
3228
|
-
align-items: center;
|
|
3229
|
-
gap: 3px;
|
|
3230
|
-
}
|
|
2688
|
+
.name-badge {
|
|
2689
|
+
display: flex;
|
|
2690
|
+
align-items: center;
|
|
2691
|
+
height: 30px;
|
|
2692
|
+
background-color: ${bgColor[0]};
|
|
2693
|
+
border-radius: 25px;
|
|
2694
|
+
color: white;
|
|
2695
|
+
padding: 0 10px;
|
|
2696
|
+
border: solid 2px white;
|
|
2697
|
+
overflow: hidden;
|
|
2698
|
+
}
|
|
3231
2699
|
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
.card .video-cover {
|
|
3241
|
-
position: relative;
|
|
3242
|
-
flex: 2;
|
|
3243
|
-
overflow: hidden;
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3246
|
-
.card .video-cover img {
|
|
3247
|
-
width: 236px;
|
|
3248
|
-
}
|
|
2700
|
+
.name-badge span {
|
|
2701
|
+
max-width: 100px;
|
|
2702
|
+
white-space: nowrap;
|
|
2703
|
+
text-overflow: ellipsis;
|
|
2704
|
+
overflow: hidden;
|
|
2705
|
+
font-weight: bold;
|
|
2706
|
+
font-size: 12px;
|
|
2707
|
+
}
|
|
3249
2708
|
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
position: absolute;
|
|
3261
|
-
color: #fff;
|
|
3262
|
-
font-size: 14px;
|
|
3263
|
-
right: 10px;
|
|
3264
|
-
bottom: 8px;
|
|
3265
|
-
}
|
|
3266
|
-
|
|
3267
|
-
.card .video-info {
|
|
3268
|
-
display: flex;
|
|
3269
|
-
justify-content: space-between;
|
|
3270
|
-
flex-direction: column;
|
|
3271
|
-
flex: 3;
|
|
3272
|
-
border: #e5e7e9 1px solid;
|
|
3273
|
-
border-left: none;
|
|
3274
|
-
border-radius: 0 5px 5px 0;
|
|
3275
|
-
padding: 12px 16px 10px;
|
|
3276
|
-
background-color: #fff;
|
|
3277
|
-
}
|
|
3278
|
-
|
|
3279
|
-
.card .video-info-header .video-title {
|
|
3280
|
-
font-size: 16px;
|
|
3281
|
-
}
|
|
3282
|
-
|
|
3283
|
-
.card .video-info-header .video-introduction {
|
|
3284
|
-
margin-top: 5px;
|
|
3285
|
-
font-size: 12px;
|
|
3286
|
-
color: #AAA;
|
|
3287
|
-
display: -webkit-box;
|
|
3288
|
-
/* 必须设置为 -webkit-box 或 -webkit-inline-box */
|
|
3289
|
-
-webkit-box-orient: vertical;
|
|
3290
|
-
/* 必须设置为 vertical */
|
|
3291
|
-
-webkit-line-clamp: 2;
|
|
3292
|
-
/* 显示的文本行数 */
|
|
3293
|
-
overflow: hidden;
|
|
3294
|
-
/* 必须设置为 hidden */
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
|
-
.card .video-stat {
|
|
3298
|
-
font-size: 12px;
|
|
3299
|
-
color: #AAA;
|
|
3300
|
-
display: flex;
|
|
3301
|
-
gap: 35px
|
|
3302
|
-
}
|
|
3303
|
-
|
|
3304
|
-
.card .video-stat .video-stat-item {
|
|
3305
|
-
display: flex;
|
|
3306
|
-
align-items: center;
|
|
3307
|
-
gap: 3px;
|
|
3308
|
-
}
|
|
2709
|
+
.accompany {
|
|
2710
|
+
display: flex;
|
|
2711
|
+
gap: 5px;
|
|
2712
|
+
align-items: center;
|
|
2713
|
+
height: 25px;
|
|
2714
|
+
background-color: ${bgColor[0]};
|
|
2715
|
+
border-radius: 25px;
|
|
2716
|
+
border: solid 2px white;
|
|
2717
|
+
overflow: hidden;
|
|
2718
|
+
}
|
|
3309
2719
|
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
display: flex;
|
|
3318
|
-
align-items: center;
|
|
3319
|
-
gap: 5px;
|
|
3320
|
-
height: 30px;
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3323
|
-
.forward-userinfo img {
|
|
3324
|
-
width: 20px;
|
|
3325
|
-
height: 20px;
|
|
3326
|
-
border-radius: 50%;
|
|
3327
|
-
}
|
|
3328
|
-
|
|
3329
|
-
.forward-userinfo span {
|
|
3330
|
-
color: #61666D;
|
|
3331
|
-
font-size: 15px;
|
|
3332
|
-
}
|
|
2720
|
+
.master-avatar {
|
|
2721
|
+
width: 25px;
|
|
2722
|
+
height: 25px;
|
|
2723
|
+
border-radius: 50%;
|
|
2724
|
+
background: url("${masterAvatarUrl}") no-repeat center;
|
|
2725
|
+
background-size: cover;
|
|
2726
|
+
}
|
|
3333
2727
|
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
2728
|
+
.accompany span {
|
|
2729
|
+
max-width: 85px;
|
|
2730
|
+
white-space: nowrap;
|
|
2731
|
+
text-overflow: ellipsis;
|
|
2732
|
+
overflow: hidden;
|
|
2733
|
+
color: white;
|
|
2734
|
+
font-size: 10px;
|
|
2735
|
+
font-weight: bold;
|
|
2736
|
+
margin-right: 5px;
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
.desc {
|
|
2740
|
+
margin-bottom: 10px;
|
|
2741
|
+
font-size: 16px;
|
|
2742
|
+
font-weight: bold;
|
|
2743
|
+
font-style: italic;
|
|
2744
|
+
color: #333;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
.captain {
|
|
2748
|
+
width: 175px;
|
|
2749
|
+
height: 175px;
|
|
2750
|
+
background: url("${captainImgUrl}") no-repeat center;
|
|
2751
|
+
background-size: cover;
|
|
2752
|
+
}
|
|
2753
|
+
</style>
|
|
2754
|
+
</head>
|
|
2755
|
+
|
|
2756
|
+
<body>
|
|
2757
|
+
<div class="bg">
|
|
2758
|
+
<div class="baseplate">
|
|
2759
|
+
<div class="info">
|
|
2760
|
+
<div class="user">
|
|
2761
|
+
<div class="avatar">
|
|
2762
|
+
<img src="${face}" alt="用户头像">
|
|
2763
|
+
</div>
|
|
2764
|
+
<div class="user-info">
|
|
2765
|
+
<div class="name-badge">
|
|
2766
|
+
<span>${uname}</span>
|
|
2767
|
+
</div>
|
|
2768
|
+
<div class="accompany">
|
|
2769
|
+
<div class="master-avatar"></div><span>${isAdmin ? "房管" : masterName}</span>
|
|
2770
|
+
</div>
|
|
2771
|
+
</div>
|
|
2772
|
+
</div>
|
|
2773
|
+
<div class="desc">
|
|
2774
|
+
${desc[guardLevel]()}
|
|
2775
|
+
</div>
|
|
2776
|
+
</div>
|
|
2777
|
+
<div class="captain"></div>
|
|
2778
|
+
</div>
|
|
2779
|
+
</div>
|
|
2780
|
+
</body>
|
|
2781
|
+
|
|
2782
|
+
</html>
|
|
2783
|
+
`;
|
|
2784
|
+
return await withRetry(() => this.imgHandler(html)).catch((e) => {
|
|
2785
|
+
throw new Error(`生成图片失败!错误: ${e.toString()}`);
|
|
2786
|
+
});
|
|
2787
|
+
}
|
|
2788
|
+
richTextParser(rt, title) {
|
|
2789
|
+
const richText = rt.reduce((accumulator, currentValue) => {
|
|
2790
|
+
if (currentValue.emoji) return `${accumulator}<img style="width:17px; height:17px;" src="${currentValue.emoji.icon_url}"/>`;
|
|
2791
|
+
return accumulator + currentValue.text;
|
|
2792
|
+
}, "");
|
|
2793
|
+
if (this.giConfig.filter.enable) {
|
|
2794
|
+
if (this.giConfig.filter.regex) {
|
|
2795
|
+
if (new RegExp(this.giConfig.filter.regex).test(richText)) throw new Error("出现关键词,屏蔽该动态");
|
|
2796
|
+
}
|
|
2797
|
+
if (this.giConfig.filter.keywords.length !== 0 && this.giConfig.filter.keywords.some((keyword) => richText.includes(keyword))) throw new Error("出现关键词,屏蔽该动态");
|
|
2798
|
+
}
|
|
2799
|
+
const text = richText.replace(/\n/g, "<br>");
|
|
2800
|
+
return `
|
|
2801
|
+
<div class="card-details">
|
|
2802
|
+
${title ? `<h1 class="dyn-title">${title}</h1>` : ""}
|
|
2803
|
+
${text}
|
|
2804
|
+
</div>
|
|
2805
|
+
`;
|
|
2806
|
+
}
|
|
2807
|
+
async generateDynamicImg(data, { cardColorStart = this.giConfig.cardColorStart, cardColorEnd = this.giConfig.cardColorEnd, cardBasePlateColor = this.giConfig.cardBasePlateColor, cardBasePlateBorder = this.giConfig.cardBasePlateBorder } = {}) {
|
|
2808
|
+
const module_author = data.modules.module_author;
|
|
2809
|
+
const avatarUrl = module_author.face;
|
|
2810
|
+
const upName = module_author.name;
|
|
2811
|
+
let pubTime = this.unixTimestampToString(module_author.pub_ts);
|
|
2812
|
+
let dynamicCardUrl;
|
|
2813
|
+
let dynamicCardId;
|
|
2814
|
+
let dynamicCardColor;
|
|
2815
|
+
if (module_author.decorate) {
|
|
2816
|
+
dynamicCardUrl = module_author.decorate.card_url;
|
|
2817
|
+
dynamicCardId = module_author.decorate.fan.num_str;
|
|
2818
|
+
dynamicCardColor = module_author.decorate.fan.color;
|
|
2819
|
+
}
|
|
2820
|
+
const module_stat = data.modules.module_stat;
|
|
2821
|
+
const comment = module_stat.comment.count;
|
|
2822
|
+
const forward = module_stat.forward.count;
|
|
2823
|
+
const like = module_stat.like.count;
|
|
2824
|
+
const topic = data.modules.module_dynamic.topic ? data.modules.module_dynamic.topic.name : "";
|
|
2825
|
+
const getDynamicMajor = async (dynamic, forward$1) => {
|
|
2826
|
+
let main$1 = "";
|
|
2827
|
+
let forwardInfo;
|
|
2828
|
+
const basicDynamic = () => {
|
|
2829
|
+
const module_dynamic = dynamic.modules.module_dynamic;
|
|
2830
|
+
if (module_dynamic?.desc?.rich_text_nodes) {
|
|
2831
|
+
const content = this.richTextParser(module_dynamic.desc.rich_text_nodes);
|
|
2832
|
+
main$1 += content;
|
|
2833
|
+
}
|
|
2834
|
+
if (module_dynamic?.major?.opus?.summary?.rich_text_nodes) {
|
|
2835
|
+
const content = this.richTextParser(module_dynamic.major.opus.summary.rich_text_nodes, module_dynamic.major.opus.title);
|
|
2836
|
+
main$1 += content;
|
|
2837
|
+
}
|
|
2838
|
+
let major = "";
|
|
2839
|
+
const arrowImg = pathToFileURL(resolve(__dirname, "img/arrow.png"));
|
|
2840
|
+
if (module_dynamic?.major?.opus?.pics) {
|
|
2841
|
+
if (module_dynamic.major.opus.pics.length === 1) if (module_dynamic.major.opus.pics[0].height > 3e3) major += `
|
|
2842
|
+
<div class="single-photo-container">
|
|
2843
|
+
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2844
|
+
<div class="single-photo-mask">
|
|
2845
|
+
<span class="single-photo-mask-text">点击链接浏览全部</span>
|
|
2846
|
+
</div>
|
|
2847
|
+
<img class="single-photo-mask-arrow" src="${arrowImg}"/>
|
|
2848
|
+
</div>
|
|
2849
|
+
`;
|
|
2850
|
+
else major += `
|
|
2851
|
+
<div class="single-photo-container">
|
|
2852
|
+
<img class="single-photo-item" src="${module_dynamic.major.opus.pics[0].url}"/>
|
|
2853
|
+
</div>
|
|
2854
|
+
`;
|
|
2855
|
+
else if (module_dynamic.major.opus.pics.length === 4) major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2856
|
+
return `${acc}<img class="four-photo-item" src="${cV.url}"/>`;
|
|
2857
|
+
}, "");
|
|
2858
|
+
else major += module_dynamic.major.opus.pics.reduce((acc, cV) => {
|
|
2859
|
+
return `${acc}<img class="photo-item" src="${cV.url}"/>`;
|
|
2860
|
+
}, "");
|
|
2861
|
+
main$1 += `
|
|
2862
|
+
<div class="card-major">
|
|
2863
|
+
${major}
|
|
2864
|
+
</div>
|
|
2865
|
+
`;
|
|
2866
|
+
}
|
|
2867
|
+
};
|
|
2868
|
+
switch (dynamic.type) {
|
|
2869
|
+
case DYNAMIC_TYPE_WORD:
|
|
2870
|
+
case DYNAMIC_TYPE_DRAW:
|
|
2871
|
+
case DYNAMIC_TYPE_FORWARD:
|
|
2872
|
+
basicDynamic();
|
|
2873
|
+
if (dynamic.type === DYNAMIC_TYPE_FORWARD) {
|
|
2874
|
+
if (this.giConfig.filter.enable && this.giConfig.filter.forward) throw new Error("已屏蔽转发动态");
|
|
2875
|
+
const forward_module_author = dynamic.orig.modules.module_author;
|
|
2876
|
+
const forwardUserAvatarUrl = forward_module_author.face;
|
|
2877
|
+
const forwardUserName = forward_module_author.name;
|
|
2878
|
+
const [forwardMain, forwardInfo$1] = await getDynamicMajor(dynamic.orig, true);
|
|
2879
|
+
main$1 += `
|
|
2880
|
+
<div class="card-forward">
|
|
2881
|
+
<div class="forward-userinfo">
|
|
2882
|
+
<img class="forward-avatar" src="${forwardUserAvatarUrl}" alt="avatar">
|
|
2883
|
+
<span class="forward-username">${forwardUserName} ${forwardInfo$1 ? forwardInfo$1 : ""}</span>
|
|
2884
|
+
</div>
|
|
2885
|
+
<div class="forward-main">
|
|
2886
|
+
${forwardMain}
|
|
2887
|
+
</div>
|
|
2888
|
+
</div>
|
|
2889
|
+
`;
|
|
2890
|
+
}
|
|
2891
|
+
if (dynamic.modules.module_dynamic.additional) {
|
|
2892
|
+
const additional = dynamic.modules.module_dynamic.additional;
|
|
2893
|
+
switch (additional.type) {
|
|
2894
|
+
case ADDITIONAL_TYPE_RESERVE: {
|
|
2895
|
+
const reserve = additional.reserve;
|
|
2896
|
+
let button;
|
|
2897
|
+
if (reserve.button.uncheck.text === "已结束") button = `
|
|
2898
|
+
<button class="reserve-button-end">
|
|
2899
|
+
<span>${reserve.button.uncheck.text}</span>
|
|
2900
|
+
</button>
|
|
2901
|
+
`;
|
|
2902
|
+
else button = `
|
|
2903
|
+
<button class="reserve-button-ing">
|
|
2904
|
+
<svg class="bili-dyn-card-reserve__action__icon" style="width: 16px; height: 16px;"
|
|
2905
|
+
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
2906
|
+
viewBox="0 0 16 16" width="16" height="16">
|
|
2907
|
+
<path
|
|
2908
|
+
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"
|
|
2909
|
+
fill="currentColor"></path>
|
|
2910
|
+
<path
|
|
2911
|
+
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"
|
|
2912
|
+
fill="currentColor"></path>
|
|
2913
|
+
<path
|
|
2914
|
+
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"
|
|
2915
|
+
fill="currentColor"></path>
|
|
2916
|
+
</svg>
|
|
2917
|
+
<span>${reserve.button.uncheck.text}</span>
|
|
2918
|
+
</button>
|
|
2919
|
+
`;
|
|
2920
|
+
main$1 += `
|
|
2921
|
+
<div class="card-reserve">
|
|
2922
|
+
<div class="reserve-main">
|
|
2923
|
+
<div class="reserve-title">
|
|
2924
|
+
${reserve.title}
|
|
2925
|
+
</div>
|
|
2926
|
+
<div class="reserve-desc">
|
|
2927
|
+
<div class="reserve-info">
|
|
2928
|
+
<span class="reserve-time">${reserve.desc1.text}</span>
|
|
2929
|
+
<span class="reserve-num">${reserve.desc2.text}</span>
|
|
2930
|
+
</div>
|
|
2931
|
+
${reserve.desc3 ? `<div class="reserve-prize">
|
|
2932
|
+
<svg class="bili-dyn-card-reserve__lottery__icon"
|
|
2933
|
+
style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2934
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2935
|
+
height="16">
|
|
2936
|
+
<path
|
|
2937
|
+
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"
|
|
2938
|
+
fill="currentColor"></path>
|
|
2939
|
+
<path
|
|
2940
|
+
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"
|
|
2941
|
+
fill="currentColor"></path>
|
|
2942
|
+
<path
|
|
2943
|
+
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"
|
|
2944
|
+
fill="currentColor"></path>
|
|
2945
|
+
<path
|
|
2946
|
+
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"
|
|
2947
|
+
fill="currentColor"></path>
|
|
2948
|
+
<path
|
|
2949
|
+
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"
|
|
2950
|
+
fill="currentColor"></path>
|
|
2951
|
+
</svg>
|
|
2952
|
+
<span>${reserve.desc3.text}</span>
|
|
2953
|
+
<svg style="width: 12px; height: 12px;" xmlns="http://www.w3.org/2000/svg"
|
|
2954
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 12 12" width="12"
|
|
2955
|
+
height="12">
|
|
2956
|
+
<path
|
|
2957
|
+
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"
|
|
2958
|
+
fill="currentColor"></path>
|
|
2959
|
+
</svg>
|
|
2960
|
+
</div>` : ""}
|
|
2961
|
+
</div>
|
|
2962
|
+
</div>
|
|
2963
|
+
<div class="reserve-button">
|
|
2964
|
+
${button}
|
|
2965
|
+
</div>
|
|
2966
|
+
</div>
|
|
2967
|
+
`;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
break;
|
|
2972
|
+
case DYNAMIC_TYPE_AV: {
|
|
2973
|
+
basicDynamic();
|
|
2974
|
+
const archive = dynamic.modules.module_dynamic.major.archive;
|
|
2975
|
+
if (archive.badge.text === "投稿视频") if (forward$1) forwardInfo = "投稿了视频";
|
|
2976
|
+
else pubTime = `${pubTime} · 投稿了视频`;
|
|
2977
|
+
main$1 += `
|
|
2978
|
+
<div class="card-video">
|
|
2979
|
+
<div class="video-cover">
|
|
2980
|
+
<img src="${archive.cover}"
|
|
2981
|
+
alt="">
|
|
2982
|
+
<div class="cover-mask"></div>
|
|
2983
|
+
<span>${archive.duration_text}</span>
|
|
2984
|
+
</div>
|
|
2985
|
+
<div class="video-info">
|
|
2986
|
+
<div class="video-info-header">
|
|
2987
|
+
<div class="video-title">
|
|
2988
|
+
${archive.title}
|
|
2989
|
+
</div>
|
|
2990
|
+
<div class="video-introduction">
|
|
2991
|
+
${archive.desc}
|
|
2992
|
+
</div>
|
|
2993
|
+
</div>
|
|
2994
|
+
<div class="video-stat">
|
|
2995
|
+
<div class="video-stat-item">
|
|
2996
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
2997
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
2998
|
+
height="16">
|
|
2999
|
+
<path
|
|
3000
|
+
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"
|
|
3001
|
+
fill="currentColor"></path>
|
|
3002
|
+
<path
|
|
3003
|
+
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"
|
|
3004
|
+
fill="currentColor"></path>
|
|
3005
|
+
</svg>
|
|
3006
|
+
<span>${archive.stat.play}</span>
|
|
3007
|
+
</div>
|
|
3008
|
+
<div class="video-stat-item">
|
|
3009
|
+
<svg style="width: 16px; height: 16px;" xmlns="http://www.w3.org/2000/svg"
|
|
3010
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" width="16"
|
|
3011
|
+
height="16">
|
|
3012
|
+
<path
|
|
3013
|
+
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"
|
|
3014
|
+
fill="currentColor"></path>
|
|
3015
|
+
<path
|
|
3016
|
+
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"
|
|
3017
|
+
fill="currentColor"></path>
|
|
3018
|
+
<path
|
|
3019
|
+
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"
|
|
3020
|
+
fill="currentColor"></path>
|
|
3021
|
+
<path
|
|
3022
|
+
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"
|
|
3023
|
+
fill="currentColor"></path>
|
|
3024
|
+
<path
|
|
3025
|
+
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"
|
|
3026
|
+
fill="currentColor"></path>
|
|
3027
|
+
</svg>
|
|
3028
|
+
<span>${archive.stat.danmaku}</span>
|
|
3029
|
+
</div>
|
|
3030
|
+
</div>
|
|
3031
|
+
</div>
|
|
3032
|
+
</div>
|
|
3033
|
+
`;
|
|
3034
|
+
break;
|
|
3035
|
+
}
|
|
3036
|
+
case DYNAMIC_TYPE_LIVE: return [`${upName}发起了直播预约,我暂时无法渲染,请自行查看`];
|
|
3037
|
+
case DYNAMIC_TYPE_MEDIALIST: return [`${upName}分享了收藏夹,我暂时无法渲染,请自行查看`];
|
|
3038
|
+
case DYNAMIC_TYPE_PGC: return [`${upName}发布了剧集(番剧、电影、纪录片),我暂时无法渲染,请自行查看`];
|
|
3039
|
+
case DYNAMIC_TYPE_ARTICLE:
|
|
3040
|
+
if (this.giConfig.filter.enable && this.giConfig.filter.article) throw new Error("已屏蔽专栏动态");
|
|
3041
|
+
return [`${upName}投稿了新专栏,我暂时无法渲染,请自行查看`];
|
|
3042
|
+
case DYNAMIC_TYPE_MUSIC: return [`${upName}发行了新歌,我暂时无法渲染,请自行查看`];
|
|
3043
|
+
case DYNAMIC_TYPE_COMMON_SQUARE: return [`${upName}发布了装扮|剧集|点评|普通分享,我暂时无法渲染,请自行查看`];
|
|
3044
|
+
case DYNAMIC_TYPE_COURSES_SEASON: return [`${upName}发布了新课程,我暂时无法渲染,请自行查看`];
|
|
3045
|
+
case DYNAMIC_TYPE_UGC_SEASON: return [`${upName}更新了合集,我暂时无法渲染,请自行查看`];
|
|
3046
|
+
case DYNAMIC_TYPE_NONE: return [`${upName}发布了一条无效动态`];
|
|
3047
|
+
case DYNAMIC_TYPE_LIVE_RCMD: throw new Error("直播开播动态,不做处理");
|
|
3048
|
+
default: return [`${upName}发布了一条我无法识别的动态,请自行查看`];
|
|
3049
|
+
}
|
|
3050
|
+
return [main$1, forwardInfo];
|
|
3051
|
+
};
|
|
3052
|
+
const [main] = await getDynamicMajor(data, false);
|
|
3391
3053
|
const html = `
|
|
3392
3054
|
<!DOCTYPE html>
|
|
3393
3055
|
<html>
|
|
3394
3056
|
<head>
|
|
3395
3057
|
<title>动态通知</title>
|
|
3396
3058
|
<style>
|
|
3397
|
-
${
|
|
3059
|
+
${this.generateCardStyle(this.giConfig.enableLargeFont, cardColorStart, cardColorEnd, cardBasePlateBorder, cardBasePlateColor, dynamicCardColor ?? "#FFFFFF")}
|
|
3398
3060
|
</style>
|
|
3399
3061
|
</head>
|
|
3400
3062
|
<body>
|
|
@@ -3771,6 +3433,15 @@ var BiliAPI = class extends Service {
|
|
|
3771
3433
|
updateJob;
|
|
3772
3434
|
pRetry;
|
|
3773
3435
|
AbortError;
|
|
3436
|
+
RETRY_CONFIG = { retries: 3 };
|
|
3437
|
+
async retryWithLog(fn, methodName) {
|
|
3438
|
+
return this.pRetry(fn, {
|
|
3439
|
+
onFailedAttempt: (error) => {
|
|
3440
|
+
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 ${methodName}() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3441
|
+
},
|
|
3442
|
+
...this.RETRY_CONFIG
|
|
3443
|
+
});
|
|
3444
|
+
}
|
|
3774
3445
|
constructor(ctx, config) {
|
|
3775
3446
|
super(ctx, "bilibili-notify-api");
|
|
3776
3447
|
this.apiConfig = config;
|
|
@@ -3840,82 +3511,46 @@ var BiliAPI = class extends Service {
|
|
|
3840
3511
|
return Buffer.concat([decipher.update(encryptedText), decipher.final()]).toString();
|
|
3841
3512
|
}
|
|
3842
3513
|
async getTheUserWhoIsLiveStreaming() {
|
|
3843
|
-
|
|
3514
|
+
return this.retryWithLog(async () => {
|
|
3844
3515
|
const { data } = await this.client.get(GET_LATEST_UPDATED_UPS);
|
|
3845
3516
|
return data;
|
|
3846
|
-
};
|
|
3847
|
-
return await this.pRetry(run, {
|
|
3848
|
-
onFailedAttempt: (error) => {
|
|
3849
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTheUserWhoIsLiveStreaming() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3850
|
-
},
|
|
3851
|
-
retries: 3
|
|
3852
|
-
});
|
|
3517
|
+
}, "getTheUserWhoIsLiveStreaming");
|
|
3853
3518
|
}
|
|
3854
3519
|
async getLiveRoomInfoStreamKey(roomId) {
|
|
3855
|
-
|
|
3520
|
+
return this.retryWithLog(async () => {
|
|
3856
3521
|
const { data } = await this.client.get(`${GET_LIVE_ROOM_INFO_STREAM_KEY}?id=${roomId}`);
|
|
3857
3522
|
return data;
|
|
3858
|
-
};
|
|
3859
|
-
return await this.pRetry(run, {
|
|
3860
|
-
onFailedAttempt: (error) => {
|
|
3861
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoStreamKey() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3862
|
-
},
|
|
3863
|
-
retries: 3
|
|
3864
|
-
});
|
|
3523
|
+
}, "getLiveRoomInfoStreamKey");
|
|
3865
3524
|
}
|
|
3866
3525
|
async getLiveRoomInfoByUids(uids) {
|
|
3867
|
-
|
|
3526
|
+
return this.retryWithLog(async () => {
|
|
3868
3527
|
const params = uids.map((uid) => `uids[]=${uid}`).join("&");
|
|
3869
3528
|
const { data } = await this.client.get(`${GET_LIVE_ROOMS_INFO}?${params}`);
|
|
3870
3529
|
return data;
|
|
3871
|
-
};
|
|
3872
|
-
return await this.pRetry(run, {
|
|
3873
|
-
onFailedAttempt: (error) => {
|
|
3874
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfoByUids() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3875
|
-
},
|
|
3876
|
-
retries: 3
|
|
3877
|
-
});
|
|
3530
|
+
}, "getLiveRoomInfoByUids");
|
|
3878
3531
|
}
|
|
3879
3532
|
async getServerUTCTime() {
|
|
3880
|
-
|
|
3533
|
+
return this.retryWithLog(async () => {
|
|
3881
3534
|
const { data } = await this.client.get(GET_SERVER_UTC_TIME);
|
|
3882
3535
|
const match = data.match(/Date\.UTC\((.*?)\)/);
|
|
3883
3536
|
if (match) return new Function(`return Date.UTC(${match[1]})`)() / 1e3;
|
|
3884
3537
|
throw new this.AbortError("解析服务器时间失败!");
|
|
3885
|
-
};
|
|
3886
|
-
return await this.pRetry(run, {
|
|
3887
|
-
onFailedAttempt: (error) => {
|
|
3888
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getServerUTCTime() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3889
|
-
},
|
|
3890
|
-
retries: 3
|
|
3891
|
-
});
|
|
3538
|
+
}, "getServerUTCTime");
|
|
3892
3539
|
}
|
|
3893
3540
|
async getTimeNow() {
|
|
3894
|
-
|
|
3541
|
+
return this.retryWithLog(async () => {
|
|
3895
3542
|
const { data } = await this.client.get(GET_TIME_NOW);
|
|
3896
3543
|
return data;
|
|
3897
|
-
};
|
|
3898
|
-
return await this.pRetry(run, {
|
|
3899
|
-
onFailedAttempt: (error) => {
|
|
3900
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getTimeNow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3901
|
-
},
|
|
3902
|
-
retries: 3
|
|
3903
|
-
});
|
|
3544
|
+
}, "getTimeNow");
|
|
3904
3545
|
}
|
|
3905
3546
|
async getAllGroup() {
|
|
3906
|
-
|
|
3547
|
+
return this.retryWithLog(async () => {
|
|
3907
3548
|
const { data } = await this.client.get(GET_ALL_GROUP);
|
|
3908
3549
|
return data;
|
|
3909
|
-
};
|
|
3910
|
-
return await this.pRetry(run, {
|
|
3911
|
-
onFailedAttempt: (error) => {
|
|
3912
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3913
|
-
},
|
|
3914
|
-
retries: 3
|
|
3915
|
-
});
|
|
3550
|
+
}, "getAllGroup");
|
|
3916
3551
|
}
|
|
3917
3552
|
async removeUserFromGroup(mid) {
|
|
3918
|
-
|
|
3553
|
+
return this.retryWithLog(async () => {
|
|
3919
3554
|
const csrf = this.getCSRF();
|
|
3920
3555
|
const { data } = await this.client.post(MODIFY_GROUP_MEMBER, {
|
|
3921
3556
|
fids: mid,
|
|
@@ -3923,16 +3558,10 @@ var BiliAPI = class extends Service {
|
|
|
3923
3558
|
csrf
|
|
3924
3559
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
3925
3560
|
return data;
|
|
3926
|
-
};
|
|
3927
|
-
return await this.pRetry(run, {
|
|
3928
|
-
onFailedAttempt: (error) => {
|
|
3929
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 removeUserFromGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3930
|
-
},
|
|
3931
|
-
retries: 3
|
|
3932
|
-
});
|
|
3561
|
+
}, "removeUserFromGroup");
|
|
3933
3562
|
}
|
|
3934
3563
|
async copyUserToGroup(mid, groupId) {
|
|
3935
|
-
|
|
3564
|
+
return this.retryWithLog(async () => {
|
|
3936
3565
|
const csrf = this.getCSRF();
|
|
3937
3566
|
const { data } = await this.client.post(COPY_USER_TO_GROUP, {
|
|
3938
3567
|
fids: mid,
|
|
@@ -3940,67 +3569,37 @@ var BiliAPI = class extends Service {
|
|
|
3940
3569
|
csrf
|
|
3941
3570
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
3942
3571
|
return data;
|
|
3943
|
-
};
|
|
3944
|
-
return await this.pRetry(run, {
|
|
3945
|
-
onFailedAttempt: (error) => {
|
|
3946
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 copyUserToGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3947
|
-
},
|
|
3948
|
-
retries: 3
|
|
3949
|
-
});
|
|
3572
|
+
}, "copyUserToGroup");
|
|
3950
3573
|
}
|
|
3951
3574
|
async getUserSpaceDynamic(mid) {
|
|
3952
|
-
|
|
3575
|
+
return this.retryWithLog(async () => {
|
|
3953
3576
|
const { data } = await this.client.get(`${GET_USER_SPACE_DYNAMIC_LIST}&host_mid=${mid}`);
|
|
3954
3577
|
return data;
|
|
3955
|
-
};
|
|
3956
|
-
return await this.pRetry(run, {
|
|
3957
|
-
onFailedAttempt: (error) => {
|
|
3958
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserSpaceDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3959
|
-
},
|
|
3960
|
-
retries: 3
|
|
3961
|
-
});
|
|
3578
|
+
}, "getUserSpaceDynamic");
|
|
3962
3579
|
}
|
|
3963
3580
|
async createGroup(tag) {
|
|
3964
|
-
|
|
3581
|
+
return this.retryWithLog(async () => {
|
|
3965
3582
|
const { data } = await this.client.post(CREATE_GROUP, {
|
|
3966
3583
|
tag,
|
|
3967
3584
|
csrf: this.getCSRF()
|
|
3968
3585
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
3969
3586
|
return data;
|
|
3970
|
-
};
|
|
3971
|
-
return await this.pRetry(run, {
|
|
3972
|
-
onFailedAttempt: (error) => {
|
|
3973
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 createGroup() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3974
|
-
},
|
|
3975
|
-
retries: 3
|
|
3976
|
-
});
|
|
3587
|
+
}, "createGroup");
|
|
3977
3588
|
}
|
|
3978
3589
|
async getAllDynamic() {
|
|
3979
|
-
|
|
3590
|
+
return this.retryWithLog(async () => {
|
|
3980
3591
|
const { data } = await this.client.get(GET_ALL_DYNAMIC_LIST);
|
|
3981
3592
|
return data;
|
|
3982
|
-
};
|
|
3983
|
-
return await this.pRetry(run, {
|
|
3984
|
-
onFailedAttempt: (error) => {
|
|
3985
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getAllDynamic() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3986
|
-
},
|
|
3987
|
-
retries: 3
|
|
3988
|
-
});
|
|
3593
|
+
}, "getAllDynamic");
|
|
3989
3594
|
}
|
|
3990
3595
|
async hasNewDynamic(updateBaseline) {
|
|
3991
|
-
|
|
3596
|
+
return this.retryWithLog(async () => {
|
|
3992
3597
|
const { data } = await this.client.get(`${HAS_NEW_DYNAMIC}?update_baseline=${updateBaseline}`);
|
|
3993
3598
|
return data;
|
|
3994
|
-
};
|
|
3995
|
-
return await this.pRetry(run, {
|
|
3996
|
-
onFailedAttempt: (error) => {
|
|
3997
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 hasNewDynamic()时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
3998
|
-
},
|
|
3999
|
-
retries: 3
|
|
4000
|
-
});
|
|
3599
|
+
}, "hasNewDynamic");
|
|
4001
3600
|
}
|
|
4002
3601
|
async follow(fid) {
|
|
4003
|
-
|
|
3602
|
+
return this.retryWithLog(async () => {
|
|
4004
3603
|
const { data } = await this.client.post(MODIFY_RELATION, {
|
|
4005
3604
|
fid,
|
|
4006
3605
|
act: 1,
|
|
@@ -4008,43 +3607,25 @@ var BiliAPI = class extends Service {
|
|
|
4008
3607
|
csrf: this.getCSRF()
|
|
4009
3608
|
}, { headers: { "Content-Type": "application/x-www-form-urlencoded" } });
|
|
4010
3609
|
return data;
|
|
4011
|
-
};
|
|
4012
|
-
return await this.pRetry(run, {
|
|
4013
|
-
onFailedAttempt: (error) => {
|
|
4014
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 follow() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4015
|
-
},
|
|
4016
|
-
retries: 3
|
|
4017
|
-
});
|
|
3610
|
+
}, "follow");
|
|
4018
3611
|
}
|
|
4019
3612
|
async getRelationGroupDetail(tagid) {
|
|
4020
|
-
|
|
3613
|
+
return this.retryWithLog(async () => {
|
|
4021
3614
|
const { data } = await this.client.get(`${GET_RELATION_GROUP_DETAIL}?tagid=${tagid}`);
|
|
4022
3615
|
return data;
|
|
4023
|
-
};
|
|
4024
|
-
return await this.pRetry(run, {
|
|
4025
|
-
onFailedAttempt: (error) => {
|
|
4026
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getRelationGroupDetail() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4027
|
-
},
|
|
4028
|
-
retries: 3
|
|
4029
|
-
});
|
|
3616
|
+
}, "getRelationGroupDetail");
|
|
4030
3617
|
}
|
|
4031
3618
|
async getCookieInfo(refreshToken) {
|
|
4032
|
-
|
|
3619
|
+
return this.retryWithLog(async () => {
|
|
4033
3620
|
const { data } = await this.client.get(`${GET_COOKIES_INFO}?csrf=${refreshToken}`).catch((e) => {
|
|
4034
3621
|
this.logger.info(e.message);
|
|
4035
3622
|
return null;
|
|
4036
3623
|
});
|
|
4037
3624
|
return data;
|
|
4038
|
-
};
|
|
4039
|
-
return await this.pRetry(run, {
|
|
4040
|
-
onFailedAttempt: (error) => {
|
|
4041
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getCookieInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4042
|
-
},
|
|
4043
|
-
retries: 3
|
|
4044
|
-
});
|
|
3625
|
+
}, "getCookieInfo");
|
|
4045
3626
|
}
|
|
4046
3627
|
async getUserInfo(mid, grisk_id) {
|
|
4047
|
-
|
|
3628
|
+
return this.retryWithLog(async () => {
|
|
4048
3629
|
if (mid === "11783021") {
|
|
4049
3630
|
console.log("检测到番剧出差UID,跳过远程用户接口访问");
|
|
4050
3631
|
return bangumiTripData;
|
|
@@ -4054,139 +3635,73 @@ var BiliAPI = class extends Service {
|
|
|
4054
3635
|
const wbi = await this.getWbi(params);
|
|
4055
3636
|
const { data } = await this.client.get(`${GET_USER_INFO}?${wbi}`);
|
|
4056
3637
|
return data;
|
|
4057
|
-
};
|
|
4058
|
-
return await this.pRetry(run, {
|
|
4059
|
-
onFailedAttempt: (error) => {
|
|
4060
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4061
|
-
},
|
|
4062
|
-
retries: 3
|
|
4063
|
-
});
|
|
3638
|
+
}, "getUserInfo");
|
|
4064
3639
|
}
|
|
4065
3640
|
async getWbiKeys() {
|
|
4066
|
-
|
|
3641
|
+
return this.retryWithLog(async () => {
|
|
4067
3642
|
const { data } = await this.client.get("https://api.bilibili.com/x/web-interface/nav");
|
|
4068
3643
|
const { data: { wbi_img: { img_url, sub_url } } } = data;
|
|
4069
3644
|
return {
|
|
4070
3645
|
img_key: img_url.slice(img_url.lastIndexOf("/") + 1, img_url.lastIndexOf(".")),
|
|
4071
3646
|
sub_key: sub_url.slice(sub_url.lastIndexOf("/") + 1, sub_url.lastIndexOf("."))
|
|
4072
3647
|
};
|
|
4073
|
-
};
|
|
4074
|
-
return await this.pRetry(run, {
|
|
4075
|
-
onFailedAttempt: (error) => {
|
|
4076
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getWbiKeys() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4077
|
-
},
|
|
4078
|
-
retries: 3
|
|
4079
|
-
});
|
|
3648
|
+
}, "getWbiKeys");
|
|
4080
3649
|
}
|
|
4081
3650
|
async getMyselfInfo() {
|
|
4082
|
-
|
|
3651
|
+
return this.retryWithLog(async () => {
|
|
4083
3652
|
const { data } = await this.client.get(GET_MYSELF_INFO);
|
|
4084
3653
|
return data;
|
|
4085
|
-
};
|
|
4086
|
-
return await this.pRetry(run, {
|
|
4087
|
-
onFailedAttempt: (error) => {
|
|
4088
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMyselfInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4089
|
-
},
|
|
4090
|
-
retries: 3
|
|
4091
|
-
});
|
|
3654
|
+
}, "getMyselfInfo");
|
|
4092
3655
|
}
|
|
4093
3656
|
async getLoginQRCode() {
|
|
4094
|
-
|
|
3657
|
+
return this.retryWithLog(async () => {
|
|
4095
3658
|
const { data } = await this.client.get(GET_LOGIN_QRCODE);
|
|
4096
3659
|
return data;
|
|
4097
|
-
};
|
|
4098
|
-
return await this.pRetry(run, {
|
|
4099
|
-
onFailedAttempt: (error) => {
|
|
4100
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginQRCode() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4101
|
-
},
|
|
4102
|
-
retries: 3
|
|
4103
|
-
});
|
|
3660
|
+
}, "getLoginQRCode");
|
|
4104
3661
|
}
|
|
4105
3662
|
async getLoginStatus(qrcodeKey) {
|
|
4106
|
-
|
|
3663
|
+
return this.retryWithLog(async () => {
|
|
4107
3664
|
const { data } = await this.client.get(`${GET_LOGIN_STATUS}?qrcode_key=${qrcodeKey}`);
|
|
4108
3665
|
return data;
|
|
4109
|
-
};
|
|
4110
|
-
return await this.pRetry(run, {
|
|
4111
|
-
onFailedAttempt: (error) => {
|
|
4112
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLoginStatus() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4113
|
-
},
|
|
4114
|
-
retries: 3
|
|
4115
|
-
});
|
|
3666
|
+
}, "getLoginStatus");
|
|
4116
3667
|
}
|
|
4117
3668
|
async getLiveRoomInfo(roomId) {
|
|
4118
|
-
|
|
3669
|
+
return this.retryWithLog(async () => {
|
|
4119
3670
|
const { data } = await this.client.get(`${GET_LIVE_ROOM_INFO}?room_id=${roomId}`);
|
|
4120
3671
|
return data;
|
|
4121
|
-
};
|
|
4122
|
-
return await this.pRetry(run, {
|
|
4123
|
-
onFailedAttempt: (error) => {
|
|
4124
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getLiveRoomInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4125
|
-
},
|
|
4126
|
-
retries: 3
|
|
4127
|
-
});
|
|
3672
|
+
}, "getLiveRoomInfo");
|
|
4128
3673
|
}
|
|
4129
3674
|
async getMasterInfo(mid) {
|
|
4130
|
-
|
|
3675
|
+
return this.retryWithLog(async () => {
|
|
4131
3676
|
const { data } = await this.client.get(`${GET_MASTER_INFO}?uid=${mid}`);
|
|
4132
3677
|
return data;
|
|
4133
|
-
};
|
|
4134
|
-
return await this.pRetry(run, {
|
|
4135
|
-
onFailedAttempt: (error) => {
|
|
4136
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getMasterInfo() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4137
|
-
},
|
|
4138
|
-
retries: 3
|
|
4139
|
-
});
|
|
3678
|
+
}, "getMasterInfo");
|
|
4140
3679
|
}
|
|
4141
3680
|
async getOnlineGoldRank(roomId, ruid, page = 1, pageSize = 20) {
|
|
4142
|
-
|
|
3681
|
+
return this.retryWithLog(async () => {
|
|
4143
3682
|
const { data } = await this.client.get(`${GET_ONLINE_GOLD_RANK}?room_id=${roomId}&ruid=${ruid}&page=${page}&page_size=${pageSize}`);
|
|
4144
3683
|
return data;
|
|
4145
|
-
};
|
|
4146
|
-
return await this.pRetry(run, {
|
|
4147
|
-
onFailedAttempt: (error) => {
|
|
4148
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getOnlineGoldRank() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4149
|
-
},
|
|
4150
|
-
retries: 3
|
|
4151
|
-
});
|
|
3684
|
+
}, "getOnlineGoldRank");
|
|
4152
3685
|
}
|
|
4153
3686
|
async getUserInfoInLive(uid, ruid) {
|
|
4154
|
-
|
|
3687
|
+
return this.retryWithLog(async () => {
|
|
4155
3688
|
const { data } = await this.client.get(`${GET_USER_INFO_IN_LIVE}?uid=${uid}&ruid=${ruid}`);
|
|
4156
3689
|
return data;
|
|
4157
|
-
};
|
|
4158
|
-
return await this.pRetry(run, {
|
|
4159
|
-
onFailedAttempt: (error) => {
|
|
4160
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4161
|
-
},
|
|
4162
|
-
retries: 3
|
|
4163
|
-
});
|
|
3690
|
+
}, "getUserInfoInLive");
|
|
4164
3691
|
}
|
|
4165
3692
|
async getUserCardInfo(mid, photo) {
|
|
4166
|
-
|
|
3693
|
+
return this.retryWithLog(async () => {
|
|
4167
3694
|
let url = `${GET_USER_CARD_INFO}?mid=${mid}`;
|
|
4168
3695
|
if (photo) url += "&photo=true";
|
|
4169
3696
|
const { data } = await this.client.get(url);
|
|
4170
3697
|
return data;
|
|
4171
|
-
};
|
|
4172
|
-
return await this.pRetry(run, {
|
|
4173
|
-
onFailedAttempt: (error) => {
|
|
4174
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4175
|
-
},
|
|
4176
|
-
retries: 3
|
|
4177
|
-
});
|
|
3698
|
+
}, "getUserCardInfo");
|
|
4178
3699
|
}
|
|
4179
3700
|
async getCORSContent(url) {
|
|
4180
|
-
|
|
3701
|
+
return this.retryWithLog(async () => {
|
|
4181
3702
|
const { data } = await this.client.get(url);
|
|
4182
3703
|
return data;
|
|
4183
|
-
};
|
|
4184
|
-
return await this.pRetry(run, {
|
|
4185
|
-
onFailedAttempt: (error) => {
|
|
4186
|
-
this.logger.error(`主人呜呜 (;>_<) 女仆在执行 getUserInfoInLive() 时第 ${error.attemptNumber} 次失败啦~原因:${error.message},请主人帮女仆看看呀 (>ω<)♡`);
|
|
4187
|
-
},
|
|
4188
|
-
retries: 3
|
|
4189
|
-
});
|
|
3704
|
+
}, "getCORSContent");
|
|
4190
3705
|
}
|
|
4191
3706
|
async chatWithAI(content) {
|
|
4192
3707
|
return await this.aiClient.chat.completions.create({
|
|
@@ -4288,6 +3803,10 @@ var BiliAPI = class extends Service {
|
|
|
4288
3803
|
getLoginInfoIsLoaded() {
|
|
4289
3804
|
return this.loginInfoIsLoaded;
|
|
4290
3805
|
}
|
|
3806
|
+
parseExpires(expires) {
|
|
3807
|
+
if (!expires || expires === "Infinity") return "Infinity";
|
|
3808
|
+
return DateTime.fromISO(expires).toJSDate();
|
|
3809
|
+
}
|
|
4291
3810
|
async getLoginInfoFromDB() {
|
|
4292
3811
|
const data = (await this.ctx.database.get("loginBili", 1))[0];
|
|
4293
3812
|
if (data === void 0) {
|
|
@@ -4328,32 +3847,13 @@ var BiliAPI = class extends Service {
|
|
|
4328
3847
|
this.loginInfoIsLoaded = true;
|
|
4329
3848
|
return;
|
|
4330
3849
|
}
|
|
4331
|
-
|
|
4332
|
-
let
|
|
4333
|
-
let domain;
|
|
4334
|
-
let path;
|
|
4335
|
-
let secure;
|
|
4336
|
-
let httpOnly;
|
|
4337
|
-
let sameSite;
|
|
3850
|
+
const biliJctCookie = cookies.find((c) => c.key === "bili_jct");
|
|
3851
|
+
let csrf = biliJctCookie?.value ?? "";
|
|
4338
3852
|
for (const cookieData of cookies) {
|
|
4339
|
-
if (cookieData.key === "bili_jct") {
|
|
4340
|
-
csrf = cookieData.value;
|
|
4341
|
-
expires = cookieData.expires ? DateTime.fromISO(cookieData.expires).toJSDate() : "Infinity";
|
|
4342
|
-
domain = cookieData.domain;
|
|
4343
|
-
path = cookieData.path;
|
|
4344
|
-
secure = cookieData.secure;
|
|
4345
|
-
httpOnly = cookieData.httpOnly;
|
|
4346
|
-
sameSite = cookieData.sameSite;
|
|
4347
|
-
}
|
|
4348
|
-
const cdExpires = (() => {
|
|
4349
|
-
if (!cookieData.expires) return "Infinity";
|
|
4350
|
-
if (cookieData.expires !== "Infinity") return DateTime.fromISO(cookieData.expires).toJSDate();
|
|
4351
|
-
return cookieData.expires;
|
|
4352
|
-
})();
|
|
4353
3853
|
const cookie = new Cookie({
|
|
4354
3854
|
key: cookieData.key,
|
|
4355
3855
|
value: cookieData.value,
|
|
4356
|
-
expires:
|
|
3856
|
+
expires: this.parseExpires(cookieData.expires),
|
|
4357
3857
|
domain: cookieData.domain,
|
|
4358
3858
|
path: cookieData.path,
|
|
4359
3859
|
secure: cookieData.secure,
|
|
@@ -4362,17 +3862,20 @@ var BiliAPI = class extends Service {
|
|
|
4362
3862
|
});
|
|
4363
3863
|
this.jar.setCookieSync(cookie, `http${cookie.secure ? "s" : ""}://${cookie.domain}${cookie.path}`);
|
|
4364
3864
|
}
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
3865
|
+
if (biliJctCookie) {
|
|
3866
|
+
csrf = biliJctCookie.value;
|
|
3867
|
+
const buvid3Cookie = new Cookie({
|
|
3868
|
+
key: "buvid3",
|
|
3869
|
+
value: "some_non_empty_value",
|
|
3870
|
+
expires: this.parseExpires(biliJctCookie.expires),
|
|
3871
|
+
domain: biliJctCookie.domain,
|
|
3872
|
+
path: biliJctCookie.path,
|
|
3873
|
+
secure: biliJctCookie.secure,
|
|
3874
|
+
httpOnly: biliJctCookie.httpOnly,
|
|
3875
|
+
sameSite: biliJctCookie.sameSite
|
|
3876
|
+
});
|
|
3877
|
+
this.jar.setCookieSync(buvid3Cookie, `http${buvid3Cookie.secure ? "s" : ""}://${buvid3Cookie.domain}${buvid3Cookie.path}`);
|
|
3878
|
+
}
|
|
4376
3879
|
this.loginInfoIsLoaded = true;
|
|
4377
3880
|
this.checkIfTokenNeedRefresh(refresh_token, csrf);
|
|
4378
3881
|
this.enableRefreshCookiesDetect();
|
|
@@ -4382,10 +3885,8 @@ var BiliAPI = class extends Service {
|
|
|
4382
3885
|
this.refreshCookieTimer = this.ctx.setInterval(async () => {
|
|
4383
3886
|
const { cookies, refresh_token } = await this.getLoginInfoFromDB();
|
|
4384
3887
|
if (!cookies || !refresh_token) return;
|
|
4385
|
-
const csrf = cookies.find((cookie) =>
|
|
4386
|
-
|
|
4387
|
-
return false;
|
|
4388
|
-
}).value;
|
|
3888
|
+
const csrf = cookies.find((cookie) => cookie.key === "bili_jct")?.value;
|
|
3889
|
+
if (!csrf) return;
|
|
4389
3890
|
this.checkIfTokenNeedRefresh(refresh_token, csrf);
|
|
4390
3891
|
}, 36e5);
|
|
4391
3892
|
}
|
|
@@ -4443,10 +3944,8 @@ var BiliAPI = class extends Service {
|
|
|
4443
3944
|
bili_cookies: encryptedCookies,
|
|
4444
3945
|
bili_refresh_token: encryptedRefreshToken
|
|
4445
3946
|
}]);
|
|
4446
|
-
const newCsrf = this.jar.serializeSync().cookies.find((cookie) =>
|
|
4447
|
-
|
|
4448
|
-
return false;
|
|
4449
|
-
}).value;
|
|
3947
|
+
const newCsrf = this.jar.serializeSync().cookies.find((cookie) => cookie.key === "bili_jct")?.value;
|
|
3948
|
+
if (!newCsrf) throw new Error("未找到 bili_jct cookie");
|
|
4450
3949
|
const { data: aceeptData } = await this.client.post("https://passport.bilibili.com/x/passport-login/web/confirm/refresh", {
|
|
4451
3950
|
csrf: newCsrf,
|
|
4452
3951
|
refresh_token: refreshToken
|