@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.
@@ -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: 227px;
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
- display: block;
71
- width: 32px;
72
- height: 32px;
73
- }
74
- .friend .headshot-offline {
75
- display: block;
76
- width: 32px;
77
- height: 32px;
78
- filter: grayscale(60%);
79
- }
80
- .friend .name-and-status {
81
- padding-left: 8px;
82
- display: flex;
83
- flex-direction: column;
84
- justify-content: center;
85
- /* 允许该 flex 项收缩,以适应父容器的宽度 */
86
- flex: 1;
87
- min-width: 0;
88
- }
89
- .status-offline {
90
- padding-left: 10px;
91
- font-size: 10px;
92
- color: #6e6e6e;
93
- }
94
- .status-online {
95
- padding-left: 10px;
96
- font-size: 10px;
97
- color: #4c91ac;
98
- }
99
- .status-gaming {
100
- padding-left: 10px;
101
- font-size: 10px;
102
- color: #91c257;
103
- }
104
- .name-offline {
105
- padding-left: 10px;
106
- font-size: 13px;
107
- line-height: 16px;
108
- color: #969797;
109
- /* 允许文本自动换行 */
110
- white-space: normal;
111
- /* 强制在长单词或 URL 内部换行,防止布局崩溃 */
112
- word-break: break-word;
113
- }
114
- .name-online {
115
- padding-left: 10px;
116
- font-size: 13px;
117
- line-height: 16px;
118
- color: #6dcff6;
119
- /* 允许文本自动换行 */
120
- white-space: normal;
121
- /* 强制在长单词或 URL 内部换行,防止布局崩溃 */
122
- word-break: break-word;
123
- }
124
- .name-gaming {
125
- padding-left: 10px;
126
- font-size: 13px;
127
- line-height: 16px;
128
- color: #e2fec1;
129
- /* 允许文本自动换行 */
130
- white-space: normal;
131
- /* 强制在长单词或 URL 内部换行,防止布局崩溃 */
132
- word-break: break-word;
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: 300px;
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
- white-space: nowrap;
62
- overflow: hidden;
63
- text-overflow: ellipsis;
62
+ min-width: 0;
63
+ flex: 1;
64
+ white-space: normal;
65
+ overflow-wrap: anywhere;
64
66
  }
65
67
 
66
68
  .username {
@@ -108,6 +108,7 @@
108
108
  }
109
109
 
110
110
  .game-name {
111
+ overflow-wrap: anywhere;
111
112
  font-size: 16px;
112
113
  font-weight: 500;
113
114
  color: #ffffff;
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: 227,
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
- "gaming.png"
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enderhorror/koishi-plugin-steam-friend-status",
3
3
  "description": "查询并播报 Steam 好友状态,支持游戏活动播报名称本地化",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
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: 227,
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
- "gaming.png",
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(() => {