MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / saveSpeedtestImage

Function saveSpeedtestImage

speedlink/speedlink.ts:382–404  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

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
401const 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

Callers 1

speedtestFunction · 0.70

Calls 3

errorMethod · 0.80
fillRoundedCornersFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected