diff --git a/404.html b/404.html index 1e7d996..869729e 100644 --- a/404.html +++ b/404.html @@ -8,6 +8,7 @@ + @@ -16,55 +17,51 @@ @@ -143,8 +140,8 @@

404

-

啊哦,您访问的页面不存在

- +

啊哦,您访问的页面不存在

+
diff --git a/choicerouter/index.html b/choicerouter/index.html index e250160..49fe8bf 100644 --- a/choicerouter/index.html +++ b/choicerouter/index.html @@ -8,6 +8,7 @@ + @@ -16,55 +17,51 @@ @@ -90,14 +87,14 @@
-
选择路由器
+
选择路由器
- - + + diff --git a/device/index.html b/device/index.html index 0a39f61..c923203 100644 --- a/device/index.html +++ b/device/index.html @@ -8,6 +8,7 @@ + @@ -18,55 +19,51 @@ @@ -108,16 +105,16 @@
-
上传速度
+
上传速度
88GB/s -
最大上传速度
+
最大上传速度
88GB/s
-
下载速度
+
下载速度
88GB/s -
最大下载速度
+
最大下载速度
88GB/s
@@ -126,66 +123,66 @@
-
总出入流量
+
总出入流量
- 上传: + 上传: 88GB
- 下载: + 下载: 88GB
-
权限
+
权限
- 可访问wan网络: + 可访问wan网络: load
- 可访问lan网络: + 可访问lan网络: load
- 可以管理员身份访问: + 可以管理员身份访问: load
- 可访问隐私盘: + 可访问隐私盘: load
-
更多信息
+
更多信息
- IP地址: + IP地址: load
- MAC地址: + MAC地址: load
- 在线时长: + 在线时长: load
- 设备连接方式: + 设备连接方式: load
- 是否在线: + 是否在线: load
- 是否为 AP: + 是否为 AP: load
diff --git a/devicehistory/index.html b/devicehistory/index.html index 964261f..b580c8f 100644 --- a/devicehistory/index.html +++ b/devicehistory/index.html @@ -8,6 +8,7 @@ + @@ -18,55 +19,51 @@ @@ -105,41 +102,41 @@
-
网速
+
网速
-
总出入流量
+
总出入流量
- 数据拟合时间: - + + + +
-
设置信息
+
设置信息
- 采样时间间隔(s): + 采样时间间隔(s): load
- 保留数据条数: + 保留数据条数: load
- 展示时间跨度: + 展示时间跨度: load
- 数据库路径: + 数据库路径: load
diff --git a/devicelist/index.html b/devicelist/index.html index fba8f1b..27ef325 100644 --- a/devicelist/index.html +++ b/devicelist/index.html @@ -8,6 +8,7 @@ + @@ -16,55 +17,51 @@ @@ -89,19 +86,20 @@
-
设备列表(按下载速度排列)
+
设备列表
+
路由器名称IP路由器名称IP地址
- + - - - - - - + + + + + + @@ -111,7 +109,7 @@
- + 当前连接了 load 个设备 diff --git a/editdevicename/index.html b/editdevicename/index.html deleted file mode 100644 index 203124a..0000000 --- a/editdevicename/index.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - MIROUTER-UI - - - - - - - - - - - -
-
- -
- -
loading
-
mac
- -
- -
-
- 设备原始名称: - load -
-
- - -
-
-
-
- -
-
- -
-
- - - - \ No newline at end of file diff --git a/fonts/roboto/Roboto-RegularItalic.woff b/fonts/roboto/Roboto-RegularItalic.woff new file mode 100644 index 0000000..60f95dd Binary files /dev/null and b/fonts/roboto/Roboto-RegularItalic.woff differ diff --git a/fonts/roboto/Roboto-RegularItalic.woff2 b/fonts/roboto/Roboto-RegularItalic.woff2 new file mode 100644 index 0000000..75495c3 Binary files /dev/null and b/fonts/roboto/Roboto-RegularItalic.woff2 differ diff --git a/i18n/i18n_en.json b/i18n/i18n_en.json new file mode 100644 index 0000000..e96d7f5 --- /dev/null +++ b/i18n/i18n_en.json @@ -0,0 +1,113 @@ +{ + "sidebar.subheader": "Router", + "sidebar.home": "Home", + "sidebar.devicelist": "Device List", + "sidebar.routerstatus": "Router Status", + "sidebar.historydata": "Historical Data", + "sidebar.upnp": "Upnp", + "sidebar.routertemperature": "Router Temperature", + "sidebar.choicerouter": "Choose Router", + "sidebar.subheader2": "MRUI", + "sidebar.settings": "Settings", + "sidebar.refreshtoken": "Refresh Token", + "sidebar.feedback": "Feedback", + "404.errmsg": "Oops, the page you visited does not exist", + "404.back": "Go back to the previous page", + "index.devicelist": "Device List (Click on device name for detailed data)", + "devicelist.subheading": "Device List", + "devicelist.subheading2": "Currently connected load devices", + "routerhistory.title": "Historical Data", + "routerhistory.cpuandmem": "CPU/MEM", + "routerhistory.speed": "Network Speed", + "general.showmixed": "Mixed Display of Device Traffic (Not Supported Yet)", + "routerhistory.devicenum": "Number of Connected Devices", + "upnp.subheading": "Upnp Status", + "upnp.th.clientip": "Client IP", + "upnp.th.protocol": "Protocol", + "upnp.th.innerport": "Internal Port", + "upnp.th.externalport": "External Port", + "upnp.th.appname": "Application Name", + "upnp.subheading2": "There are load records", + "temperature.subheading": "Temperature Display", + "temperature.subheading2": "Mode", + "temperature.option1": "API", + "temperature.option2": "Get Through Backend Program", + "temperature.th.temperature": "Core Temperature", + "temperature.th.fanspeed": "Fan Speed", + "temperature.th.moduletemperature24g": "2.4G Module Temperature", + "temperature.th.moduletemperature5g": "5G Module Temperature", + "settings.websettings.title": "Frontend Page Configuration", + "settings.traffic-unit-select.title": "Traffic Unit:", + "settings.speed-unit-select.title": "Speed Unit:", + "settings.language-select.title": "Language Switch:", + "settings.checkupdate.title": "Check for Updates", + "settings.checkupdate.frontversion": "Frontend Version:", + "settings.checkupdate.backendversion": "Backend Version:", + "settings.checkupdate.checkupdate": "Click Button to Check for Updates...", + "settings.checkupdate.viewfrontchangelog": "View Frontend Update Log", + "settings.checkupdate.viewbackendchangelog": "View Backend Update Log", + "settings.checkupdate.buttontext.flushfront": "Update Frontend", + "settings.checkupdate.buttontext.checkupdate": "Check for Updates", + "settings.checkupdate.loading": "Processing......", + "settings.programlink.title": "Set Backend Address", + "settings.programlink.subtitle": "Configure the Backend Server Address of the Application", + "settings.programlink.ip": "Backend Program IP", + "settings.programlink.port": "Backend Program Port (Default 6789)", + "settings.programlink.button.confirm": "Confirm", + "devicehistory.subheading1": "Network Speed", + "device.authority.wan": "Can Access wan Network:", + "device.authority.lan": "Can Access lan Network:", + "device.authority.admin": "Can Access as Administrator:", + "device.authority.pridisk": "Can Access Private Disk:", + "device.ipaddress": "IP Address:", + "device.mac": "MAC Address:", + "device.onlinetime": "Online Duration:", + "device.connectway": "Device Connection Method:", + "device.isonline": "Is Online:", + "device.isap": "Is AP:", + "choicerouter.title": "Choose Router", + "choicerouter.th.routername": "Router Name", + "choicerouter.th.ip": "IP Address", + "router.system_version": "System Version:", + "router.cpu_core": "CPU Core Count:", + "router.cpu_freq": "CPU Working Frequency:", + "router.mem_total": "Memory Capacity:", + "router.mem_freq": "Memory Frequency:", + "router.mem_type": "Memory Type:", + "router.isinit": "Is Initialized:", + "router.is4kblock": "Is 4K Block:", + "router.isuart": "Is UART Enabled:", + "router.isfacmode": "Is Factory Mode:", + "router.isssh": "Is SSH Enabled:", + "router.istelnet": "Is Telnet Enabled:", + "general.settingsinfo": "Settings Information", + "general.sampletime": "Sampling Time Interval (s):", + "general.maxsaved": "Number of Data Retained:", + "general.timespan": "Display Time Span:", + "general.databasepath": "Database Path:", + "general.data-fit-time-select.title": "Traffic Data Fitting Time:", + "general.data-fit-time-select.week": "Week", + "general.data-fit-time-select.day": "Day", + "general.data-fit-time-select.hour": "Hour", + "general.data-fit-time-select.min": "Minute", + "general.cpu-used": "CPU Usage Rate", + "general.mem-used": "Memory Usage Rate", + "general.uploadspeed": "Upload Speed", + "general.maxuploadspeed": "Maximum Upload Speed", + "general.downloadspeed": "Download Speed", + "general.maxdownloadspeed": "Maximum Download Speed", + "general.totaltraffic": "Total Inbound and Outbound Traffic", + "general.upload": "Upload:", + "general.download": "Download:", + "general.authority": "Authority", + "general.moreinfo": "More Information", + "general.th.devicename": "Device Name", + "general.th.downloadspeed": "Download Speed", + "general.th.uploadspeed": "Upload Speed", + "general.th.uploadtotal": "Total Upload Volume", + "general.th.downloadtotal": "Total Download Volume", + "general.th.onlinetime": "Online Duration", + "general.th.connectway": "Connection Method", + "general.th.ipaddress": "IP Address", + "general.th.mac": "MAC" +} \ No newline at end of file diff --git a/i18n/i18n_zh_CN.json b/i18n/i18n_zh_CN.json new file mode 100644 index 0000000..c32b8a8 --- /dev/null +++ b/i18n/i18n_zh_CN.json @@ -0,0 +1,122 @@ +{ + "sidebar.subheader": "路由器", + "sidebar.home": "首页", + "sidebar.devicelist": "设备列表", + "sidebar.routerstatus": "路由器状态", + "sidebar.historydata": "历史数据", + "sidebar.upnp": "Upnp", + "sidebar.routertemperature": "路由器温度", + "sidebar.choicerouter": "选择路由器", + "sidebar.subheader2": "MRUI", + "sidebar.settings": "设置", + "sidebar.refreshtoken": "刷新token", + "sidebar.feedback": "反馈", + "404.errmsg": "啊哦,您访问的页面不存在", + "404.back": "返回上一页", + "index.devicelist":"设备列表(详细数据点击设备名称)", + "devicelist.subheading": "设备列表", + "devicelist.subheading2": "当前连接了 load 个设备", + + "routerhistory.title":"历史数据", + "routerhistory.cpuandmem": "CPU/MEM", + "routerhistory.speed": "网速", + "general.showmixed": "设备流量混合显示(暂不支持)", + "routerhistory.devicenum":"连接设备数量", + + "upnp.subheading":"Upnp状态", + "upnp.th.clientip":"客户端IP", + "upnp.th.protocol":"协议", + "upnp.th.innerport":"内部端口", + "upnp.th.externalport":"外部端口", + "upnp.th.appname":"应用名称", + "upnp.subheading2":"共有load条记录", + + "temperature.subheading":"温度显示", + "temperature.subheading2":"模式", + "temperature.option1":"API", + "temperature.option2":"通过后端程序获取", + "temperature.th.temperature":"核心温度", + "temperature.th.fanspeed":"风扇转速", + "temperature.th.moduletemperature24g":"2.4G模块温度", + "temperature.th.moduletemperature5g":"5G模块温度", + + "settings.websettings.title": "前端页面配置", + "settings.traffic-unit-select.title": "流量单位:", + "settings.speed-unit-select.title": "速度单位:", + "settings.language-select.title": "语言切换:", + "settings.checkupdate.title": "检查更新", + "settings.checkupdate.frontversion": "前端版本:", + "settings.checkupdate.backendversion": "后端版本:", + "settings.checkupdate.checkupdate": "点击按钮检查更新...", + "settings.checkupdate.viewfrontchangelog": "查看前端更新日志", + "settings.checkupdate.viewbackendchangelog": "查看后端更新日志", + "settings.checkupdate.buttontext.flushfront": "更新前端", + "settings.checkupdate.buttontext.checkupdate": "检查更新", + "settings.checkupdate.loading": "处理中......", + "settings.programlink.title": "设置后端地址", + "settings.programlink.subtitle": "配置应用的后端服务器地址", + "settings.programlink.ip": "后端程序IP", + "settings.programlink.port": "后端程序端口(默认6789)", + "settings.programlink.button.confirm": "确定", + + "devicehistory.subheading1":"网速", + + "device.authority.wan":"可访问wan网络:", + "device.authority.lan":"可访问lan网络:", + "device.authority.admin":"可以管理员身份访问:", + "device.authority.pridisk":"可访问隐私盘:", + "device.ipaddress": "IP地址:", + "device.mac": "MAC地址:", + "device.onlinetime": "在线时长:", + "device.connectway": "设备连接方式:", + "device.isonline": "是否在线:", + "device.isap": "是否为 AP:", + + "choicerouter.title": "选择路由器", + "choicerouter.th.routername": "路由器名称", + "choicerouter.th.ip": "IP地址", + + "router.system_version": "系统版本:", + "router.cpu_core": "CPU核心数:", + "router.cpu_freq": "CPU工作频率:", + "router.mem_total": "内存容量:", + "router.mem_freq": "内存频率:", + "router.mem_type": "内存类型:", + "router.isinit": "是否初始化:", + "router.is4kblock": "是否为4K Block:", + "router.isuart": "是否开启UART:", + "router.isfacmode": "是否为工厂模式:", + "router.isssh": "是否开启SSH:", + "router.istelnet": "是否开启Telnet:", + + "general.settingsinfo":"设置信息", + "general.sampletime":"采样时间间隔(s):", + "general.maxsaved":"保留数据条数:", + "general.timespan":"展示时间跨度:", + "general.databasepath":"数据库路径:", + "general.data-fit-time-select.title": "流量数据拟合时间:", + "general.data-fit-time-select.week": "周", + "general.data-fit-time-select.day": "天", + "general.data-fit-time-select.hour": "时", + "general.data-fit-time-select.min": "分", + "general.cpu-used": "CPU使用率", + "general.mem-used": "内存使用率", + "general.uploadspeed": "上传速度", + "general.maxuploadspeed": "最大上传速度", + "general.downloadspeed": "下载速度", + "general.maxdownloadspeed": "最大下载速度", + "general.totaltraffic":"总出入流量", + "general.upload":"上传:", + "general.download":"下载:", + "general.authority":"权限", + "general.moreinfo":"更多信息", + "general.th.devicename": "设备名称", + "general.th.downloadspeed": "下载速度", + "general.th.uploadspeed": "上传速度", + "general.th.uploadtotal": "总上传量", + "general.th.downloadtotal": "总下载量", + "general.th.onlinetime": "在线时长", + "general.th.connectway": "连接方式", + "general.th.ipaddress": "IP地址", + "general.th.mac": "MAC" +} \ No newline at end of file diff --git a/i18n/i18n_zh_TW.json b/i18n/i18n_zh_TW.json new file mode 100644 index 0000000..51bf092 --- /dev/null +++ b/i18n/i18n_zh_TW.json @@ -0,0 +1,122 @@ +{ + "sidebar.subheader": "路由器", + "sidebar.home": "首頁", + "sidebar.devicelist": "設備列表", + "sidebar.routerstatus": "路由器狀態", + "sidebar.historydata": "歷史數據", + "sidebar.upnp": "Upnp", + "sidebar.routertemperature": "路由器溫度", + "sidebar.choicerouter": "選擇路由器", + "sidebar.subheader2": "MRUI", + "sidebar.settings": "設置", + "sidebar.refreshtoken": "刷新token", + "sidebar.feedback": "反饋", + "404.errmsg": "啊哦,您訪問的頁面不存在", + "404.back": "返回上一頁", + "index.devicelist":"設備列表(詳細數據點擊設備名稱)", + "devicelist.subheading": "設備列表", + "devicelist.subheading2": "當前連接了 load 個設備", + + "routerhistory.title":"歷史數據", + "routerhistory.cpuandmem": "CPU/MEM", + "routerhistory.speed": "網速", + "general.showmixed": "設備流量混合顯示(暫不支持)", + "routerhistory.devicenum":"連接設備數量", + + "upnp.subheading":"Upnp狀態", + "upnp.th.clientip":"客戶端IP", + "upnp.th.protocol":"協議", + "upnp.th.innerport":"內部端口", + "upnp.th.externalport":"外部端口", + "upnp.th.appname":"應用名稱", + "upnp.subheading2":"共有load條記錄", + + "temperature.subheading":"溫度顯示", + "temperature.subheading2":"模式", + "temperature.option1":"API", + "temperature.option2":"通過後端程序獲取", + "temperature.th.temperature":"核心溫度", + "temperature.th.fanspeed":"風扇轉速", + "temperature.th.moduletemperature24g":"2.4G模塊溫度", + "temperature.th.moduletemperature5g":"5G模塊溫度", + + "settings.websettings.title": "前端頁面配置", + "settings.traffic-unit-select.title": "流量單位:", + "settings.speed-unit-select.title": "速度單位:", + "settings.language-select.title": "語言切換:", + "settings.checkupdate.title": "檢查更新", + "settings.checkupdate.frontversion": "前端版本:", + "settings.checkupdate.backendversion": "後端版本:", + "settings.checkupdate.checkupdate": "點擊按鈕檢查更新...", + "settings.checkupdate.viewfrontchangelog": "查看前端更新日誌", + "settings.checkupdate.viewbackendchangelog": "查看後端更新日誌", + "settings.checkupdate.buttontext.flushfront": "更新前端", + "settings.checkupdate.buttontext.checkupdate": "檢查更新", + "settings.checkupdate.loading": "處理中......", + "settings.programlink.title": "設置後端地址", + "settings.programlink.subtitle": "配置應用的後端服務器地址", + "settings.programlink.ip": "後端程序IP", + "settings.programlink.port": "後端程序端口(默認6789)", + "settings.programlink.button.confirm": "確定", + + "devicehistory.subheading1":"網速", + + "device.authority.wan":"可訪問wan網絡:", + "device.authority.lan":"可訪問lan網絡:", + "device.authority.admin":"可以管理員身份訪問:", + "device.authority.pridisk":"可訪問隱私盤:", + "device.ipaddress": "IP地址:", + "device.mac": "MAC地址:", + "device.onlinetime": "在線時長:", + "device.connectway": "設備連接方式:", + "device.isonline": "是否在線:", + "device.isap": "是否為 AP:", + + "choicerouter.title": "選擇路由器", + "choicerouter.th.routername": "路由器名稱", + "choicerouter.th.ip": "IP地址", + + "router.system_version": "系統版本:", + "router.cpu_core": "CPU核心數:", + "router.cpu_freq": "CPU工作頻率:", + "router.mem_total": "內存容量:", + "router.mem_freq": "內存頻率:", + "router.mem_type": "內存類型:", + "router.isinit": "是否初始化:", + "router.is4kblock": "是否為4K Block:", + "router.isuart": "是否開啟UART:", + "router.isfacmode": "是否為工廠模式:", + "router.isssh": "是否開啟SSH:", + "router.istelnet": "是否開啟Telnet:", + + "general.settingsinfo":"設置信息", + "general.sampletime":"采樣時間間隔(s):", + "general.maxsaved":"保留數據條數:", + "general.timespan":"展示時間跨度:", + "general.databasepath":"數據庫路徑:", + "general.data-fit-time-select.title": "流量數據擬合時間:", + "general.data-fit-time-select.week": "周", + "general.data-fit-time-select.day": "天", + "general.data-fit-time-select.hour": "時", + "general.data-fit-time-select.min": "分", + "general.cpu-used": "CPU使用率", + "general.mem-used": "內存使用率", + "general.uploadspeed": "上傳速度", + "general.maxuploadspeed": "最大上傳速度", + "general.downloadspeed": "下載速度", + "general.maxdownloadspeed": "最大下載速度", + "general.totaltraffic":"總出入流量", + "general.upload":"上傳:", + "general.download":"下載:", + "general.authority":"權限", + "general.moreinfo":"更多信息", + "general.th.devicename": "設備名稱", + "general.th.downloadspeed": "下載速度", + "general.th.uploadspeed": "上傳速度", + "general.th.uploadtotal": "總上傳量", + "general.th.downloadtotal": "總下載量", + "general.th.onlinetime": "在線時長", + "general.th.connectway": "連接方式", + "general.th.ipaddress": "IP地址", + "general.th.mac": "MAC" +} \ No newline at end of file diff --git a/index.html b/index.html index d484789..781a26d 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@ + @@ -18,55 +19,51 @@ @@ -108,7 +105,7 @@
-
CPU 使用率
+
CPU 使用率
@@ -116,7 +113,7 @@
-
内存使用率
+
内存使用率
@@ -128,16 +125,16 @@
-
上传速度
+
上传速度
load -
最大上传速度
+
最大上传速度
load
-
下载速度
+
下载速度
load -
最大下载速度
+
最大下载速度
load
@@ -145,32 +142,32 @@
-
总出入流量
+
总出入流量
- 上传: + 上传: load
- 下载: + 下载: load
-
设备列表(详细数据点击设备名称)
+
设备列表(详细数据点击设备名称)
设备名称设备名称 下载速度上传速度在线时长连接方式IP地址MAC下载速度上传速度在线时长连接方式IP地址MAC
- - - - - + + + + + diff --git a/js/checkupdate.js b/js/checkupdate.js deleted file mode 100644 index 15c2fa3..0000000 --- a/js/checkupdate.js +++ /dev/null @@ -1,64 +0,0 @@ -$("#spinner").hide(); - -function getBackVersion() { - $.get(host + '/_api/getconfig', function(data) { - $('#backversion').text(data.ver) - }); -} - -function checkUpdate() { - $("#update-info").text("正在检查更新..."); - $("#checkUpdate-button").attr("disabled", true); - $("#spinner").show(); - $.get("https://mrui-api.hzchu.top/checkupdate", function(data) { - var frontversion = data.frontversion; - var backversion = data.backversion; - var versioninfo = "" - // 检查document.getElementById("frontversion")是否一致 - if ($("#frontversion").text() != frontversion) { - versioninfo += "前端版本有更新,版本号:" + frontversion + "
"; - } - if ($("#backversion").text() == "Docker") { - versioninfo += "当前为Docker环境,无法检查后端更新
"; - $("#flushFront-button").attr("disabled", false); - } else if ($("#backversion").text() != backversion) { - versioninfo += "后端版本有更新,版本号:" + backversion + "
"; - } - if ($("#frontversion").text() == frontversion && $("#backversion").text() == backversion) { - versioninfo += "未检测到更新(●'◡'●)
"; - } - $("#update-info").html(versioninfo); - $("#checkUpdate-button").attr("disabled", false); - $("#spinner").hide(); - }) - -} - -function flushFront() { - $("#spinner").show(); - $("#flushFront-button").attr("disabled", true); - $.get(host + '/_api/flushstatic', function(data) { - if (data.code == 0) { - mdui.snackbar({ - message: "更新成功" - }) - } else if (data.msg) { - mdui.snackbar({ - message: data.msg - }); - } else { - mdui.snackbar({ - message: data.message - }); - } - $("#spinner").hide(); - $("#flushFront-button").attr("disabled", false); - // 5秒后刷新 - setTimeout(function() { - location.reload(); - }, 5000); - }) -} -$(function() { - getBackVersion(); -}); \ No newline at end of file diff --git a/js/device.js b/js/device.js index 6695679..e5b46c1 100644 --- a/js/device.js +++ b/js/device.js @@ -53,15 +53,17 @@ function updateStatus() { $('#uploadtotal').text(uploadtotal) $('#downloadtotal').text(downloadtotal) $('#onlinetime').text(onlinetime) - var upspeed = (device.upspeed / 1024 / 1024).toFixed(2); - var downspeed = (device.downspeed / 1024 / 1024).toFixed(2); - var uploadtotal = convertSize(device.upload,"GiB") - var downloadtotal = convertSize(device.download,"GiB"); + var upspeed = convertSize(device.upspeed,speedUnit) + var downspeed = convertSize(device.downspeed,speedUnit) + var uploadtotal = convertSize(device.upload,trafficUnit); + var downloadtotal = convertSize(device.download,trafficUnit); addData(upspeed_data, upspeed) addData(downspeed_data, downspeed) addData(upload_traffic_data, uploadtotal) addData(download_traffic_data, downloadtotal) // 调用drawChart函数,绘制图表 + SpeedChart.showLoading(); + TrafficChart.showLoading(); drawspeedChart(); drawtrafficChart(); data_num += 1 @@ -103,7 +105,7 @@ function getDeviceInfo() { $("#authority_lan").text(getbooleantype(device.authority.lan)); $("#authority_admin").text(getbooleantype(device.authority.admin)); $("#authority_pridisk").text(getbooleantype(device.authority.pridisk)); - $("#connecttype").text(getconnecttype(device.type)); + $("#connecttype").text(getConnectType(device.type)); $("#isap").text(getbooleantype(device.isap)); $("#isonline").text(getbooleantype(device.online)); @@ -143,25 +145,26 @@ function drawspeedChart() { }, yAxis: { type: "value", - name: "网络速度(MiB/s)", + name: "网络速度("+speedUnit+")", }, legend: { orient: 'vertical', left: 'right' }, series: [{ - name: "上传速度(MiB/s)", + name: "上传速度("+speedUnit+")", type: "line", - data: upspeed_data, // 返回网络速度(MiB/s)作为纵坐标 + data: upspeed_data, }, { - name: "下载速度(MiB/s)", + name: "下载速度("+speedUnit+")", type: "line", - data: downspeed_data, // 返回网络速度(MiB/s)作为纵坐标 + data: downspeed_data, }, ], }; // 设置图表的配置项和数据 + SpeedChart.hideLoading(); SpeedChart.setOption(option); } @@ -188,21 +191,22 @@ function drawtrafficChart() { }, yAxis: { type: "value", - name: "上传/下载(GiB)", + name: "上传/下载("+trafficUnit+")", }, series: [{ - name: "上传总量(GiB)", + name: "上传总量("+trafficUnit+")", type: "line", - data: upload_traffic_data, // 返回网络速度(MiB/s)作为纵坐标 + data: upload_traffic_data, }, { - name: "下载总量(GiB)", + name: "下载总量("+trafficUnit+")", type: "line", - data: download_traffic_data, // 返回网络速度(MiB/s)作为纵坐标 + data: download_traffic_data, }, ], }; // 设置图表的配置项和数据 + TrafficChart.hideLoading(); TrafficChart.setOption(option); } window.addEventListener('resize', function() { @@ -225,6 +229,7 @@ function get_router_name() { } $(function() { // 初次加载状态 + showChartLoading(); getDeviceInfo(); get_router_name(); updateStatus(); @@ -237,4 +242,10 @@ $(function() { // jumptodevidehisory function jumptodevicehisory() { window.location.href = "/devicehistory/index.html?mac=" + mac; +} + +// 展示加载动画 +function showChartLoading() { + TrafficChart.showLoading(); + SpeedChart.showLoading(); } \ No newline at end of file diff --git a/js/devicehistory.js b/js/devicehistory.js index 904b991..f4637bc 100644 --- a/js/devicehistory.js +++ b/js/devicehistory.js @@ -89,11 +89,13 @@ function updateStatus() { uptotal = history_data[i].UpTotal.toFixed(2) downtotal = history_data[i].DownTotal.toFixed(2) xdata.push(time) - upspeed_data.push((upspeed / 1024 / 1024).toFixed(2)) - downspeed_data.push((downspeed / 1024 / 1024).toFixed(2)) - upload_traffic_data.push(convertSize(uptotal,"GiB")) - download_traffic_data.push(convertSize(downtotal,"GiB")) + upspeed_data.push(convertSize(upspeed,speedUnit)) + downspeed_data.push(convertSize(downspeed,speedUnit)) + upload_traffic_data.push(convertSize(uptotal,trafficUnit)) + download_traffic_data.push(convertSize(downtotal,trafficUnit)) } + SpeedChart.showLoading(); + TrafficChart.showLoading(); drawspeedChart(); drawTrafficChart(); }); @@ -131,7 +133,7 @@ function drawTrafficChart() { }, yAxis: { type: "value", - name: "(GiB)", + name: "(" + trafficUnit + ")", }, dataZoom: [{ type: 'slider', @@ -141,15 +143,16 @@ function drawTrafficChart() { series: [{ name: "上传", type: "bar", - data: upload_traffic_data_processed, // 返回网络速度(MiB/s)作为纵坐标 + data: upload_traffic_data_processed, }, { name: "下载", type: "bar", - data: download_traffic_data_processed, // 返回网络速度(MiB/s)作为纵坐标 + data: download_traffic_data_processed, } ], }; + TrafficChart.hideLoading(); TrafficChart.setOption(option); } function drawspeedChart() { @@ -169,7 +172,7 @@ function drawspeedChart() { }, yAxis: { type: "value", - name: "(MiB/s)", + name: "(" + speedUnit + ")", }, dataZoom: [{ type: 'slider', @@ -188,7 +191,7 @@ function drawspeedChart() { }, ], }; - // 设置图表的配置项和数据 + SpeedChart.hideLoading(); SpeedChart.setOption(option); } @@ -212,6 +215,7 @@ window.addEventListener('resize', function() { $(function() { // 初次加载状态 + showChartLoading(); get_appconfig(); updateStatus(); getDeviceInfo(); @@ -224,4 +228,10 @@ $(function() { // jumptodevidehisory function jumptodeviceinfo() { window.location.href = "/device/index.html?mac=" + mac; +} + +// 展示加载动画 +function showChartLoading() { + TrafficChart.showLoading(); + SpeedChart.showLoading(); } \ No newline at end of file diff --git a/js/devicelist.js b/js/devicelist.js index c108844..0ecfdf4 100644 --- a/js/devicelist.js +++ b/js/devicelist.js @@ -62,7 +62,7 @@ function listDevices(dev) { tr.appendChild(td_onlinetime); var td_type = document.createElement("td"); - td_type.textContent = getconnecttype(device.type); + td_type.textContent = getConnectType(device.type); tr.appendChild(td_type); ips = moreipdisplay(device.ip) @@ -90,11 +90,11 @@ function listDevices(dev) { $('#switchdownspeed').click(function() { showtype = false; - $('#showtypetext').text('下载速度'); + // $('#showtypetext').text('下载速度'); }); $('#switchupspeed').click(function() { showtype = true; - $('#showtypetext').text('上传速度'); + // $('#showtypetext').text('上传速度'); }) $(function() { diff --git a/js/general.js b/js/general.js index fb02d52..28a17c9 100644 --- a/js/general.js +++ b/js/general.js @@ -9,13 +9,26 @@ let host = localStorage.getItem("host") || ""; let routernum = localStorage.getItem("routernum") || "0"; // 获取默认时间分组 let classification = localStorage.getItem("classification") || "day"; - +// 获取默认速度单位 +let speedUnit = localStorage.getItem("speed-unit") || "MiB/s"; +// 获取默认速度单位 +let trafficUnit = localStorage.getItem("traffic-unit") || "GiB"; +// 获取默认语言 +let language = localStorage.getItem("language") || "zh_CN"; //跳转 -if (window.location.host == 'mrui.hzchu.top:8880' && !host && window.location.pathname !== '/settings/index.html') { +if (window.location.host == 'mrui-web.hzchu.top' && !host && window.location.pathname !== '/settings/index.html') { window.location.href = '/settings/index.html'; } - +$("[i18n]").i18n({ + defaultLang: language, + filePath: "/i18n/", + filePrefix: "i18n_", + fileSuffix: "", + forever: true, + callback: function() { + } +}); @@ -115,21 +128,32 @@ function convertbytes(bytes, mode) { } function convertSize(size, unit) { - switch(unit) { - case 'KiB': - return (size / 1024).toFixed(2) - case 'MiB': - return (size / 1024 / 1024).toFixed(2) - case 'GiB': - return (size / 1024 / 1024 / 1024).toFixed(2) - case 'TiB': - return (size / 1024 / 1024 / 1024 / 1024).toFixed(2) - default: - console.log('Invalid unit "'+unit+'", defaulting to GiB'); - return (size / 1024 / 1024 / 1024).toFixed(2) + const units = { + 'B': 1, + 'B/s': 1, + 'KiB': 1024, + 'KiB/s': 1024, + 'MiB': 1024 * 1024, + 'MiB/s': 1024 * 1024, + 'GiB': 1024 * 1024 * 1024, + 'GiB/s': 1024 * 1024 * 1024, + 'TiB': 1024 * 1024 * 1024 * 1024, + 'TiB/s': 1024 * 1024 * 1024 * 1024 + }; + + try { + const divisor = units[unit]; + if (!divisor) { + throw new Error('Invalid unit "' + unit + '", defaulting to GiB'); + } + return (size / divisor).toFixed(2); + } catch (error) { + console.log(error.message); + return (size / units['GiB']).toFixed(2); } } + function roundToOneDecimal(num) { // 保留一位小数 return num.toFixed(1); @@ -167,39 +191,39 @@ function convertSeconds(seconds) { return result; } +// 转换布尔值 function getbooleantype(type) { - // 0/1/2/3 有线 / 2.4G wifi / 5G wifi / guest wifi switch (type) { case 0: - return "否"; + return "No"; case 1: - return "是"; + return "Yes"; default: - return "未知"; + return "Unknown"; } } -// 转换布尔值为是/否 +// 转换布尔值 function boolTostring(value) { if (value) { - return '是'; + return "Yes"; } else { - return '否'; + return "No"; } } -function getconnecttype(type) { - // 0/1/2/3 有线 / 2.4G wifi / 5G wifi / guest wifi +function getConnectType(type) { + // 0/1/2/3 Wired / 2.4G wifi / 5G wifi / guest wifi switch (type) { case 0: - return "有线连接"; + return "Wired"; case 1: return "2.4G wifi"; case 2: return "5G wifi"; case 3: - return "guest wifi"; + return "Guest wifi"; default: - return "未知"; + return "Unknown"; } } @@ -268,7 +292,7 @@ function refreshToken() { $.ajaxSetup({ error: function (jqXHR, textStatus, errorThrown) { mdui.snackbar({ - message: "发送网络请求失败:" + textStatus + message: "Failed to send network request: " + textStatus }); } }); diff --git a/js/jquery.i18n.min.js b/js/jquery.i18n.min.js new file mode 100644 index 0000000..20d73b4 --- /dev/null +++ b/js/jquery.i18n.min.js @@ -0,0 +1 @@ +(function($){$.fn.extend({i18n:function(options){var defaults={lang:"",defaultLang:"",filePath:"/i18n/",filePrefix:"i18n_",fileSuffix:"",forever:true,callback:function(){}};function getCookie(name){var arr=document.cookie.split('; ');for(var i=0;i"; + } + if ($("#backendversion").text() == "Docker") { + versioninfo += "当前为Docker环境,无法检查后端更新
"; + $("#flushFront-button").attr("disabled", false); + } else if ($("#backendversion").text() != backendversion) { + versioninfo += "后端版本有更新,版本号:" + backendversion + "
"; + } + if ($("#frontversion").text() == frontversion && $("#backendversion").text() == backendversion) { + versioninfo += "未检测到更新(●'◡'●)
"; + } + // 处理更新日志 + var frontlog = data.front.changelog; + var backendlog = data.backend.changelog; + if (frontlog) { + + changelog += "前端" + frontversion + "版本更新日志:
" + frontlog + "
"; + } + if (backendlog) { + changelog += "
后端" + backendversion + "版本更新日志:
" + backendlog + "
"; + } + $("#update-info").html(versioninfo); + $("#update-log").html(changelog); + $("#checkUpdate-button").attr("disabled", false); + $("#spinner").hide(); + }) + +} + +function flushFront() { + $("#spinner").show(); + $("#flushFront-button").attr("disabled", true); + $.get(host + '/_api/flushstatic', function(data) { + if (data.code == 0) { + mdui.snackbar({ + message: "更新成功" + }) + } else if (data.msg) { + mdui.snackbar({ + message: data.msg + }); + } else { + mdui.snackbar({ + message: data.message + }); + } + $("#spinner").hide(); + $("#flushFront-button").attr("disabled", false); + // 5秒后刷新 + setTimeout(function() { + location.reload(); + }, 5000); + }) +} +$(function() { + getbackendversion(); +}); + +// 切换后端程序地址 +$(document).ready(function() { + var storedHost = localStorage.getItem('host'); + if (storedHost) { + var url = new URL(storedHost); + $('#ip').val(url.hostname); + $('#port').val(url.port); + } +}); + +$('#Form').submit(function(event) { + event.preventDefault(); + var ip = $('#ip').val(); + var port = $('#port').val(); + var newHost = "http://" + ip + ":" + port; + localStorage.setItem('host', newHost); + window.location.href = "/"; +}); \ No newline at end of file diff --git a/js/temperature.js b/js/temperature.js index 746a634..6ffd6b1 100644 --- a/js/temperature.js +++ b/js/temperature.js @@ -12,11 +12,7 @@ if (localStorage.getItem("darkMode") == "true") { var tp_chart = document.getElementById("tp-chart"); var TpChart = echarts.init(tp_chart, lightmode); $(document).ready(function() { - try { - mode = localStorage.getItem('mode') || 1; - } catch (error) { - mode = 1; - } + mode = localStorage.getItem('mode') || 1; $('.mdui-select').val(mode); new mdui.Select('.mdui-select'); }); @@ -172,21 +168,21 @@ function drawTpChart() { series: [{ name: "CPU", type: "line", - data: cputp_data, // 返回网络速度(MiB/s)作为纵坐标 + data: cputp_data, }, { name: "2.4g网卡模块", type: "line", - data: w24gtp_data, // 返回网络速度(MiB/s)作为纵坐标 + data: w24gtp_data, }, { name: "5g网卡模块", type: "line", - data: w5gtp_data, // 返回网络速度(MiB/s)作为纵坐标 + data: w5gtp_data, } ], }; - // 设置图表的配置项和数据 + TpChart.hideLoading(); TpChart.setOption(option); } @@ -196,6 +192,7 @@ window.addEventListener('resize', function() { $(function() { + TpChart.showLoading(); // 初次加载状态 getTp(); // 每5秒刷新状态 diff --git a/router/index.html b/router/index.html index f0435e4..fcaf605 100644 --- a/router/index.html +++ b/router/index.html @@ -8,6 +8,7 @@ + @@ -18,55 +19,51 @@ @@ -108,7 +105,7 @@
-
CPU 使用率
+
CPU 使用率
@@ -116,7 +113,7 @@
-
内存使用率
+
内存使用率
@@ -130,16 +127,16 @@
-
上传速度
+
上传速度
load -
最大上传速度
+
最大上传速度
load
-
下载速度
+
下载速度
load -
最大下载速度
+
最大下载速度
load
@@ -149,96 +146,81 @@
-
总出入流量
+
总出入流量
- 上传: + 上传: load
- 下载: + 下载: load
-
设备信息
+
设备信息
- MAC地址: + MAC地址: load
- SN: + SN: load
- 系统版本: + 系统版本: load
- CPU核心数: + CPU核心数: load
- CPU工作频率: + CPU工作频率: load
- 内存容量: + 内存容量: load
- 内存频率: + 内存频率: load
- 内存类型: + 内存类型: load
-
-
-
工厂信息
-
- 是否初始化: + 是否初始化: load
- 是否为4K Block + 是否为4K Block load
-
- 是否开启UART + 是否开启UART load
- 是否为工厂模式: + 是否为工厂模式: load
- 是否开启SSH + 是否开启SSH load
- 是否开启Telnet + 是否开启Telnet load
-
- 网卡wlan0上的 SSID: - load -
-
- 网卡wlan1上的 SSID: - load -
+
diff --git a/routerhistory/index.html b/routerhistory/index.html index fb2c342..333ed8f 100644 --- a/routerhistory/index.html +++ b/routerhistory/index.html @@ -8,6 +8,7 @@ + @@ -18,55 +19,51 @@ @@ -92,7 +89,7 @@
-
-
检查更新
+
检查更新
-

前端版本:v1.3.2-1
后端版本:load

+

前端版本:v1.3.3-1
后端版本:load

-

点击检查更新...

+

点击按钮检查更新...

- 查看前端更新日志
- 查看后端更新日志 +
- - + +
-
+
处理中......
@@ -159,32 +168,31 @@ border-radius: 8px; } -
-
设置后端地址
-
配置应用的后端服务器地址
+
设置后端地址
+
配置应用的后端服务器地址
- +
- +
- +
- + \ No newline at end of file diff --git a/temperature/index.html b/temperature/index.html index 5a87e86..d90af43 100644 --- a/temperature/index.html +++ b/temperature/index.html @@ -8,6 +8,7 @@ + @@ -18,55 +19,51 @@ @@ -91,12 +88,12 @@
-
温度显示
+
温度显示
-
模式
+
模式
@@ -104,10 +101,10 @@
设备名称下载速度上传速度总上传量总下载量设备名称下载速度上传速度总上传量总下载量
- - - - + + + + diff --git a/upnp/index.html b/upnp/index.html index 839ecb0..03e7bf2 100644 --- a/upnp/index.html +++ b/upnp/index.html @@ -8,6 +8,7 @@ + @@ -16,55 +17,51 @@ @@ -89,16 +86,16 @@
-
Upnp状态
+
Upnp状态
核心温度风扇转速2.4g模块温度5g模块温度核心温度风扇转速2.4G模块温度5G模块温度
- - - - - + + + + + @@ -108,7 +105,7 @@
- + 共有 load 条记录 diff --git a/version/index.html b/version/index.html index 7723cbf..18909f7 100644 --- a/version/index.html +++ b/version/index.html @@ -1 +1 @@ -v1.3.2-1 \ No newline at end of file +v1.3.3-1 \ No newline at end of file
客户端IP协议内部端口外部端口应用名称客户端IP协议内部端口外部端口应用名称