Compare commits
15 Commits
e064ec40de
...
fbd50145fc
Author | SHA1 | Date | |
---|---|---|---|
|
fbd50145fc | ||
|
9e5f223ccf | ||
ae0672c7da | |||
c3567313af | |||
f82b413e34 | |||
ea0fc4491d | |||
2634790118 | |||
272a7ac05f | |||
39c0d31995 | |||
18acb53ead | |||
43d91f84f6 | |||
0914217769 | |||
ea117b7222 | |||
39e1c84a45 | |||
20ee4dfb24 |
@ -77,10 +77,10 @@ func main() {
|
|||||||
pfp := path.Join(scriptDir, "pp.csv")
|
pfp := path.Join(scriptDir, "pp.csv")
|
||||||
|
|
||||||
cfg := engine.Config{
|
cfg := engine.Config{
|
||||||
Root: "root",
|
Root: "root",
|
||||||
OutputSize: uint32(size),
|
OutputSize: uint32(size),
|
||||||
FlagCount: uint32(128),
|
FlagCount: uint32(128),
|
||||||
MenuSeparator: menuSeparator,
|
MenuSeparator: menuSeparator,
|
||||||
ResetOnEmptyInput: true,
|
ResetOnEmptyInput: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ func main() {
|
|||||||
pfp := path.Join(scriptDir, "pp.csv")
|
pfp := path.Join(scriptDir, "pp.csv")
|
||||||
|
|
||||||
cfg := engine.Config{
|
cfg := engine.Config{
|
||||||
Root: "root",
|
Root: "root",
|
||||||
OutputSize: uint32(size),
|
OutputSize: uint32(size),
|
||||||
FlagCount: uint32(128),
|
FlagCount: uint32(128),
|
||||||
MenuSeparator: menuSeparator,
|
MenuSeparator: menuSeparator,
|
||||||
ResetOnEmptyInput: true,
|
ResetOnEmptyInput: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,10 +78,10 @@ func main() {
|
|||||||
pfp := path.Join(scriptDir, "pp.csv")
|
pfp := path.Join(scriptDir, "pp.csv")
|
||||||
|
|
||||||
cfg := engine.Config{
|
cfg := engine.Config{
|
||||||
Root: "root",
|
Root: "root",
|
||||||
OutputSize: uint32(size),
|
OutputSize: uint32(size),
|
||||||
FlagCount: uint32(128),
|
FlagCount: uint32(128),
|
||||||
MenuSeparator: menuSeparator,
|
MenuSeparator: menuSeparator,
|
||||||
ResetOnEmptyInput: true,
|
ResetOnEmptyInput: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ func main() {
|
|||||||
var stateDebug bool
|
var stateDebug bool
|
||||||
var host string
|
var host string
|
||||||
var port uint
|
var port uint
|
||||||
|
|
||||||
flag.StringVar(&override.DbConn, "c", "?", "default connection string (replaces all unspecified strings)")
|
flag.StringVar(&override.DbConn, "c", "?", "default connection string (replaces all unspecified strings)")
|
||||||
flag.StringVar(&override.ResourceConn, "resource", "?", "resource connection string")
|
flag.StringVar(&override.ResourceConn, "resource", "?", "resource connection string")
|
||||||
flag.StringVar(&override.UserConn, "userdata", "?", "userdata store connection string")
|
flag.StringVar(&override.UserConn, "userdata", "?", "userdata store connection string")
|
||||||
@ -81,9 +81,9 @@ func main() {
|
|||||||
pfp := path.Join(scriptDir, "pp.csv")
|
pfp := path.Join(scriptDir, "pp.csv")
|
||||||
|
|
||||||
cfg := engine.Config{
|
cfg := engine.Config{
|
||||||
Root: "root",
|
Root: "root",
|
||||||
OutputSize: uint32(size),
|
OutputSize: uint32(size),
|
||||||
FlagCount: uint32(128),
|
FlagCount: uint32(128),
|
||||||
ResetOnEmptyInput: true,
|
ResetOnEmptyInput: true,
|
||||||
}
|
}
|
||||||
if stateDebug {
|
if stateDebug {
|
||||||
|
@ -25,7 +25,7 @@ const (
|
|||||||
defaultSSHHost string = "127.0.0.1"
|
defaultSSHHost string = "127.0.0.1"
|
||||||
defaultSSHPort uint = 7122
|
defaultSSHPort uint = 7122
|
||||||
defaultHTTPHost string = "127.0.0.1"
|
defaultHTTPHost string = "127.0.0.1"
|
||||||
defaultHTTPPort uint = 7123
|
defaultHTTPPort uint = 7123
|
||||||
defaultDomain = "sarafu.local"
|
defaultDomain = "sarafu.local"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -52,7 +52,6 @@ func SearchDomains() []string {
|
|||||||
return ParsedDomains
|
return ParsedDomains
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func Language() string {
|
func Language() string {
|
||||||
return viseconfig.DefaultLanguage
|
return viseconfig.DefaultLanguage
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"git.defalsify.org/vise.git/logging"
|
|
||||||
"git.defalsify.org/vise.git/engine"
|
"git.defalsify.org/vise.git/engine"
|
||||||
|
"git.defalsify.org/vise.git/logging"
|
||||||
|
|
||||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
"git.grassecon.net/grassrootseconomics/sarafu-vise/config"
|
||||||
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
|
"git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application"
|
||||||
@ -17,8 +17,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logg = logging.NewVanilla().WithContextKey("SessionId")
|
logg = logging.NewVanilla().WithContextKey("SessionId")
|
||||||
scriptDir = path.Join("services", "registration")
|
scriptDir = path.Join("services", "registration")
|
||||||
menuSeparator = ": "
|
menuSeparator = ": "
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -87,5 +87,4 @@ func main() {
|
|||||||
fmt.Fprintf(os.Stderr, "cmd exec error: %v\n", err)
|
fmt.Fprintf(os.Stderr, "cmd exec error: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module git.grassecon.net/grassrootseconomics/sarafu-vise
|
|||||||
go 1.23.4
|
go 1.23.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.defalsify.org/vise.git v0.3.2-0.20250326034808-b9c2294cbf1a
|
git.defalsify.org/vise.git v0.3.2-0.20250401123711-d481b04a6805
|
||||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d
|
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d
|
||||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20250310093912-8145b4bd004b
|
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20250310093912-8145b4bd004b
|
||||||
git.grassecon.net/grassrootseconomics/visedriver v0.9.0-beta.2
|
git.grassecon.net/grassrootseconomics/visedriver v0.9.0-beta.2
|
||||||
|
6
go.sum
6
go.sum
@ -1,5 +1,7 @@
|
|||||||
git.defalsify.org/vise.git v0.3.2-0.20250326034808-b9c2294cbf1a h1:5uLBUZC6armYgBPkuNEsQPtqT3qZxRfNP4HUdkhjm4I=
|
git.defalsify.org/vise.git v0.3.1 h1:A6FhMcur09ft/JzUPGXR+KpA17fltfeBnasyvLMZmq4=
|
||||||
git.defalsify.org/vise.git v0.3.2-0.20250326034808-b9c2294cbf1a/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
git.defalsify.org/vise.git v0.3.1/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
||||||
|
git.defalsify.org/vise.git v0.3.2-0.20250401123711-d481b04a6805 h1:FnT39aqXcP5YWhwPDBABopSjCu2SlbPFoOVitSpAVxU=
|
||||||
|
git.defalsify.org/vise.git v0.3.2-0.20250401123711-d481b04a6805/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
||||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d h1:5mzLas+jxTUtusOKx4XvU+n2QvrV/mH17MnJRy46siQ=
|
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d h1:5mzLas+jxTUtusOKx4XvU+n2QvrV/mH17MnJRy46siQ=
|
||||||
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60=
|
git.grassecon.net/grassrootseconomics/common v0.0.0-20250121134736-ba8cbbccea7d/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60=
|
||||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20250310093912-8145b4bd004b h1:xiTpaqWWoF5qcnarY/9ZkT6aVdnKwqztb2gzIahJn4w=
|
git.grassecon.net/grassrootseconomics/sarafu-api v0.9.0-beta.1.0.20250310093912-8145b4bd004b h1:xiTpaqWWoF5qcnarY/9ZkT6aVdnKwqztb2gzIahJn4w=
|
||||||
|
@ -1946,9 +1946,11 @@ func (h *MenuHandlers) InitiateTransaction(ctx context.Context, sym string, inpu
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaultVoucher retrieves the current vouchers
|
// ManageVouchers retrieves the token holdings from the API using the "PublicKey" and
|
||||||
// and sets the first as the default voucher, if no active voucher is set.
|
// 1. sets the first as the default voucher if no active voucher is set.
|
||||||
func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
// 2. Stores list of vouchers
|
||||||
|
// 3. updates the balance of the active voucher
|
||||||
|
func (h *MenuHandlers) ManageVouchers(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
userStore := h.userdataStore
|
userStore := h.userdataStore
|
||||||
|
|
||||||
@ -1959,30 +1961,31 @@ func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input
|
|||||||
|
|
||||||
flag_no_active_voucher, _ := h.flagManager.GetFlag("flag_no_active_voucher")
|
flag_no_active_voucher, _ := h.flagManager.GetFlag("flag_no_active_voucher")
|
||||||
|
|
||||||
// check if the user has an active sym
|
publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY)
|
||||||
_, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
if err != nil {
|
||||||
|
logg.ErrorCtxf(ctx, "failed to read publicKey entry", "key", storedb.DATA_PUBLIC_KEY, "error", err)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch vouchers from API
|
||||||
|
vouchersResp, err := h.accountService.FetchVouchers(ctx, string(publicKey))
|
||||||
|
if err != nil {
|
||||||
|
res.FlagSet = append(res.FlagSet, flag_no_active_voucher)
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(vouchersResp) == 0 {
|
||||||
|
res.FlagSet = append(res.FlagSet, flag_no_active_voucher)
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
res.FlagReset = append(res.FlagReset, flag_no_active_voucher)
|
||||||
|
|
||||||
|
// Check if user has an active voucher with proper error handling
|
||||||
|
activeSym, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if db.IsNotFound(err) {
|
if db.IsNotFound(err) {
|
||||||
publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY)
|
// No active voucher, set the first one as default
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to read publicKey entry with", "key", storedb.DATA_PUBLIC_KEY, "error", err)
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch vouchers from the API using the public key
|
|
||||||
vouchersResp, err := h.accountService.FetchVouchers(ctx, string(publicKey))
|
|
||||||
if err != nil {
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_no_active_voucher)
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return if there is no voucher
|
|
||||||
if len(vouchersResp) == 0 {
|
|
||||||
res.FlagSet = append(res.FlagSet, flag_no_active_voucher)
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use only the first voucher
|
|
||||||
firstVoucher := vouchersResp[0]
|
firstVoucher := vouchersResp[0]
|
||||||
defaultSym := firstVoucher.TokenSymbol
|
defaultSym := firstVoucher.TokenSymbol
|
||||||
defaultBal := firstVoucher.Balance
|
defaultBal := firstVoucher.Balance
|
||||||
@ -1992,71 +1995,27 @@ func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input
|
|||||||
// Scale down the balance
|
// Scale down the balance
|
||||||
scaledBalance := store.ScaleDownBalance(defaultBal, defaultDec)
|
scaledBalance := store.ScaleDownBalance(defaultBal, defaultDec)
|
||||||
|
|
||||||
// TODO: implement atomic transaction
|
firstVoucherMap := map[storedb.DataTyp]string{
|
||||||
// set the active symbol
|
storedb.DATA_ACTIVE_SYM: defaultSym,
|
||||||
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM, []byte(defaultSym))
|
storedb.DATA_ACTIVE_BAL: scaledBalance,
|
||||||
if err != nil {
|
storedb.DATA_ACTIVE_DECIMAL: defaultDec,
|
||||||
logg.ErrorCtxf(ctx, "failed to write defaultSym entry with", "key", storedb.DATA_ACTIVE_SYM, "value", defaultSym, "error", err)
|
storedb.DATA_ACTIVE_ADDRESS: defaultAddr,
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
// set the active balance
|
|
||||||
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_BAL, []byte(scaledBalance))
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to write defaultBal entry with", "key", storedb.DATA_ACTIVE_BAL, "value", scaledBalance, "error", err)
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
// set the active decimals
|
|
||||||
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_DECIMAL, []byte(defaultDec))
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to write defaultDec entry with", "key", storedb.DATA_ACTIVE_DECIMAL, "value", defaultDec, "error", err)
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
// set the active contract address
|
|
||||||
err = userStore.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS, []byte(defaultAddr))
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to write defaultAddr entry with", "key", storedb.DATA_ACTIVE_ADDRESS, "value", defaultAddr, "error", err)
|
|
||||||
return res, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res, nil
|
for key, value := range firstVoucherMap {
|
||||||
|
if err := userStore.WriteEntry(ctx, sessionId, key, []byte(value)); err != nil {
|
||||||
|
logg.ErrorCtxf(ctx, "Failed to write active voucher data", "key", key, "error", err)
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logg.InfoCtxf(ctx, "Default voucher set", "symbol", defaultSym, "balance", defaultBal, "decimals", defaultDec, "address", defaultAddr)
|
||||||
|
} else {
|
||||||
|
logg.ErrorCtxf(ctx, "failed to read activeSym entry with", "key", storedb.DATA_ACTIVE_SYM, "error", err)
|
||||||
|
return res, err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
logg.ErrorCtxf(ctx, "failed to read activeSym entry with", "key", storedb.DATA_ACTIVE_SYM, "error", err)
|
// Update active voucher balance
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_no_active_voucher)
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckVouchers retrieves the token holdings from the API using the "PublicKey" and stores
|
|
||||||
// them to gdbm.
|
|
||||||
func (h *MenuHandlers) CheckVouchers(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
|
||||||
var res resource.Result
|
|
||||||
sessionId, ok := ctx.Value("SessionId").(string)
|
|
||||||
if !ok {
|
|
||||||
return res, fmt.Errorf("missing session")
|
|
||||||
}
|
|
||||||
|
|
||||||
userStore := h.userdataStore
|
|
||||||
publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY)
|
|
||||||
if err != nil {
|
|
||||||
logg.ErrorCtxf(ctx, "failed to read publicKey entry with", "key", storedb.DATA_PUBLIC_KEY, "error", err)
|
|
||||||
return res, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch vouchers from the API using the public key
|
|
||||||
vouchersResp, err := h.accountService.FetchVouchers(ctx, string(publicKey))
|
|
||||||
if err != nil {
|
|
||||||
return res, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
logg.InfoCtxf(ctx, "fetched user vouchers", "public_key", string(publicKey), "vouchers", vouchersResp)
|
|
||||||
|
|
||||||
// check the current active sym and update the data
|
|
||||||
activeSym, _ := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM)
|
|
||||||
if activeSym != nil {
|
|
||||||
activeSymStr := string(activeSym)
|
activeSymStr := string(activeSym)
|
||||||
|
|
||||||
// Find the matching voucher data
|
// Find the matching voucher data
|
||||||
@ -2086,14 +2045,8 @@ func (h *MenuHandlers) CheckVouchers(ctx context.Context, sym string, input []by
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activeBal, _ := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_BAL)
|
|
||||||
activeAddr, _ := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS)
|
|
||||||
|
|
||||||
logg.InfoCtxf(ctx, "The active data in CheckVouchers:", "activeSym", string(activeSym), string(activeBal), string(activeAddr))
|
|
||||||
|
|
||||||
data := store.ProcessVouchers(vouchersResp)
|
|
||||||
|
|
||||||
// Store all voucher data
|
// Store all voucher data
|
||||||
|
data := store.ProcessVouchers(vouchersResp)
|
||||||
dataMap := map[storedb.DataTyp]string{
|
dataMap := map[storedb.DataTyp]string{
|
||||||
storedb.DATA_VOUCHER_SYMBOLS: data.Symbols,
|
storedb.DATA_VOUCHER_SYMBOLS: data.Symbols,
|
||||||
storedb.DATA_VOUCHER_BALANCES: data.Balances,
|
storedb.DATA_VOUCHER_BALANCES: data.Balances,
|
||||||
@ -2103,7 +2056,6 @@ func (h *MenuHandlers) CheckVouchers(ctx context.Context, sym string, input []by
|
|||||||
|
|
||||||
// Write data entries
|
// Write data entries
|
||||||
for key, value := range dataMap {
|
for key, value := range dataMap {
|
||||||
logg.InfoCtxf(ctx, "Writing data entry for sessionId: %s", sessionId, "key", key, "value", value)
|
|
||||||
if err := userStore.WriteEntry(ctx, sessionId, key, []byte(value)); err != nil {
|
if err := userStore.WriteEntry(ctx, sessionId, key, []byte(value)); err != nil {
|
||||||
logg.ErrorCtxf(ctx, "Failed to write data entry for sessionId: %s", sessionId, "key", key, "error", err)
|
logg.ErrorCtxf(ctx, "Failed to write data entry for sessionId: %s", sessionId, "key", key, "error", err)
|
||||||
continue
|
continue
|
||||||
@ -2528,9 +2480,10 @@ func (h *MenuHandlers) RequestCustomAlias(ctx context.Context, sym string, input
|
|||||||
return res, fmt.Errorf("Failed to retrieve alias: %s", err.Error())
|
return res, fmt.Errorf("Failed to retrieve alias: %s", err.Error())
|
||||||
}
|
}
|
||||||
alias := aliasResult.Alias
|
alias := aliasResult.Alias
|
||||||
|
logg.InfoCtxf(ctx, "Suggested alias ", "alias", alias)
|
||||||
|
|
||||||
//Store the returned alias,wait for user to confirm it as new account alias
|
//Store the returned alias,wait for user to confirm it as new account alias
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE, []byte(alias))
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS, []byte(alias))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logg.ErrorCtxf(ctx, "failed to write account alias", "key", storedb.DATA_TEMPORARY_VALUE, "value", alias, "error", err)
|
logg.ErrorCtxf(ctx, "failed to write account alias", "key", storedb.DATA_TEMPORARY_VALUE, "value", alias, "error", err)
|
||||||
return res, err
|
return res, err
|
||||||
@ -2559,7 +2512,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input
|
|||||||
if !ok {
|
if !ok {
|
||||||
return res, fmt.Errorf("missing session")
|
return res, fmt.Errorf("missing session")
|
||||||
}
|
}
|
||||||
suggestedAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
suggestedAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
@ -2567,7 +2520,7 @@ func (h *MenuHandlers) GetSuggestedAlias(ctx context.Context, sym string, input
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfirmNewAlias reads the suggested alias from the temporary value and confirms it as the new account alias.
|
// ConfirmNewAlias reads the suggested alias from the [DATA_SUGGECTED_ALIAS] key and confirms it as the new account alias.
|
||||||
func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []byte) (resource.Result, error) {
|
||||||
var res resource.Result
|
var res resource.Result
|
||||||
store := h.userdataStore
|
store := h.userdataStore
|
||||||
@ -2578,10 +2531,11 @@ func (h *MenuHandlers) ConfirmNewAlias(ctx context.Context, sym string, input []
|
|||||||
if !ok {
|
if !ok {
|
||||||
return res, fmt.Errorf("missing session")
|
return res, fmt.Errorf("missing session")
|
||||||
}
|
}
|
||||||
newAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_TEMPORARY_VALUE)
|
newAlias, err := store.ReadEntry(ctx, sessionId, storedb.DATA_SUGGESTED_ALIAS)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
logg.InfoCtxf(ctx, "Confirming new alias", "alias", string(newAlias))
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS, []byte(string(newAlias)))
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACCOUNT_ALIAS, []byte(string(newAlias)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logg.ErrorCtxf(ctx, "failed to clear DATA_ACCOUNT_ALIAS_VALUE entry with", "key", storedb.DATA_ACCOUNT_ALIAS, "value", "empty", "error", err)
|
logg.ErrorCtxf(ctx, "failed to clear DATA_ACCOUNT_ALIAS_VALUE entry with", "key", storedb.DATA_ACCOUNT_ALIAS, "value", "empty", "error", err)
|
||||||
|
@ -1990,36 +1990,46 @@ func TestFetchCommunityBalance(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetDefaultVoucher(t *testing.T) {
|
func TestManageVouchers(t *testing.T) {
|
||||||
sessionId := "session123"
|
sessionId := "session123"
|
||||||
|
publicKey := "0X13242618721"
|
||||||
|
|
||||||
ctx, store := InitializeTestStore(t)
|
ctx, store := InitializeTestStore(t)
|
||||||
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
||||||
|
|
||||||
fm, err := NewFlagManager(flagsPath)
|
fm, err := NewFlagManager(flagsPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf(err.Error())
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
flag_no_active_voucher, err := fm.GetFlag("flag_no_active_voucher")
|
flag_no_active_voucher, err := fm.GetFlag("flag_no_active_voucher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Logf(err.Error())
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
publicKey := "0X13242618721"
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY, []byte(publicKey))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
vouchersResp []dataserviceapi.TokenHoldings
|
vouchersResp []dataserviceapi.TokenHoldings
|
||||||
expectedResult resource.Result
|
storedActiveVoucher string
|
||||||
|
expectedVoucherSymbols []byte
|
||||||
|
expectedUpdatedAddress []byte
|
||||||
|
expectedResult resource.Result
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "Test no vouchers available",
|
name: "No vouchers available",
|
||||||
vouchersResp: []dataserviceapi.TokenHoldings{},
|
vouchersResp: []dataserviceapi.TokenHoldings{},
|
||||||
|
expectedVoucherSymbols: []byte(""),
|
||||||
|
expectedUpdatedAddress: []byte(""),
|
||||||
expectedResult: resource.Result{
|
expectedResult: resource.Result{
|
||||||
FlagSet: []uint32{flag_no_active_voucher},
|
FlagSet: []uint32{flag_no_active_voucher},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Test set default voucher when no active voucher is set",
|
name: "Set default voucher when no active voucher is set",
|
||||||
vouchersResp: []dataserviceapi.TokenHoldings{
|
vouchersResp: []dataserviceapi.TokenHoldings{
|
||||||
{
|
{
|
||||||
ContractAddress: "0x123",
|
ContractAddress: "0x123",
|
||||||
@ -2028,7 +2038,24 @@ func TestSetDefaultVoucher(t *testing.T) {
|
|||||||
Balance: "100",
|
Balance: "100",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectedResult: resource.Result{},
|
expectedVoucherSymbols: []byte("1:TOKEN1"),
|
||||||
|
expectedUpdatedAddress: []byte("0x123"),
|
||||||
|
expectedResult: resource.Result{
|
||||||
|
FlagReset: []uint32{flag_no_active_voucher},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Check and update active voucher balance",
|
||||||
|
vouchersResp: []dataserviceapi.TokenHoldings{
|
||||||
|
{ContractAddress: "0xd4c288865Ce", TokenSymbol: "SRF", TokenDecimals: "6", Balance: "100"},
|
||||||
|
{ContractAddress: "0x41c188d63Qa", TokenSymbol: "MILO", TokenDecimals: "4", Balance: "200"},
|
||||||
|
},
|
||||||
|
storedActiveVoucher: "SRF",
|
||||||
|
expectedVoucherSymbols: []byte("1:SRF\n2:MILO"),
|
||||||
|
expectedUpdatedAddress: []byte("0xd4c288865Ce"),
|
||||||
|
expectedResult: resource.Result{
|
||||||
|
FlagReset: []uint32{flag_no_active_voucher},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2042,85 +2069,41 @@ func TestSetDefaultVoucher(t *testing.T) {
|
|||||||
flagManager: fm,
|
flagManager: fm,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := store.WriteEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY, []byte(publicKey))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
mockAccountService.On("FetchVouchers", string(publicKey)).Return(tt.vouchersResp, nil)
|
mockAccountService.On("FetchVouchers", string(publicKey)).Return(tt.vouchersResp, nil)
|
||||||
|
|
||||||
res, err := h.SetDefaultVoucher(ctx, "set_default_voucher", []byte("some-input"))
|
// Store active voucher if needed
|
||||||
|
if tt.storedActiveVoucher != "" {
|
||||||
|
err := store.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM, []byte(tt.storedActiveVoucher))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS, []byte("0x41c188D45rfg6ds"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res, err := h.ManageVouchers(ctx, "manage_vouchers", []byte(""))
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, tt.expectedResult, res)
|
||||||
|
|
||||||
assert.Equal(t, res, tt.expectedResult, "Expected result should be equal to the actual result")
|
if tt.storedActiveVoucher != "" {
|
||||||
|
// Validate stored voucher symbols
|
||||||
|
voucherData, err := store.ReadEntry(ctx, sessionId, storedb.DATA_VOUCHER_SYMBOLS)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, tt.expectedVoucherSymbols, voucherData)
|
||||||
|
|
||||||
mockAccountService.AssertExpectations(t)
|
// Validate stored active contract address
|
||||||
|
updatedAddress, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, tt.expectedUpdatedAddress, updatedAddress)
|
||||||
|
|
||||||
|
mockAccountService.AssertExpectations(t)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckVouchers(t *testing.T) {
|
|
||||||
mockAccountService := new(mocks.MockAccountService)
|
|
||||||
sessionId := "session123"
|
|
||||||
publicKey := "0X13242618721"
|
|
||||||
|
|
||||||
ctx, store := InitializeTestStore(t)
|
|
||||||
ctx = context.WithValue(ctx, "SessionId", sessionId)
|
|
||||||
|
|
||||||
h := &MenuHandlers{
|
|
||||||
userdataStore: store,
|
|
||||||
accountService: mockAccountService,
|
|
||||||
}
|
|
||||||
|
|
||||||
err := store.WriteEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY, []byte(publicKey))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
mockVouchersResponse := []dataserviceapi.TokenHoldings{
|
|
||||||
{ContractAddress: "0xd4c288865Ce", TokenSymbol: "SRF", TokenDecimals: "6", Balance: "100"},
|
|
||||||
{ContractAddress: "0x41c188d63Qa", TokenSymbol: "MILO", TokenDecimals: "4", Balance: "200"},
|
|
||||||
}
|
|
||||||
|
|
||||||
// store the default voucher data
|
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM, []byte("SRF"))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
err = store.WriteEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS, []byte("0x41c188D45rfg6ds"))
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedSym := []byte("1:SRF\n2:MILO")
|
|
||||||
expectedUpdatedAddress := []byte("0xd4c288865Ce")
|
|
||||||
|
|
||||||
mockAccountService.On("FetchVouchers", string(publicKey)).Return(mockVouchersResponse, nil)
|
|
||||||
|
|
||||||
_, err = h.CheckVouchers(ctx, "check_vouchers", []byte(""))
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
// Read voucher sym data from the store
|
|
||||||
voucherData, err := store.ReadEntry(ctx, sessionId, storedb.DATA_VOUCHER_SYMBOLS)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read active contract address from the store
|
|
||||||
updatedAddress, err := store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_ADDRESS)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// assert that the data is stored correctly
|
|
||||||
assert.Equal(t, expectedSym, voucherData)
|
|
||||||
// assert that the address is updated
|
|
||||||
assert.Equal(t, expectedUpdatedAddress, updatedAddress)
|
|
||||||
|
|
||||||
mockAccountService.AssertExpectations(t)
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestGetVoucherList(t *testing.T) {
|
func TestGetVoucherList(t *testing.T) {
|
||||||
sessionId := "session123"
|
sessionId := "session123"
|
||||||
|
|
||||||
|
@ -103,8 +103,7 @@ func (ls *LocalHandlerService) GetHandler(accountService remote.AccountService)
|
|||||||
ls.DbRs.AddLocalFunc("confirm_pin_change", appHandlers.ConfirmPinChange)
|
ls.DbRs.AddLocalFunc("confirm_pin_change", appHandlers.ConfirmPinChange)
|
||||||
ls.DbRs.AddLocalFunc("quit_with_help", appHandlers.QuitWithHelp)
|
ls.DbRs.AddLocalFunc("quit_with_help", appHandlers.QuitWithHelp)
|
||||||
ls.DbRs.AddLocalFunc("fetch_community_balance", appHandlers.FetchCommunityBalance)
|
ls.DbRs.AddLocalFunc("fetch_community_balance", appHandlers.FetchCommunityBalance)
|
||||||
ls.DbRs.AddLocalFunc("set_default_voucher", appHandlers.SetDefaultVoucher)
|
ls.DbRs.AddLocalFunc("manage_vouchers", appHandlers.ManageVouchers)
|
||||||
ls.DbRs.AddLocalFunc("check_vouchers", appHandlers.CheckVouchers)
|
|
||||||
ls.DbRs.AddLocalFunc("get_vouchers", appHandlers.GetVoucherList)
|
ls.DbRs.AddLocalFunc("get_vouchers", appHandlers.GetVoucherList)
|
||||||
ls.DbRs.AddLocalFunc("view_voucher", appHandlers.ViewVoucher)
|
ls.DbRs.AddLocalFunc("view_voucher", appHandlers.ViewVoucher)
|
||||||
ls.DbRs.AddLocalFunc("set_voucher", appHandlers.SetVoucher)
|
ls.DbRs.AddLocalFunc("set_voucher", appHandlers.SetVoucher)
|
||||||
|
@ -3,9 +3,11 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"git.defalsify.org/vise.git/logging"
|
"git.defalsify.org/vise.git/db"
|
||||||
"git.defalsify.org/vise.git/engine"
|
"git.defalsify.org/vise.git/engine"
|
||||||
|
"git.defalsify.org/vise.git/logging"
|
||||||
"git.defalsify.org/vise.git/persist"
|
"git.defalsify.org/vise.git/persist"
|
||||||
"git.defalsify.org/vise.git/resource"
|
"git.defalsify.org/vise.git/resource"
|
||||||
"git.defalsify.org/vise.git/state"
|
"git.defalsify.org/vise.git/state"
|
||||||
@ -16,21 +18,24 @@ import (
|
|||||||
var argc map[string]int = map[string]int{
|
var argc map[string]int = map[string]int{
|
||||||
"reset": 0,
|
"reset": 0,
|
||||||
"admin": 1,
|
"admin": 1,
|
||||||
|
"clone": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logg = logging.NewVanilla().WithDomain("cmd").WithContextKey("SessionId")
|
logg = logging.NewVanilla().WithDomain("cmd").WithContextKey("SessionId")
|
||||||
|
cloneTargetRegex = `^\+000`
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cmd struct {
|
type Cmd struct {
|
||||||
sessionId string
|
sessionId string
|
||||||
conn storage.ConnData
|
conn storage.ConnData
|
||||||
flagParser *application.FlagManager
|
flagParser *application.FlagManager
|
||||||
cmd int
|
cmd int
|
||||||
enable bool
|
enable bool
|
||||||
exec func(ctx context.Context, ss storage.StorageService) error
|
param string
|
||||||
engineConfig *engine.Config
|
exec func(ctx context.Context, ss storage.StorageService) error
|
||||||
st *state.State
|
engineConfig *engine.Config
|
||||||
|
st *state.State
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCmd(sessionId string, flagParser *application.FlagManager) *Cmd {
|
func NewCmd(sessionId string, flagParser *application.FlagManager) *Cmd {
|
||||||
@ -70,6 +75,50 @@ func (c *Cmd) engine(ctx context.Context, rs resource.Resource, pe *persist.Pers
|
|||||||
return en, nil
|
return en, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Cmd) execClone(ctx context.Context, ss storage.StorageService) error {
|
||||||
|
re := regexp.MustCompile(cloneTargetRegex)
|
||||||
|
if !re.MatchString(c.param) {
|
||||||
|
return fmt.Errorf("Clone sessionId must match target: %s", c.param)
|
||||||
|
}
|
||||||
|
|
||||||
|
pe, err := ss.GetPersister(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("get persister error: %v", err)
|
||||||
|
}
|
||||||
|
err = pe.Load(c.engineConfig.SessionId)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("persister load error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// TODO consider DRY with devtools/store/dump
|
||||||
|
store, err := ss.GetUserdataDb(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("store retrieve error: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
store.SetSession(c.engineConfig.SessionId)
|
||||||
|
store.SetPrefix(db.DATATYPE_USERDATA)
|
||||||
|
dmp, err := store.Dump(ctx, []byte(""))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("store dump fail: %v\n", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
for true {
|
||||||
|
store.SetSession(c.engineConfig.SessionId)
|
||||||
|
k, v := dmp.Next(ctx)
|
||||||
|
if k == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
store.SetSession(c.param)
|
||||||
|
err = store.Put(ctx, k, v)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("user data store clone failed on key: %x", k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pe.Save(c.param)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Cmd) execReset(ctx context.Context, ss storage.StorageService) error {
|
func (c *Cmd) execReset(ctx context.Context, ss storage.StorageService) error {
|
||||||
pe, err := ss.GetPersister(ctx)
|
pe, err := ss.GetPersister(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -157,6 +206,16 @@ func (c *Cmd) parseCmdReset(cmd string, param string, more []string) (bool, erro
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Cmd) parseCmdClone(cmd string, param string, more []string) (bool, error) {
|
||||||
|
if cmd == "clone" {
|
||||||
|
c.enable = false
|
||||||
|
c.param = param
|
||||||
|
c.exec = c.execClone
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Cmd) Parse(args []string) error {
|
func (c *Cmd) Parse(args []string) error {
|
||||||
var param string
|
var param string
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
@ -169,7 +228,7 @@ func (c *Cmd) Parse(args []string) error {
|
|||||||
return fmt.Errorf("invalid command: %v", cmd)
|
return fmt.Errorf("invalid command: %v", cmd)
|
||||||
}
|
}
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
if len(args) < n + 1 {
|
if len(args) < n+1 {
|
||||||
return fmt.Errorf("Wrong number of arguments, need: %d", n)
|
return fmt.Errorf("Wrong number of arguments, need: %d", n)
|
||||||
}
|
}
|
||||||
param = args[1]
|
param = args[1]
|
||||||
@ -192,6 +251,13 @@ func (c *Cmd) Parse(args []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r, err = c.parseCmdClone(cmd, param, args)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if r {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return fmt.Errorf("unknown subcommand: %s", cmd)
|
return fmt.Errorf("unknown subcommand: %s", cmd)
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,9 @@ import (
|
|||||||
func TestInsertOrShift(t *testing.T) {
|
func TestInsertOrShift(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
profile Profile
|
profile Profile
|
||||||
index int
|
index int
|
||||||
value string
|
value string
|
||||||
expected []string
|
expected []string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
LOAD clear_temporary_value 2
|
LOAD clear_temporary_value 2
|
||||||
RELOAD clear_temporary_value
|
RELOAD clear_temporary_value
|
||||||
LOAD set_default_voucher 8
|
LOAD manage_vouchers 160
|
||||||
RELOAD set_default_voucher
|
RELOAD manage_vouchers
|
||||||
LOAD check_vouchers 10
|
|
||||||
RELOAD check_vouchers
|
|
||||||
LOAD check_balance 128
|
LOAD check_balance 128
|
||||||
RELOAD check_balance
|
RELOAD check_balance
|
||||||
CATCH api_failure flag_api_call_error 1
|
CATCH api_failure flag_api_call_error 1
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
Current alias: {{.get_current_profile_info}}
|
Current alias: {{.get_current_profile_info}}
|
||||||
Enter your preferred alias::
|
Enter your preferred alias:
|
@ -1,2 +1,2 @@
|
|||||||
Lakabu ya sasa: {{.get_current_profile_info}}
|
Lakabu ya sasa: {{.get_current_profile_info}}
|
||||||
Weka lakabu unalopendelea::
|
Weka lakabu unalopendelea:
|
@ -181,8 +181,8 @@ func (s *SshRunner) GetEngine(sessionId string) (engine.Engine, func(), error) {
|
|||||||
accountService := services.New(ctx, menuStorageService)
|
accountService := services.New(ctx, menuStorageService)
|
||||||
_, err = lhs.GetHandler(accountService)
|
_, err = lhs.GetHandler(accountService)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "get accounts service handler: %v\n", err)
|
fmt.Fprintf(os.Stderr, "get accounts service handler: %v\n", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
en := lhs.GetEngine(lhs.Cfg, rs, pe)
|
en := lhs.GetEngine(lhs.Cfg, rs, pe)
|
||||||
closer := func() {
|
closer := func() {
|
||||||
|
@ -63,6 +63,8 @@ const (
|
|||||||
DATA_INITIAL_LANGUAGE_CODE
|
DATA_INITIAL_LANGUAGE_CODE
|
||||||
//Fully qualified account alias string
|
//Fully qualified account alias string
|
||||||
DATA_ACCOUNT_ALIAS
|
DATA_ACCOUNT_ALIAS
|
||||||
|
//currently suggested alias by the api awaiting user's confirmation as accepted account alias
|
||||||
|
DATA_SUGGESTED_ALIAS
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Loading…
Reference in New Issue
Block a user