diff --git a/cmd/agent/main.go b/cmd/agent/main.go
index 4d92ae1..5aa7a22 100644
--- a/cmd/agent/main.go
+++ b/cmd/agent/main.go
@@ -166,6 +166,7 @@ func receiveCommand(hc pb.NezhaService_HeartbeatClient) error {
}
func reportState() {
+ var lastReportHostInfo time.Time
var err error
defer log.Printf("reportState exit %v => %v", time.Now(), err)
for {
@@ -176,6 +177,10 @@ func reportState() {
log.Printf("reportState error %v", err)
time.Sleep(delayWhenError)
}
+ if lastReportHostInfo.Before(time.Now().Add(-10 * time.Minute)) {
+ lastReportHostInfo = time.Now()
+ client.Register(ctx, monitor.GetHost().PB())
+ }
}
}
}
diff --git a/cmd/dashboard/controller/member_api.go b/cmd/dashboard/controller/member_api.go
index 8d72f70..5b1d83f 100644
--- a/cmd/dashboard/controller/member_api.go
+++ b/cmd/dashboard/controller/member_api.go
@@ -261,10 +261,11 @@ func (ma *memberAPI) logout(c *gin.Context) {
}
type settingForm struct {
- Title string
- Admin string
- Theme string
- CustomCode string
+ Title string
+ Admin string
+ Theme string
+ CustomCode string
+ EnableIPChangeNotification string
}
func (ma *memberAPI) updateSetting(c *gin.Context) {
@@ -276,6 +277,7 @@ func (ma *memberAPI) updateSetting(c *gin.Context) {
})
return
}
+ dao.Conf.EnableIPChangeNotification = sf.EnableIPChangeNotification == "on"
dao.Conf.Site.Brand = sf.Title
dao.Conf.Site.Theme = sf.Theme
dao.Conf.Site.CustomCode = sf.CustomCode
diff --git a/model/config.go b/model/config.go
index 1982f8e..616f92a 100644
--- a/model/config.go
+++ b/model/config.go
@@ -10,7 +10,6 @@ import (
"gopkg.in/yaml.v2"
)
-// Config ..
type Config struct {
Debug bool
Site struct {
@@ -24,7 +23,8 @@ type Config struct {
ClientID string
ClientSecret string
}
- HTTPPort uint
+ HTTPPort uint
+ EnableIPChangeNotification bool
v *viper.Viper
}
diff --git a/resource/static/main.js b/resource/static/main.js
index aa5c653..2e14494 100644
--- a/resource/static/main.js
+++ b/resource/static/main.js
@@ -106,6 +106,8 @@ function addOrEditServer(server) {
modal.find('.positive.button').html(server ? '修改' : '添加')
modal.find('input[name=id]').val(server ? server.ID : null)
modal.find('input[name=name]').val(server ? server.Name : null)
+ modal.find('input[name=Tag]').val(server ? server.Tag : null)
+ modal.find('input[name=DisplayIndex]').val(server ? server.DisplayIndex : null)
if (server) {
modal.find('.secret.field').attr('style', '')
modal.find('input[name=secret]').val(server.Secret)
diff --git a/resource/template/common/footer.html b/resource/template/common/footer.html
index e5842a1..6726aee 100644
--- a/resource/template/common/footer.html
+++ b/resource/template/common/footer.html
@@ -9,7 +9,7 @@
-
+