mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-05 21:20:06 +00:00
feat: 优化 GeoIP 更新逻辑
This commit is contained in:
@@ -116,11 +116,11 @@ func (s *NezhaHandler) ReportSystemState(stream pb.NezhaService_ReportSystemStat
|
||||
}
|
||||
}
|
||||
|
||||
func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Receipt, error) {
|
||||
func (s *NezhaHandler) onReportSystemInfo(c context.Context, r *pb.Host) error {
|
||||
var clientID uint64
|
||||
var err error
|
||||
if clientID, err = s.Auth.Check(c); err != nil {
|
||||
return nil, err
|
||||
return err
|
||||
}
|
||||
host := model.PB2Host(r)
|
||||
singleton.ServerLock.RLock()
|
||||
@@ -137,9 +137,19 @@ func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Rece
|
||||
}
|
||||
|
||||
singleton.ServerList[clientID].Host = &host
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *NezhaHandler) ReportSystemInfo(c context.Context, r *pb.Host) (*pb.Receipt, error) {
|
||||
s.onReportSystemInfo(c, r)
|
||||
return &pb.Receipt{Proced: true}, nil
|
||||
}
|
||||
|
||||
func (s *NezhaHandler) ReportSystemInfo2(c context.Context, r *pb.Host) (*pb.Unit64Receipt, error) {
|
||||
s.onReportSystemInfo(c, r)
|
||||
return &pb.Unit64Receipt{Data: singleton.DashboardBootTime}, nil
|
||||
}
|
||||
|
||||
func (s *NezhaHandler) IOStream(stream pb.NezhaService_IOStreamServer) error {
|
||||
if _, err := s.Auth.Check(stream.Context()); err != nil {
|
||||
return err
|
||||
|
||||
@@ -33,6 +33,7 @@ var (
|
||||
Community: true,
|
||||
},
|
||||
}
|
||||
DashboardBootTime = uint64(time.Now().Unix())
|
||||
)
|
||||
|
||||
func InitTimezoneAndCache() {
|
||||
|
||||
Reference in New Issue
Block a user