紧急处理 GeoIP API 问题

This commit is contained in:
naiba 2021-07-05 13:44:21 +08:00
parent 8d0e269b73
commit 557cccd770
5 changed files with 16 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<div align="center">
<img width="500" style="max-width:100%" src="resource/static/brand.png" title="哪吒监控">
<br><br>
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.8.3&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.6.1-brightgreen?style=for-the-badge&logo=linux">
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.8.5&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.6.2-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,命令批量执行和计划任务。</p>

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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