mirror of
https://github.com/roacn/openwrt-packages.git
synced 2025-01-08 11:57:31 +08:00
🏅 Sync 2022-05-23 20:48
This commit is contained in:
parent
b1c8610843
commit
f4e1e993f9
83
UnblockNeteaseMusic-Go/Makefile
Normal file
83
UnblockNeteaseMusic-Go/Makefile
Normal file
@ -0,0 +1,83 @@
|
||||
# SPDX-Identifier-License: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=UnblockNeteaseMusic-Go
|
||||
PKG_VERSION:=0.2.13
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/cnsilvan/UnblockNeteaseMusic/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=92201b7f04ab1015c806c672b98a29b97d0f137d9b60e6d35d279c2064ed86a4
|
||||
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
PKG_LICENSE_FILE:=LICENSE
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_UNBLOCKNETEASEMUSIC_GO_COMPRESS_GOPROXY \
|
||||
CONFIG_UNBLOCKNETEASEMUSIC_GO_COMPRESS_UPX
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(firstword $(subst -, ,$(PKG_NAME)))-$(PKG_VERSION)
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/cnsilvan/UnblockNeteaseMusic
|
||||
GO_PKG_BUILD_PKG:=$$(GO_PKG)
|
||||
GO_PKG_LDFLAGS:=-s -w
|
||||
COMPILE_TIME:= $(shell TZ=UTC-8 date '+%Y-%m-%d %H:%M:%S')
|
||||
GO_PKG_LDFLAGS+= \
|
||||
-X '$(GO_PKG)/version.Version=$(PKG_VERSION)' \
|
||||
-X '$(GO_PKG)/version.BuildTime=$(COMPILE_TIME)' \
|
||||
-X '$(GO_PKG)/version.ExGoVersionInfo=$(GO_ARM) $(GO_MIPS)$(GO_MIPS64)'
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../../lang/golang/golang-package.mk
|
||||
|
||||
define Package/UnblockNeteaseMusic-Go/config
|
||||
config UNBLOCKNETEASEMUSIC_GO_COMPRESS_GOPROXY
|
||||
bool "Compiling with GOPROXY proxy"
|
||||
default n
|
||||
|
||||
config UNBLOCKNETEASEMUSIC_GO_COMPRESS_UPX
|
||||
bool "Compress executable files with UPX"
|
||||
depends on !mips64
|
||||
default n
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_UNBLOCKNETEASEMUSIC_GO_COMPRESS_GOPROXY),y)
|
||||
export GO111MODULE=on
|
||||
export GOPROXY=https://goproxy.io
|
||||
endif
|
||||
|
||||
define Package/UnblockNeteaseMusic-Go
|
||||
SECTION:=multimedia
|
||||
CATEGORY:=Multimedia
|
||||
TITLE:=Revive Netease Cloud Music (Golang)
|
||||
URL:=https://github.com/cnsilvan/UnblockNeteaseMusic
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
ifeq ($(CONFIG_GOST_COMPRESS_UPX),y)
|
||||
$(STAGING_DIR_HOST)/bin/upx --lzma --best $(GO_PKG_BUILD_BIN_DIR)/UnblockNeteaseMusic
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/UnblockNeteaseMusic-Go/install
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/UnblockNeteaseMusic $(1)/usr/bin/UnblockNeteaseMusic
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/UnblockNeteaseMusicGo
|
||||
$(CP) ./files/* $(1)/usr/share/UnblockNeteaseMusicGo/
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinPackage,UnblockNeteaseMusic-Go))
|
||||
$(eval $(call BuildPackage,UnblockNeteaseMusic-Go))
|
14
UnblockNeteaseMusic-Go/files/ca.crt
Normal file
14
UnblockNeteaseMusic-Go/files/ca.crt
Normal file
@ -0,0 +1,14 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICIjCCAaigAwIBAgIUTc9HQDej5hLCQ74u436a5yE4MDcwCgYIKoZIzj0EAwMw
|
||||
SDELMAkGA1UEBhMCQ04xJDAiBgNVBAMMG1VuYmxvY2tOZXRlYXNlTXVzaWMgUm9v
|
||||
dCBDQTETMBEGA1UECgwKMTcxNTE3MzMyOTAeFw0yMTA0MzAwNzIzMDJaFw0yNjA0
|
||||
MjkwNzIzMDJaMEgxCzAJBgNVBAYTAkNOMSQwIgYDVQQDDBtVbmJsb2NrTmV0ZWFz
|
||||
ZU11c2ljIFJvb3QgQ0ExEzARBgNVBAoMCjE3MTUxNzMzMjkwdjAQBgcqhkjOPQIB
|
||||
BgUrgQQAIgNiAASIyI7lYgGlq49qWtY1O2/XNDeowYf7W/Z+l7C14bphxAJ9jSDo
|
||||
tLwbFPWy5VPENc0rB0/yeHA2z7LU67POL2gGgp+17y7scLkkBk3Q7wRMETrtP44Z
|
||||
ITBstZ0wzVyyQEKjUzBRMB0GA1UdDgQWBBQ2F7+t8cPHJaWuCD8RHTSdLugKYzAf
|
||||
BgNVHSMEGDAWgBQ2F7+t8cPHJaWuCD8RHTSdLugKYzAPBgNVHRMBAf8EBTADAQH/
|
||||
MAoGCCqGSM49BAMDA2gAMGUCMQDqaRX2e01e0U+f0As/KUKDhmG5ElkK5CjYK9jk
|
||||
kXLNGFXJLGta6CDvjtMLBPc20qkCMBvDs+JnJKVBEJNZVsRBBs+v2YxNU/u2aYJa
|
||||
dMwXuFveSDWOS7mBeRztX/geEggiSw==
|
||||
-----END CERTIFICATE-----
|
15
UnblockNeteaseMusic-Go/files/server.crt
Normal file
15
UnblockNeteaseMusic-Go/files/server.crt
Normal file
@ -0,0 +1,15 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICRDCCAcqgAwIBAgIUeVqRrT2mHG5Mc8JD+ErphiAmlgkwCgYIKoZIzj0EAwMw
|
||||
SDELMAkGA1UEBhMCQ04xJDAiBgNVBAMMG1VuYmxvY2tOZXRlYXNlTXVzaWMgUm9v
|
||||
dCBDQTETMBEGA1UECgwKMTcxNTE3MzMyOTAeFw0yMTA0MzAwNzIzMDJaFw0yMjA0
|
||||
MzAwNzIzMDJaMHsxCzAJBgNVBAYTAkNOMREwDwYDVQQHDAhIYW5nemhvdTEsMCoG
|
||||
A1UECgwjTmV0RWFzZSAoSGFuZ3pob3UpIE5ldHdvcmsgQ28uLCBMdGQxETAPBgNV
|
||||
BAsMCElUIERlcHQuMRgwFgYDVQQDDA8qLm11c2ljLjE2My5jb20wdjAQBgcqhkjO
|
||||
PQIBBgUrgQQAIgNiAAQTPyU9RQ1pAFMLmozi+c4pEC1rrxAlPGwO9Em+qV+a5qLW
|
||||
gQjjsJeabMqJ/UQ7hDtdKVxWuXiAjMiDcXwL63I71MZKPTAEKXdCmNQwb4kXvRUn
|
||||
oOR4r7BMxEpGlf0CULWjQjBAMBMGA1UdJQQMMAoGCCsGAQUFBwMBMCkGA1UdEQQi
|
||||
MCCCDW11c2ljLjE2My5jb22CDyoubXVzaWMuMTYzLmNvbTAKBggqhkjOPQQDAwNo
|
||||
ADBlAjEAs5bdgnNP/DiK919RiWscC0kyuY0ugG1C8m8F2Yod4MI3oTyrkVcag21o
|
||||
NSzm802uAjBoPuKEbjjFP4ics0BQdICiVd6WCVAsE69FnlmqRteAJqxvdKGpVLi+
|
||||
Qi3arfomrrc=
|
||||
-----END CERTIFICATE-----
|
9
UnblockNeteaseMusic-Go/files/server.key
Normal file
9
UnblockNeteaseMusic-Go/files/server.key
Normal file
@ -0,0 +1,9 @@
|
||||
-----BEGIN EC PARAMETERS-----
|
||||
BgUrgQQAIg==
|
||||
-----END EC PARAMETERS-----
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MIGkAgEBBDBfW3twxGaQmMzP9p0/UU5EvHFVCbBw4piVFJ+pm/uFY6CKZkC5LGMa
|
||||
Uc9vn/KiewGgBwYFK4EEACKhZANiAAQTPyU9RQ1pAFMLmozi+c4pEC1rrxAlPGwO
|
||||
9Em+qV+a5qLWgQjjsJeabMqJ/UQ7hDtdKVxWuXiAjMiDcXwL63I71MZKPTAEKXdC
|
||||
mNQwb4kXvRUnoOR4r7BMxEpGlf0CULU=
|
||||
-----END EC PRIVATE KEY-----
|
144
UnblockNeteaseMusic-Go/patches/01-fix-block-ad.patch
Normal file
144
UnblockNeteaseMusic-Go/patches/01-fix-block-ad.patch
Normal file
@ -0,0 +1,144 @@
|
||||
From f4f5d11b578a1ab2c3d089bbe5453052b43892bb Mon Sep 17 00:00:00 2001
|
||||
From: tofuliang <tofuliang@gmail.com>
|
||||
Date: Mon, 24 Jan 2022 18:53:11 +0800
|
||||
Subject: [PATCH] fix block ad,add web traffic logs
|
||||
|
||||
---
|
||||
app.go | 1 +
|
||||
config/config.go | 1 +
|
||||
processor/processor.go | 55 +++++++++++++++++++++++++++++++++---------
|
||||
3 files changed, 45 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/app.go b/app.go
|
||||
index 73a6070..1018d75 100644
|
||||
--- a/app.go
|
||||
+++ b/app.go
|
||||
@@ -45,6 +45,7 @@ func main() {
|
||||
log.Println("EnableLocalVip=", *config.EnableLocalVip)
|
||||
log.Println("UnlockSoundEffects=", *config.UnlockSoundEffects)
|
||||
log.Println("QQCookieFile=", *config.QQCookieFile)
|
||||
+ log.Println("LogWebTraffic=", *config.LogWebTraffic)
|
||||
if host.InitHosts() == nil {
|
||||
//go func() {
|
||||
// // // terminal: $ go tool pprof -http=:8081 http://localhost:6060/debug/pprof/heap
|
||||
diff --git a/config/config.go b/config/config.go
|
||||
index 6c07873..a653cdf 100644
|
||||
--- a/config/config.go
|
||||
+++ b/config/config.go
|
||||
@@ -31,6 +31,7 @@ var (
|
||||
EnableLocalVip = flag.Bool("lv", false, "enable local vip")
|
||||
UnlockSoundEffects = flag.Bool("sef", false, "unlock SoundEffects")
|
||||
QQCookieFile = flag.String("qc", "./qq.cookie", "specify cookies file ,such as : \"qq.cookie\"")
|
||||
+ LogWebTraffic = flag.Bool("wl", false, "log request url and response")
|
||||
)
|
||||
|
||||
func ValidParams() bool {
|
||||
diff --git a/processor/processor.go b/processor/processor.go
|
||||
index 8d09dbf..d07b9d3 100644
|
||||
--- a/processor/processor.go
|
||||
+++ b/processor/processor.go
|
||||
@@ -6,14 +6,6 @@ import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/cache"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/common"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/config"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/network"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/processor/crypto"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/provider"
|
||||
- "github.com/cnsilvan/UnblockNeteaseMusic/utils"
|
||||
- "golang.org/x/text/width"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
@@ -22,6 +14,15 @@ import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
+
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/cache"
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/common"
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/config"
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/network"
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/processor/crypto"
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/provider"
|
||||
+ "github.com/cnsilvan/UnblockNeteaseMusic/utils"
|
||||
+ "golang.org/x/text/width"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -188,6 +189,9 @@ func RequestAfter(request *http.Request, response *http.Response, netease *Netea
|
||||
if ok {
|
||||
code = codeN.String()
|
||||
}
|
||||
+
|
||||
+ logResponse(netease)
|
||||
+
|
||||
if strings.EqualFold(netease.Path, "/api/osx/version") {
|
||||
modified = disableUpdate(netease)
|
||||
} else if strings.Contains(netease.Path, "/usertool/sound/") {
|
||||
@@ -197,9 +201,24 @@ func RequestAfter(request *http.Request, response *http.Response, netease *Netea
|
||||
for key, resp := range netease.JsonBody {
|
||||
if strings.Contains(key, "/usertool/sound/") {
|
||||
modified = unblockSoundEffects(resp.(map[string]interface{}))
|
||||
- } else if *config.BlockAds && strings.Contains(netease.Path, "api/ad/") {
|
||||
+ } else if *config.BlockAds && strings.Contains(key, "api/ad/") {
|
||||
+ log.Println("block Ad has been triggered(" + key + ").")
|
||||
resp = &common.MapType{}
|
||||
modified = true
|
||||
+ } else if *config.BlockAds && strings.EqualFold(key, "/api/v2/banner/get") {
|
||||
+ newInfo := make(common.SliceType, 0)
|
||||
+ info := netease.JsonBody[key]
|
||||
+ for _, data := range info.(common.MapType)["banners"].(common.SliceType) {
|
||||
+ if banner, ok := data.(common.MapType); ok {
|
||||
+ if banner["adid"] == nil {
|
||||
+ newInfo = append(newInfo, banner)
|
||||
+ } else {
|
||||
+ log.Println("block banner Ad has been triggered.")
|
||||
+ modified = true
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ info.(common.MapType)["banners"] = newInfo
|
||||
}
|
||||
}
|
||||
} else if !netease.Web && (code == "401" || code == "512") && strings.Contains(netease.Path, "manipulate") {
|
||||
@@ -220,7 +239,9 @@ func RequestAfter(request *http.Request, response *http.Response, netease *Netea
|
||||
// log.Println("NeedRepackage")
|
||||
modifiedJson, _ := json.Marshal(netease.JsonBody)
|
||||
// log.Println(netease)
|
||||
- // log.Println(string(modifiedJson))
|
||||
+ if *config.LogWebTraffic {
|
||||
+ log.Println("modified =>\n" + string(modifiedJson))
|
||||
+ }
|
||||
if netease.Encrypted {
|
||||
modifiedJson = crypto.AesEncryptECB(modifiedJson, []byte(aeskey))
|
||||
}
|
||||
@@ -258,14 +279,24 @@ func disableUpdate(netease *Netease) bool {
|
||||
if len(value.(common.SliceType)) > 0 {
|
||||
modified = true
|
||||
jsonBody["updateFiles"] = make(common.SliceType, 0)
|
||||
+ log.Println("disable update has been triggered.")
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
- // modifiedJson, _ := json.Marshal(jsonBody)
|
||||
- // log.Println(string(modifiedJson))
|
||||
return modified
|
||||
}
|
||||
+
|
||||
+func logResponse(netease *Netease) {
|
||||
+ if *config.LogWebTraffic {
|
||||
+ reqUrl := netease.Path
|
||||
+ jsonBody := netease.JsonBody
|
||||
+ modifiedJson, _ := json.Marshal(jsonBody)
|
||||
+ sep := "===================================\n"
|
||||
+ log.Println(sep + reqUrl + " => \n" + string(modifiedJson) + "\n")
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
func localVIP(netease *Netease) bool {
|
||||
if !*config.EnableLocalVip {
|
||||
return false
|
@ -0,0 +1,29 @@
|
||||
From 6c009953d357d1cc03478cf65fc05701fb1966d6 Mon Sep 17 00:00:00 2001
|
||||
From: ameansone <ameansone@outlook.com>
|
||||
Date: Sun, 5 Dec 2021 19:18:20 +0800
|
||||
Subject: [PATCH] fix(processor): avoid unnecessary decryption
|
||||
|
||||
---
|
||||
processor/processor.go | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/processor/processor.go b/processor/processor.go
|
||||
index 8d09dbf..011571b 100644
|
||||
--- a/processor/processor.go
|
||||
+++ b/processor/processor.go
|
||||
@@ -177,9 +177,13 @@ func RequestAfter(request *http.Request, response *http.Response, netease *Netea
|
||||
if netease.Forward {
|
||||
aeskey = linuxApiKey
|
||||
}
|
||||
- decryptECBBytes, encrypted := crypto.AesDecryptECB(decryptECBBytes, []byte(aeskey))
|
||||
- netease.Encrypted = encrypted
|
||||
result := utils.ParseJson(decryptECBBytes)
|
||||
+ netease.Encrypted = false;
|
||||
+ if result == nil {
|
||||
+ decryptECBBytes, encrypted := crypto.AesDecryptECB(decryptECBBytes, []byte(aeskey))
|
||||
+ netease.Encrypted = encrypted
|
||||
+ result = utils.ParseJson(decryptECBBytes)
|
||||
+ }
|
||||
netease.JsonBody = result
|
||||
|
||||
modified := false
|
@ -1,6 +1,6 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
# Copyright (C) 2020-2021 sirpdboy <herboy2008@gmail.com>
|
||||
# https://github.com/sirpdboy/luci-app-netdata for v 1.30.1 cn
|
||||
# https://github.com/sirpdboy/luci-app-netdata for v 1.33.1 cn
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
@ -9,8 +9,10 @@ include $(TOPDIR)/rules.mk
|
||||
LUCI_TITLE:=LuCI support for Netdata
|
||||
LUCI_DEPENDS:=+netdata
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_NAME:=luci-app-netdata
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=20210610
|
||||
PKG_RELEASE:=20220523
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
@ -1,12 +1,6 @@
|
||||
module("luci.controller.netdata", package.seeall)
|
||||
|
||||
function index()
|
||||
if not (luci.sys.call("pidof netdata > /dev/null") == 0) then
|
||||
return
|
||||
end
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
entry({"admin","status","netdata"},template("netdata"),_("NetData"),10).leaf=true
|
||||
|
||||
|
||||
entry({"admin", "status", "netdata"}, template("netdata"), _("NetData"), 10).leaf = true
|
||||
end
|
@ -6,7 +6,7 @@
|
||||
|
||||
<%+header%>
|
||||
<div class="cbi-map">
|
||||
<h2 name="content"><%=translate("NetData")%></h2>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function upnetdata(button) {
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
}
|
||||
//]]></script>
|
||||
|
||||
<iframe id="netdata" style="width: 100%; min-height: 1200px; border: none; border-radius: 3px;"></iframe>
|
||||
<iframe id="netdata" style="width: 100%; min-height: 780px; border: none; border-radius: .375rem;box-shadow: rgba(0, 0, 0, 0.75) 0px 0px 15px -5px;"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("netdata").src = window.location.protocol + "//" + window.location.hostname + ":19999";
|
||||
|
@ -1,4 +1,4 @@
|
||||
luci-app-netdata for OpenWRT/Lede(中文)
|
||||
luci-app-netdata for OpenWRT/Lede
|
||||
|
||||
|
||||
Install to OpenWRT/LEDE
|
||||
|
@ -63,7 +63,7 @@
|
||||
* (default: null) */
|
||||
/*global netdataAlarmsRecipients *//* array, an array of alarm recipients to show notifications for
|
||||
* (default: null) */
|
||||
/*global netdataAlarmsRemember *//* boolen, keep our position in the alarm log at browser local storage
|
||||
/*global netdataAlarmsRemember *//* boolean, keep our position in the alarm log at browser local storage
|
||||
* (default: true) */
|
||||
/*global netdataAlarmsActiveCallback *//* function, a hook for the alarm logs
|
||||
* (default: undefined) */
|
||||
@ -142,18 +142,18 @@ NETDATA.zeropad = function (x) {
|
||||
|
||||
NETDATA.seconds4human = function (seconds, options) {
|
||||
let defaultOptions = {
|
||||
now: '现在',
|
||||
now: 'now',
|
||||
space: ' ',
|
||||
negative_suffix: '前',
|
||||
day: '日',
|
||||
days: '日',
|
||||
hour: '小时',
|
||||
hours: '小时',
|
||||
minute: '分钟',
|
||||
minutes: '分钟',
|
||||
second: '秒',
|
||||
seconds: '秒',
|
||||
and: '及'
|
||||
negative_suffix: 'ago',
|
||||
day: 'day',
|
||||
days: 'days',
|
||||
hour: 'hour',
|
||||
hours: 'hours',
|
||||
minute: 'min',
|
||||
minutes: 'mins',
|
||||
second: 'sec',
|
||||
seconds: 'secs',
|
||||
and: 'and'
|
||||
};
|
||||
|
||||
if (typeof options !== 'object') {
|
||||
@ -549,7 +549,7 @@ if (typeof netdataServerStatic !== 'undefined' && netdataServerStatic !== null &
|
||||
// default URLs for all the external files we need
|
||||
// make them RELATIVE so that the whole thing can also be
|
||||
// installed under a web server
|
||||
NETDATA.jQuery = NETDATA.serverStatic + 'lib/jquery-2.2.4.min.js';
|
||||
NETDATA.jQuery = NETDATA.serverStatic + 'lib/jquery-3.6.0.min.js';
|
||||
NETDATA.peity_js = NETDATA.serverStatic + 'lib/jquery.peity-3.2.0.min.js';
|
||||
NETDATA.sparkline_js = NETDATA.serverStatic + 'lib/jquery.sparkline-2.1.2.min.js';
|
||||
NETDATA.easypiechart_js = NETDATA.serverStatic + 'lib/jquery.easypiechart-97b5824.min.js';
|
||||
@ -2371,7 +2371,6 @@ NETDATA.dygraphChartCreate = function (state, data) {
|
||||
NETDATA.globalSelectionSync.stop();
|
||||
},
|
||||
underlayCallback: function (canvas, area, g) {
|
||||
|
||||
// the chart is about to be drawn
|
||||
|
||||
// update history_tip_element
|
||||
@ -6655,7 +6654,7 @@ let chartState = function (element) {
|
||||
if (NETDATA.options.current.show_help) {
|
||||
if (this.element_legend_childs.toolbox !== null) {
|
||||
if (this.debug) {
|
||||
this.log('hideChart(): hidding legend popovers');
|
||||
this.log('hideChart(): hiding legend popovers');
|
||||
}
|
||||
|
||||
$(this.element_legend_childs.toolbox_left).popover('hide');
|
||||
@ -6994,7 +6993,7 @@ let chartState = function (element) {
|
||||
resizeChartToHeight(this.height_original.toString());
|
||||
}
|
||||
|
||||
// else if the current height is not the firstchild's clientheight
|
||||
// else if the current height is not the firstChild's clientheight
|
||||
// resize to it
|
||||
else if (typeof this.element_legend_childs.perfect_scroller.firstChild !== 'undefined') {
|
||||
let parent_rect = this.element.getBoundingClientRect();
|
||||
@ -8202,7 +8201,7 @@ let chartState = function (element) {
|
||||
}
|
||||
}
|
||||
|
||||
// create a hidden div to be used for hidding
|
||||
// create a hidden div to be used for hiding
|
||||
// the original legend of the chart library
|
||||
let el = document.createElement('div');
|
||||
if (this.element_legend !== null) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -108,10 +108,6 @@
|
||||
<ul class="nav navbar-nav">
|
||||
<li id="alarmsButton" title="检查健康状况监控警报与记录" data-toggle="tooltip" data-placement="bottom"><a href="#" class="btn" data-toggle="modal" data-target="#alarmsModal"><i class="fas fa-bell"></i> <span class="hidden-sm hidden-md">警报 </span><span id="alarms_count_badge" class="badge"></span></a></li>
|
||||
<li title="变更仪表板设定" data-toggle="tooltip" data-placement="bottom"><a href="#" class="btn" data-toggle="modal" data-target="#optionsModal"><i class="fas fa-cog"></i> <span class="hidden-sm hidden-md">设定</span></a></li>
|
||||
<li title="检查 netdata 更新<br/>您应随时保持 netdata 为最新版本" data-toggle="tooltip" data-placement="bottom" class="hidden-sm" id="updateButton"><a href="#" class="btn" data-toggle="modal" data-target="#updateModal"><i class="fas fa-cloud-download-alt"></i> <span class="hidden-sm hidden-md">更新 </span><span id="update_badge" class="badge"></span></a></li>
|
||||
<li title="到 netdata 在 github 上的 wiki<br/>记得 <b>给 netdata 一个 <i class="fas fa-star"></i></b> !" data-toggle="tooltip" data-placement="bottom" class="hidden-xs hidden-sm hidden-md"><a href="https://github.com/netdata/netdata" class="btn" target="_blank"><i class="fab fa-github"></i></a></li>
|
||||
<li title="在 twitter 上跟随 netdata" data-toggle="tooltip" data-placement="bottom" class="hidden-xs hidden-sm hidden-md"><a href="https://twitter.com/linuxnetdata" class="btn" target="_blank"><i class="fab fa-twitter"></i></a></li>
|
||||
<li title="到 facebook 上给 netdata 按赞" data-toggle="tooltip" data-placement="bottom" class="hidden-xs hidden-sm hidden-md"><a href="https://www.facebook.com/linuxnetdata/" class="btn" target="_blank"><i class="fab fa-facebook"></i></a></li>
|
||||
<li title="汇入 / 载入 netdata 快照" data-toggle="tooltip" data-placement="bottom" id="loadButton"><a href="#" class="btn" data-toggle="modal" data-target="#loadSnapshotModal"><i class="fas fa-download"></i> <span class="hidden-sm hidden-md hidden-lg">汇入</span></a></li>
|
||||
<li title="汇出 / 储存 netdata 快照" data-toggle="tooltip" data-placement="bottom" id="saveButton"><a href="#" class="btn" data-toggle="modal" data-target="#saveSnapshotModal"><i class="fas fa-upload"></i> <span class="hidden-sm hidden-md hidden-lg">汇出</span></a></li>
|
||||
<li title="将仪表板列印为 PDF" data-toggle="tooltip" data-placement="bottom" id="printButton"><a href="#" class="btn" data-toggle="modal" data-target="#printPreflightModal"><i class="fas fa-print"></i> <span class="hidden-sm hidden-md hidden-lg">列印</span></a></li>
|
||||
@ -180,14 +176,14 @@
|
||||
<div class="row">
|
||||
<div class="col-md-10" role="main">
|
||||
<div class="p">
|
||||
<big><a href="https://github.com/netdata/netdata/wiki" target="_blank">Netdata</a></big>
|
||||
<big><a href="" target="_blank">Netdata</a></big>
|
||||
<br /><br />
|
||||
<i class="fas fa-copyright"></i> Copyright 2018, <a href="mailto:info@netdata.cloud">Netdata, Inc</a>.<br/>
|
||||
<i class="fas fa-copyright"></i> Copyright 2016-2018, <a href="mailto:costa@tsaousis.gr">Costa Tsaousis</a>.<br/>
|
||||
</div>
|
||||
<div class="p">
|
||||
以 <a href="http://www.gnu.org/licenses/gpl-3.0.en.html" target="_blank">GPL v3 或之后</a> 条款释出。
|
||||
Netdata 使用之 <a href="https://github.com/netdata/netdata/blob/master/REDISTRIBUTED.md" target="_blank">第三方工具</a>.
|
||||
Netdata 使用之 <a href="" target="_blank">第三方工具</a>.
|
||||
<br /><br />
|
||||
</div>
|
||||
</div>
|
||||
@ -420,14 +416,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="p">
|
||||
<b><a href="https://github.com/netdata/netdata/wiki" target="_blank">netdata</a></b>
|
||||
<b><a href="" target="_blank">netdata</a></b>
|
||||
is a new way to monitor your systems and applications, to get <strong>real-time insights</strong>
|
||||
of what is really happening and what affects performance.
|
||||
It is carefully optimised to be a real-time system, without interfering in any way,
|
||||
to the core function of your systems.
|
||||
</div>
|
||||
<div class="p">
|
||||
<b><a href="https://github.com/netdata/netdata/wiki" target="_blank">netdata</a></b>
|
||||
<b><a href="" target="_blank">netdata</a></b>
|
||||
has been designed to monitor <strong>massive amounts of metrics, per server, per second</strong>.
|
||||
When installed, it might come up with 1k to 3k metrics, but we have been testing it with 100k
|
||||
metrics, all collected per second, and still the cpu utilisation remained negligible.
|
||||
@ -437,9 +433,9 @@
|
||||
better understanding of the underlying technologies and mechanisms.
|
||||
</div>
|
||||
<div class="p">
|
||||
<b><a href="https://github.com/netdata/netdata/wiki" target="_blank">netdata</a></b> is free,
|
||||
<b><a href="" target="_blank">netdata</a></b> is free,
|
||||
open-source software. If you decide to use it,
|
||||
<strong><a href="https://github.com/netdata/netdata/tree/master/docs/a-github-star-is-important.md" target="_blank">it is important to give netdata a star at GitHub</a></strong>.
|
||||
<strong><a href="" target="_blank">it is important to give netdata a star at GitHub</a></strong>.
|
||||
</div>
|
||||
<div class="p">
|
||||
Enjoy real-time performance monitoring!
|
||||
@ -1169,19 +1165,10 @@
|
||||
您的 netdata 版本:<b><code><span id="netdataVersion">未知</span></code></b><br/>
|
||||
<br/>
|
||||
<div style="padding: 10px;"></div>
|
||||
<div id="versionCheckLog">尚未检查,请下 立即检查 按钮。</div>
|
||||
<div>
|
||||
<hr/>
|
||||
</div>
|
||||
<div>
|
||||
到这里查阅 netdata 的进度报告与关键更新:<strong><a href="https://twitter.com/linuxnetdata" target="_blank">在 <i class="fab fa-twitter"></i> twitter 上跟随 netdata</a></strong>。
|
||||
<br/>
|
||||
您也可以在 <a href="https://www.facebook.com/linuxnetdata/" target="_blank"><i class="fab fa-facebook"></i> facebook 上给 netdata 按赞</a>,
|
||||
或是 <a href="https://github.com/netdata/netdata" target="_blank">到 <i class="fab fa-github"></i> github 上了解 netdata</a>.
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#" onclick="notifyForUpdate(true); return false;" type="button" class="btn btn-default">立即检查</a>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -275,7 +275,7 @@ var urlOptions = {
|
||||
|
||||
$('.highlight-tooltip').tooltip({
|
||||
html: true,
|
||||
delay: {show: 500, hide: 0},
|
||||
delay: { show: 500, hide: 0 },
|
||||
container: 'body'
|
||||
});
|
||||
} else {
|
||||
@ -496,7 +496,7 @@ function toggleAgentItem(e, guid) {
|
||||
}
|
||||
}
|
||||
|
||||
// When you stream metrics from netdata to netdata, the recieving netdata now
|
||||
// When you stream metrics from netdata to netdata, the receiving netdata now
|
||||
// has multiple host databases. It's own, and multiple mirrored. Mirrored databases
|
||||
// can be accessed with <http://localhost:19999/host/NAME/>
|
||||
const OLD_DASHBOARD_SUFFIX = "old"
|
||||
@ -621,20 +621,20 @@ function renderMachines(machinesArray) {
|
||||
const alternateUrlItems = (
|
||||
`<div class="agent-alternate-urls agent-${machine.guid} collapsed">
|
||||
${machine.alternate_urls.reduce((str, url) => {
|
||||
if (url === maskedURL) {
|
||||
return str
|
||||
}
|
||||
if (url === maskedURL) {
|
||||
return str
|
||||
}
|
||||
|
||||
return str + (
|
||||
`<div class="agent-item agent-item--alternate">
|
||||
return str + (
|
||||
`<div class="agent-item agent-item--alternate">
|
||||
<div></div>
|
||||
<a href="${url}" title="${url}">${truncateString(url, 64)}</a>
|
||||
<a href="#" onclick="deleteRegistryModalHandler('${machine.guid}', '${machine.name}', '${url}'); return false;">
|
||||
<i class="fas fa-trash" style="color: #777;"></i>
|
||||
</a>
|
||||
</div>`
|
||||
)
|
||||
},
|
||||
)
|
||||
},
|
||||
''
|
||||
)}
|
||||
</div>`
|
||||
@ -683,14 +683,14 @@ function renderMachines(machinesArray) {
|
||||
html += `<div class="info-item">Demo netdata nodes</div>`;
|
||||
|
||||
const demoServers = [
|
||||
{url: "//london.netdata.rocks/default.html", title: "UK - London (DigitalOcean.com)"},
|
||||
{url: "//newyork.netdata.rocks/default.html", title: "US - New York (DigitalOcean.com)"},
|
||||
{url: "//sanfrancisco.netdata.rocks/default.html", title: "US - San Francisco (DigitalOcean.com)"},
|
||||
{url: "//atlanta.netdata.rocks/default.html", title: "US - Atlanta (CDN77.com)"},
|
||||
{url: "//frankfurt.netdata.rocks/default.html", title: "Germany - Frankfurt (DigitalOcean.com)"},
|
||||
{url: "//toronto.netdata.rocks/default.html", title: "Canada - Toronto (DigitalOcean.com)"},
|
||||
{url: "//singapore.netdata.rocks/default.html", title: "Japan - Singapore (DigitalOcean.com)"},
|
||||
{url: "//bangalore.netdata.rocks/default.html", title: "India - Bangalore (DigitalOcean.com)"},
|
||||
{ url: "//london.netdata.rocks/default.html", title: "UK - London (DigitalOcean.com)" },
|
||||
{ url: "//newyork.netdata.rocks/default.html", title: "US - New York (DigitalOcean.com)" },
|
||||
{ url: "//sanfrancisco.netdata.rocks/default.html", title: "US - San Francisco (DigitalOcean.com)" },
|
||||
{ url: "//atlanta.netdata.rocks/default.html", title: "US - Atlanta (CDN77.com)" },
|
||||
{ url: "//frankfurt.netdata.rocks/default.html", title: "Germany - Frankfurt (DigitalOcean.com)" },
|
||||
{ url: "//toronto.netdata.rocks/default.html", title: "Canada - Toronto (DigitalOcean.com)" },
|
||||
{ url: "//singapore.netdata.rocks/default.html", title: "Japan - Singapore (DigitalOcean.com)" },
|
||||
{ url: "//bangalore.netdata.rocks/default.html", title: "India - Bangalore (DigitalOcean.com)" },
|
||||
|
||||
]
|
||||
|
||||
@ -971,7 +971,7 @@ function gotoServerModalHandler(guid) {
|
||||
|
||||
if (!isSignedIn()) {
|
||||
// When the registry is enabled, if the user's known URLs are not working
|
||||
// we consult the registry to get additional URLs.
|
||||
// we consult the registry to get additional URLs.
|
||||
setTimeout(function () {
|
||||
if (gotoServerStop === false) {
|
||||
document.getElementById('gotoServerResponse').innerHTML = '<b>Added all the known URLs for this machine.</b>';
|
||||
@ -1032,7 +1032,7 @@ function notifyForSwitchRegistry() {
|
||||
}
|
||||
}
|
||||
|
||||
var deleteRegistryGuid = null;
|
||||
var deleteRegistryGuid = null;
|
||||
var deleteRegistryUrl = null;
|
||||
|
||||
function deleteRegistryModalHandler(guid, name, url) {
|
||||
@ -1045,7 +1045,7 @@ function deleteRegistryModalHandler(guid, name, url) {
|
||||
document.getElementById('deleteRegistryServerName2').innerHTML = name;
|
||||
document.getElementById('deleteRegistryServerURL').innerHTML = url;
|
||||
document.getElementById('deleteRegistryResponse').innerHTML = '';
|
||||
|
||||
|
||||
$('#deleteRegistryModal').modal('show');
|
||||
}
|
||||
|
||||
@ -1068,7 +1068,7 @@ function notifyForDeleteRegistry() {
|
||||
deleteRegistryUrl = null;
|
||||
$('#deleteRegistryModal').modal('hide');
|
||||
NETDATA.registry.init();
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
NETDATA.registry.delete(deleteRegistryUrl, function (result) {
|
||||
@ -1079,7 +1079,7 @@ function notifyForDeleteRegistry() {
|
||||
} else {
|
||||
responseEl.innerHTML = "<b>Sorry, this command was rejected by the registry server!</b>";
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1160,7 +1160,7 @@ function scrollToId(hash) {
|
||||
var offset = $('#' + hash).offset();
|
||||
if (typeof offset !== 'undefined') {
|
||||
//console.log('scrolling to ' + hash + ' at ' + offset.top.toString());
|
||||
$('html, body').animate({scrollTop: offset.top - 30}, 0);
|
||||
$('html, body').animate({ scrollTop: offset.top - 30 }, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1212,7 +1212,7 @@ var netdataDashboard = {
|
||||
}
|
||||
|
||||
if (typeof this.sparklines_registry[key] === 'undefined') {
|
||||
this.sparklines_registry[key] = {count: 1};
|
||||
this.sparklines_registry[key] = { count: 1 };
|
||||
} else {
|
||||
this.sparklines_registry[key].count++;
|
||||
}
|
||||
@ -1406,6 +1406,14 @@ function enrichChartData(chart) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'mount':
|
||||
if (parts.length > 2) {
|
||||
chart.menu = tmp + '_' + parts[1];
|
||||
} else {
|
||||
chart.menu = tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'isc':
|
||||
chart.menu = chart.type;
|
||||
if (parts.length > 2 && parts[1] === 'dhcpd') {
|
||||
@ -1810,8 +1818,9 @@ function renderPage(menus, data) {
|
||||
}
|
||||
|
||||
const isMemoryModeDbEngine = data.memory_mode === "dbengine";
|
||||
sidebar += '<li class="" style="padding-top:15px;"><a href="https://github.com/netdata/netdata/blob/master/docs/Add-more-charts-to-netdata.md#add-more-charts-to-netdata" target="_blank"><i class="fas fa-plus"></i> 加入更多图表</a></li>';
|
||||
sidebar += '<li class=""><a href="https://github.com/netdata/netdata/tree/master/health#Health-monitoring" target="_blank"><i class="fas fa-plus"></i> 加入更多警报</a></li>';
|
||||
|
||||
sidebar += '<li class="" style="padding-top:15px;"><a href="https://learn.netdata.cloud/docs/agent/collectors/quickstart/" target="_blank"><i class="fas fa-plus"></i> 加入更多图表</a></li>';
|
||||
sidebar += '<li class=""><a href="https://learn.netdata.cloud/docs/agent/health/quickstart/" target="_blank"><i class="fas fa-plus"></i> 加入更多警报</a></li>';
|
||||
sidebar += '<li class="" style="margin:20px;color:#666;"><small>每 ' +
|
||||
((data.update_every === 1) ? '秒' : data.update_every.toString() + ' 秒') + ', ' +
|
||||
'收集<strong>' + data.dimensions_count.toLocaleString() + '</strong> 上的度量 ' +
|
||||
@ -1822,8 +1831,7 @@ function renderPage(menus, data) {
|
||||
data.alarms_count.toLocaleString() + '</strong> 警报.';
|
||||
|
||||
if (!isMemoryModeDbEngine) {
|
||||
sidebar += '<br /> <br />获取更多历史记录 ' +
|
||||
'<a href="https://learn.netdata.cloud/guides/longer-metrics-storage#using-the-round-robin-database" target=_blank>配置Netdata\'s <strong>历史</strong></a> 或使用 <a href="https://learn.netdata.cloud/docs/agent/database/engine/" target=_blank>DB 引擎.</a>';
|
||||
sidebar += '<br /> <br />获取更多历史记录 ';
|
||||
}
|
||||
|
||||
sidebar += '<br/> <br/><strong>netdata</strong><br/>' + data.version.toString() + '</small></li>';
|
||||
@ -1940,7 +1948,7 @@ function loadJs(url, callback) {
|
||||
url: url.startsWith("http") ? url : transformWithOldSuffix(url),
|
||||
cache: true,
|
||||
dataType: "script",
|
||||
xhrFields: {withCredentials: true} // required for the cookie
|
||||
xhrFields: { withCredentials: true } // required for the cookie
|
||||
})
|
||||
.fail(function () {
|
||||
alert('Cannot load required JS library: ' + url);
|
||||
@ -2042,8 +2050,8 @@ function alarmsUpdateModal() {
|
||||
if (data === null) {
|
||||
document.getElementById('alarms_active').innerHTML =
|
||||
document.getElementById('alarms_all').innerHTML =
|
||||
document.getElementById('alarms_log').innerHTML =
|
||||
'failed to load alarm data!';
|
||||
document.getElementById('alarms_log').innerHTML =
|
||||
'failed to load alarm data!';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2306,7 +2314,7 @@ function alarmsUpdateModal() {
|
||||
all += "</div>";
|
||||
|
||||
if (!count_active) {
|
||||
active += '<div style="width:100%; height: 100px; text-align: center;"><span style="font-size: 50px;"><i class="fas fa-thumbs-up"></i></span><br/>一切正常。没有警报。</div>';
|
||||
active += '<div style="width:100%; height: 100px; text-align: center;"><span style="font-size: 50px;"><i class="fas fa-thumbs-up"></i></span><br/>Everything is normal. No raised alarms.</div>';
|
||||
} else {
|
||||
active += footer;
|
||||
}
|
||||
@ -2565,12 +2573,12 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'duration',
|
||||
title: 'Last Duration',
|
||||
title: '上次持续时间',
|
||||
titleTooltip: 'The duration the alarm was at its previous state, just before this event',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
void (index);
|
||||
return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
|
||||
return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
|
||||
},
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2579,12 +2587,12 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'non_clear_duration',
|
||||
title: 'Raised Duration',
|
||||
title: '提升的持续时间',
|
||||
titleTooltip: 'The duration the alarm was raised, just before this event',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
void (index);
|
||||
return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
|
||||
return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
|
||||
},
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2593,7 +2601,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'recipient',
|
||||
title: 'Recipient',
|
||||
title: '收件人',
|
||||
titleTooltip: 'The recipient of this event',
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2602,7 +2610,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'processed',
|
||||
title: 'Processed Status',
|
||||
title: '已处理状态',
|
||||
titleTooltip: 'True when this event is processed',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2621,7 +2629,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'updated',
|
||||
title: 'Updated Status',
|
||||
title: '更新的状态',
|
||||
titleTooltip: 'True when this event has been updated by another event',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2640,7 +2648,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'updated_by_id',
|
||||
title: 'Updated By ID',
|
||||
title: '由ID更新',
|
||||
titleTooltip: 'The unique ID of the event that obsoleted this one',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2654,7 +2662,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'updates_id',
|
||||
title: 'Updates ID',
|
||||
title: '更新ID',
|
||||
titleTooltip: 'The unique ID of the event obsoleted because of this event',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2668,7 +2676,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'exec',
|
||||
title: 'Script',
|
||||
title: '脚本',
|
||||
titleTooltip: 'The script to handle the event notification',
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2677,7 +2685,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'exec_run',
|
||||
title: 'Script Run At',
|
||||
title: '脚本运行时间',
|
||||
titleTooltip: 'The date and time the script has been ran',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2691,7 +2699,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'exec_code',
|
||||
title: 'Script Return Value',
|
||||
title: '脚本返回值',
|
||||
titleTooltip: 'The return code of the script',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2710,13 +2718,13 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'delay',
|
||||
title: 'Script Delay',
|
||||
title: '脚本延迟',
|
||||
titleTooltip: 'The hysteresis of the notification',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
void (index);
|
||||
|
||||
return NETDATA.seconds4human(value, {negative_suffix: '', space: ' ', now: 'no time'});
|
||||
return NETDATA.seconds4human(value, { negative_suffix: '', space: ' ', now: 'no time' });
|
||||
},
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2725,7 +2733,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'delay_up_to_timestamp',
|
||||
title: 'Script Delay Run At',
|
||||
title: '脚本延迟运行时间',
|
||||
titleTooltip: 'The date and time the script should be run, after hysteresis',
|
||||
formatter: function (value, row, index) {
|
||||
void (row);
|
||||
@ -2739,7 +2747,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'info',
|
||||
title: '说明',
|
||||
title: '描述',
|
||||
titleTooltip: 'A short description of the alarm',
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2748,7 +2756,7 @@ function alarmsUpdateModal() {
|
||||
},
|
||||
{
|
||||
field: 'source',
|
||||
title: '警报来源',
|
||||
title: '报警源',
|
||||
titleTooltip: 'The source of configuration of the alarm',
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
@ -2834,7 +2842,7 @@ function initializeDynamicDashboardWithData(data) {
|
||||
}
|
||||
}
|
||||
|
||||
// an object to keep initilization configuration
|
||||
// an object to keep initialization configuration
|
||||
// needed due to the async nature of the XSS modal
|
||||
var initializeConfig = {
|
||||
url: null,
|
||||
@ -3037,19 +3045,10 @@ function notifyForUpdate(force) {
|
||||
|
||||
if (sha1 === null) {
|
||||
save = false;
|
||||
versionLog('<p><big>取得您的 netdata 版本失败!</big></p><p>You can always get the latest netdata from <a href="https://github.com/netdata/netdata" target="_blank">its github page</a>.</p>');
|
||||
} else if (sha2 === null) {
|
||||
save = false;
|
||||
versionLog('<p><big>从 github 取得 netdata 最新版本失败。</big></p><p>您也可以从 <a href="https://github.com/netdata/netdata" target="_blank"> github</a> 取得最新 netdata 版本。</p>');
|
||||
} else if (versionsMatch(sha1, sha2)) {
|
||||
versionLog('<p><big>取得您的 netdata 版本失败!</big></p>');
|
||||
else {
|
||||
save = true;
|
||||
versionLog('<p><big>您已经是最新版本的 netdata!</big></p><p>还没有更新?<br/>或许,我们还需要一些动力继续前进!</p><p>如果您还没有做好更新的准备,请您 <a href="https://github.com/netdata/netdata" target="_blank">到 github 给 netdata <b><i class="fas fa-star"></i></b></a>。</p>');
|
||||
} else {
|
||||
save = true;
|
||||
var compare = 'https://learn.netdata.cloud/docs/agent/changelog/';
|
||||
versionLog('<p><big><strong>New version of netdata available!</strong></big></p><p>Latest version: <b><code>' + sha2 + '</code></b></p><p><a href="' + compare + '" target="_blank">Click here for the changes log</a> and<br/><a href="https://github.com/netdata/netdata/tree/master/packaging/installer/UPDATE.md" target="_blank">click here for directions on updating</a> your netdata installation.</p><p>We suggest to review the changes log for new features you may be interested, or important bug fixes you may need.<br/>Keeping your netdata updated is generally a good idea.</p>');
|
||||
|
||||
document.getElementById('update_badge').innerHTML = '!';
|
||||
versionLog('<p><big>您已经是最新版本的 netdata!</big></p>');
|
||||
}
|
||||
|
||||
if (save) {
|
||||
@ -3193,7 +3192,7 @@ var snapshotOptions = {
|
||||
bytes_per_point_disk: 1.9,
|
||||
|
||||
compress: function (s) {
|
||||
return btoa(pako.deflate(s, {to: 'string'}));
|
||||
return btoa(pako.deflate(s, { to: 'string' }));
|
||||
},
|
||||
|
||||
compressed_length: function (s) {
|
||||
@ -3201,7 +3200,7 @@ var snapshotOptions = {
|
||||
},
|
||||
|
||||
uncompress: function (s) {
|
||||
return pako.inflate(atob(s), {to: 'string'});
|
||||
return pako.inflate(atob(s), { to: 'string' });
|
||||
}
|
||||
},
|
||||
|
||||
@ -3210,7 +3209,7 @@ var snapshotOptions = {
|
||||
bytes_per_point_disk: 3.2,
|
||||
|
||||
compress: function (s) {
|
||||
return pako.deflate(s, {to: 'string'});
|
||||
return pako.deflate(s, { to: 'string' });
|
||||
},
|
||||
|
||||
compressed_length: function (s) {
|
||||
@ -3218,7 +3217,7 @@ var snapshotOptions = {
|
||||
},
|
||||
|
||||
uncompress: function (s) {
|
||||
return pako.inflate(s, {to: 'string'});
|
||||
return pako.inflate(s, { to: 'string' });
|
||||
}
|
||||
},
|
||||
|
||||
@ -4023,7 +4022,7 @@ function enableTooltipsAndPopovers() {
|
||||
animated: 'fade',
|
||||
trigger: 'hover',
|
||||
html: true,
|
||||
delay: {show: 500, hide: 0},
|
||||
delay: { show: 500, hide: 0 },
|
||||
container: 'body'
|
||||
});
|
||||
$('[data-toggle="popover"]').popover();
|
||||
@ -4101,7 +4100,7 @@ function runOnceOnDashboardWithjQuery() {
|
||||
|
||||
// scroll to the position we had open before the modal
|
||||
$('html, body')
|
||||
.animate({scrollTop: scrollPos}, 0);
|
||||
.animate({ scrollTop: scrollPos }, 0);
|
||||
|
||||
// unpause netdata, if we paused it
|
||||
if (netdata_paused_on_modal === true) {
|
||||
@ -4254,7 +4253,6 @@ function runOnceOnDashboardWithjQuery() {
|
||||
versionLog('checking, please wait...');
|
||||
})
|
||||
.on('shown.bs.modal', function () {
|
||||
notifyForUpdate(true);
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -4267,8 +4265,8 @@ function runOnceOnDashboardWithjQuery() {
|
||||
.on('hidden.bs.modal', function () {
|
||||
document.getElementById('alarms_active').innerHTML =
|
||||
document.getElementById('alarms_all').innerHTML =
|
||||
document.getElementById('alarms_log').innerHTML =
|
||||
'loading...';
|
||||
document.getElementById('alarms_log').innerHTML =
|
||||
'loading...';
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -4318,7 +4316,7 @@ function runOnceOnDashboardWithjQuery() {
|
||||
if ($this.hasClass('less')) {
|
||||
$this.removeClass('less');
|
||||
$this.html(config.moreText);
|
||||
$this.parent().prev().animate({'height': '0' + '%'}, 0, function () {
|
||||
$this.parent().prev().animate({ 'height': '0' + '%' }, 0, function () {
|
||||
$this.parent().prev().prev().show();
|
||||
}).hide(0, function () {
|
||||
config.onLess();
|
||||
@ -4326,7 +4324,7 @@ function runOnceOnDashboardWithjQuery() {
|
||||
} else {
|
||||
$this.addClass('less');
|
||||
$this.html(config.lessText);
|
||||
$this.parent().prev().animate({'height': '100' + '%'}, 0, function () {
|
||||
$this.parent().prev().animate({ 'height': '100' + '%' }, 0, function () {
|
||||
$this.parent().prev().prev().hide();
|
||||
}).show(0, function () {
|
||||
config.onMore();
|
||||
@ -4425,7 +4423,7 @@ function runOnceOnDashboardWithjQuery() {
|
||||
function finalizePage() {
|
||||
// resize all charts - without starting the background thread
|
||||
// this has to be done while NETDATA is paused
|
||||
// if we ommit this, the affix menu will be wrong, since all
|
||||
// if we omit this, the affix menu will be wrong, since all
|
||||
// the Dom elements are initially zero-sized
|
||||
NETDATA.parseDom();
|
||||
|
||||
@ -4474,7 +4472,6 @@ function finalizePage() {
|
||||
ga('send', 'pageview', '/demosite/' + window.location.host);
|
||||
}, 2000);
|
||||
} else {
|
||||
notifyForUpdate();
|
||||
}
|
||||
|
||||
if (urlOptions.show_alarms === true) {
|
||||
@ -4649,7 +4646,7 @@ function getCloudAccountAgents() {
|
||||
if (!isSignedIn()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
return fetch(
|
||||
`${NETDATA.registry.cloudBaseURL}/api/v1/accounts/${cloudAccountID}/agents`,
|
||||
{
|
||||
@ -4659,7 +4656,7 @@ function getCloudAccountAgents() {
|
||||
"Authorization": `Bearer ${cloudToken}`
|
||||
}
|
||||
}
|
||||
).then((response) => {
|
||||
).then((response) => {
|
||||
if (!response.ok) {
|
||||
throw Error("Cannot fetch known accounts");
|
||||
}
|
||||
@ -4738,7 +4735,7 @@ function postCloudAccountAgents(agentsToSync) {
|
||||
"agents": agents,
|
||||
"merge": false,
|
||||
};
|
||||
|
||||
|
||||
return fetch(
|
||||
`${NETDATA.registry.cloudBaseURL}/api/v1/accounts/${cloudAccountID}/agents`,
|
||||
{
|
||||
@ -4766,7 +4763,7 @@ function postCloudAccountAgents(agentsToSync) {
|
||||
"url": a.urls[0],
|
||||
"alternate_urls": a.urls
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@ -4839,7 +4836,7 @@ function updateMyNetdataAfterFilterChange() {
|
||||
|
||||
if (options.hosts.length > 1) {
|
||||
const streamedEl = document.getElementById("my-netdata-menu-streamed")
|
||||
streamedEl.innerHTML = renderStreamedHosts(options);
|
||||
streamedEl.innerHTML = renderStreamedHosts(options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4854,7 +4851,7 @@ function myNetdataFilterDidChange(e) {
|
||||
const inputEl = e.target;
|
||||
setTimeout(() => {
|
||||
myNetdataMenuFilterValue = inputEl.value;
|
||||
updateMyNetdataAfterFilterChange();
|
||||
updateMyNetdataAfterFilterChange();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@ -4865,9 +4862,9 @@ function myNetdataFilterClearDidClick(e) {
|
||||
const inputEl = document.getElementById("my-netdata-menu-filter-input");
|
||||
inputEl.value = "";
|
||||
myNetdataMenuFilterValue = "";
|
||||
|
||||
updateMyNetdataAfterFilterChange();
|
||||
|
||||
|
||||
updateMyNetdataAfterFilterChange();
|
||||
|
||||
inputEl.focus();
|
||||
}
|
||||
|
||||
@ -4998,17 +4995,17 @@ function explicitlySyncAgents() {
|
||||
$("#syncRegistryModal").modal("hide");
|
||||
|
||||
const json = localStorage.getItem("cloud.sync");
|
||||
const sync = json ? JSON.parse(json): {};
|
||||
const sync = json ? JSON.parse(json) : {};
|
||||
delete sync[cloudAccountID];
|
||||
localStorage.setItem("cloud.sync", JSON.stringify(sync));
|
||||
|
||||
|
||||
NETDATA.registry.init();
|
||||
}
|
||||
|
||||
function syncAgents(callback) {
|
||||
const json = localStorage.getItem("cloud.sync");
|
||||
const sync = json ? JSON.parse(json): {};
|
||||
|
||||
const sync = json ? JSON.parse(json) : {};
|
||||
|
||||
const currentAgent = {
|
||||
guid: NETDATA.registry.machine_guid,
|
||||
name: NETDATA.registry.hostname,
|
||||
@ -5016,30 +5013,30 @@ function syncAgents(callback) {
|
||||
alternate_urls: [NETDATA.serverDefault],
|
||||
}
|
||||
|
||||
const localAgents = sync[cloudAccountID]
|
||||
? [currentAgent]
|
||||
const localAgents = sync[cloudAccountID]
|
||||
? [currentAgent]
|
||||
: registryAgents.concat([currentAgent]);
|
||||
|
||||
|
||||
console.log("Checking if sync is needed.", localAgents);
|
||||
|
||||
const agentsToSync = mergeAgents(cloudAgents, localAgents);
|
||||
|
||||
if ((!sync[cloudAccountID]) || agentsToSync) {
|
||||
if ((!sync[cloudAccountID]) || agentsToSync) {
|
||||
sync[cloudAccountID] = new Date().getTime();
|
||||
localStorage.setItem("cloud.sync", JSON.stringify(sync));
|
||||
}
|
||||
|
||||
if (agentsToSync) {
|
||||
console.log("Synchronizing with netdata.cloud.");
|
||||
|
||||
|
||||
postCloudAccountAgents(agentsToSync).then((agents) => {
|
||||
// TODO: clear syncTime on error!
|
||||
cloudAgents = agents;
|
||||
callback(cloudAgents);
|
||||
});
|
||||
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
callback(cloudAgents);
|
||||
}
|
||||
@ -5087,10 +5084,10 @@ function netdataRegistryCallback(machinesArray) {
|
||||
|
||||
initCloud();
|
||||
|
||||
registryAgents = machinesArray;
|
||||
registryAgents = machinesArray;
|
||||
|
||||
if (isSignedIn()) {
|
||||
// We call getCloudAccountAgents() here because it requires that
|
||||
// We call getCloudAccountAgents() here because it requires that
|
||||
// NETDATA.registry is initialized.
|
||||
clearMyNetdataMenu();
|
||||
getCloudAccountAgents().then((agents) => {
|
||||
@ -5098,17 +5095,17 @@ function netdataRegistryCallback(machinesArray) {
|
||||
errorMyNetdataMenu();
|
||||
return;
|
||||
}
|
||||
cloudAgents = agents;
|
||||
cloudAgents = agents;
|
||||
syncAgents((agents) => {
|
||||
const agentsMap = {}
|
||||
for (const agent of agents) {
|
||||
agentsMap[agent.guid] = agent;
|
||||
}
|
||||
|
||||
|
||||
NETDATA.registry.machines = agentsMap;
|
||||
NETDATA.registry.machines_array = agents;
|
||||
|
||||
renderMyNetdataMenu(agents);
|
||||
|
||||
renderMyNetdataMenu(agents);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@ -5116,8 +5113,8 @@ function netdataRegistryCallback(machinesArray) {
|
||||
}
|
||||
};
|
||||
|
||||
// If we know the cloudBaseURL and agentID from local storage render (eagerly)
|
||||
// the account ui before receiving the definitive response from the web server.
|
||||
// If we know the cloudBaseURL and agentID from local storage render (eagerly)
|
||||
// the account ui before receiving the definitive response from the web server.
|
||||
// This improves the perceived performance.
|
||||
function tryFastInitCloud() {
|
||||
const baseURL = localStorage.getItem("cloud.baseURL");
|
||||
@ -5127,15 +5124,15 @@ function tryFastInitCloud() {
|
||||
NETDATA.registry.cloudBaseURL = baseURL;
|
||||
NETDATA.registry.machine_guid = agentID;
|
||||
NETDATA.registry.isCloudEnabled = true;
|
||||
|
||||
|
||||
initCloud();
|
||||
}
|
||||
}
|
||||
|
||||
function initializeApp() {
|
||||
window.addEventListener("message", handleMessage, false);
|
||||
window.addEventListener("message", handleMessage, false);
|
||||
|
||||
// tryFastInitCloud();
|
||||
// tryFastInitCloud();
|
||||
}
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
|
Loading…
Reference in New Issue
Block a user