Skip to content

Commit a66897b

Browse files
committed
✨ feat: 更新嵌入图尺寸
1 parent 8a306eb commit a66897b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

game/backend/src/routes/embed.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,31 +104,31 @@ router.get('/state/:username/:game.svg', async (req: Request, res: Response) =>
104104
--bg-color: ${bgColor};
105105
--text-gray: ${textGray};
106106
}
107-
.no-data { background-color: var(--bg-color); border-radius: 8px; padding: 16px; width: 368px; height: 168px; font-family: system-ui, -apple-system, sans-serif; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
107+
.no-data { background-color: var(--bg-color); border-radius: 8px; padding: 16px; width: 260px; height: 168px; font-family: system-ui, -apple-system, sans-serif; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
108108
.no-data-text { text-align: center; color: var(--text-gray); }
109109
</style>
110110
<div class="no-data">
111111
<div class="no-data-text">未找到 ${username}${gameName} 中的战绩</div>
112112
</div>
113113
`;
114114
}
115-
const svg = `<svg width="360" height="168" xmlns="http://www.w3.org/2000/svg">
116-
<foreignObject x="0" y="0" width="360" height="168">
115+
const svg = `<svg width="260" height="168" xmlns="http://www.w3.org/2000/svg">
116+
<foreignObject x="0" y="0" width="260" height="168">
117117
<html xmlns="http://www.w3.org/1999/xhtml">${htmlContent}</html>
118118
</foreignObject>
119119
</svg>`;
120120
res.setHeader('Content-Type', 'image/svg+xml; charset=utf-8');
121121
res.send(svg);
122122
} catch (error) {
123123
console.error(error);
124-
const errorSvg = `<svg width="360" height="168" xmlns="http://www.w3.org/2000/svg">
125-
<foreignObject x="0" y="0" width="360" height="168">
124+
const errorSvg = `<svg width="260" height="168" xmlns="http://www.w3.org/2000/svg">
125+
<foreignObject x="0" y="0" width="260" height="168">
126126
<html xmlns="http://www.w3.org/1999/xhtml">
127127
<style>
128128
:root {
129129
--error-color: ${errorColor};
130130
}
131-
.error { color: var(--error-color); text-align: center; padding: 20px; width: 360px; height: 168px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
131+
.error { color: var(--error-color); text-align: center; padding: 20px; width: 260px; height: 168px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
132132
</style>
133133
<div class="error">服务器错误</div>
134134
</html>

0 commit comments

Comments
 (0)