Skip to content

Commit

Permalink
add Notifications、RileAccess func,fixed login of unexisting user into…
Browse files Browse the repository at this point in the history
… other ecosys,fixed uid generation.
  • Loading branch information
powerpook committed Aug 28, 2020
1 parent 6c4ac72 commit 6f071b1
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 63 deletions.
16 changes: 5 additions & 11 deletions data/ibax/ibax-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ if [ ! -f "/mnt/ibax/data/config.toml" ]; then
--httpHost="$HTTP_HOST" \
--httpPort="$HTTP_PORT" \
--dbHost="$DB_HOST" \
--dbName="$DB_NAME" \
--dbPassword="$DB_PASSWORD" \
--dbPort="$DB_PORT" \
--dbUser="$DB_USER" \
--redisenable="$REDIS_ENABLE" \
--redisdb="$REDIS_DBNAME" \
--redishost="$REDIS_HOST" \
--redispassword="$REDIS_PASSWORD" \
--redisport="$REDIS_PORT" \
--centKey="$CENTRIFUGO_KEY" \
--centSecret="$CENTRIFUGO_SECRET" \
--centUrl="$CENTRIFUGO_URL" \
--cryptoer="$CRYPTOSETTINGS_CRYPTOER" \
--hasher="$CRYPTOSETTINGS_HASHER"
Expand All @@ -50,3 +39,8 @@ if [ ! -f "/mnt/ibax/data/initDatabase.txt" ]; then
sleep 1
fi

/mnt/ibax/go-ibax start




16 changes: 6 additions & 10 deletions packages/daemons/subnode_send_private_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,14 @@ func SendPrivateData(ctx context.Context, d *daemon) error {
if key < len(m.TcpSendStateFlag) {
TcpSendStateFlag := []byte(m.TcpSendStateFlag)
TcpSendStateFlag[key] = '1'
m.TcpSendStateFlag = string(TcpSendStateFlag)
}
} else {
if key < len(m.TcpSendStateFlag) {
TcpSendStateFlag := []byte(m.TcpSendStateFlag)
TcpSendStateFlag[key] = '2'
m.TcpSendStateFlag = string(TcpSendStateFlag)
}
}
err = m.Updates()
if tran_mode == "1" { //HASH up chain transport mode
//DataBytes := m.Data
DataBytes, err := ecies.EccCryptoKey(m.Data, node_pubkeyslice[key])
if err != nil {
log.WithError(err)
continue
}

hash := tcpclient.SentPrivateData(tcp, DataBytes)
if string(hash) == string(m.Hash) {
m.TcpSendState = 1
Expand Down
3 changes: 3 additions & 0 deletions packages/daemons/upd_full_nodes.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) IBAX. All rights reserved.
* See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

22 changes: 9 additions & 13 deletions packages/language/language.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ func IsLang(code string) bool {
if LangList == nil {
return true
}
for _, val := range LangList {
if val == code {
return true
}
}
return false
}

// DefLang returns the default language
func DefLang() string {
if LangList == nil {
return `en`
}
return LangList[0]
}

Expand Down Expand Up @@ -122,6 +109,15 @@ func LangText(transaction *model.DbTransaction, in string, state int, accept str
}
if state == 0 {
return in, false
}
if _, ok := lang[state]; !ok {
if err := loadLang(transaction, state); err != nil {
return err.Error(), false
}
}
mutex.RLock()
defer mutex.RUnlock()
langs := strings.Split(accept, `,`)
if _, ok := (*lang[state]).res[in]; !ok {
return in, false
}
Expand Down
17 changes: 1 addition & 16 deletions packages/migration/contracts/first_ecosystem/UploadBinary.sim
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,13 @@ contract UploadBinary {
ApplicationId int
Name string
Data bytes
DataMimeType string "optional"
MemberAccount string "optional"
}
conditions {
if Size($MemberAccount) > 0 {
$UserID = $MemberAccount
} else {
$UserID = $account_id
}
$Id = Int(DBFind("@1binaries").Columns("id").Where({"app_id": $ApplicationId,
"account": $UserID, "name": $Name, "ecosystem": $ecosystem_id}).One("id"))
if $Id == 0 {
if $ApplicationId == 0 {
warning LangRes("@1aid_cannot_zero")
}
}
}
action {
var hash string
hash = Hash($Data)
if $DataMimeType == "" {
$DataMimeType = "application/octet-stream"
}
if $Id != 0 {
DBUpdate("@1binaries", $Id, {"data": $Data, "hash": hash, "mime_type": $DataMimeType})
} else {
Expand Down
5 changes: 0 additions & 5 deletions packages/migration/contracts/obs/StopOBS.sim
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
// +prop AppID = '1'
// +prop Conditions = 'ContractConditions("MainCondition")'
contract StopOBS {
data {
OBSName string
}
17 changes: 11 additions & 6 deletions packages/model/poolpub.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ package model

var (
MintCountCh = make(chan *MinterCount, 10)
)

func Put_MintCount() error {

return nil
}

func Deal_MintCount() error {
//for {
// select {
// case dat := <-MintCountCh:
// err := dat.Insert_redisdb()
// if err != nil {
// log.Info("Deal_MintCount Insert_redisdb: ", err.Error())
// //time.Sleep(4000)
// }
// //time.Sleep(5*time.Second)
// //MintCountDealCh<-dat
// }
//
//}
return nil
}
14 changes: 12 additions & 2 deletions packages/utils/metric/collector_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) IBAX. All rights reserved.
* See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
package metric

import (
"errors"
"testing"

"github.com/stretchr/testify/assert"
)

func MockValue(v int64) *Value {
return &Value{Time: 1, Metric: "test_metric", Key: "ecosystem_1", Value: v}
}

func MockCollectorFunc(v int64, err error) CollectorFunc {
Expand Down Expand Up @@ -30,5 +42,3 @@ func TestCollector(t *testing.T) {
map[string]interface{}{"time": int64(1), "metric": "test_metric", "key": "ecosystem_1", "value": int64(100)},
map[string]interface{}{"time": int64(1), "metric": "test_metric", "key": "ecosystem_1", "value": int64(200)},
}
assert.Equal(t, result, c.Values())
}

0 comments on commit 6f071b1

Please sign in to comment.