feat: change Overall Speed display from MB/s to Mb/s

Agent-Logs-Url: https://github.com/xAlokyx/3x-ui/sessions/63fee593-57c0-49be-8faf-10d58c72c55a

Co-authored-by: xAlokyx <234771438+xAlokyx@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-06 00:56:50 +00:00 committed by GitHub
parent 59782779fd
commit ad830201e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View file

@ -591,6 +591,16 @@ class SizeFormatter {
if (size < this.ONE_PB) return (size / this.ONE_TB).toFixed(2) + " TB";
return (size / this.ONE_PB).toFixed(2) + " PB";
}
static bitFormat(size) {
const bits = size * 8;
if (bits <= 0) return "0 b";
if (bits < 1000) return bits.toFixed(0) + " b";
if (bits < 1000000) return (bits / 1000).toFixed(2) + " Kb";
if (bits < 1000000000) return (bits / 1000000).toFixed(2) + " Mb";
if (bits < 1000000000000) return (bits / 1000000000).toFixed(2) + " Gb";
return (bits / 1000000000000).toFixed(2) + " Tb";
}
}
class CPUFormatter {

View file

@ -205,7 +205,7 @@
<a-row :gutter="isMobile ? [8,8] : 0">
<a-col :span="12">
<a-custom-statistic title='{{ i18n "pages.index.upload" }}'
:value="SizeFormatter.sizeFormat(status.netIO.up)">
:value="SizeFormatter.bitFormat(status.netIO.up)">
<template #prefix>
<a-icon type="arrow-up" />
</template>
@ -216,7 +216,7 @@
</a-col>
<a-col :span="12">
<a-custom-statistic title='{{ i18n "pages.index.download" }}'
:value="SizeFormatter.sizeFormat(status.netIO.down)">
:value="SizeFormatter.bitFormat(status.netIO.down)">
<template #prefix>
<a-icon type="arrow-down" />
</template>