Skip to content

Commit

Permalink
fix: 修复SignInfo空切片的问题 (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fripine authored Jan 13, 2025
1 parent 8bc963b commit 13e3312
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions api/dice_public.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"net/http"
"time"

"sealdice-core/dice"

Expand Down Expand Up @@ -41,5 +42,7 @@ func dicePublicSet(c echo.Context) error {
myDice.PublicDiceInfoRegister()
myDice.PublicDiceEndpointRefresh()
myDice.PublicDiceSetupTick()
myDice.LastUpdatedTime = time.Now().Unix()
myDice.Save(false)
return Success(&c, Response{})
}
6 changes: 3 additions & 3 deletions dice/platform_adapter_lagrange_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,21 @@ func LagrangeGetSignInfo(dice *Dice) ([]SignInfo, error) {
cachePath := filepath.Join(dice.BaseConfig.DataDir, "extra/SignInfo.cache")
signInfo, err := lagrangeGetSignInfoFromCloud(cachePath)
if err == nil && len(signInfo) > 0 {
copy(signInfoGlobal, signInfo)
signInfoGlobal = append([]SignInfo(nil), signInfo...)
return signInfo, nil
}
dice.Logger.Infof("无法从云端获取SignInfo,即将读取本地缓存数据, 原因: %s", err.Error())

signInfo, err = lagrangeGetSignInfoFromCache(cachePath)
if err == nil && len(signInfo) > 0 {
copy(signInfoGlobal, signInfo)
signInfoGlobal = append([]SignInfo(nil), signInfo...)
return signInfo, nil
}
dice.Logger.Infof("无法从本地缓存获取SignInfo,即将读取内置数据, 原因: %s", err.Error())

if err = json.Unmarshal([]byte(signInfoJson), &signInfo); err == nil {
lagrangeGetSignServerLatency(signInfo)
copy(signInfoGlobal, signInfo)
signInfoGlobal = append([]SignInfo(nil), signInfo...)
return signInfo, nil
}
dice.Logger.Infof("无法从内置数据获取SignInfo,请联系开发者上报问题, 原因: %s", err.Error())
Expand Down
2 changes: 1 addition & 1 deletion dice/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
// APP_CHANNEL 更新频道,stable/dev,在 action 构建时自动注入
APP_CHANNEL = "dev" //nolint:revive

VERSION_CODE = int64(1004100) //nolint:revive
VERSION_CODE = int64(1004101) //nolint:revive

VERSION_JSAPI_COMPATIBLE = []*semver.Version{
VERSION,
Expand Down

0 comments on commit 13e3312

Please sign in to comment.