Commit 94238e0f authored by szh's avatar szh

节点更新 区分 arm 和 linux 版本

parent ea5930ae
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"chain33-pai/pkg/setting" "chain33-pai/pkg/setting"
"chain33-pai/pkg/util" "chain33-pai/pkg/util"
"chain33-pai/service/pai_service" "chain33-pai/service/pai_service"
"encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
...@@ -384,8 +385,13 @@ func Unlock() error { ...@@ -384,8 +385,13 @@ func Unlock() error {
return err return err
} }
pass := strings.Replace(string(passwd), "\n", "", -1) pass := strings.Replace(string(passwd), "\n", "", -1)
passByte,err := base64.StdEncoding.DecodeString(pass)
if err != nil {
tlog.Info("decode err","err",err)
return err
}
reply, err := setting.PaiClient.Unlock(&types.WalletUnLock{ reply, err := setting.PaiClient.Unlock(&types.WalletUnLock{
Passwd: pass, Passwd: string(passByte)[9:],
Timeout: 0, Timeout: 0,
WalletOrTicket: false, WalletOrTicket: false,
XXX_NoUnkeyedLiteral: struct{}{}, XXX_NoUnkeyedLiteral: struct{}{},
......
...@@ -5,9 +5,11 @@ import ( ...@@ -5,9 +5,11 @@ import (
"chain33-pai/pkg/app" "chain33-pai/pkg/app"
"chain33-pai/pkg/chain33" "chain33-pai/pkg/chain33"
"chain33-pai/pkg/e" "chain33-pai/pkg/e"
pai2 "chain33-pai/pkg/pai"
"chain33-pai/pkg/setting" "chain33-pai/pkg/setting"
"chain33-pai/pkg/util" "chain33-pai/pkg/util"
"chain33-pai/service/pai_service" "chain33-pai/service/pai_service"
"encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
...@@ -88,8 +90,14 @@ func UpdateNodeNew(c *gin.Context) { ...@@ -88,8 +90,14 @@ func UpdateNodeNew(c *gin.Context) {
stderr := bytes.NewBuffer(nil) stderr := bytes.NewBuffer(nil)
name := setting.BityuanSetting.Name + "_" + latestVersion + ".tar.gz" name := setting.BityuanSetting.Name + "_" + latestVersion + ".tar.gz"
url := setting.Chain33Pai.DownloadUrl + name url := setting.Chain33Pai.DownloadUrl + name
if pai2.GetArchType() == "arm" {
url = setting.Chain33Pai.DownloadUrl+setting.BityuanSetting.Name + "-linux_" + latestVersion + ".tar.gz"
} else if pai2.GetArchType() == "arm" {
url = setting.Chain33Pai.DownloadUrl+setting.BityuanSetting.Name +"-arm_" + latestVersion + ".tar.gz"
}
tlog.Info("UpdateNode", "dir", setting.BityuanSetting.Name+"_"+latestVersion) tlog.Info("UpdateNode", "dir", setting.BityuanSetting.Name+"_"+latestVersion)
tlog.Info("UpdateNode", "path", absPath) tlog.Info("UpdateNode", "path", absPath)
tlog.Info("downloadUrl","url",url)
err = app.DownLoadFile(url, name, int32(1)) err = app.DownLoadFile(url, name, int32(1))
if err != nil { if err != nil {
appG.Response(http.StatusOK, e.DOWNLOAD_ERROR, err) appG.Response(http.StatusOK, e.DOWNLOAD_ERROR, err)
...@@ -457,7 +465,8 @@ func EscrowPasswd(c *gin.Context) { ...@@ -457,7 +465,8 @@ func EscrowPasswd(c *gin.Context) {
return return
} }
defer f.Close() defer f.Close()
f.WriteString(passwd.Password) pdStr := base64.StdEncoding.EncodeToString([]byte("raspberry"+passwd.Password))
f.WriteString(pdStr)
appG.Response(http.StatusOK, e.SUCCESS, nil) appG.Response(http.StatusOK, e.SUCCESS, nil)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment