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