(url: string)
| 380 | const response = await axios.get(imageUrl, { responseType: "arraybuffer" }); |
| 381 | const imagePath = path.join(TEMP_DIR, "speedtest.png"); |
| 382 | const filledImagePath = path.join(TEMP_DIR, "speedtest_filled.png"); |
| 383 | fs.writeFileSync(imagePath, response.data); |
| 384 | |
| 385 | const bgColor = "#212338"; |
| 386 | const borderPx = 14; |
| 387 | try { |
| 388 | await fillRoundedCorners(imagePath, filledImagePath, bgColor, borderPx); |
| 389 | return filledImagePath; |
| 390 | } catch (err: any) { |
| 391 | console.error("Failed to fill rounded corners:", err); |
| 392 | } |
| 393 | |
| 394 | return imagePath; |
| 395 | } catch (error: any) { |
| 396 | console.error("Failed to save speedtest image:", error); |
| 397 | return null; |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | const HELP_TEXT = ` |
| 402 | 本插件可以对本机或多台远程服务器进行网络速度测试,并支持保存和管理服务器配置。 |
| 403 | |
| 404 | <b>⚠️ 远程服务器要求</b> |
| 405 | 为了测试远程服务器,您必须首先在该服务器上安装 <b>Ookla Speedtest CLI</b>。 |
| 406 | - <b>Debian/Ubuntu 系统:</b> |
| 407 | <pre><code>curl -sL https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash |
no test coverage detected