From 557cccd7701c9bed97eeb216854c546fd333c519 Mon Sep 17 00:00:00 2001 From: naiba Date: Mon, 5 Jul 2021 13:44:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A7=E6=80=A5=E5=A4=84=E7=90=86=20GeoIP=20?= =?UTF-8?q?API=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- cmd/agent/monitor/myip.go | 8 ++++---- resource/template/theme-daynight/home.html | 7 +++++-- resource/template/theme-hotaru/home.html | 7 +++++-- service/dao/dao.go | 7 +------ 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f92619f..a86ef2d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@


-    +   

:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。

diff --git a/cmd/agent/monitor/myip.go b/cmd/agent/monitor/myip.go index cdf8962..73c9ba2 100644 --- a/cmd/agent/monitor/myip.go +++ b/cmd/agent/monitor/myip.go @@ -17,13 +17,13 @@ type geoIP struct { var ( ipv4Servers = []string{ - "https://api-ipv4.ip.sb/geoip", - "https://ip4.seeip.org/geoip", + "https://api.ip.sb/geoip", + "https://ip.seeip.org/geoip", "https://ipapi.co/json", } ipv6Servers = []string{ - "https://ip6.seeip.org/geoip", - "https://api-ipv6.ip.sb/geoip", + "https://api.ip.sb/geoip", + "https://ip.seeip.org/geoip", "https://ipapi.co/json", } cachedIP, cachedCountry string diff --git a/resource/template/theme-daynight/home.html b/resource/template/theme-daynight/home.html index 121f225..0188992 100644 --- a/resource/template/theme-daynight/home.html +++ b/resource/template/theme-daynight/home.html @@ -217,9 +217,12 @@ return this.cache[percent] }, readableBytes(bytes) { + if (!bytes) { + return '0B' + } var i = Math.floor(Math.log(bytes) / Math.log(1024)), - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - return (bytes / Math.pow(1024, i)).toFixed(0) + ' ' + sizes[i]; + sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + sizes[i]; }, DarkMode() { const hour = new Date(Date.now()).getHours() diff --git a/resource/template/theme-hotaru/home.html b/resource/template/theme-hotaru/home.html index 133fa04..b0fbf5b 100644 --- a/resource/template/theme-hotaru/home.html +++ b/resource/template/theme-hotaru/home.html @@ -204,9 +204,12 @@ return this.cache[percent] }, readableBytes(bytes) { + if (!bytes) { + return '0B' + } var i = Math.floor(Math.log(bytes) / Math.log(1024)), - sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; - return (bytes / Math.pow(1024, i)).toFixed(0) + ' ' + sizes[i]; + sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + sizes[i]; }, troggleDarkMode() { const hour = new Date(Date.now()).getHours() diff --git a/service/dao/dao.go b/service/dao/dao.go index a10bebb..26626b1 100644 --- a/service/dao/dao.go +++ b/service/dao/dao.go @@ -13,12 +13,7 @@ import ( pb "github.com/naiba/nezha/proto" ) -var Version = "v0.8.3" // !!记得修改 README 中的 badge 版本!! - -const ( - SnapshotDelay = 3 - ReportDelay = 2 -) +var Version = "v0.8.5" // !!记得修改 README 中的 badge 版本!! var ( Conf *model.Config