@enderhorror/koishi-plugin-steam-friend-status 0.3.2 → 0.3.3
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/data/css/steamFriendList.css +138 -133
- package/data/html/gameChange.html +6 -4
- package/data/html/steamProfile.html +1 -0
- package/data/res/game_change_background.png +0 -0
- package/lib/index.js +3 -2
- package/package.json +1 -1
- package/readme.md +2 -0
- package/src/image.ts +3 -2
|
@@ -1,133 +1,138 @@
|
|
|
1
|
-
* {
|
|
2
|
-
margin: 0px;
|
|
3
|
-
padding: 0px;
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
}
|
|
6
|
-
ul {
|
|
7
|
-
list-style: none;
|
|
8
|
-
}
|
|
9
|
-
.bg {
|
|
10
|
-
width:
|
|
11
|
-
}
|
|
12
|
-
.header {
|
|
13
|
-
display: flex;
|
|
14
|
-
border-radius: 7px 7px 0px 0px;
|
|
15
|
-
height: 75px;
|
|
16
|
-
padding-top: 15px;
|
|
17
|
-
padding-left: 7px;
|
|
18
|
-
padding-bottom: 10px;
|
|
19
|
-
background-color: #1c232c;
|
|
20
|
-
}
|
|
21
|
-
.header .headshot {
|
|
22
|
-
display: block;
|
|
23
|
-
width: 50px;
|
|
24
|
-
height: 50px;
|
|
25
|
-
}
|
|
26
|
-
.header .bot {
|
|
27
|
-
display: flex;
|
|
28
|
-
}
|
|
29
|
-
.header .bot .text {
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-direction: column;
|
|
32
|
-
justify-content: center;
|
|
33
|
-
}
|
|
34
|
-
.friendline {
|
|
35
|
-
height: 30px;
|
|
36
|
-
background-color: #434952;
|
|
37
|
-
}
|
|
38
|
-
.friendline .text {
|
|
39
|
-
padding-left: 15px;
|
|
40
|
-
font-size: 12px;
|
|
41
|
-
line-height: 30px;
|
|
42
|
-
color: #b7ccd5;
|
|
43
|
-
}
|
|
44
|
-
.friendlist {
|
|
45
|
-
background-color: #1f2126;
|
|
46
|
-
padding-bottom: 15px;
|
|
47
|
-
border-radius: 0px 0px 6px 6px;
|
|
48
|
-
}
|
|
49
|
-
.group {
|
|
50
|
-
border-bottom: 1px solid #176383;
|
|
51
|
-
}
|
|
52
|
-
.group .title {
|
|
53
|
-
padding: 6px 0px 0px 13px;
|
|
54
|
-
font-size: 12px;
|
|
55
|
-
color: #c5d6d4;
|
|
56
|
-
line-height: 28px;
|
|
57
|
-
}
|
|
58
|
-
.group:last-child {
|
|
59
|
-
border-bottom: none;
|
|
60
|
-
}
|
|
61
|
-
.friend {
|
|
62
|
-
/* 允许容器高度根据内容自适应,以容纳换行的昵称 */
|
|
63
|
-
height: auto;
|
|
64
|
-
padding: 7px 0px 7px 13px;
|
|
65
|
-
display: flex;
|
|
66
|
-
/* 垂直顶部对齐,确保头像在视觉上保持一致 */
|
|
67
|
-
align-items: flex-start;
|
|
68
|
-
}
|
|
69
|
-
.friend .headshot-online {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
padding-left: 10px;
|
|
106
|
-
font-size:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
1
|
+
* {
|
|
2
|
+
margin: 0px;
|
|
3
|
+
padding: 0px;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
}
|
|
6
|
+
ul {
|
|
7
|
+
list-style: none;
|
|
8
|
+
}
|
|
9
|
+
.bg {
|
|
10
|
+
width: 360px;
|
|
11
|
+
}
|
|
12
|
+
.header {
|
|
13
|
+
display: flex;
|
|
14
|
+
border-radius: 7px 7px 0px 0px;
|
|
15
|
+
height: 75px;
|
|
16
|
+
padding-top: 15px;
|
|
17
|
+
padding-left: 7px;
|
|
18
|
+
padding-bottom: 10px;
|
|
19
|
+
background-color: #1c232c;
|
|
20
|
+
}
|
|
21
|
+
.header .headshot {
|
|
22
|
+
display: block;
|
|
23
|
+
width: 50px;
|
|
24
|
+
height: 50px;
|
|
25
|
+
}
|
|
26
|
+
.header .bot {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
.header .bot .text {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
.friendline {
|
|
35
|
+
height: 30px;
|
|
36
|
+
background-color: #434952;
|
|
37
|
+
}
|
|
38
|
+
.friendline .text {
|
|
39
|
+
padding-left: 15px;
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
line-height: 30px;
|
|
42
|
+
color: #b7ccd5;
|
|
43
|
+
}
|
|
44
|
+
.friendlist {
|
|
45
|
+
background-color: #1f2126;
|
|
46
|
+
padding-bottom: 15px;
|
|
47
|
+
border-radius: 0px 0px 6px 6px;
|
|
48
|
+
}
|
|
49
|
+
.group {
|
|
50
|
+
border-bottom: 1px solid #176383;
|
|
51
|
+
}
|
|
52
|
+
.group .title {
|
|
53
|
+
padding: 6px 0px 0px 13px;
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
color: #c5d6d4;
|
|
56
|
+
line-height: 28px;
|
|
57
|
+
}
|
|
58
|
+
.group:last-child {
|
|
59
|
+
border-bottom: none;
|
|
60
|
+
}
|
|
61
|
+
.friend {
|
|
62
|
+
/* 允许容器高度根据内容自适应,以容纳换行的昵称 */
|
|
63
|
+
height: auto;
|
|
64
|
+
padding: 7px 0px 7px 13px;
|
|
65
|
+
display: flex;
|
|
66
|
+
/* 垂直顶部对齐,确保头像在视觉上保持一致 */
|
|
67
|
+
align-items: flex-start;
|
|
68
|
+
}
|
|
69
|
+
.friend .headshot-online {
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
display: block;
|
|
72
|
+
width: 32px;
|
|
73
|
+
height: 32px;
|
|
74
|
+
}
|
|
75
|
+
.friend .headshot-offline {
|
|
76
|
+
flex-shrink: 0;
|
|
77
|
+
display: block;
|
|
78
|
+
width: 32px;
|
|
79
|
+
height: 32px;
|
|
80
|
+
filter: grayscale(60%);
|
|
81
|
+
}
|
|
82
|
+
.friend .name-and-status {
|
|
83
|
+
padding-left: 8px;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
/* 允许该 flex 项收缩,以适应父容器的宽度 */
|
|
88
|
+
flex: 1;
|
|
89
|
+
min-width: 0;
|
|
90
|
+
}
|
|
91
|
+
.status-offline {
|
|
92
|
+
padding-left: 10px;
|
|
93
|
+
font-size: 10px;
|
|
94
|
+
color: #6e6e6e;
|
|
95
|
+
}
|
|
96
|
+
.status-online {
|
|
97
|
+
padding-left: 10px;
|
|
98
|
+
font-size: 10px;
|
|
99
|
+
color: #4c91ac;
|
|
100
|
+
}
|
|
101
|
+
.status-gaming {
|
|
102
|
+
white-space: normal;
|
|
103
|
+
overflow-wrap: anywhere;
|
|
104
|
+
line-height: 15px;
|
|
105
|
+
padding-left: 10px;
|
|
106
|
+
font-size: 10px;
|
|
107
|
+
color: #91c257;
|
|
108
|
+
}
|
|
109
|
+
.name-offline {
|
|
110
|
+
padding-left: 10px;
|
|
111
|
+
font-size: 13px;
|
|
112
|
+
line-height: 16px;
|
|
113
|
+
color: #969797;
|
|
114
|
+
/* 允许文本自动换行 */
|
|
115
|
+
white-space: normal;
|
|
116
|
+
/* 强制在长单词或 URL 内部换行,防止布局崩溃 */
|
|
117
|
+
word-break: break-word;
|
|
118
|
+
}
|
|
119
|
+
.name-online {
|
|
120
|
+
padding-left: 10px;
|
|
121
|
+
font-size: 13px;
|
|
122
|
+
line-height: 16px;
|
|
123
|
+
color: #6dcff6;
|
|
124
|
+
/* 允许文本自动换行 */
|
|
125
|
+
white-space: normal;
|
|
126
|
+
/* 强制在长单词或 URL 内部换行,防止布局崩溃 */
|
|
127
|
+
word-break: break-word;
|
|
128
|
+
}
|
|
129
|
+
.name-gaming {
|
|
130
|
+
padding-left: 10px;
|
|
131
|
+
font-size: 13px;
|
|
132
|
+
line-height: 16px;
|
|
133
|
+
color: #e2fec1;
|
|
134
|
+
/* 允许文本自动换行 */
|
|
135
|
+
white-space: normal;
|
|
136
|
+
/* 强制在长单词或 URL 内部换行,防止布局崩溃 */
|
|
137
|
+
word-break: break-word;
|
|
138
|
+
}
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
background-image: url("{{background}}");
|
|
20
20
|
background-size: cover;
|
|
21
21
|
border-radius: 4px;
|
|
22
|
-
width:
|
|
22
|
+
width: 380px;
|
|
23
23
|
box-sizing: border-box;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.avatar-container {
|
|
27
27
|
position: relative;
|
|
28
28
|
margin-right: 10px;
|
|
29
|
+
flex-shrink: 0;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.avatar {
|
|
@@ -58,9 +59,10 @@
|
|
|
58
59
|
justify-content: center;
|
|
59
60
|
color: #c1c6cf;
|
|
60
61
|
font-size: 14px;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
min-width: 0;
|
|
63
|
+
flex: 1;
|
|
64
|
+
white-space: normal;
|
|
65
|
+
overflow-wrap: anywhere;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
.username {
|
|
Binary file
|
package/lib/index.js
CHANGED
|
@@ -905,7 +905,7 @@ async function getFriendStatusImg(ctx, userData, botid, channelid, channelname)
|
|
|
905
905
|
const displayedGroups = (gamingUsers.length > 0 ? 1 : 0) + (onlineUsers.length > 0 ? 1 : 0) + (config.showOfflineFriends && offlineUsers.length > 0 ? 1 : 0);
|
|
906
906
|
const totalHeight = 75 + 30 + 15 + displayedGroups * 28 + displayedUsers * 46;
|
|
907
907
|
await page.setViewport({
|
|
908
|
-
width:
|
|
908
|
+
width: 360,
|
|
909
909
|
height: totalHeight,
|
|
910
910
|
deviceScaleFactor: 2
|
|
911
911
|
});
|
|
@@ -1199,7 +1199,7 @@ async function getGameChangeImg(ctx, playerInfo, changeInfo) {
|
|
|
1199
1199
|
"..",
|
|
1200
1200
|
"data",
|
|
1201
1201
|
"res",
|
|
1202
|
-
"
|
|
1202
|
+
"game_change_background.png"
|
|
1203
1203
|
);
|
|
1204
1204
|
const backgroundBase64 = fs3.readFileSync(backgroundPath, "base64");
|
|
1205
1205
|
htmlContent = htmlContent.replace(
|
|
@@ -1208,6 +1208,7 @@ async function getGameChangeImg(ctx, playerInfo, changeInfo) {
|
|
|
1208
1208
|
).replace("{{avatar}}", avatarBase64).replace("{{statusClass}}", statusClass).replace("{{username}}", changeInfo.userName).replace("{{statusText}}", statusText).replace("{{gameName}}", gameName);
|
|
1209
1209
|
const page = await ctx.puppeteer.page();
|
|
1210
1210
|
try {
|
|
1211
|
+
await page.setViewport({ width: 380, height: 200 });
|
|
1211
1212
|
await page.setContent(htmlContent);
|
|
1212
1213
|
const clip = await page.evaluate(() => {
|
|
1213
1214
|
const element = document.querySelector(".card");
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
## 本版本的主要改动
|
|
6
6
|
|
|
7
|
+
- **长游戏名称布局**:加宽好友列表和活动播报卡片,长游戏名自动换行,减少截断;个人资料游戏名支持长单词换行。
|
|
8
|
+
|
|
7
9
|
- **游戏活动播报名称本地化**:通过正在游玩的 Steam App ID 查询 Steam 商店简体中文名称,并用于开始、切换和停止游戏的文字及图片播报,`看看steam` 好友列表图片,以及 Steam 个人资料卡片中的最近游戏列表。
|
|
8
10
|
- **兼容回退**:查询失败、游戏没有可用 App ID 或没有商店页面时,使用 Steam 返回的原始名称,不阻断播报。Steam 商店未提供中文名的游戏仍可能显示英文。
|
|
9
11
|
- **缓存查询结果**:名称缓存于内存;成功结果缓存 24 小时,失败结果缓存 5 分钟,插件重启后清空。相同游戏的并发查询会合并。
|
package/src/image.ts
CHANGED
|
@@ -286,7 +286,7 @@ export async function getFriendStatusImg(
|
|
|
286
286
|
(config.showOfflineFriends && offlineUsers.length > 0 ? 1 : 0);
|
|
287
287
|
const totalHeight = 75 + 30 + 15 + displayedGroups * 28 + displayedUsers * 46;
|
|
288
288
|
await page.setViewport({
|
|
289
|
-
width:
|
|
289
|
+
width: 360,
|
|
290
290
|
height: totalHeight,
|
|
291
291
|
deviceScaleFactor: 2,
|
|
292
292
|
});
|
|
@@ -653,7 +653,7 @@ export async function getGameChangeImg(
|
|
|
653
653
|
"..",
|
|
654
654
|
"data",
|
|
655
655
|
"res",
|
|
656
|
-
"
|
|
656
|
+
"game_change_background.png",
|
|
657
657
|
);
|
|
658
658
|
const backgroundBase64 = fs.readFileSync(backgroundPath, "base64");
|
|
659
659
|
htmlContent = htmlContent
|
|
@@ -670,6 +670,7 @@ export async function getGameChangeImg(
|
|
|
670
670
|
// 4. 使用 Puppeteer 截图
|
|
671
671
|
const page = await ctx.puppeteer.page();
|
|
672
672
|
try {
|
|
673
|
+
await page.setViewport({ width: 380, height: 200 });
|
|
673
674
|
await page.setContent(htmlContent);
|
|
674
675
|
|
|
675
676
|
const clip = await page.evaluate(() => {
|