Compare commits
7 Commits
lash/async
...
lash/vise-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ae3372c36
|
||
| 3a7c3ffc67 | |||
|
|
78c033e61c
|
||
|
|
b5ef483f34
|
||
|
|
006eef0a28
|
||
|
|
e99a788c60
|
||
| b5d33a98f0 |
1
go.mod
1
go.mod
@@ -5,6 +5,7 @@ go 1.22.6
|
|||||||
require (
|
require (
|
||||||
git.defalsify.org/vise.git v0.1.0-rc.3.0.20240911231817-0d23e0dbb57f
|
git.defalsify.org/vise.git v0.1.0-rc.3.0.20240911231817-0d23e0dbb57f
|
||||||
github.com/alecthomas/assert/v2 v2.2.2
|
github.com/alecthomas/assert/v2 v2.2.2
|
||||||
|
github.com/peteole/testdata-loader v0.3.0
|
||||||
gopkg.in/leonelquinteros/gotext.v1 v1.3.1
|
gopkg.in/leonelquinteros/gotext.v1 v1.3.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ func NewHandlers(appFlags *asm.FlagParser, userdataStore db.Db) (*Handlers, erro
|
|||||||
Db: userdataStore,
|
Db: userdataStore,
|
||||||
}
|
}
|
||||||
h := &Handlers{
|
h := &Handlers{
|
||||||
userdataStore: userDb,
|
userdataStore: userDb,
|
||||||
flagManager: appFlags,
|
flagManager: appFlags,
|
||||||
accountService: &server.AccountService{},
|
accountService: &server.AccountService{},
|
||||||
}
|
}
|
||||||
return h, nil
|
return h, nil
|
||||||
}
|
}
|
||||||
@@ -748,7 +748,8 @@ func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte)
|
|||||||
|
|
||||||
flag_invalid_amount, _ := h.flagManager.GetFlag("flag_invalid_amount")
|
flag_invalid_amount, _ := h.flagManager.GetFlag("flag_invalid_amount")
|
||||||
|
|
||||||
publicKey, _ := utils.ReadEntry(ctx, h.userdataStore, sessionId, utils.DATA_PUBLIC_KEY)
|
store := h.userdataStore
|
||||||
|
publicKey, _ := store.ReadEntry(ctx, sessionId, utils.DATA_PUBLIC_KEY)
|
||||||
|
|
||||||
amountStr := string(input)
|
amountStr := string(input)
|
||||||
|
|
||||||
@@ -792,7 +793,6 @@ func (h *Handlers) ValidateAmount(ctx context.Context, sym string, input []byte)
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.Content = fmt.Sprintf("%.3f", inputAmount) // Format to 3 decimal places
|
res.Content = fmt.Sprintf("%.3f", inputAmount) // Format to 3 decimal places
|
||||||
store := h.userdataStore
|
|
||||||
err = store.WriteEntry(ctx, sessionId, utils.DATA_AMOUNT, []byte(amountStr))
|
err = store.WriteEntry(ctx, sessionId, utils.DATA_AMOUNT, []byte(amountStr))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,7 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
"git.defalsify.org/vise.git/db"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type DataTyp uint16
|
type DataTyp uint16
|
||||||
@@ -37,21 +34,3 @@ func PackKey(typ DataTyp, data []byte) []byte {
|
|||||||
v := typToBytes(typ)
|
v := typToBytes(typ)
|
||||||
return append(v, data...)
|
return append(v, data...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReadEntry(ctx context.Context, store db.Db, sessionId string, typ DataTyp) ([]byte, error) {
|
|
||||||
store.SetPrefix(db.DATATYPE_USERDATA)
|
|
||||||
store.SetSession(sessionId)
|
|
||||||
k := PackKey(typ, []byte(sessionId))
|
|
||||||
b, err := store.Get(ctx, k)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return b, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func WriteEntry(ctx context.Context, store db.Db, sessionId string, typ DataTyp, value []byte) error {
|
|
||||||
store.SetPrefix(db.DATATYPE_USERDATA)
|
|
||||||
store.SetSession(sessionId)
|
|
||||||
k := PackKey(typ, []byte(sessionId))
|
|
||||||
return store.Put(ctx, k, value)
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
# Variables to match files in the current directory
|
# Variables to match files in the current directory
|
||||||
INPUTS = $(wildcard ./*.vis)
|
INPUTS = $(wildcard ./*.vis)
|
||||||
TXTS = $(wildcard ./*.txt.orig)
|
TXTS = $(wildcard ./*.txt.orig)
|
||||||
|
VISE_PATH := ../../go-vise
|
||||||
|
|
||||||
# Rule to build .bin files from .vis files
|
# Rule to build .bin files from .vis files
|
||||||
%.vis:
|
%.vis:
|
||||||
go run ../../go-vise/dev/asm/main.go -f pp.csv $(basename $@).vis > $(basename $@).bin
|
go run $(VISE_PATH)/dev/asm/main.go -f pp.csv $(basename $@).vis > $(basename $@).bin
|
||||||
@echo "Built $(basename $@).bin from $(basename $@).vis"
|
@echo "Built $(basename $@).bin from $(basename $@).vis"
|
||||||
|
|
||||||
# Rule to copy .orig files to .txt
|
# Rule to copy .orig files to .txt
|
||||||
|
|||||||
Reference in New Issue
Block a user