mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/refactor did state (#10)
* feat(did): remove account types * feat: Refactor Property to Proof in zkprop.go * feat: add ZKP proof mechanism for verifications * fix: return bool and error from pinInitialVault * feat: implement KeyshareSet for managing user and validator keyshares * feat: Update Credential type in protobuf * feat: update credential schema with sign count * feat: migrate and modules to middleware * refactor: rename vault module to ORM * chore(dwn): add service worker registration to index template * feat: integrate service worker for offline functionality * refactor(did): use DIDNamespace enum for verification method in proto reflection * refactor: update protobuf definitions to support Keyshare * feat: expose did keeper in app keepers * Add Motr Web App * refactor: rename motr/handlers/discovery.go to motr/handlers/openid.go * refactor: move session related code to middleware * feat: add database operations for managing assets, chains, and credentials * feat: add htmx support for UI updates * refactor: extract common helper scripts * chore: remove unused storage GUI components * refactor: Move frontend rendering to dedicated handlers * refactor: rename to * refactor: move alert implementation to templ * feat: add alert component with icon, title, and message * feat: add new RequestHeaders struct to store request headers * Feature/create home view (#9) * refactor: move view logic to new htmx handler * refactor: remove unnecessary dependencies * refactor: remove unused dependencies * feat(devbox): integrate air for local development * feat: implement openid connect discovery document * refactor: rename to * refactor(did): update service handling to support DNS discovery * feat: add support for user and validator keyshares * refactor: move keyshare signing logic to signer
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
root = "."
|
||||
testdata_dir = "testdata"
|
||||
tmp_dir = "tmp"
|
||||
|
||||
[build]
|
||||
delay = 1000
|
||||
cmd = "devbox run build:motr"
|
||||
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
|
||||
exclude_file = []
|
||||
exclude_regex = ["_test.go"]
|
||||
exclude_unchanged = true
|
||||
follow_symlink = false
|
||||
full_bin = "bunx wrangler -c ./cmd/motr/wrangler.toml dev"
|
||||
include_dir = ["cmd/dwn", "cmd/motr", "internal", "models", "pkl"]
|
||||
include_ext = ["go", "templ", "html", "pkl", "js", "mjs"]
|
||||
include_file = [
|
||||
"wrangler.toml",
|
||||
"Dockerfile",
|
||||
".goreleaser.yaml",
|
||||
"go.mod",
|
||||
"devbox.json",
|
||||
".air.toml",
|
||||
]
|
||||
kill_delay = "2s"
|
||||
log = "build-errors.log"
|
||||
poll = false
|
||||
poll_interval = 0
|
||||
post_cmd = []
|
||||
pre_cmd = ["templ generate"]
|
||||
rerun = false
|
||||
rerun_delay = 500
|
||||
send_interrupt = false
|
||||
stop_on_error = false
|
||||
|
||||
[color]
|
||||
build = "yellow"
|
||||
main = "magenta"
|
||||
runner = "green"
|
||||
watcher = "cyan"
|
||||
|
||||
[log]
|
||||
main_only = true
|
||||
time = true
|
||||
|
||||
[misc]
|
||||
clean_on_exit = true
|
||||
|
||||
[screen]
|
||||
clear_on_rebuild = true
|
||||
keep_scroll = true
|
||||
@@ -299,18 +299,15 @@ sh-testnet: mod-tidy
|
||||
### templ & vault ###
|
||||
###############################################################################
|
||||
|
||||
.PHONY: templ vault
|
||||
|
||||
templ:
|
||||
@echo "Generating templ files"
|
||||
templ generate
|
||||
.PHONY: dwn motr
|
||||
|
||||
dwn:
|
||||
@echo "Generating go-pkl files"
|
||||
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/txns.pkl
|
||||
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/vault.pkl
|
||||
@echo "Building vault.wasm"
|
||||
GOOS=js GOARCH=wasm go build -o ./internal/vfs/dwn.wasm ./cmd/dwn/main.go
|
||||
@echo "(dwn) Building dwn.wasm -> IPFS Vault"
|
||||
GOOS=js GOARCH=wasm go build -o ./internal/vfs/dwn.wasm ./cmd/dwn
|
||||
|
||||
motr:
|
||||
@echo "(motr) Building app.wasm -> Deploy to Cloudflare Workers"
|
||||
GOOS=js GOARCH=wasm go build -o ./motr/build/app.wasm ./motr
|
||||
|
||||
###############################################################################
|
||||
### help ###
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+357
-1902
File diff suppressed because it is too large
Load Diff
+3552
-5260
File diff suppressed because it is too large
Load Diff
+150
-3195
File diff suppressed because it is too large
Load Diff
+19
-15
@@ -29,11 +29,13 @@ const (
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type QueryClient interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
||||
// Resolve queries the DID document by its id.
|
||||
Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error)
|
||||
Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
||||
// Service returns associated ServiceInfo for a given Origin
|
||||
Service(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryServiceResponse, error)
|
||||
// if the servie is not found, a fingerprint is generated to be used
|
||||
// as a TXT record in DNS. v=sonr, o=origin, p=protocol
|
||||
Service(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
@@ -44,8 +46,8 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
|
||||
return &queryClient{cc}
|
||||
}
|
||||
|
||||
func (c *queryClient) Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
|
||||
out := new(QueryParamsResponse)
|
||||
func (c *queryClient) Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
||||
out := new(QueryResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -53,8 +55,8 @@ func (c *queryClient) Params(ctx context.Context, in *QueryRequest, opts ...grpc
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error) {
|
||||
out := new(QueryResolveResponse)
|
||||
func (c *queryClient) Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
||||
out := new(QueryResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Resolve_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -62,8 +64,8 @@ func (c *queryClient) Resolve(ctx context.Context, in *QueryRequest, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Service(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryServiceResponse, error) {
|
||||
out := new(QueryServiceResponse)
|
||||
func (c *queryClient) Service(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
||||
out := new(QueryResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Service_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -76,11 +78,13 @@ func (c *queryClient) Service(ctx context.Context, in *QueryRequest, opts ...grp
|
||||
// for forward compatibility
|
||||
type QueryServer interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(context.Context, *QueryRequest) (*QueryParamsResponse, error)
|
||||
Params(context.Context, *QueryRequest) (*QueryResponse, error)
|
||||
// Resolve queries the DID document by its id.
|
||||
Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error)
|
||||
Resolve(context.Context, *QueryRequest) (*QueryResponse, error)
|
||||
// Service returns associated ServiceInfo for a given Origin
|
||||
Service(context.Context, *QueryRequest) (*QueryServiceResponse, error)
|
||||
// if the servie is not found, a fingerprint is generated to be used
|
||||
// as a TXT record in DNS. v=sonr, o=origin, p=protocol
|
||||
Service(context.Context, *QueryRequest) (*QueryResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
@@ -88,13 +92,13 @@ type QueryServer interface {
|
||||
type UnimplementedQueryServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedQueryServer) Params(context.Context, *QueryRequest) (*QueryParamsResponse, error) {
|
||||
func (UnimplementedQueryServer) Params(context.Context, *QueryRequest) (*QueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error) {
|
||||
func (UnimplementedQueryServer) Resolve(context.Context, *QueryRequest) (*QueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Resolve not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Service(context.Context, *QueryRequest) (*QueryServiceResponse, error) {
|
||||
func (UnimplementedQueryServer) Service(context.Context, *QueryRequest) (*QueryResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Service not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||
|
||||
+419
-495
File diff suppressed because it is too large
Load Diff
+1662
-1915
File diff suppressed because it is too large
Load Diff
+753
-1479
File diff suppressed because it is too large
Load Diff
+34
-34
@@ -20,9 +20,9 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
|
||||
Msg_Authorize_FullMethodName = "/did.v1.Msg/Authorize"
|
||||
Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService"
|
||||
Msg_AllocateVault_FullMethodName = "/did.v1.Msg/AllocateVault"
|
||||
Msg_SyncVault_FullMethodName = "/did.v1.Msg/SyncVault"
|
||||
Msg_SyncController_FullMethodName = "/did.v1.Msg/SyncController"
|
||||
Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController"
|
||||
Msg_RegisterService_FullMethodName = "/did.v1.Msg/RegisterService"
|
||||
)
|
||||
@@ -35,13 +35,13 @@ type MsgClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// Authorize asserts the given controller is the owner of the given address.
|
||||
Authorize(ctx context.Context, in *MsgAuthorize, opts ...grpc.CallOption) (*MsgAuthorizeResponse, error)
|
||||
// AuthorizeService asserts the given controller is the owner of the given address.
|
||||
AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error)
|
||||
// AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database.
|
||||
// this operation is called by services initiating a controller registration.
|
||||
AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error)
|
||||
// SyncVault synchronizes the controller with the Vault Motr DWN WASM Wallet.
|
||||
SyncVault(ctx context.Context, in *MsgSyncVault, opts ...grpc.CallOption) (*MsgSyncVaultResponse, error)
|
||||
// SyncController synchronizes the controller with the Vault Motr DWN WASM Wallet.
|
||||
SyncController(ctx context.Context, in *MsgSyncController, opts ...grpc.CallOption) (*MsgSyncControllerResponse, error)
|
||||
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
|
||||
RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error)
|
||||
// RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key.
|
||||
@@ -65,9 +65,9 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) Authorize(ctx context.Context, in *MsgAuthorize, opts ...grpc.CallOption) (*MsgAuthorizeResponse, error) {
|
||||
out := new(MsgAuthorizeResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_Authorize_FullMethodName, in, out, opts...)
|
||||
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) {
|
||||
out := new(MsgAuthorizeServiceResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_AuthorizeService_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -83,9 +83,9 @@ func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opt
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) SyncVault(ctx context.Context, in *MsgSyncVault, opts ...grpc.CallOption) (*MsgSyncVaultResponse, error) {
|
||||
out := new(MsgSyncVaultResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_SyncVault_FullMethodName, in, out, opts...)
|
||||
func (c *msgClient) SyncController(ctx context.Context, in *MsgSyncController, opts ...grpc.CallOption) (*MsgSyncControllerResponse, error) {
|
||||
out := new(MsgSyncControllerResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_SyncController_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -118,13 +118,13 @@ type MsgServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// Authorize asserts the given controller is the owner of the given address.
|
||||
Authorize(context.Context, *MsgAuthorize) (*MsgAuthorizeResponse, error)
|
||||
// AuthorizeService asserts the given controller is the owner of the given address.
|
||||
AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error)
|
||||
// AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database.
|
||||
// this operation is called by services initiating a controller registration.
|
||||
AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error)
|
||||
// SyncVault synchronizes the controller with the Vault Motr DWN WASM Wallet.
|
||||
SyncVault(context.Context, *MsgSyncVault) (*MsgSyncVaultResponse, error)
|
||||
// SyncController synchronizes the controller with the Vault Motr DWN WASM Wallet.
|
||||
SyncController(context.Context, *MsgSyncController) (*MsgSyncControllerResponse, error)
|
||||
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
|
||||
RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error)
|
||||
// RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key.
|
||||
@@ -139,14 +139,14 @@ type UnimplementedMsgServer struct {
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) Authorize(context.Context, *MsgAuthorize) (*MsgAuthorizeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Authorize not implemented")
|
||||
func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) SyncVault(context.Context, *MsgSyncVault) (*MsgSyncVaultResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SyncVault not implemented")
|
||||
func (UnimplementedMsgServer) SyncController(context.Context, *MsgSyncController) (*MsgSyncControllerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SyncController not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented")
|
||||
@@ -185,20 +185,20 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_Authorize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgAuthorize)
|
||||
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgAuthorizeService)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).Authorize(ctx, in)
|
||||
return srv.(MsgServer).AuthorizeService(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_Authorize_FullMethodName,
|
||||
FullMethod: Msg_AuthorizeService_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).Authorize(ctx, req.(*MsgAuthorize))
|
||||
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgAuthorizeService))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -221,20 +221,20 @@ func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_SyncVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgSyncVault)
|
||||
func _Msg_SyncController_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgSyncController)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).SyncVault(ctx, in)
|
||||
return srv.(MsgServer).SyncController(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_SyncVault_FullMethodName,
|
||||
FullMethod: Msg_SyncController_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).SyncVault(ctx, req.(*MsgSyncVault))
|
||||
return srv.(MsgServer).SyncController(ctx, req.(*MsgSyncController))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -287,16 +287,16 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Authorize",
|
||||
Handler: _Msg_Authorize_Handler,
|
||||
MethodName: "AuthorizeService",
|
||||
Handler: _Msg_AuthorizeService_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AllocateVault",
|
||||
Handler: _Msg_AllocateVault_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SyncVault",
|
||||
Handler: _Msg_SyncVault_Handler,
|
||||
MethodName: "SyncController",
|
||||
Handler: _Msg_SyncController_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterController",
|
||||
|
||||
@@ -1,504 +0,0 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package modulev1
|
||||
|
||||
import (
|
||||
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
|
||||
fmt "fmt"
|
||||
runtime "github.com/cosmos/cosmos-proto/runtime"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
io "io"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
var (
|
||||
md_Module protoreflect.MessageDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_oracle_module_v1_module_proto_init()
|
||||
md_Module = File_oracle_module_v1_module_proto.Messages().ByName("Module")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_Module)(nil)
|
||||
|
||||
type fastReflection_Module Module
|
||||
|
||||
func (x *Module) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_Module)(x)
|
||||
}
|
||||
|
||||
func (x *Module) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_oracle_module_v1_module_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_Module_messageType fastReflection_Module_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
|
||||
|
||||
type fastReflection_Module_messageType struct{}
|
||||
|
||||
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_Module)(nil)
|
||||
}
|
||||
func (x fastReflection_Module_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_Module)
|
||||
}
|
||||
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Module
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_Module
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_Module) Type() protoreflect.MessageType {
|
||||
return _fastReflection_Module_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_Module) New() protoreflect.Message {
|
||||
return new(fastReflection_Module)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
|
||||
return (*Module)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
// calling f for each field descriptor and value encountered.
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
//
|
||||
// Some fields have the property of nullability where it is possible to
|
||||
// distinguish between the default value of a field and whether the field
|
||||
// was explicitly populated with the default value. Singular message fields,
|
||||
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||
// fields are populated only if explicitly set.
|
||||
//
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: onsonr.sonr.oracle.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message onsonr.sonr.oracle.module.v1.Module does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the field such that a subsequent Has call reports false.
|
||||
//
|
||||
// Clearing an extension field clears both the extension type and value
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: onsonr.sonr.oracle.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message onsonr.sonr.oracle.module.v1.Module does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves the value for a field.
|
||||
//
|
||||
// For unpopulated scalars, it returns the default value, where
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: onsonr.sonr.oracle.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message onsonr.sonr.oracle.module.v1.Module does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Set stores the value for a field.
|
||||
//
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||
// When setting a composite type, it is unspecified whether the stored value
|
||||
// aliases the source's memory in any way. If the composite value is an
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: onsonr.sonr.oracle.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message onsonr.sonr.oracle.module.v1.Module does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Mutable returns a mutable reference to a composite type.
|
||||
//
|
||||
// If the field is unpopulated, it may allocate a composite value.
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType
|
||||
// if not already stored.
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: onsonr.sonr.oracle.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message onsonr.sonr.oracle.module.v1.Module does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: onsonr.sonr.oracle.module.v1.Module"))
|
||||
}
|
||||
panic(fmt.Errorf("message onsonr.sonr.oracle.module.v1.Module does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in onsonr.sonr.oracle.module.v1.Module", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
// SetUnknown stores an entire list of unknown fields.
|
||||
// The raw fields must be syntactically valid according to the wire format.
|
||||
// An implementation may panic if this is not the case.
|
||||
// Once stored, the caller must not mutate the content of the RawFields.
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
// IsValid reports whether the message is valid.
|
||||
//
|
||||
// An invalid message is an empty, read-only value.
|
||||
//
|
||||
// An invalid message often corresponds to a nil pointer of the concrete
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_Module) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*Module)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: n,
|
||||
}
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*Module)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
} else {
|
||||
input.Buf = dAtA
|
||||
}
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*Module)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Flags: input.Flags,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.UnmarshalInputToOptions(input)
|
||||
_ = options
|
||||
dAtA := input.Buf
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
// protoc (unknown)
|
||||
// source: oracle/module/v1/module.proto
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// Module is the app config object of the module.
|
||||
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
|
||||
type Module struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *Module) Reset() {
|
||||
*x = Module{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_oracle_module_v1_module_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Module) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Module) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
|
||||
func (*Module) Descriptor() ([]byte, []int) {
|
||||
return file_oracle_module_v1_module_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
var File_oracle_module_v1_module_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_oracle_module_v1_module_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x1c, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2e, 0x73, 0x6f, 0x6e, 0x72, 0x2e, 0x6f, 0x72, 0x61,
|
||||
0x63, 0x6c, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63,
|
||||
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
|
||||
0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||
0x28, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1e, 0xba, 0xc0, 0x96, 0xda, 0x01,
|
||||
0x18, 0x0a, 0x16, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e,
|
||||
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xfa, 0x01, 0x0a, 0x20, 0x63, 0x6f,
|
||||
0x6d, 0x2e, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2e, 0x73, 0x6f, 0x6e, 0x72, 0x2e, 0x6f, 0x72,
|
||||
0x61, 0x63, 0x6c, 0x65, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b,
|
||||
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72,
|
||||
0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65,
|
||||
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
|
||||
0x65, 0x76, 0x31, 0xa2, 0x02, 0x04, 0x4f, 0x53, 0x4f, 0x4d, 0xaa, 0x02, 0x1c, 0x4f, 0x6e, 0x73,
|
||||
0x6f, 0x6e, 0x72, 0x2e, 0x53, 0x6f, 0x6e, 0x72, 0x2e, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e,
|
||||
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1c, 0x4f, 0x6e, 0x73, 0x6f,
|
||||
0x6e, 0x72, 0x5c, 0x53, 0x6f, 0x6e, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x4d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x28, 0x4f, 0x6e, 0x73, 0x6f, 0x6e,
|
||||
0x72, 0x5c, 0x53, 0x6f, 0x6e, 0x72, 0x5c, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x4d, 0x6f,
|
||||
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
|
||||
0x61, 0x74, 0x61, 0xea, 0x02, 0x20, 0x4f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x3a, 0x3a, 0x53, 0x6f,
|
||||
0x6e, 0x72, 0x3a, 0x3a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75,
|
||||
0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_oracle_module_v1_module_proto_rawDescOnce sync.Once
|
||||
file_oracle_module_v1_module_proto_rawDescData = file_oracle_module_v1_module_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_oracle_module_v1_module_proto_rawDescGZIP() []byte {
|
||||
file_oracle_module_v1_module_proto_rawDescOnce.Do(func() {
|
||||
file_oracle_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_oracle_module_v1_module_proto_rawDescData)
|
||||
})
|
||||
return file_oracle_module_v1_module_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_oracle_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_oracle_module_v1_module_proto_goTypes = []interface{}{
|
||||
(*Module)(nil), // 0: onsonr.sonr.oracle.module.v1.Module
|
||||
}
|
||||
var file_oracle_module_v1_module_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_oracle_module_v1_module_proto_init() }
|
||||
func file_oracle_module_v1_module_proto_init() {
|
||||
if File_oracle_module_v1_module_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_oracle_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Module); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_oracle_module_v1_module_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_oracle_module_v1_module_proto_goTypes,
|
||||
DependencyIndexes: file_oracle_module_v1_module_proto_depIdxs,
|
||||
MessageInfos: file_oracle_module_v1_module_proto_msgTypes,
|
||||
}.Build()
|
||||
File_oracle_module_v1_module_proto = out.File
|
||||
file_oracle_module_v1_module_proto_rawDesc = nil
|
||||
file_oracle_module_v1_module_proto_goTypes = nil
|
||||
file_oracle_module_v1_module_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,493 +0,0 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package oraclev1
|
||||
|
||||
import (
|
||||
fmt "fmt"
|
||||
runtime "github.com/cosmos/cosmos-proto/runtime"
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoiface "google.golang.org/protobuf/runtime/protoiface"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
io "io"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
var (
|
||||
md_GenesisState protoreflect.MessageDescriptor
|
||||
)
|
||||
|
||||
func init() {
|
||||
file_oracle_v1_genesis_proto_init()
|
||||
md_GenesisState = File_oracle_v1_genesis_proto.Messages().ByName("GenesisState")
|
||||
}
|
||||
|
||||
var _ protoreflect.Message = (*fastReflection_GenesisState)(nil)
|
||||
|
||||
type fastReflection_GenesisState GenesisState
|
||||
|
||||
func (x *GenesisState) ProtoReflect() protoreflect.Message {
|
||||
return (*fastReflection_GenesisState)(x)
|
||||
}
|
||||
|
||||
func (x *GenesisState) slowProtoReflect() protoreflect.Message {
|
||||
mi := &file_oracle_v1_genesis_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
var _fastReflection_GenesisState_messageType fastReflection_GenesisState_messageType
|
||||
var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{}
|
||||
|
||||
type fastReflection_GenesisState_messageType struct{}
|
||||
|
||||
func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message {
|
||||
return (*fastReflection_GenesisState)(nil)
|
||||
}
|
||||
func (x fastReflection_GenesisState_messageType) New() protoreflect.Message {
|
||||
return new(fastReflection_GenesisState)
|
||||
}
|
||||
func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_GenesisState
|
||||
}
|
||||
|
||||
// Descriptor returns message descriptor, which contains only the protobuf
|
||||
// type information for the message.
|
||||
func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor {
|
||||
return md_GenesisState
|
||||
}
|
||||
|
||||
// Type returns the message type, which encapsulates both Go and protobuf
|
||||
// type information. If the Go type information is not needed,
|
||||
// it is recommended that the message descriptor be used instead.
|
||||
func (x *fastReflection_GenesisState) Type() protoreflect.MessageType {
|
||||
return _fastReflection_GenesisState_messageType
|
||||
}
|
||||
|
||||
// New returns a newly allocated and mutable empty message.
|
||||
func (x *fastReflection_GenesisState) New() protoreflect.Message {
|
||||
return new(fastReflection_GenesisState)
|
||||
}
|
||||
|
||||
// Interface unwraps the message reflection interface and
|
||||
// returns the underlying ProtoMessage interface.
|
||||
func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage {
|
||||
return (*GenesisState)(x)
|
||||
}
|
||||
|
||||
// Range iterates over every populated field in an undefined order,
|
||||
// calling f for each field descriptor and value encountered.
|
||||
// Range returns immediately if f returns false.
|
||||
// While iterating, mutating operations may only be performed
|
||||
// on the current field descriptor.
|
||||
func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||
}
|
||||
|
||||
// Has reports whether a field is populated.
|
||||
//
|
||||
// Some fields have the property of nullability where it is possible to
|
||||
// distinguish between the default value of a field and whether the field
|
||||
// was explicitly populated with the default value. Singular message fields,
|
||||
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||
// fields are populated only if explicitly set.
|
||||
//
|
||||
// In other cases (aside from the nullable cases above),
|
||||
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||
// a repeated field is populated if it is non-empty.
|
||||
func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: oracle.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message oracle.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Clear clears the field such that a subsequent Has call reports false.
|
||||
//
|
||||
// Clearing an extension field clears both the extension type and value
|
||||
// associated with the given field number.
|
||||
//
|
||||
// Clear is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) Clear(fd protoreflect.FieldDescriptor) {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: oracle.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message oracle.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Get retrieves the value for a field.
|
||||
//
|
||||
// For unpopulated scalars, it returns the default value, where
|
||||
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||
// For unpopulated composite types, it returns an empty, read-only view
|
||||
// of the value; to obtain a mutable reference, use Mutable.
|
||||
func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch descriptor.FullName() {
|
||||
default:
|
||||
if descriptor.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: oracle.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message oracle.v1.GenesisState does not contain field %s", descriptor.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Set stores the value for a field.
|
||||
//
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||
// When setting a composite type, it is unspecified whether the stored value
|
||||
// aliases the source's memory in any way. If the composite value is an
|
||||
// empty, read-only value, then it panics.
|
||||
//
|
||||
// Set is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: oracle.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message oracle.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// Mutable returns a mutable reference to a composite type.
|
||||
//
|
||||
// If the field is unpopulated, it may allocate a composite value.
|
||||
// For a field belonging to a oneof, it implicitly clears any other field
|
||||
// that may be currently set within the same oneof.
|
||||
// For extension fields, it implicitly stores the provided ExtensionType
|
||||
// if not already stored.
|
||||
// It panics if the field does not contain a composite type.
|
||||
//
|
||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: oracle.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message oracle.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// NewField returns a new value that is assignable to the field
|
||||
// for the given descriptor. For scalars, this returns the default value.
|
||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||
func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||
switch fd.FullName() {
|
||||
default:
|
||||
if fd.IsExtension() {
|
||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: oracle.v1.GenesisState"))
|
||||
}
|
||||
panic(fmt.Errorf("message oracle.v1.GenesisState does not contain field %s", fd.FullName()))
|
||||
}
|
||||
}
|
||||
|
||||
// WhichOneof reports which field within the oneof is populated,
|
||||
// returning nil if none are populated.
|
||||
// It panics if the oneof descriptor does not belong to this message.
|
||||
func (x *fastReflection_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||
switch d.FullName() {
|
||||
default:
|
||||
panic(fmt.Errorf("%s is not a oneof field in oracle.v1.GenesisState", d.FullName()))
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
// GetUnknown retrieves the entire list of unknown fields.
|
||||
// The caller may only mutate the contents of the RawFields
|
||||
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||
func (x *fastReflection_GenesisState) GetUnknown() protoreflect.RawFields {
|
||||
return x.unknownFields
|
||||
}
|
||||
|
||||
// SetUnknown stores an entire list of unknown fields.
|
||||
// The raw fields must be syntactically valid according to the wire format.
|
||||
// An implementation may panic if this is not the case.
|
||||
// Once stored, the caller must not mutate the content of the RawFields.
|
||||
// An empty RawFields may be passed to clear the fields.
|
||||
//
|
||||
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||
func (x *fastReflection_GenesisState) SetUnknown(fields protoreflect.RawFields) {
|
||||
x.unknownFields = fields
|
||||
}
|
||||
|
||||
// IsValid reports whether the message is valid.
|
||||
//
|
||||
// An invalid message is an empty, read-only value.
|
||||
//
|
||||
// An invalid message often corresponds to a nil pointer of the concrete
|
||||
// message type, but the details are implementation dependent.
|
||||
// Validity is not part of the protobuf data model, and may not
|
||||
// be preserved in marshaling or other operations.
|
||||
func (x *fastReflection_GenesisState) IsValid() bool {
|
||||
return x != nil
|
||||
}
|
||||
|
||||
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||
// This method may return nil.
|
||||
//
|
||||
// The returned methods type is identical to
|
||||
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||
// Consult the protoiface package documentation for details.
|
||||
func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
|
||||
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||
x := input.Message.Interface().(*GenesisState)
|
||||
if x == nil {
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: 0,
|
||||
}
|
||||
}
|
||||
options := runtime.SizeInputToOptions(input)
|
||||
_ = options
|
||||
var n int
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
n += len(x.unknownFields)
|
||||
}
|
||||
return protoiface.SizeOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Size: n,
|
||||
}
|
||||
}
|
||||
|
||||
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||
x := input.Message.Interface().(*GenesisState)
|
||||
if x == nil {
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.MarshalInputToOptions(input)
|
||||
_ = options
|
||||
size := options.Size(x)
|
||||
dAtA := make([]byte, size)
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if x.unknownFields != nil {
|
||||
i -= len(x.unknownFields)
|
||||
copy(dAtA[i:], x.unknownFields)
|
||||
}
|
||||
if input.Buf != nil {
|
||||
input.Buf = append(input.Buf, dAtA...)
|
||||
} else {
|
||||
input.Buf = dAtA
|
||||
}
|
||||
return protoiface.MarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Buf: input.Buf,
|
||||
}, nil
|
||||
}
|
||||
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
x := input.Message.Interface().(*GenesisState)
|
||||
if x == nil {
|
||||
return protoiface.UnmarshalOutput{
|
||||
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||
Flags: input.Flags,
|
||||
}, nil
|
||||
}
|
||||
options := runtime.UnmarshalInputToOptions(input)
|
||||
_ = options
|
||||
dAtA := input.Buf
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= uint64(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||
}
|
||||
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
if !options.DiscardUnknown {
|
||||
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
}
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||
}
|
||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||
}
|
||||
return &protoiface.Methods{
|
||||
NoUnkeyedLiterals: struct{}{},
|
||||
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||
Size: size,
|
||||
Marshal: marshal,
|
||||
Unmarshal: unmarshal,
|
||||
Merge: nil,
|
||||
CheckInitialized: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
// protoc (unknown)
|
||||
// source: oracle/v1/genesis.proto
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// GenesisState defines the middlewares genesis state.
|
||||
type GenesisState struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *GenesisState) Reset() {
|
||||
*x = GenesisState{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_oracle_v1_genesis_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GenesisState) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GenesisState) ProtoMessage() {}
|
||||
|
||||
// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead.
|
||||
func (*GenesisState) Descriptor() ([]byte, []int) {
|
||||
return file_oracle_v1_genesis_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
var File_oracle_v1_genesis_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_oracle_v1_genesis_proto_rawDesc = []byte{
|
||||
0x0a, 0x17, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x65,
|
||||
0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6f, 0x72, 0x61, 0x63, 0x6c,
|
||||
0x65, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
|
||||
0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0e, 0x0a, 0x0c, 0x47, 0x65,
|
||||
0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x91, 0x01, 0x0a, 0x0d, 0x63,
|
||||
0x6f, 0x6d, 0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65,
|
||||
0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69,
|
||||
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f,
|
||||
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f,
|
||||
0x76, 0x31, 0x3b, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4f, 0x58,
|
||||
0x58, 0xaa, 0x02, 0x09, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x09,
|
||||
0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x15, 0x4f, 0x72, 0x61, 0x63,
|
||||
0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0xea, 0x02, 0x0a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_oracle_v1_genesis_proto_rawDescOnce sync.Once
|
||||
file_oracle_v1_genesis_proto_rawDescData = file_oracle_v1_genesis_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_oracle_v1_genesis_proto_rawDescGZIP() []byte {
|
||||
file_oracle_v1_genesis_proto_rawDescOnce.Do(func() {
|
||||
file_oracle_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_oracle_v1_genesis_proto_rawDescData)
|
||||
})
|
||||
return file_oracle_v1_genesis_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_oracle_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_oracle_v1_genesis_proto_goTypes = []interface{}{
|
||||
(*GenesisState)(nil), // 0: oracle.v1.GenesisState
|
||||
}
|
||||
var file_oracle_v1_genesis_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_oracle_v1_genesis_proto_init() }
|
||||
func file_oracle_v1_genesis_proto_init() {
|
||||
if File_oracle_v1_genesis_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_oracle_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GenesisState); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_oracle_v1_genesis_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_oracle_v1_genesis_proto_goTypes,
|
||||
DependencyIndexes: file_oracle_v1_genesis_proto_depIdxs,
|
||||
MessageInfos: file_oracle_v1_genesis_proto_msgTypes,
|
||||
}.Build()
|
||||
File_oracle_v1_genesis_proto = out.File
|
||||
file_oracle_v1_genesis_proto_rawDesc = nil
|
||||
file_oracle_v1_genesis_proto_goTypes = nil
|
||||
file_oracle_v1_genesis_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package oraclev1
|
||||
|
||||
import (
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
// protoc (unknown)
|
||||
// source: oracle/v1/query.proto
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
var File_oracle_v1_query_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_oracle_v1_query_proto_rawDesc = []byte{
|
||||
0x0a, 0x15, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e,
|
||||
0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f,
|
||||
0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x8f, 0x01, 0x0a, 0x0d, 0x63, 0x6f, 0x6d,
|
||||
0x2e, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72,
|
||||
0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6f,
|
||||
0x72, 0x61, 0x63, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4f, 0x58, 0x58, 0xaa, 0x02, 0x09,
|
||||
0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x09, 0x4f, 0x72, 0x61, 0x63,
|
||||
0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x15, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56,
|
||||
0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a,
|
||||
0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_oracle_v1_query_proto_goTypes = []interface{}{}
|
||||
var file_oracle_v1_query_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_oracle_v1_query_proto_init() }
|
||||
func file_oracle_v1_query_proto_init() {
|
||||
if File_oracle_v1_query_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_oracle_v1_query_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_oracle_v1_query_proto_goTypes,
|
||||
DependencyIndexes: file_oracle_v1_query_proto_depIdxs,
|
||||
}.Build()
|
||||
File_oracle_v1_query_proto = out.File
|
||||
file_oracle_v1_query_proto_rawDesc = nil
|
||||
file_oracle_v1_query_proto_goTypes = nil
|
||||
file_oracle_v1_query_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
|
||||
package oraclev1
|
||||
|
||||
import (
|
||||
_ "github.com/cosmos/gogoproto/gogoproto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.0
|
||||
// protoc (unknown)
|
||||
// source: oracle/v1/tx.proto
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
var File_oracle_v1_tx_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_oracle_v1_tx_proto_rawDesc = []byte{
|
||||
0x0a, 0x12, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x78, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a,
|
||||
0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x42, 0x8c, 0x01, 0x0a, 0x0d, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, 0x72,
|
||||
0x61, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x2d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f,
|
||||
0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f,
|
||||
0x72, 0x61, 0x63, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x76,
|
||||
0x31, 0xa2, 0x02, 0x03, 0x4f, 0x58, 0x58, 0xaa, 0x02, 0x09, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65,
|
||||
0x2e, 0x56, 0x31, 0xca, 0x02, 0x09, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2,
|
||||
0x02, 0x15, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65,
|
||||
0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var file_oracle_v1_tx_proto_goTypes = []interface{}{}
|
||||
var file_oracle_v1_tx_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_oracle_v1_tx_proto_init() }
|
||||
func file_oracle_v1_tx_proto_init() {
|
||||
if File_oracle_v1_tx_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_oracle_v1_tx_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 0,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_oracle_v1_tx_proto_goTypes,
|
||||
DependencyIndexes: file_oracle_v1_tx_proto_depIdxs,
|
||||
}.Build()
|
||||
File_oracle_v1_tx_proto = out.File
|
||||
file_oracle_v1_tx_proto_rawDesc = nil
|
||||
file_oracle_v1_tx_proto_goTypes = nil
|
||||
file_oracle_v1_tx_proto_depIdxs = nil
|
||||
}
|
||||
-17
@@ -148,9 +148,6 @@ import (
|
||||
did "github.com/onsonr/sonr/x/did"
|
||||
didkeeper "github.com/onsonr/sonr/x/did/keeper"
|
||||
didtypes "github.com/onsonr/sonr/x/did/types"
|
||||
oracle "github.com/onsonr/sonr/x/oracle"
|
||||
oraclekeeper "github.com/onsonr/sonr/x/oracle/keeper"
|
||||
oracletypes "github.com/onsonr/sonr/x/oracle/types"
|
||||
)
|
||||
|
||||
const appName = "sonr"
|
||||
@@ -220,7 +217,6 @@ type SonrApp struct {
|
||||
NFTKeeper nftkeeper.Keeper
|
||||
AuthzKeeper authzkeeper.Keeper
|
||||
FeeGrantKeeper feegrantkeeper.Keeper
|
||||
OracleKeeper oraclekeeper.Keeper
|
||||
interfaceRegistry types.InterfaceRegistry
|
||||
txConfig client.TxConfig
|
||||
appCodec codec.Codec
|
||||
@@ -361,7 +357,6 @@ func NewChainApp(
|
||||
poa.StoreKey,
|
||||
globalfeetypes.StoreKey,
|
||||
packetforwardtypes.StoreKey,
|
||||
oracletypes.StoreKey,
|
||||
didtypes.StoreKey,
|
||||
)
|
||||
|
||||
@@ -621,13 +616,6 @@ func NewChainApp(
|
||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
)
|
||||
|
||||
// Create the oracle Middleware Keeper
|
||||
app.OracleKeeper = oraclekeeper.NewKeeper(
|
||||
appCodec,
|
||||
app.MsgServiceRouter(),
|
||||
app.IBCKeeper.ChannelKeeper,
|
||||
)
|
||||
|
||||
// Create the globalfee keeper
|
||||
app.GlobalFeeKeeper = globalfeekeeper.NewKeeper(
|
||||
appCodec,
|
||||
@@ -883,7 +871,6 @@ func NewChainApp(
|
||||
app.PacketForwardKeeper,
|
||||
app.GetSubspace(packetforwardtypes.ModuleName),
|
||||
),
|
||||
oracle.NewAppModule(app.OracleKeeper),
|
||||
|
||||
did.NewAppModule(appCodec, app.DidKeeper),
|
||||
)
|
||||
@@ -933,7 +920,6 @@ func NewChainApp(
|
||||
ibcfeetypes.ModuleName,
|
||||
tokenfactorytypes.ModuleName,
|
||||
packetforwardtypes.ModuleName,
|
||||
oracletypes.ModuleName,
|
||||
didtypes.ModuleName,
|
||||
)
|
||||
|
||||
@@ -953,7 +939,6 @@ func NewChainApp(
|
||||
ibcfeetypes.ModuleName,
|
||||
tokenfactorytypes.ModuleName,
|
||||
packetforwardtypes.ModuleName,
|
||||
oracletypes.ModuleName,
|
||||
didtypes.ModuleName,
|
||||
)
|
||||
|
||||
@@ -982,7 +967,6 @@ func NewChainApp(
|
||||
tokenfactorytypes.ModuleName,
|
||||
globalfeetypes.ModuleName,
|
||||
packetforwardtypes.ModuleName,
|
||||
oracletypes.ModuleName,
|
||||
didtypes.ModuleName,
|
||||
}
|
||||
app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
|
||||
@@ -1440,7 +1424,6 @@ func initParamsKeeper(
|
||||
paramsKeeper.Subspace(globalfee.ModuleName)
|
||||
paramsKeeper.Subspace(packetforwardtypes.ModuleName).
|
||||
WithKeyTable(packetforwardtypes.ParamKeyTable())
|
||||
paramsKeeper.Subspace(oracletypes.ModuleName)
|
||||
paramsKeeper.Subspace(didtypes.ModuleName)
|
||||
|
||||
return paramsKeeper
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/ipfs/kubo/client/rpc"
|
||||
)
|
||||
|
||||
var (
|
||||
ChainID = "testnet"
|
||||
ValAddr = "val1"
|
||||
)
|
||||
|
||||
// Initialize initializes the local configuration values
|
||||
func init() {
|
||||
|
||||
}
|
||||
|
||||
// SetLocalContextSessionID sets the session ID for the local context
|
||||
func SetLocalValidatorAddress(address string) {
|
||||
ValAddr = address
|
||||
}
|
||||
|
||||
// SetLocalContextChainID sets the chain ID for the local
|
||||
func SetLocalChainID(id string) {
|
||||
ChainID = id
|
||||
}
|
||||
|
||||
// IPFSClient is an interface for interacting with an IPFS node.
|
||||
type IPFSClient = *rpc.HttpApi
|
||||
|
||||
// NewLocalClient creates a new IPFS client that connects to the local IPFS node.
|
||||
func GetIPFSClient() (IPFSClient, error) {
|
||||
rpcClient, err := rpc.NewLocalApi()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rpcClient, nil
|
||||
}
|
||||
@@ -22,6 +22,7 @@ func (app *SonrApp) RegisterUpgradeHandlers() {
|
||||
|
||||
keepers := upgrades.AppKeepers{
|
||||
AccountKeeper: &app.AccountKeeper,
|
||||
DidKeeper: &app.DidKeeper,
|
||||
ParamsKeeper: &app.ParamsKeeper,
|
||||
ConsensusParamsKeeper: &app.ConsensusParamsKeeper,
|
||||
CapabilityKeeper: app.CapabilityKeeper,
|
||||
|
||||
@@ -14,10 +14,12 @@ import (
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
|
||||
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
|
||||
didkeeper "github.com/onsonr/sonr/x/did/keeper"
|
||||
)
|
||||
|
||||
type AppKeepers struct {
|
||||
AccountKeeper *authkeeper.AccountKeeper
|
||||
DidKeeper *didkeeper.Keeper
|
||||
ParamsKeeper *paramskeeper.Keeper
|
||||
ConsensusParamsKeeper *consensusparamkeeper.Keeper
|
||||
Codec codec.Codec
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package main
|
||||
|
||||
templ VaultIndex() {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>Sonr Vault</title>
|
||||
<script>
|
||||
navigator.serviceWorker.register({ swPath });
|
||||
|
||||
// Skip installed stage and jump to activating stage
|
||||
addEventListener("install", (event) => {
|
||||
event.waitUntil(skipWaiting());
|
||||
});
|
||||
|
||||
// Start controlling clients as soon as the SW is activated
|
||||
addEventListener("activate", (event) => {
|
||||
event.waitUntil(clients.claim());
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Sonr Vault</h1>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
+90
-15
@@ -7,37 +7,112 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
wasmhttp "github.com/nlepage/go-wasm-http-server"
|
||||
"github.com/onsonr/sonr/internal/vfs/wasm"
|
||||
|
||||
"github.com/donseba/go-htmx"
|
||||
"github.com/onsonr/sonr/internal/db"
|
||||
)
|
||||
|
||||
var edb *db.DB
|
||||
var dwn *DWN
|
||||
|
||||
func main() {
|
||||
// Initialize the database
|
||||
initDB()
|
||||
|
||||
e := echo.New()
|
||||
e.POST("/api/insert/:account/:address", itemsHandler)
|
||||
wasmhttp.Serve(e)
|
||||
type DWN struct {
|
||||
*echo.Echo
|
||||
DB *db.DB
|
||||
Htmx *htmx.HTMX
|
||||
}
|
||||
|
||||
func initDB() {
|
||||
var err error
|
||||
edb, err = db.Open(db.New())
|
||||
func main() {
|
||||
dwn = initRails()
|
||||
|
||||
dwn.GET("/", htmxHandler)
|
||||
dwn.POST("/accounts", accountsHandler)
|
||||
|
||||
wasm.Serve(dwn.Echo)
|
||||
}
|
||||
|
||||
// initRails initializes the Rails application
|
||||
func initRails() *DWN {
|
||||
// Open the database
|
||||
cnfg := db.New()
|
||||
db, err := cnfg.Open()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
// Initialize the htmx handler
|
||||
return &DWN{
|
||||
Echo: echo.New(),
|
||||
DB: db,
|
||||
Htmx: htmx.New(),
|
||||
}
|
||||
}
|
||||
|
||||
func itemsHandler(e echo.Context) error {
|
||||
func accountsHandler(e echo.Context) error {
|
||||
switch e.Request().Method {
|
||||
case "GET":
|
||||
case "POST":
|
||||
edb.AddAccount(e.Param("account"), e.Param("address"))
|
||||
case "PUT":
|
||||
// dwn.DB.AddAccount(e.Param("account"), e.Param("address"))
|
||||
default:
|
||||
e.Error(errors.New("Method not allowed"))
|
||||
}
|
||||
return e.JSON(200, "OK")
|
||||
}
|
||||
|
||||
func htmxHandler(e echo.Context) error {
|
||||
// initiate a new htmx handler
|
||||
h := dwn.Htmx.NewHandler(e.Response(), e.Request())
|
||||
|
||||
// check if the request is a htmx request
|
||||
if h.IsHxRequest() {
|
||||
// do something
|
||||
}
|
||||
|
||||
// check if the request is boosted
|
||||
if h.IsHxBoosted() {
|
||||
// do something
|
||||
}
|
||||
|
||||
// check if the request is a history restore request
|
||||
if h.IsHxHistoryRestoreRequest() {
|
||||
// do something
|
||||
}
|
||||
|
||||
// check if the request is a prompt request
|
||||
if h.RenderPartial() {
|
||||
// do something
|
||||
}
|
||||
|
||||
// set the headers for the response, see docs for more options
|
||||
h.PushURL("http://push.url")
|
||||
h.ReTarget("#ReTarged")
|
||||
|
||||
// write the output like you normally do.
|
||||
// check the inspector tool in the browser to see that the headers are set.
|
||||
_, err := h.Write([]byte("OK"))
|
||||
return err
|
||||
}
|
||||
|
||||
//
|
||||
// func credentialsHandler(e echo.Context) error {
|
||||
// switch e.Request().Method {
|
||||
// case "GET":
|
||||
// dwn.DB.GetCredentials(e.Param("account"))
|
||||
// case "PUT":
|
||||
// dwn.DB.AddCredentials(e.Param("account"), e.Param("address"))
|
||||
// default:
|
||||
// e.Error(errors.New("Method not allowed"))
|
||||
// }
|
||||
// return e.JSON(200, "OK")
|
||||
// }
|
||||
//
|
||||
// func keysharesHandler(e echo.Context) error {
|
||||
// switch e.Request().Method {
|
||||
// case "GET":
|
||||
// dwn.DB.GetKeyshares(e.Param("account"))
|
||||
// case "PUT":
|
||||
// dwn.DB.AddKeyshares(e.Param("account"), e.Param("address"))
|
||||
// default:
|
||||
// e.Error(errors.New("Method not allowed"))
|
||||
// }
|
||||
// return e.JSON(200, "OK")
|
||||
// }
|
||||
|
||||
+2
-2
@@ -95,8 +95,8 @@ func NewRootCmd() *cobra.Command {
|
||||
}
|
||||
|
||||
// Set the context chain ID and validator address
|
||||
app.SetLocalChainID(initClientCtx.ChainID)
|
||||
app.SetLocalValidatorAddress(initClientCtx.FromAddress.String())
|
||||
// app.SetLocalChainID(initClientCtx.ChainID)
|
||||
// app.SetLocalValidatorAddress(initClientCtx.FromAddress.String())
|
||||
|
||||
customAppTemplate, customAppConfig := initAppConfig()
|
||||
customCMTConfig := initCometBFTConfig()
|
||||
|
||||
+24
-16
@@ -3,11 +3,11 @@
|
||||
"packages": [
|
||||
"go@1.22",
|
||||
"templ@latest",
|
||||
"commitizen@latest",
|
||||
"goreleaser@latest",
|
||||
"go-task@latest",
|
||||
"templ@latest",
|
||||
"bun@latest",
|
||||
"ipfs-cluster@latest"
|
||||
"ipfs-cluster@latest",
|
||||
"air@latest"
|
||||
],
|
||||
"env": {
|
||||
"GOPATH": "$HOME/go",
|
||||
@@ -20,25 +20,33 @@
|
||||
},
|
||||
"shell": {
|
||||
"scripts": {
|
||||
"init": [
|
||||
"make install",
|
||||
"sh ./scripts/test_node.sh"
|
||||
],
|
||||
"gen": [
|
||||
"make proto-gen",
|
||||
"make templ",
|
||||
"make dwn"
|
||||
"install": [
|
||||
"make install"
|
||||
],
|
||||
"build": [
|
||||
"make build",
|
||||
"make local-image"
|
||||
],
|
||||
"testnet": [
|
||||
"make install",
|
||||
"devbox services up"
|
||||
"build:dwn": [
|
||||
"templ generate",
|
||||
"make dwn"
|
||||
],
|
||||
"pkl-eval": [
|
||||
"bunx pkl eval ./pkl/msgs.pkl"
|
||||
"build:motr": [
|
||||
"templ generate",
|
||||
"make motr"
|
||||
],
|
||||
"gen:proto": [
|
||||
"make proto-gen"
|
||||
],
|
||||
"gen:pkl": [
|
||||
"go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/orm.pkl",
|
||||
"go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/txns.pkl"
|
||||
],
|
||||
"dev": [
|
||||
"air"
|
||||
],
|
||||
"testnet": [
|
||||
"devbox services up"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- /home/prad/.sonr:/root/.sonr
|
||||
- /home/prad/.scnr:/root/.sonr
|
||||
ports:
|
||||
- "26657:26657"
|
||||
- "1317:1317"
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type Account interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetName() string
|
||||
|
||||
GetAddress() string
|
||||
|
||||
GetPublicKey() *pkl.Object
|
||||
|
||||
GetCreatedAt() *string
|
||||
}
|
||||
|
||||
var _ Account = (*AccountImpl)(nil)
|
||||
|
||||
type AccountImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty"`
|
||||
|
||||
Address string `pkl:"address" json:"address,omitempty"`
|
||||
|
||||
PublicKey *pkl.Object `pkl:"publicKey" json:"publicKey,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *AccountImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *AccountImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *AccountImpl) GetName() string {
|
||||
return rcv.Name
|
||||
}
|
||||
|
||||
func (rcv *AccountImpl) GetAddress() string {
|
||||
return rcv.Address
|
||||
}
|
||||
|
||||
func (rcv *AccountImpl) GetPublicKey() *pkl.Object {
|
||||
return rcv.PublicKey
|
||||
}
|
||||
|
||||
func (rcv *AccountImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Asset interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetName() string
|
||||
|
||||
GetSymbol() string
|
||||
|
||||
GetDecimals() int
|
||||
|
||||
GetChainId() *int
|
||||
|
||||
GetCreatedAt() *string
|
||||
}
|
||||
|
||||
var _ Asset = (*AssetImpl)(nil)
|
||||
|
||||
type AssetImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty"`
|
||||
|
||||
Symbol string `pkl:"symbol" json:"symbol,omitempty"`
|
||||
|
||||
Decimals int `pkl:"decimals" json:"decimals,omitempty"`
|
||||
|
||||
ChainId *int `pkl:"chainId" json:"chainId,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetName() string {
|
||||
return rcv.Name
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetSymbol() string {
|
||||
return rcv.Symbol
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetDecimals() int {
|
||||
return rcv.Decimals
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetChainId() *int {
|
||||
return rcv.ChainId
|
||||
}
|
||||
|
||||
func (rcv *AssetImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Chain interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetName() string
|
||||
|
||||
GetNetworkId() string
|
||||
|
||||
GetCreatedAt() *string
|
||||
}
|
||||
|
||||
var _ Chain = (*ChainImpl)(nil)
|
||||
|
||||
type ChainImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty"`
|
||||
|
||||
NetworkId string `pkl:"networkId" json:"networkId,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *ChainImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *ChainImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *ChainImpl) GetName() string {
|
||||
return rcv.Name
|
||||
}
|
||||
|
||||
func (rcv *ChainImpl) GetNetworkId() string {
|
||||
return rcv.NetworkId
|
||||
}
|
||||
|
||||
func (rcv *ChainImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Client interface {
|
||||
GetChainId() string
|
||||
|
||||
GetKeyringBackend() string
|
||||
|
||||
GetOutput() string
|
||||
|
||||
GetNode() string
|
||||
|
||||
GetBroadcastMode() string
|
||||
|
||||
GetApiUrl() string
|
||||
|
||||
GetAddressPrefix() string
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type Credential interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetSubject() string
|
||||
|
||||
GetController() string
|
||||
|
||||
GetAttestationType() string
|
||||
|
||||
GetOrigin() string
|
||||
|
||||
GetCredentialId() *pkl.Object
|
||||
|
||||
GetPublicKey() *pkl.Object
|
||||
|
||||
GetTransport() string
|
||||
|
||||
GetSignCount() uint
|
||||
|
||||
GetUserPresent() bool
|
||||
|
||||
GetUserVerified() bool
|
||||
|
||||
GetBackupEligible() bool
|
||||
|
||||
GetBackupState() bool
|
||||
|
||||
GetCloneWarning() bool
|
||||
|
||||
GetCreatedAt() *string
|
||||
|
||||
GetUpdatedAt() *string
|
||||
}
|
||||
|
||||
var _ Credential = (*CredentialImpl)(nil)
|
||||
|
||||
type CredentialImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty"`
|
||||
|
||||
AttestationType string `pkl:"attestationType" json:"attestationType,omitempty"`
|
||||
|
||||
Origin string `pkl:"origin" json:"origin,omitempty"`
|
||||
|
||||
CredentialId *pkl.Object `pkl:"credentialId" json:"credentialId,omitempty"`
|
||||
|
||||
PublicKey *pkl.Object `pkl:"publicKey" json:"publicKey,omitempty"`
|
||||
|
||||
Transport string `pkl:"transport" json:"transport,omitempty"`
|
||||
|
||||
SignCount uint `pkl:"signCount" json:"signCount,omitempty"`
|
||||
|
||||
UserPresent bool `pkl:"userPresent" json:"userPresent,omitempty"`
|
||||
|
||||
UserVerified bool `pkl:"userVerified" json:"userVerified,omitempty"`
|
||||
|
||||
BackupEligible bool `pkl:"backupEligible" json:"backupEligible,omitempty"`
|
||||
|
||||
BackupState bool `pkl:"backupState" json:"backupState,omitempty"`
|
||||
|
||||
CloneWarning bool `pkl:"cloneWarning" json:"cloneWarning,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetSubject() string {
|
||||
return rcv.Subject
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetController() string {
|
||||
return rcv.Controller
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetAttestationType() string {
|
||||
return rcv.AttestationType
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetOrigin() string {
|
||||
return rcv.Origin
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetCredentialId() *pkl.Object {
|
||||
return rcv.CredentialId
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetPublicKey() *pkl.Object {
|
||||
return rcv.PublicKey
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetTransport() string {
|
||||
return rcv.Transport
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetSignCount() uint {
|
||||
return rcv.SignCount
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetUserPresent() bool {
|
||||
return rcv.UserPresent
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetUserVerified() bool {
|
||||
return rcv.UserVerified
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetBackupEligible() bool {
|
||||
return rcv.BackupEligible
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetBackupState() bool {
|
||||
return rcv.BackupState
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetCloneWarning() bool {
|
||||
return rcv.CloneWarning
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
|
||||
func (rcv *CredentialImpl) GetUpdatedAt() *string {
|
||||
return rcv.UpdatedAt
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type DB interface {
|
||||
GetFilename() string
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Ipfs struct {
|
||||
ResolverUrl string `pkl:"resolverUrl"`
|
||||
|
||||
IpfsMountPath string `pkl:"ipfsMountPath"`
|
||||
|
||||
IpnsMountPath string `pkl:"ipnsMountPath"`
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type Keyshare interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetMetadata() string
|
||||
|
||||
GetPayloads() string
|
||||
|
||||
GetProtocol() string
|
||||
|
||||
GetPublicKey() *pkl.Object
|
||||
|
||||
GetRole() int
|
||||
|
||||
GetVersion() int
|
||||
|
||||
GetCreatedAt() *string
|
||||
}
|
||||
|
||||
var _ Keyshare = (*KeyshareImpl)(nil)
|
||||
|
||||
type KeyshareImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Metadata string `pkl:"metadata" json:"metadata,omitempty"`
|
||||
|
||||
Payloads string `pkl:"payloads" json:"payloads,omitempty"`
|
||||
|
||||
Protocol string `pkl:"protocol" json:"protocol,omitempty"`
|
||||
|
||||
PublicKey *pkl.Object `pkl:"publicKey" json:"publicKey,omitempty"`
|
||||
|
||||
Role int `pkl:"role" json:"role,omitempty"`
|
||||
|
||||
Version int `pkl:"version" json:"version,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetMetadata() string {
|
||||
return rcv.Metadata
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetPayloads() string {
|
||||
return rcv.Payloads
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetProtocol() string {
|
||||
return rcv.Protocol
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetPublicKey() *pkl.Object {
|
||||
return rcv.PublicKey
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetRole() int {
|
||||
return rcv.Role
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetVersion() int {
|
||||
return rcv.Version
|
||||
}
|
||||
|
||||
func (rcv *KeyshareImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Model interface {
|
||||
GetTable() string
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Permission interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetServiceId() string
|
||||
|
||||
GetGrants() string
|
||||
|
||||
GetScopes() string
|
||||
|
||||
GetCreatedAt() *string
|
||||
|
||||
GetUpdatedAt() *string
|
||||
}
|
||||
|
||||
var _ Permission = (*PermissionImpl)(nil)
|
||||
|
||||
type PermissionImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
ServiceId string `pkl:"serviceId" json:"serviceId,omitempty"`
|
||||
|
||||
Grants string `pkl:"grants" json:"grants,omitempty"`
|
||||
|
||||
Scopes string `pkl:"scopes" json:"scopes,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetServiceId() string {
|
||||
return rcv.ServiceId
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetGrants() string {
|
||||
return rcv.Grants
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetScopes() string {
|
||||
return rcv.Scopes
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
|
||||
func (rcv *PermissionImpl) GetUpdatedAt() *string {
|
||||
return rcv.UpdatedAt
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Profile interface {
|
||||
Model
|
||||
|
||||
GetId() string
|
||||
|
||||
GetSubject() string
|
||||
|
||||
GetController() string
|
||||
|
||||
GetOriginUri() *string
|
||||
|
||||
GetPublicMetadata() *string
|
||||
|
||||
GetPrivateMetadata() *string
|
||||
|
||||
GetCreatedAt() *string
|
||||
|
||||
GetUpdatedAt() *string
|
||||
}
|
||||
|
||||
var _ Profile = (*ProfileImpl)(nil)
|
||||
|
||||
type ProfileImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id string `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty"`
|
||||
|
||||
OriginUri *string `pkl:"originUri" json:"originUri,omitempty"`
|
||||
|
||||
PublicMetadata *string `pkl:"publicMetadata" json:"publicMetadata,omitempty"`
|
||||
|
||||
PrivateMetadata *string `pkl:"privateMetadata" json:"privateMetadata,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetId() string {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetSubject() string {
|
||||
return rcv.Subject
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetController() string {
|
||||
return rcv.Controller
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetOriginUri() *string {
|
||||
return rcv.OriginUri
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetPublicMetadata() *string {
|
||||
return rcv.PublicMetadata
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetPrivateMetadata() *string {
|
||||
return rcv.PrivateMetadata
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
|
||||
func (rcv *ProfileImpl) GetUpdatedAt() *string {
|
||||
return rcv.UpdatedAt
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type Property interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetProfileId() string
|
||||
|
||||
GetKey() string
|
||||
|
||||
GetAccumulator() *pkl.Object
|
||||
|
||||
GetPropertyKey() *pkl.Object
|
||||
}
|
||||
|
||||
var _ Property = (*PropertyImpl)(nil)
|
||||
|
||||
type PropertyImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
ProfileId string `pkl:"profileId" json:"profileId,omitempty"`
|
||||
|
||||
Key string `pkl:"key" json:"key,omitempty"`
|
||||
|
||||
Accumulator *pkl.Object `pkl:"accumulator" json:"accumulator,omitempty"`
|
||||
|
||||
PropertyKey *pkl.Object `pkl:"propertyKey" json:"propertyKey,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *PropertyImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *PropertyImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *PropertyImpl) GetProfileId() string {
|
||||
return rcv.ProfileId
|
||||
}
|
||||
|
||||
func (rcv *PropertyImpl) GetKey() string {
|
||||
return rcv.Key
|
||||
}
|
||||
|
||||
func (rcv *PropertyImpl) GetAccumulator() *pkl.Object {
|
||||
return rcv.Accumulator
|
||||
}
|
||||
|
||||
func (rcv *PropertyImpl) GetPropertyKey() *pkl.Object {
|
||||
return rcv.PropertyKey
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type PublicKey interface {
|
||||
Model
|
||||
|
||||
GetId() uint
|
||||
|
||||
GetRole() int
|
||||
|
||||
GetAlgorithm() int
|
||||
|
||||
GetEncoding() int
|
||||
|
||||
GetRaw() *pkl.Object
|
||||
|
||||
GetHex() string
|
||||
|
||||
GetMultibase() string
|
||||
|
||||
GetJwk() *pkl.Object
|
||||
|
||||
GetCreatedAt() *string
|
||||
}
|
||||
|
||||
var _ PublicKey = (*PublicKeyImpl)(nil)
|
||||
|
||||
type PublicKeyImpl struct {
|
||||
Table string `pkl:"table"`
|
||||
|
||||
Id uint `pkl:"id" gorm:"primaryKey" json:"id,omitempty"`
|
||||
|
||||
Role int `pkl:"role" json:"role,omitempty"`
|
||||
|
||||
Algorithm int `pkl:"algorithm" json:"algorithm,omitempty"`
|
||||
|
||||
Encoding int `pkl:"encoding" json:"encoding,omitempty"`
|
||||
|
||||
Raw *pkl.Object `pkl:"raw" json:"raw,omitempty"`
|
||||
|
||||
Hex string `pkl:"hex" json:"hex,omitempty"`
|
||||
|
||||
Multibase string `pkl:"multibase" json:"multibase,omitempty"`
|
||||
|
||||
Jwk *pkl.Object `pkl:"jwk" json:"jwk,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetTable() string {
|
||||
return rcv.Table
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetId() uint {
|
||||
return rcv.Id
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetRole() int {
|
||||
return rcv.Role
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetAlgorithm() int {
|
||||
return rcv.Algorithm
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetEncoding() int {
|
||||
return rcv.Encoding
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetRaw() *pkl.Object {
|
||||
return rcv.Raw
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetHex() string {
|
||||
return rcv.Hex
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetMultibase() string {
|
||||
return rcv.Multibase
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetJwk() *pkl.Object {
|
||||
return rcv.Jwk
|
||||
}
|
||||
|
||||
func (rcv *PublicKeyImpl) GetCreatedAt() *string {
|
||||
return rcv.CreatedAt
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Sonr interface {
|
||||
Client
|
||||
|
||||
GetRpcUrl() any
|
||||
}
|
||||
|
||||
var _ Sonr = (*SonrImpl)(nil)
|
||||
|
||||
type SonrImpl struct {
|
||||
ChainId string `pkl:"chainId"`
|
||||
|
||||
KeyringBackend string `pkl:"keyringBackend"`
|
||||
|
||||
Output string `pkl:"output"`
|
||||
|
||||
RpcUrl any `pkl:"rpcUrl"`
|
||||
|
||||
BroadcastMode string `pkl:"broadcastMode"`
|
||||
|
||||
ApiUrl string `pkl:"apiUrl"`
|
||||
|
||||
AddressPrefix string `pkl:"addressPrefix"`
|
||||
|
||||
Node string `pkl:"node"`
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetChainId() string {
|
||||
return rcv.ChainId
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetKeyringBackend() string {
|
||||
return rcv.KeyringBackend
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetOutput() string {
|
||||
return rcv.Output
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetRpcUrl() any {
|
||||
return rcv.RpcUrl
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetBroadcastMode() string {
|
||||
return rcv.BroadcastMode
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetApiUrl() string {
|
||||
return rcv.ApiUrl
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetAddressPrefix() string {
|
||||
return rcv.AddressPrefix
|
||||
}
|
||||
|
||||
func (rcv *SonrImpl) GetNode() string {
|
||||
return rcv.Node
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
type Sqlite interface {
|
||||
DB
|
||||
}
|
||||
|
||||
var _ Sqlite = (*SqliteImpl)(nil)
|
||||
|
||||
type SqliteImpl struct {
|
||||
Filename string `pkl:"filename"`
|
||||
}
|
||||
|
||||
func (rcv *SqliteImpl) GetFilename() string {
|
||||
return rcv.Filename
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("vault", Vault{})
|
||||
pkl.RegisterMapping("vault#Sonr", SonrImpl{})
|
||||
pkl.RegisterMapping("vault#Sqlite", SqliteImpl{})
|
||||
pkl.RegisterMapping("vault#Account", AccountImpl{})
|
||||
pkl.RegisterMapping("vault#Asset", AssetImpl{})
|
||||
pkl.RegisterMapping("vault#Chain", ChainImpl{})
|
||||
pkl.RegisterMapping("vault#Credential", CredentialImpl{})
|
||||
pkl.RegisterMapping("vault#Profile", ProfileImpl{})
|
||||
pkl.RegisterMapping("vault#Property", PropertyImpl{})
|
||||
pkl.RegisterMapping("vault#Keyshare", KeyshareImpl{})
|
||||
pkl.RegisterMapping("vault#PublicKey", PublicKeyImpl{})
|
||||
pkl.RegisterMapping("vault#Permission", PermissionImpl{})
|
||||
}
|
||||
@@ -64,6 +64,7 @@ require (
|
||||
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb
|
||||
github.com/cosmos/ibc-go/modules/capability v1.0.0
|
||||
github.com/cosmos/ibc-go/v8 v8.2.0
|
||||
github.com/donseba/go-htmx v1.10.0
|
||||
github.com/go-webauthn/webauthn v0.10.2
|
||||
github.com/golang/protobuf v1.5.4
|
||||
github.com/gorilla/mux v1.8.1
|
||||
@@ -71,12 +72,14 @@ require (
|
||||
github.com/ipfs/boxo v0.21.0
|
||||
github.com/ipfs/kubo v0.29.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/labstack/echo/v4 v4.10.0
|
||||
github.com/labstack/echo-jwt/v4 v4.2.0
|
||||
github.com/labstack/echo/v4 v4.10.2
|
||||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/ncruces/go-sqlite3 v0.18.2
|
||||
github.com/ncruces/go-sqlite3/gormlite v0.18.0
|
||||
github.com/nlepage/go-wasm-http-server v1.1.0
|
||||
github.com/onsonr/crypto v1.23.0
|
||||
github.com/nlepage/go-js-promise v1.0.0
|
||||
github.com/onsonr/crypto v1.28.0
|
||||
github.com/segmentio/ksuid v1.0.4
|
||||
github.com/spf13/cast v1.6.0
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
@@ -85,11 +88,13 @@ require (
|
||||
github.com/strangelove-ventures/poa v0.50.0
|
||||
github.com/strangelove-ventures/tokenfactory v0.50.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
github.com/syumai/workers v0.26.3
|
||||
golang.org/x/crypto v0.26.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4
|
||||
google.golang.org/grpc v1.64.0
|
||||
google.golang.org/protobuf v1.34.2
|
||||
gopkg.in/macaroon-bakery.v2 v2.3.0
|
||||
gopkg.in/macaroon.v2 v2.1.0
|
||||
gorm.io/gorm v1.25.11
|
||||
lukechampine.com/adiantum v1.1.1
|
||||
)
|
||||
@@ -171,6 +176,7 @@ require (
|
||||
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
|
||||
github.com/gogo/googleapis v1.4.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
||||
github.com/golang/glog v1.2.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
@@ -189,6 +195,7 @@ require (
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
||||
github.com/gtank/merlin v0.1.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-getter v1.7.5 // indirect
|
||||
@@ -258,6 +265,7 @@ require (
|
||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/miekg/dns v1.1.61 // indirect
|
||||
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect
|
||||
github.com/minio/highwayhash v1.0.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
@@ -279,7 +287,6 @@ require (
|
||||
github.com/multiformats/go-multistream v0.5.0 // indirect
|
||||
github.com/multiformats/go-varint v0.0.7 // indirect
|
||||
github.com/ncruces/julianday v1.0.0 // indirect
|
||||
github.com/nlepage/go-js-promise v1.0.0 // indirect
|
||||
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
|
||||
github.com/oklog/run v1.1.0 // indirect
|
||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||
@@ -352,7 +359,6 @@ require (
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240617180043-68d350f18fd4 // indirect
|
||||
gopkg.in/errgo.v1 v1.0.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/macaroon.v2 v2.1.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gotest.tools/v3 v3.5.1 // indirect
|
||||
|
||||
@@ -1094,6 +1094,8 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh
|
||||
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||
github.com/donseba/go-htmx v1.10.0 h1:ByeQd8frMPSX38vkjvsprSQ7+xTkHMDrkzBV0ljfYvA=
|
||||
github.com/donseba/go-htmx v1.10.0/go.mod h1:8PTAYvNKf8+QYis+DpAsggKz+sa2qljtMgvdAeNBh5s=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
@@ -1226,6 +1228,8 @@ github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRx
|
||||
github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
|
||||
github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0=
|
||||
github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
@@ -1397,6 +1401,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
|
||||
github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is=
|
||||
github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
|
||||
github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g=
|
||||
github.com/hashicorp/consul/sdk v0.14.1/go.mod h1:vFt03juSzocLRFo59NkeQHHmQa6+g7oU0pfzdI1mUhg=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
@@ -1639,8 +1645,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/labstack/echo/v4 v4.10.0 h1:5CiyngihEO4HXsz3vVsJn7f8xAlWwRr3aY6Ih280ZKA=
|
||||
github.com/labstack/echo/v4 v4.10.0/go.mod h1:S/T/5fy/GigaXnHTkh0ZGe4LpkkQysvRjFMSUTkDRNQ=
|
||||
github.com/labstack/echo-jwt/v4 v4.2.0 h1:odSISV9JgcSCuhgQSV/6Io3i7nUmfM/QkBeR5GVJj5c=
|
||||
github.com/labstack/echo-jwt/v4 v4.2.0/go.mod h1:MA2RqdXdEn4/uEglx0HcUOgQSyBaTh5JcaHIan3biwU=
|
||||
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=
|
||||
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
|
||||
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
|
||||
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
|
||||
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
|
||||
@@ -1741,6 +1749,8 @@ github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUM
|
||||
github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU=
|
||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc=
|
||||
github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s=
|
||||
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0=
|
||||
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
|
||||
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
|
||||
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
|
||||
@@ -1825,8 +1835,6 @@ github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvz
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nlepage/go-js-promise v1.0.0 h1:K7OmJ3+0BgWJ2LfXchg2sI6RDr7AW/KWR8182epFwGQ=
|
||||
github.com/nlepage/go-js-promise v1.0.0/go.mod h1:bdOP0wObXu34euibyK39K1hoBCtlgTKXGc56AGflaRo=
|
||||
github.com/nlepage/go-wasm-http-server v1.1.0 h1:phw2NtSp71m/6NmGjE2veQ41PBPzWFcnE614cKucy5M=
|
||||
github.com/nlepage/go-wasm-http-server v1.1.0/go.mod h1:xpffUeN97vuv8CTlMJ2oC5tPsftfPoG9HkAgI9gkiPI=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY=
|
||||
@@ -1849,8 +1857,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk=
|
||||
github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0=
|
||||
github.com/onsonr/crypto v1.23.0 h1:8YYDwja/tGpRaA2Tcoau3Rw5j1t/RfZkIcVacKIi7dI=
|
||||
github.com/onsonr/crypto v1.23.0/go.mod h1:nPb9pp3n7kMl4/3l2sW3ZJWMU3DQsGoNzyYAqLwL+EY=
|
||||
github.com/onsonr/crypto v1.28.0 h1:IZnWipcqtehohvau065NJSEgS2a2iMeTv2S0KlQ22ns=
|
||||
github.com/onsonr/crypto v1.28.0/go.mod h1:2Ew7gRDlysE9+UXN904nUaJ9bqn6OlpKFMtk/LuTYoc=
|
||||
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
|
||||
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
|
||||
github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI=
|
||||
@@ -2001,6 +2009,8 @@ github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXn
|
||||
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
|
||||
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c=
|
||||
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
@@ -2065,6 +2075,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
|
||||
github.com/syumai/workers v0.26.3 h1:AF+IBaRccbR4JIj2kNJLJblruPFMD/pAbzkopejGcP8=
|
||||
github.com/syumai/workers v0.26.3/go.mod h1:ZnqmdiHNBrbxOLrZ/HJ5jzHy6af9cmiNZk10R9NrIEA=
|
||||
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
|
||||
github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
|
||||
github.com/tetratelabs/wazero v1.8.0 h1:iEKu0d4c2Pd+QSRieYbnQC9yiFlMS9D+Jr0LsRmcF4g=
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsonr/sonr/internal/db/orm"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// createInitialTables creates the initial tables in the database.
|
||||
func createInitialTables(db *gorm.DB) (*DB, error) {
|
||||
err := db.AutoMigrate(
|
||||
&orm.Account{},
|
||||
&orm.Asset{},
|
||||
&orm.Keyshare{},
|
||||
&orm.Credential{},
|
||||
&orm.Profile{},
|
||||
&orm.Property{},
|
||||
&orm.Permission{},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create table: %w", err)
|
||||
}
|
||||
|
||||
return &DB{db}, nil
|
||||
}
|
||||
|
||||
// AddAccount adds a new account to the database
|
||||
func (db *DB) AddAccount(account *orm.Account) error {
|
||||
tx := db.Create(account)
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to add account: %w", tx.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddKeyshare adds a new keyshare to the database
|
||||
func (db *DB) AddKeyshare(keyshare *orm.Keyshare) error {
|
||||
tx := db.Create(keyshare)
|
||||
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to add keyshare: %w", tx.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddCredential adds a new credential to the database
|
||||
func (db *DB) AddCredential(credential *orm.Credential) error {
|
||||
tx := db.Create(credential)
|
||||
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to add credential: %w", tx.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddProfile adds a new profile to the database
|
||||
func (db *DB) AddProfile(profile *orm.Profile) error {
|
||||
tx := db.Create(profile)
|
||||
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to add profile: %w", tx.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddProperty adds a new property to the database
|
||||
func (db *DB) AddProperty(property *orm.Property) error {
|
||||
tx := db.Create(property)
|
||||
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to add property: %w", tx.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddPermission adds a new permission to the database
|
||||
func (db *DB) AddPermission(permission *orm.Permission) error {
|
||||
tx := db.Create(permission)
|
||||
|
||||
if tx.Error != nil {
|
||||
return fmt.Errorf("failed to add permission: %w", tx.Error)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package db
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
type DB struct {
|
||||
*gorm.DB
|
||||
}
|
||||
|
||||
func New(opts ...DBOption) *DBConfig {
|
||||
config := &DBConfig{
|
||||
fileName: "vault.db",
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/ncruces/go-sqlite3"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
)
|
||||
|
||||
type DB struct {
|
||||
*sqlite3.Conn
|
||||
}
|
||||
|
||||
func New(opts ...DBOption) *DBConfig {
|
||||
config := &DBConfig{
|
||||
fileName: "vault.db",
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
func Open(config *DBConfig) (*DB, error) {
|
||||
conn, err := sqlite3.Open(config.ConnectionString())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open database: %w", err)
|
||||
}
|
||||
|
||||
db := &DB{
|
||||
Conn: conn,
|
||||
}
|
||||
|
||||
if err := createTables(db); err != nil {
|
||||
conn.Close()
|
||||
return nil, fmt.Errorf("failed to create tables: %w", err)
|
||||
}
|
||||
return db, nil
|
||||
}
|
||||
|
||||
func createTables(db *DB) error {
|
||||
tables := []string{
|
||||
createAccountsTable,
|
||||
createAssetsTable,
|
||||
createChainsTable,
|
||||
createCredentialsTable,
|
||||
createKeysharesTable,
|
||||
createProfilesTable,
|
||||
createPropertiesTable,
|
||||
createPermissionsTable,
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
err := db.Exec(table)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create table: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AddAccount adds a new account to the database
|
||||
func (db *DB) AddAccount(name, address string) error {
|
||||
return db.Exec(insertAccountQuery(name, address))
|
||||
}
|
||||
|
||||
// AddAsset adds a new asset to the database
|
||||
func (db *DB) AddAsset(name, symbol string, decimals int, chainID int64) error {
|
||||
return db.Exec(insertAssetQuery(name, symbol, decimals, chainID))
|
||||
}
|
||||
|
||||
// AddChain adds a new chain to the database
|
||||
func (db *DB) AddChain(name, networkID string) error {
|
||||
return db.Exec(insertChainQuery(name, networkID))
|
||||
}
|
||||
|
||||
// AddCredential adds a new credential to the database
|
||||
func (db *DB) AddCredential(
|
||||
handle, controller, attestationType, origin string,
|
||||
credentialID, publicKey []byte,
|
||||
transport string,
|
||||
signCount uint32,
|
||||
userPresent, userVerified, backupEligible, backupState, cloneWarning bool,
|
||||
) error {
|
||||
return db.Exec(insertCredentialQuery(
|
||||
handle,
|
||||
controller,
|
||||
attestationType,
|
||||
origin,
|
||||
credentialID,
|
||||
publicKey,
|
||||
transport,
|
||||
signCount,
|
||||
userPresent,
|
||||
userVerified,
|
||||
backupEligible,
|
||||
backupState,
|
||||
cloneWarning,
|
||||
))
|
||||
}
|
||||
|
||||
//
|
||||
// // AddProfile adds a new profile to the database
|
||||
// func (db *DB) AddProfile(
|
||||
// id, subject, controller, originURI string,
|
||||
// publicMetadata, privateMetadata string,
|
||||
// ) error {
|
||||
// return db.statements["insertProfile"].Exec(
|
||||
// id,
|
||||
// subject,
|
||||
// controller,
|
||||
// originURI,
|
||||
// publicMetadata,
|
||||
// privateMetadata,
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// // AddProperty adds a new property to the database
|
||||
// func (db *DB) AddProperty(profileID, key string, accumulator, propertyKey []byte) error {
|
||||
// return db.statements["insertProperty"].Exec(profileID, key, accumulator, propertyKey)
|
||||
// }
|
||||
//
|
||||
// // AddPermission adds a new permission to the database
|
||||
// func (db *DB) AddPermission(
|
||||
// serviceID string,
|
||||
// grants []DIDNamespace,
|
||||
// scopes []PermissionScope,
|
||||
// ) error {
|
||||
// grantsJSON, err := json.Marshal(grants)
|
||||
// if err != nil {
|
||||
// return fmt.Errorf("failed to marshal grants: %w", err)
|
||||
// }
|
||||
//
|
||||
// scopesJSON, err := json.Marshal(scopes)
|
||||
// if err != nil {
|
||||
// return fmt.Errorf("failed to marshal scopes: %w", err)
|
||||
// }
|
||||
//
|
||||
// return db.statements["insertPermission"].Exec(
|
||||
// serviceID,
|
||||
// string(grantsJSON),
|
||||
// string(scopesJSON),
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// // GetPermission retrieves a permission from the database
|
||||
// func (db *DB) GetPermission(serviceID string) ([]DIDNamespace, []PermissionScope, error) {
|
||||
// stmt := db.statements["getPermission"]
|
||||
// if err := stmt.Exec(serviceID); err != nil {
|
||||
// return nil, nil, fmt.Errorf("failed to execute statement: %w", err)
|
||||
// }
|
||||
//
|
||||
// if !stmt.Step() {
|
||||
// return nil, nil, fmt.Errorf("permission not found")
|
||||
// }
|
||||
//
|
||||
// grantsJSON := stmt.ColumnText(0)
|
||||
// scopesJSON := stmt.ColumnText(1)
|
||||
//
|
||||
// var grants []DIDNamespace
|
||||
// err := json.Unmarshal([]byte(grantsJSON), &grants)
|
||||
// if err != nil {
|
||||
// return nil, nil, fmt.Errorf("failed to unmarshal grants: %w", err)
|
||||
// }
|
||||
//
|
||||
// var scopes []PermissionScope
|
||||
// err = json.Unmarshal([]byte(scopesJSON), &scopes)
|
||||
// if err != nil {
|
||||
// return nil, nil, fmt.Errorf("failed to unmarshal scopes: %w", err)
|
||||
// }
|
||||
//
|
||||
// return grants, scopes, nil
|
||||
// }
|
||||
@@ -1,36 +0,0 @@
|
||||
package db
|
||||
|
||||
// DIDNamespace defines the different namespaces of DID
|
||||
type DIDNamespace int
|
||||
|
||||
const (
|
||||
DIDNamespaceUnspecified DIDNamespace = iota
|
||||
DIDNamespaceIPFS
|
||||
DIDNamespaceSonr
|
||||
DIDNamespaceBitcoin
|
||||
DIDNamespaceEthereum
|
||||
DIDNamespaceIBC
|
||||
DIDNamespaceWebauthn
|
||||
DIDNamespaceDWN
|
||||
DIDNamespaceService
|
||||
)
|
||||
|
||||
// PermissionScope defines the Capabilities Controllers can grant for Services
|
||||
type PermissionScope int
|
||||
|
||||
const (
|
||||
PermissionScopeUnspecified PermissionScope = iota
|
||||
PermissionScopeBasicInfo
|
||||
PermissionScopeRecordsRead
|
||||
PermissionScopeRecordsWrite
|
||||
PermissionScopeTransactionsRead
|
||||
PermissionScopeTransactionsWrite
|
||||
PermissionScopeWalletsRead
|
||||
PermissionScopeWalletsCreate
|
||||
PermissionScopeWalletsSubscribe
|
||||
PermissionScopeWalletsUpdate
|
||||
PermissionScopeTransactionsVerify
|
||||
PermissionScopeTransactionsBroadcast
|
||||
PermissionScopeAdminUser
|
||||
PermissionScopeAdminValidator
|
||||
)
|
||||
+9
-22
@@ -4,11 +4,12 @@ import (
|
||||
"crypto/rand"
|
||||
|
||||
"github.com/ncruces/go-sqlite3/gormlite"
|
||||
"github.com/ncruces/go-sqlite3/vfs"
|
||||
"golang.org/x/crypto/argon2"
|
||||
"gorm.io/gorm"
|
||||
"lukechampine.com/adiantum/hbsh"
|
||||
"lukechampine.com/adiantum/hpolyc"
|
||||
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
)
|
||||
|
||||
type DBOption func(config *DBConfig)
|
||||
@@ -19,46 +20,32 @@ func WithDir(dir string) DBOption {
|
||||
}
|
||||
}
|
||||
|
||||
func WithInMemory() DBOption {
|
||||
return func(config *DBConfig) {
|
||||
config.InMemory = true
|
||||
}
|
||||
}
|
||||
|
||||
func WithSecretKey(secretKey string) DBOption {
|
||||
return func(config *DBConfig) {
|
||||
config.SecretKey = secretKey
|
||||
}
|
||||
}
|
||||
|
||||
func WithOpenFlag(flag vfs.OpenFlag) DBOption {
|
||||
return func(config *DBConfig) {
|
||||
config.OpenFlag = flag
|
||||
}
|
||||
}
|
||||
|
||||
type DBConfig struct {
|
||||
Dir string
|
||||
InMemory bool
|
||||
SecretKey string
|
||||
OpenFlag vfs.OpenFlag
|
||||
|
||||
fileName string
|
||||
}
|
||||
|
||||
func (config *DBConfig) ConnectionString() string {
|
||||
connStr := "file:"
|
||||
if config.InMemory {
|
||||
connStr += ":memory:"
|
||||
} else {
|
||||
connStr += config.Dir + "/" + config.fileName
|
||||
}
|
||||
connStr += config.Dir + "/" + config.fileName
|
||||
return connStr
|
||||
}
|
||||
|
||||
// GormDialector creates a gorm dialector for the database.
|
||||
func (config *DBConfig) GormDialector() (*gorm.DB, error) {
|
||||
return gorm.Open(gormlite.Open(config.ConnectionString()))
|
||||
func (config *DBConfig) Open() (*DB, error) {
|
||||
db, err := gorm.Open(gormlite.Open(config.ConnectionString()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return createInitialTables(db)
|
||||
}
|
||||
|
||||
// HBSH creates an HBSH cipher given a key.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Account struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty" param:"name"`
|
||||
|
||||
Address string `pkl:"address" json:"address,omitempty" param:"address"`
|
||||
|
||||
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Asset struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty" param:"name"`
|
||||
|
||||
Symbol string `pkl:"symbol" json:"symbol,omitempty" param:"symbol"`
|
||||
|
||||
Decimals int `pkl:"decimals" json:"decimals,omitempty" param:"decimals"`
|
||||
|
||||
ChainId *int `pkl:"chainId" json:"chainId,omitempty" param:"chainId"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Chain struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty" param:"name"`
|
||||
|
||||
NetworkId string `pkl:"networkId" json:"networkId,omitempty" param:"networkId"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Credential struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty" param:"subject"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty" param:"controller"`
|
||||
|
||||
AttestationType string `pkl:"attestationType" json:"attestationType,omitempty" param:"attestationType"`
|
||||
|
||||
Origin string `pkl:"origin" json:"origin,omitempty" param:"origin"`
|
||||
|
||||
CredentialId string `pkl:"credentialId" json:"credentialId,omitempty" param:"credentialId"`
|
||||
|
||||
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"`
|
||||
|
||||
Transport string `pkl:"transport" json:"transport,omitempty" param:"transport"`
|
||||
|
||||
SignCount uint `pkl:"signCount" json:"signCount,omitempty" param:"signCount"`
|
||||
|
||||
UserPresent bool `pkl:"userPresent" json:"userPresent,omitempty" param:"userPresent"`
|
||||
|
||||
UserVerified bool `pkl:"userVerified" json:"userVerified,omitempty" param:"userVerified"`
|
||||
|
||||
BackupEligible bool `pkl:"backupEligible" json:"backupEligible,omitempty" param:"backupEligible"`
|
||||
|
||||
BackupState bool `pkl:"backupState" json:"backupState,omitempty" param:"backupState"`
|
||||
|
||||
CloneWarning bool `pkl:"cloneWarning" json:"cloneWarning,omitempty" param:"cloneWarning"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"`
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type DiscoveryDocument struct {
|
||||
Issuer string `pkl:"issuer" json:"issuer,omitempty" param:"issuer"`
|
||||
|
||||
AuthorizationEndpoint string `pkl:"authorization_endpoint" json:"authorization_endpoint,omitempty" param:"authorization_endpoint"`
|
||||
|
||||
TokenEndpoint string `pkl:"token_endpoint" json:"token_endpoint,omitempty" param:"token_endpoint"`
|
||||
|
||||
UserinfoEndpoint string `pkl:"userinfo_endpoint" json:"userinfo_endpoint,omitempty" param:"userinfo_endpoint"`
|
||||
|
||||
JwksUri string `pkl:"jwks_uri" json:"jwks_uri,omitempty" param:"jwks_uri"`
|
||||
|
||||
RegistrationEndpoint string `pkl:"registration_endpoint" json:"registration_endpoint,omitempty" param:"registration_endpoint"`
|
||||
|
||||
ScopesSupported []string `pkl:"scopes_supported" json:"scopes_supported,omitempty" param:"scopes_supported"`
|
||||
|
||||
ResponseTypesSupported []string `pkl:"response_types_supported" json:"response_types_supported,omitempty" param:"response_types_supported"`
|
||||
|
||||
ResponseModesSupported []string `pkl:"response_modes_supported" json:"response_modes_supported,omitempty" param:"response_modes_supported"`
|
||||
|
||||
SubjectTypesSupported []string `pkl:"subject_types_supported" json:"subject_types_supported,omitempty" param:"subject_types_supported"`
|
||||
|
||||
IdTokenSigningAlgValuesSupported []string `pkl:"id_token_signing_alg_values_supported" json:"id_token_signing_alg_values_supported,omitempty" param:"id_token_signing_alg_values_supported"`
|
||||
|
||||
ClaimsSupported []string `pkl:"claims_supported" json:"claims_supported,omitempty" param:"claims_supported"`
|
||||
|
||||
GrantTypesSupported []string `pkl:"grant_types_supported" json:"grant_types_supported,omitempty" param:"grant_types_supported"`
|
||||
|
||||
AcrValuesSupported []string `pkl:"acr_values_supported" json:"acr_values_supported,omitempty" param:"acr_values_supported"`
|
||||
|
||||
TokenEndpointAuthMethodsSupported []string `pkl:"token_endpoint_auth_methods_supported" json:"token_endpoint_auth_methods_supported,omitempty" param:"token_endpoint_auth_methods_supported"`
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Keyshare struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Metadata string `pkl:"metadata" json:"metadata,omitempty" param:"metadata"`
|
||||
|
||||
Payloads string `pkl:"payloads" json:"payloads,omitempty" param:"payloads"`
|
||||
|
||||
Protocol string `pkl:"protocol" json:"protocol,omitempty" param:"protocol"`
|
||||
|
||||
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"`
|
||||
|
||||
Role int `pkl:"role" json:"role,omitempty" param:"role"`
|
||||
|
||||
Version int `pkl:"version" json:"version,omitempty" param:"version"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Code generated from Pkl module `vault`. DO NOT EDIT.
|
||||
package vault
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Vault struct {
|
||||
type Orm struct {
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Vault
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Vault, err error) {
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Orm
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Orm, err error) {
|
||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -26,9 +26,9 @@ func LoadFromPath(ctx context.Context, path string) (ret *Vault, err error) {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Vault
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Vault, error) {
|
||||
var ret Vault
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Orm
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Orm, error) {
|
||||
var ret Orm
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Permission struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
ServiceId string `pkl:"serviceId" json:"serviceId,omitempty" param:"serviceId"`
|
||||
|
||||
Grants string `pkl:"grants" json:"grants,omitempty" param:"grants"`
|
||||
|
||||
Scopes string `pkl:"scopes" json:"scopes,omitempty" param:"scopes"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"`
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Profile struct {
|
||||
Id string `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty" param:"subject"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty" param:"controller"`
|
||||
|
||||
OriginUri *string `pkl:"originUri" json:"originUri,omitempty" param:"originUri"`
|
||||
|
||||
PublicMetadata *string `pkl:"publicMetadata" json:"publicMetadata,omitempty" param:"publicMetadata"`
|
||||
|
||||
PrivateMetadata *string `pkl:"privateMetadata" json:"privateMetadata,omitempty" param:"privateMetadata"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Property struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
ProfileId string `pkl:"profileId" json:"profileId,omitempty" param:"profileId"`
|
||||
|
||||
Key string `pkl:"key" json:"key,omitempty" param:"key"`
|
||||
|
||||
Accumulator string `pkl:"accumulator" json:"accumulator,omitempty" param:"accumulator"`
|
||||
|
||||
PropertyKey string `pkl:"propertyKey" json:"propertyKey,omitempty" param:"propertyKey"`
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type PublicKey struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Role int `pkl:"role" json:"role,omitempty" param:"role"`
|
||||
|
||||
Algorithm int `pkl:"algorithm" json:"algorithm,omitempty" param:"algorithm"`
|
||||
|
||||
Encoding int `pkl:"encoding" json:"encoding,omitempty" param:"encoding"`
|
||||
|
||||
Jwk string `pkl:"jwk" json:"jwk,omitempty" param:"jwk"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("orm", Orm{})
|
||||
pkl.RegisterMapping("orm#Account", Account{})
|
||||
pkl.RegisterMapping("orm#Asset", Asset{})
|
||||
pkl.RegisterMapping("orm#Chain", Chain{})
|
||||
pkl.RegisterMapping("orm#Credential", Credential{})
|
||||
pkl.RegisterMapping("orm#Profile", Profile{})
|
||||
pkl.RegisterMapping("orm#Property", Property{})
|
||||
pkl.RegisterMapping("orm#Keyshare", Keyshare{})
|
||||
pkl.RegisterMapping("orm#PublicKey", PublicKey{})
|
||||
pkl.RegisterMapping("orm#Permission", Permission{})
|
||||
pkl.RegisterMapping("orm#DiscoveryDocument", DiscoveryDocument{})
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package db
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Account queries
|
||||
func insertAccountQuery(name, address string) string {
|
||||
return fmt.Sprintf(`INSERT INTO accounts (name, address) VALUES (%s, %s)`, name, address)
|
||||
}
|
||||
|
||||
// Asset queries
|
||||
func insertAssetQuery(name, symbol string, decimals int, chainID int64) string {
|
||||
return fmt.Sprintf(
|
||||
`INSERT INTO assets (name, symbol, decimals, chain_id) VALUES (%s, %s, %d, %d)`,
|
||||
name,
|
||||
symbol,
|
||||
decimals,
|
||||
chainID,
|
||||
)
|
||||
}
|
||||
|
||||
// Chain queries
|
||||
func insertChainQuery(name string, networkID string) string {
|
||||
return fmt.Sprintf(`INSERT INTO chains (name, network_id) VALUES (%s, %s)`, name, networkID)
|
||||
}
|
||||
|
||||
// Credential queries
|
||||
func insertCredentialQuery(
|
||||
handle, controller, attestationType, origin string,
|
||||
credentialID, publicKey []byte,
|
||||
transport string,
|
||||
signCount uint32,
|
||||
userPresent, userVerified, backupEligible, backupState, cloneWarning bool,
|
||||
) string {
|
||||
return fmt.Sprintf(`INSERT INTO credentials (
|
||||
handle, controller, attestation_type, origin,
|
||||
credential_id, public_key, transport, sign_count,
|
||||
user_present, user_verified, backup_eligible,
|
||||
backup_state, clone_warning
|
||||
) VALUES (%s, %s, %s, %s, %s, %s, %s, %d, %t, %t, %t, %t, %t)`,
|
||||
handle, controller, attestationType, origin,
|
||||
credentialID, publicKey, transport, signCount,
|
||||
userPresent, userVerified, backupEligible,
|
||||
backupState, cloneWarning)
|
||||
}
|
||||
|
||||
// Profile queries
|
||||
func insertProfileQuery(
|
||||
id, subject, controller, originURI, publicMetadata, privateMetadata string,
|
||||
) string {
|
||||
return fmt.Sprintf(`INSERT INTO profiles (
|
||||
id, subject, controller, origin_uri,
|
||||
public_metadata, private_metadata
|
||||
) VALUES (%s, %s, %s, %s, %s, %s)`,
|
||||
id, subject, controller, originURI,
|
||||
publicMetadata, privateMetadata)
|
||||
}
|
||||
|
||||
// Property queries
|
||||
func insertPropertyQuery(profileID, key, accumulator, propertyKey string) string {
|
||||
return fmt.Sprintf(`INSERT INTO properties (
|
||||
profile_id, key, accumulator, property_key
|
||||
) VALUES (%s, %s, %s, %s)`,
|
||||
profileID, key, accumulator, propertyKey)
|
||||
}
|
||||
|
||||
// Permission queries
|
||||
func insertPermissionQuery(serviceID, grants, scopes string) string {
|
||||
return fmt.Sprintf(
|
||||
`INSERT INTO permissions (service_id, grants, scopes) VALUES (%s, %s, %s)`,
|
||||
serviceID,
|
||||
grants,
|
||||
scopes,
|
||||
)
|
||||
}
|
||||
|
||||
// GetPermission query
|
||||
func getPermissionQuery(serviceID string) string {
|
||||
return fmt.Sprintf(`SELECT grants, scopes FROM permissions WHERE service_id = %s`, serviceID)
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package db
|
||||
|
||||
const (
|
||||
createAccountsTable = `
|
||||
CREATE TABLE IF NOT EXISTS accounts (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
address TEXT NOT NULL UNIQUE,
|
||||
public_key BLOB NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`
|
||||
|
||||
createAssetsTable = `
|
||||
CREATE TABLE IF NOT EXISTS assets (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
symbol TEXT NOT NULL,
|
||||
decimals INTEGER NOT NULL,
|
||||
chain_id INTEGER,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (chain_id) REFERENCES chains(id)
|
||||
)
|
||||
`
|
||||
|
||||
createChainsTable = `
|
||||
CREATE TABLE IF NOT EXISTS chains (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
network_id TEXT NOT NULL UNIQUE,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`
|
||||
|
||||
createCredentialsTable = `
|
||||
CREATE TABLE IF NOT EXISTS credentials (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
handle TEXT NOT NULL,
|
||||
controller TEXT NOT NULL,
|
||||
attestation_type TEXT NOT NULL,
|
||||
origin TEXT NOT NULL,
|
||||
credential_id BLOB NOT NULL,
|
||||
public_key BLOB NOT NULL,
|
||||
transport TEXT NOT NULL,
|
||||
sign_count INTEGER NOT NULL,
|
||||
user_present BOOLEAN NOT NULL,
|
||||
user_verified BOOLEAN NOT NULL,
|
||||
backup_eligible BOOLEAN NOT NULL,
|
||||
backup_state BOOLEAN NOT NULL,
|
||||
clone_warning BOOLEAN NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`
|
||||
|
||||
createProfilesTable = `
|
||||
CREATE TABLE IF NOT EXISTS profiles (
|
||||
id TEXT PRIMARY KEY,
|
||||
subject TEXT NOT NULL,
|
||||
controller TEXT NOT NULL,
|
||||
origin_uri TEXT,
|
||||
public_metadata TEXT,
|
||||
private_metadata TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`
|
||||
|
||||
createPropertiesTable = `
|
||||
CREATE TABLE IF NOT EXISTS properties (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
profile_id TEXT NOT NULL,
|
||||
key TEXT NOT NULL,
|
||||
accumulator BLOB NOT NULL,
|
||||
property_key BLOB NOT NULL,
|
||||
FOREIGN KEY (profile_id) REFERENCES profiles(id)
|
||||
)
|
||||
`
|
||||
|
||||
createKeysharesTable = `
|
||||
CREATE TABLE IF NOT EXISTS keyshares (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
metadata TEXT NOT NULL,
|
||||
payloads TEXT NOT NULL,
|
||||
protocol TEXT NOT NULL,
|
||||
public_key BLOB NOT NULL,
|
||||
role INTEGER NOT NULL,
|
||||
version INTEGER NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
`
|
||||
|
||||
createPermissionsTable = `
|
||||
CREATE TABLE IF NOT EXISTS permissions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
service_id TEXT NOT NULL,
|
||||
grants TEXT NOT NULL,
|
||||
scopes TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (service_id) REFERENCES services(id)
|
||||
)
|
||||
`
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package front
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewServeFrontendCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "serve-web",
|
||||
Short: "TUI for managing the local Sonr validator node",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
e := echo.New()
|
||||
if err := e.Start(":42069"); err != http.ErrServerClosed {
|
||||
log.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
package handlers
|
||||
@@ -1 +0,0 @@
|
||||
package handlers
|
||||
@@ -1 +0,0 @@
|
||||
package handlers
|
||||
@@ -1 +0,0 @@
|
||||
package handlers
|
||||
@@ -1 +0,0 @@
|
||||
package routes
|
||||
@@ -1 +0,0 @@
|
||||
package routes
|
||||
@@ -0,0 +1,67 @@
|
||||
package elements
|
||||
|
||||
func Alert(variant Variant, icon Icon, title, message string) templ.Component {
|
||||
return alertElement(variant.Attributes(), title, message, icon.Render())
|
||||
}
|
||||
|
||||
templ alertElement(attrs templ.Attributes, title, message string, icon templ.Component) {
|
||||
<div { attrs... }>
|
||||
@icon
|
||||
<h5 class="mb-1 font-medium leading-none tracking-tight">{ title }</h5>
|
||||
<div class="text-sm opacity-70">{ message }</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
type AlertVariant int
|
||||
|
||||
const (
|
||||
AlertVariant_Default AlertVariant = iota
|
||||
AlertVariant_Info
|
||||
AlertVariant_Error
|
||||
AlertVariant_Success
|
||||
AlertVariant_Warning
|
||||
AlertVariant_Subtle_Info
|
||||
AlertVariant_Subtle_Error
|
||||
AlertVariant_Subtle_Success
|
||||
AlertVariant_Subtle_Warning
|
||||
)
|
||||
|
||||
func (v AlertVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case AlertVariant_Info:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-blue-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Error:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-red-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Success:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-green-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Warning:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-yellow-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Subtle_Info:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-blue-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-blue-600",
|
||||
}
|
||||
case AlertVariant_Subtle_Error:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-red-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-red-600",
|
||||
}
|
||||
case AlertVariant_Subtle_Success:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-green-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-green-600",
|
||||
}
|
||||
case AlertVariant_Subtle_Warning:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-yellow-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-yellow-600",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border bg-white p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-neutral-900",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
func Alert(variant Variant, icon Icon, title, message string) templ.Component {
|
||||
return alertElement(variant.Attributes(), title, message, icon.Render())
|
||||
}
|
||||
|
||||
func alertElement(attrs templ.Attributes, title, message string, icon templ.Component) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = icon.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h5 class=\"mb-1 font-medium leading-none tracking-tight\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/alert.templ`, Line: 10, Col: 66}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h5><div class=\"text-sm opacity-70\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(message)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/alert.templ`, Line: 11, Col: 43}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
type AlertVariant int
|
||||
|
||||
const (
|
||||
AlertVariant_Default AlertVariant = iota
|
||||
AlertVariant_Info
|
||||
AlertVariant_Error
|
||||
AlertVariant_Success
|
||||
AlertVariant_Warning
|
||||
AlertVariant_Subtle_Info
|
||||
AlertVariant_Subtle_Error
|
||||
AlertVariant_Subtle_Success
|
||||
AlertVariant_Subtle_Warning
|
||||
)
|
||||
|
||||
func (v AlertVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case AlertVariant_Info:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-blue-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Error:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-red-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Success:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-green-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Warning:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-yellow-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
|
||||
}
|
||||
case AlertVariant_Subtle_Info:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-blue-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-blue-600",
|
||||
}
|
||||
case AlertVariant_Subtle_Error:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-red-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-red-600",
|
||||
}
|
||||
case AlertVariant_Subtle_Success:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-green-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-green-600",
|
||||
}
|
||||
case AlertVariant_Subtle_Warning:
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border border-transparent bg-yellow-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-yellow-600",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "relative w-full rounded-lg border bg-white p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-neutral-900",
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,5 @@
|
||||
package elements
|
||||
|
||||
templ Animation() {
|
||||
<lottie-player src="https://assets5.lottiefiles.com/packages/lf20_0c0a2a8a.json" background="transparent" speed="1" style="width: 100%; height: 100%;" loop autoplay></lottie-player>
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package main
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
func VaultIndex() templ.Component {
|
||||
func Animation() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
@@ -26,7 +26,7 @@ func VaultIndex() templ.Component {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Sonr Vault</title><script>\n navigator.serviceWorker.register({ swPath });\n\n // Skip installed stage and jump to activating stage\n addEventListener(\"install\", (event) => {\n event.waitUntil(skipWaiting());\n });\n\n // Start controlling clients as soon as the SW is activated\n addEventListener(\"activate\", (event) => {\n event.waitUntil(clients.claim());\n });\n </script></head><body><h1>Sonr Vault</h1></body></html>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<lottie-player src=\"https://assets5.lottiefiles.com/packages/lf20_0c0a2a8a.json\" background=\"transparent\" speed=\"1\" style=\"width: 100%; height: 100%;\" loop autoplay></lottie-player>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package elements
|
||||
|
||||
func Button(variant Variant) templ.Component {
|
||||
return renderButton(variant.Attributes())
|
||||
}
|
||||
|
||||
templ renderButton(attrs templ.Attributes) {
|
||||
<button { attrs... }>
|
||||
{ children... }
|
||||
</button>
|
||||
}
|
||||
|
||||
type ButtonVariant int
|
||||
|
||||
const (
|
||||
ButtonVariantDefault ButtonVariant = iota
|
||||
ButtonVariantPrimary
|
||||
ButtonVariantInfo
|
||||
ButtonVariantError
|
||||
ButtonVariantSuccess
|
||||
ButtonVariantWarning
|
||||
)
|
||||
|
||||
func (v ButtonVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case ButtonVariantPrimary:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantInfo:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantError:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantSuccess:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantWarning:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
|
||||
type SubtleButtonVariant int
|
||||
|
||||
const (
|
||||
SubtleButtonVariantDefault SubtleButtonVariant = iota
|
||||
SubtleButtonVariantInfo
|
||||
SubtleButtonVariantError
|
||||
SubtleButtonVariantSuccess
|
||||
SubtleButtonVariantWarning
|
||||
)
|
||||
|
||||
func (v SubtleButtonVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case SubtleButtonVariantInfo:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100",
|
||||
"type": "button",
|
||||
}
|
||||
case SubtleButtonVariantError:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100",
|
||||
"type": "button",
|
||||
}
|
||||
case SubtleButtonVariantSuccess:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100",
|
||||
"type": "button",
|
||||
}
|
||||
case SubtleButtonVariantWarning:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
|
||||
type OutlineButtonVariant int
|
||||
|
||||
const (
|
||||
OutlineButtonVariantDefault OutlineButtonVariant = iota
|
||||
OutlineButtonVariantInfo
|
||||
OutlineButtonVariantError
|
||||
OutlineButtonVariantSuccess
|
||||
OutlineButtonVariantWarning
|
||||
)
|
||||
|
||||
func (v OutlineButtonVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case OutlineButtonVariantInfo:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600",
|
||||
"type": "button",
|
||||
}
|
||||
case OutlineButtonVariantError:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600",
|
||||
"type": "button",
|
||||
}
|
||||
case OutlineButtonVariantSuccess:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600",
|
||||
"type": "button",
|
||||
}
|
||||
case OutlineButtonVariantWarning:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
func Button(variant Variant) templ.Component {
|
||||
return renderButton(variant.Attributes())
|
||||
}
|
||||
|
||||
func renderButton(attrs templ.Attributes) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
type ButtonVariant int
|
||||
|
||||
const (
|
||||
ButtonVariantDefault ButtonVariant = iota
|
||||
ButtonVariantPrimary
|
||||
ButtonVariantInfo
|
||||
ButtonVariantError
|
||||
ButtonVariantSuccess
|
||||
ButtonVariantWarning
|
||||
)
|
||||
|
||||
func (v ButtonVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case ButtonVariantPrimary:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantInfo:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantError:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantSuccess:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
case ButtonVariantWarning:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
|
||||
type SubtleButtonVariant int
|
||||
|
||||
const (
|
||||
SubtleButtonVariantDefault SubtleButtonVariant = iota
|
||||
SubtleButtonVariantInfo
|
||||
SubtleButtonVariantError
|
||||
SubtleButtonVariantSuccess
|
||||
SubtleButtonVariantWarning
|
||||
)
|
||||
|
||||
func (v SubtleButtonVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case SubtleButtonVariantInfo:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100",
|
||||
"type": "button",
|
||||
}
|
||||
case SubtleButtonVariantError:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100",
|
||||
"type": "button",
|
||||
}
|
||||
case SubtleButtonVariantSuccess:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100",
|
||||
"type": "button",
|
||||
}
|
||||
case SubtleButtonVariantWarning:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
|
||||
type OutlineButtonVariant int
|
||||
|
||||
const (
|
||||
OutlineButtonVariantDefault OutlineButtonVariant = iota
|
||||
OutlineButtonVariantInfo
|
||||
OutlineButtonVariantError
|
||||
OutlineButtonVariantSuccess
|
||||
OutlineButtonVariantWarning
|
||||
)
|
||||
|
||||
func (v OutlineButtonVariant) Attributes() templ.Attributes {
|
||||
switch v {
|
||||
case OutlineButtonVariantInfo:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600",
|
||||
"type": "button",
|
||||
}
|
||||
case OutlineButtonVariantError:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600",
|
||||
"type": "button",
|
||||
}
|
||||
case OutlineButtonVariantSuccess:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600",
|
||||
"type": "button",
|
||||
}
|
||||
case OutlineButtonVariantWarning:
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900",
|
||||
"type": "button",
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,17 @@
|
||||
package elements
|
||||
|
||||
func Card(size Size) templ.Component {
|
||||
return renderCard(size.CardAttributes())
|
||||
}
|
||||
|
||||
templ renderCard(attrs templ.Attributes) {
|
||||
<div { attrs... }>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12 space-3">
|
||||
{ children... }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
func Card(size Size) templ.Component {
|
||||
return renderCard(size.CardAttributes())
|
||||
}
|
||||
|
||||
func renderCard(attrs templ.Attributes) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("><div class=\"container\"><div class=\"row\"><div class=\"col-md-12 space-3\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,37 @@
|
||||
package elements
|
||||
|
||||
templ Layout(title string) {
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@defaultStyles()
|
||||
<title>{ title }</title>
|
||||
</head>
|
||||
<body class="flex items-center justify-center h-full bg-gray-50 lg:p-24">
|
||||
<main class="flex items-center justify-center w-full max-w-full">
|
||||
<div id="view">
|
||||
{ children... }
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
|
||||
templ Spacer() {
|
||||
<br/>
|
||||
}
|
||||
|
||||
templ ServiceWorker(path string) {
|
||||
<script>
|
||||
navigator.serviceWorker.register({ path })
|
||||
</script>
|
||||
}
|
||||
|
||||
templ defaultStyles() {
|
||||
<meta charset="UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<style>[x-cloak]{display:none}</style>
|
||||
<script src="https://unpkg.com/alpinejs" defer></script>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
func Layout(title string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html><head>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = defaultStyles().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<title>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/global.templ`, Line: 8, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title></head><body class=\"flex items-center justify-center h-full bg-gray-50 lg:p-24\"><main class=\"flex items-center justify-center w-full max-w-full\"><div id=\"view\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></main></body></html>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Spacer() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func ServiceWorker(path string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\n\t navigator.serviceWorker.register({ path })\n </script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func defaultStyles() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var5 == nil {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<meta charset=\"UTF-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><style>[x-cloak]{display:none}</style><script src=\"https://unpkg.com/alpinejs\" defer></script><script src=\"https://cdn.tailwindcss.com\"></script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,28 @@
|
||||
package elements
|
||||
|
||||
type Icons int
|
||||
|
||||
const (
|
||||
Icons_Info Icons = iota
|
||||
Icons_Error
|
||||
Icons_Success
|
||||
Icons_Warning
|
||||
)
|
||||
|
||||
func (v Icons) Render() templ.Component {
|
||||
return renderIconVariant(v)
|
||||
}
|
||||
|
||||
templ renderIconVariant(v Icons) {
|
||||
switch v {
|
||||
case Icons_Info:
|
||||
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg>
|
||||
case Icons_Error:
|
||||
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"></path></svg>
|
||||
case Icons_Success:
|
||||
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
|
||||
case Icons_Warning:
|
||||
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path></svg>
|
||||
}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
type Icons int
|
||||
|
||||
const (
|
||||
Icons_Info Icons = iota
|
||||
Icons_Error
|
||||
Icons_Success
|
||||
Icons_Warning
|
||||
)
|
||||
|
||||
func (v Icons) Render() templ.Component {
|
||||
return renderIconVariant(v)
|
||||
}
|
||||
|
||||
func renderIconVariant(v Icons) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
switch v {
|
||||
case Icons_Info:
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z\"></path></svg> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
case Icons_Error:
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z\"></path></svg> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
case Icons_Success:
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"></path></svg> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
case Icons_Warning:
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z\"></path></svg> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-chevron-right\"><polyline points=\"9 18 15 12 9 6\"></polyline></svg>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,61 @@
|
||||
package elements
|
||||
|
||||
type Size int
|
||||
|
||||
const (
|
||||
SizeDefault Size = iota
|
||||
SizeSmall
|
||||
SizeMedium
|
||||
SizeLarge
|
||||
)
|
||||
|
||||
func (s Size) CardAttributes() templ.Attributes {
|
||||
switch s {
|
||||
case SizeSmall:
|
||||
return templ.Attributes{
|
||||
"class": "max-w-md bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
|
||||
}
|
||||
case SizeLarge:
|
||||
return templ.Attributes{
|
||||
"class": "max-w-xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "max-w-lg bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
|
||||
}
|
||||
}
|
||||
|
||||
func (s Size) SvgAttributes() templ.Attributes {
|
||||
switch s {
|
||||
case SizeSmall:
|
||||
return templ.Attributes{
|
||||
"height": "16",
|
||||
"width": "16",
|
||||
}
|
||||
case SizeLarge:
|
||||
return templ.Attributes{
|
||||
"height": "32",
|
||||
"width": "32",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"height": "24",
|
||||
"width": "24",
|
||||
}
|
||||
}
|
||||
|
||||
func (s Size) TextAttributes() templ.Attributes {
|
||||
switch s {
|
||||
case SizeSmall:
|
||||
return templ.Attributes{
|
||||
"class": "text-sm",
|
||||
}
|
||||
case SizeLarge:
|
||||
return templ.Attributes{
|
||||
"class": "text-lg",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "text-md",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
type Size int
|
||||
|
||||
const (
|
||||
SizeDefault Size = iota
|
||||
SizeSmall
|
||||
SizeMedium
|
||||
SizeLarge
|
||||
)
|
||||
|
||||
func (s Size) CardAttributes() templ.Attributes {
|
||||
switch s {
|
||||
case SizeSmall:
|
||||
return templ.Attributes{
|
||||
"class": "max-w-md bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
|
||||
}
|
||||
case SizeLarge:
|
||||
return templ.Attributes{
|
||||
"class": "max-w-xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "max-w-lg bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
|
||||
}
|
||||
}
|
||||
|
||||
func (s Size) SvgAttributes() templ.Attributes {
|
||||
switch s {
|
||||
case SizeSmall:
|
||||
return templ.Attributes{
|
||||
"height": "16",
|
||||
"width": "16",
|
||||
}
|
||||
case SizeLarge:
|
||||
return templ.Attributes{
|
||||
"height": "32",
|
||||
"width": "32",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"height": "24",
|
||||
"width": "24",
|
||||
}
|
||||
}
|
||||
|
||||
func (s Size) TextAttributes() templ.Attributes {
|
||||
switch s {
|
||||
case SizeSmall:
|
||||
return templ.Attributes{
|
||||
"class": "text-sm",
|
||||
}
|
||||
case SizeLarge:
|
||||
return templ.Attributes{
|
||||
"class": "text-lg",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "text-md",
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,124 @@
|
||||
package elements
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Text(content string, options ...Variant) templ.Component {
|
||||
if err := ValidTextVariants(options...); err != nil {
|
||||
return renderParagraph(clsxMerge(TextSizeDefault, TextStyleDefault), content)
|
||||
}
|
||||
return renderParagraph(clsxMerge(options...), content)
|
||||
}
|
||||
|
||||
func ValidTextVariants(variants ...Variant) error {
|
||||
for _, v := range variants {
|
||||
switch v.(type) {
|
||||
case TextSize:
|
||||
case TextStyle:
|
||||
default:
|
||||
return fmt.Errorf("invalid text variant: %v", v)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
templ renderHeading(attrs templ.Attributes, text string) {
|
||||
<h1 { attrs... }>
|
||||
{ text }
|
||||
</h1>
|
||||
}
|
||||
|
||||
templ renderParagraph(attrs templ.Attributes, text string) {
|
||||
<p { attrs... }>
|
||||
{ text }
|
||||
</p>
|
||||
}
|
||||
|
||||
templ renderLink(attrs templ.Attributes, text string) {
|
||||
<a { attrs... }>
|
||||
{ text }
|
||||
</a>
|
||||
}
|
||||
|
||||
templ renderStrong(attrs templ.Attributes, text string) {
|
||||
<strong { attrs... }>
|
||||
{ text }
|
||||
</strong>
|
||||
}
|
||||
|
||||
templ renderEmphasis(attrs templ.Attributes, text string) {
|
||||
<em { attrs... }>
|
||||
{ text }
|
||||
</em>
|
||||
}
|
||||
|
||||
templ renderCode(attrs templ.Attributes, text string) {
|
||||
<code { attrs... }>
|
||||
{ text }
|
||||
</code>
|
||||
}
|
||||
|
||||
type TextSize int
|
||||
|
||||
const (
|
||||
TextSizeDefault TextSize = iota
|
||||
TextSizeSmall
|
||||
TextSizeMedium
|
||||
TextSizeLarge
|
||||
)
|
||||
|
||||
func (s TextSize) Attributes() templ.Attributes {
|
||||
switch s {
|
||||
case TextSizeSmall:
|
||||
return templ.Attributes{
|
||||
"class": "text-sm",
|
||||
}
|
||||
case TextSizeLarge:
|
||||
return templ.Attributes{
|
||||
"class": "text-xl",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "text-md",
|
||||
}
|
||||
}
|
||||
|
||||
type TextStyle int
|
||||
|
||||
const (
|
||||
TextStyleDefault TextStyle = iota
|
||||
TextStyleHeading
|
||||
TextStyleParagraph
|
||||
TextStyleLink
|
||||
TextStyleStrong
|
||||
TextStyleEmphasis
|
||||
TextStyleCode
|
||||
)
|
||||
|
||||
func (s TextStyle) Attributes() templ.Attributes {
|
||||
switch s {
|
||||
case TextStyleHeading:
|
||||
return templ.Attributes{
|
||||
"class": "text-xl font-bold text-xl",
|
||||
}
|
||||
case TextStyleParagraph:
|
||||
return templ.Attributes{
|
||||
"class": "text-base font-normal",
|
||||
}
|
||||
case TextStyleLink:
|
||||
return templ.Attributes{
|
||||
"class": "text-blue-600 font-medium underline",
|
||||
}
|
||||
case TextStyleStrong:
|
||||
return templ.Attributes{
|
||||
"class": "font-semibold text-md",
|
||||
}
|
||||
case TextStyleCode:
|
||||
return templ.Attributes{
|
||||
"class": "text-stone-800 font-mono",
|
||||
}
|
||||
default:
|
||||
return templ.Attributes{
|
||||
"class": "text-base font-normal text-md",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,380 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Text(content string, options ...Variant) templ.Component {
|
||||
if err := ValidTextVariants(options...); err != nil {
|
||||
return renderParagraph(clsxMerge(TextSizeDefault, TextStyleDefault), content)
|
||||
}
|
||||
return renderParagraph(clsxMerge(options...), content)
|
||||
}
|
||||
|
||||
func ValidTextVariants(variants ...Variant) error {
|
||||
for _, v := range variants {
|
||||
switch v.(type) {
|
||||
case TextSize:
|
||||
case TextStyle:
|
||||
default:
|
||||
return fmt.Errorf("invalid text variant: %v", v)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func renderHeading(attrs templ.Attributes, text string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h1")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/text.templ`, Line: 26, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h1>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func renderParagraph(attrs templ.Attributes, text string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/text.templ`, Line: 32, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func renderLink(attrs templ.Attributes, text string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var5 == nil {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/text.templ`, Line: 38, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func renderStrong(attrs templ.Attributes, text string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var7 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var7 == nil {
|
||||
templ_7745c5c3_Var7 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<strong")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/text.templ`, Line: 44, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</strong>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func renderEmphasis(attrs templ.Attributes, text string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var9 == nil {
|
||||
templ_7745c5c3_Var9 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<em")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/text.templ`, Line: 50, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</em>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func renderCode(attrs templ.Attributes, text string) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var11 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var11 == nil {
|
||||
templ_7745c5c3_Var11 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<code")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/text.templ`, Line: 56, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</code>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
type TextSize int
|
||||
|
||||
const (
|
||||
TextSizeDefault TextSize = iota
|
||||
TextSizeSmall
|
||||
TextSizeMedium
|
||||
TextSizeLarge
|
||||
)
|
||||
|
||||
func (s TextSize) Attributes() templ.Attributes {
|
||||
switch s {
|
||||
case TextSizeSmall:
|
||||
return templ.Attributes{
|
||||
"class": "text-sm",
|
||||
}
|
||||
case TextSizeLarge:
|
||||
return templ.Attributes{
|
||||
"class": "text-xl",
|
||||
}
|
||||
}
|
||||
return templ.Attributes{
|
||||
"class": "text-md",
|
||||
}
|
||||
}
|
||||
|
||||
type TextStyle int
|
||||
|
||||
const (
|
||||
TextStyleDefault TextStyle = iota
|
||||
TextStyleHeading
|
||||
TextStyleParagraph
|
||||
TextStyleLink
|
||||
TextStyleStrong
|
||||
TextStyleEmphasis
|
||||
TextStyleCode
|
||||
)
|
||||
|
||||
func (s TextStyle) Attributes() templ.Attributes {
|
||||
switch s {
|
||||
case TextStyleHeading:
|
||||
return templ.Attributes{
|
||||
"class": "text-xl font-bold text-xl",
|
||||
}
|
||||
case TextStyleParagraph:
|
||||
return templ.Attributes{
|
||||
"class": "text-base font-normal",
|
||||
}
|
||||
case TextStyleLink:
|
||||
return templ.Attributes{
|
||||
"class": "text-blue-600 font-medium underline",
|
||||
}
|
||||
case TextStyleStrong:
|
||||
return templ.Attributes{
|
||||
"class": "font-semibold text-md",
|
||||
}
|
||||
case TextStyleCode:
|
||||
return templ.Attributes{
|
||||
"class": "text-stone-800 font-mono",
|
||||
}
|
||||
default:
|
||||
return templ.Attributes{
|
||||
"class": "text-base font-normal text-md",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,37 @@
|
||||
package elements
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
)
|
||||
|
||||
type Icon interface {
|
||||
Render() templ.Component
|
||||
}
|
||||
|
||||
type Variant interface {
|
||||
Attributes() templ.Attributes
|
||||
}
|
||||
|
||||
func clsxMerge(variants ...Variant) templ.Attributes {
|
||||
combinedAttrs := templ.Attributes{}
|
||||
var classElements []string
|
||||
|
||||
for _, variant := range variants {
|
||||
attrs := variant.Attributes()
|
||||
if class, ok := attrs["class"].(string); ok {
|
||||
classElements = append(classElements, strings.Fields(class)...)
|
||||
}
|
||||
for key, value := range attrs {
|
||||
if key != "class" {
|
||||
combinedAttrs[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(classElements) > 0 {
|
||||
combinedAttrs["class"] = strings.Join(classElements, " ")
|
||||
}
|
||||
return combinedAttrs
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func HomeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderHomeView())
|
||||
}
|
||||
|
||||
templ renderHomeView() {
|
||||
@elements.Layout("Sonr.ID") {
|
||||
@elements.Card(elements.SizeMedium) {
|
||||
@elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading)
|
||||
@elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph)
|
||||
@elements.Spacer()
|
||||
@elements.Button(elements.ButtonVariantPrimary) {
|
||||
@elements.Text("Get Started", elements.TextSizeMedium, elements.TextStyleParagraph)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package views
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func HomeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderHomeView())
|
||||
}
|
||||
|
||||
func renderHomeView() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Get Started", elements.TextSizeMedium, elements.TextStyleParagraph).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Button(elements.ButtonVariantPrimary).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card(elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,23 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func LoginView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderLoginView())
|
||||
}
|
||||
|
||||
templ renderLoginView() {
|
||||
@elements.Layout("Sonr.ID") {
|
||||
@elements.Card(elements.SizeMedium) {
|
||||
@elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading)
|
||||
@elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph)
|
||||
@elements.Spacer()
|
||||
@elements.Button(elements.ButtonVariantPrimary) {
|
||||
@elements.Text("Login", elements.TextSizeMedium, elements.TextStyleParagraph)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package views
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func LoginView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderLoginView())
|
||||
}
|
||||
|
||||
func renderLoginView() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Login", elements.TextSizeMedium, elements.TextStyleParagraph).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Button(elements.ButtonVariantPrimary).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card(elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,19 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func AuthorizeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderAuthorizeView())
|
||||
}
|
||||
|
||||
templ renderAuthorizeView() {
|
||||
@elements.Layout("Login | Sonr.ID") {
|
||||
@elements.Card(elements.SizeMedium) {
|
||||
@elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading)
|
||||
@elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package views
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func AuthorizeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderAuthorizeView())
|
||||
}
|
||||
|
||||
func renderAuthorizeView() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card(elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,33 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func RegisterView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderRegisterView())
|
||||
}
|
||||
|
||||
templ renderRegisterView() {
|
||||
@elements.Layout("Register | Sonr.ID") {
|
||||
@elements.Card(elements.SizeMedium) {
|
||||
@elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading)
|
||||
@elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph)
|
||||
}
|
||||
@elements.Card(elements.SizeMedium) {
|
||||
<h1>Welcome to Neo-tree</h1>
|
||||
<p>Neo-tree is a file manager for NeoFS.</p>
|
||||
}
|
||||
@elements.Card(elements.SizeMedium) {
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1>Welcome to Neo-tree</h1>
|
||||
<p>Neo-tree is a file manager for NeoFS.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package views
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gui/elements"
|
||||
)
|
||||
|
||||
func RegisterView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderRegisterView())
|
||||
}
|
||||
|
||||
func renderRegisterView() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Sonr.ID", elements.TextSizeLarge, elements.TextStyleHeading).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.", elements.TextSizeMedium, elements.TextStyleParagraph).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card(elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h1>Welcome to Neo-tree</h1><p>Neo-tree is a file manager for NeoFS.</p>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card(elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var5 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"container\"><div class=\"row\"><div class=\"col-md-12\"><h1>Welcome to Neo-tree</h1><p>Neo-tree is a file manager for NeoFS.</p></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card(elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Layout("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,27 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// render renders a templ.Component
|
||||
func echoComponentResponse(c echo.Context, cmp templ.Component) error {
|
||||
// Create a buffer to store the rendered HTML
|
||||
buf := &bytes.Buffer{}
|
||||
|
||||
// Render the component to the buffer
|
||||
err := cmp.Render(c.Request().Context(), buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set the content type
|
||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
|
||||
|
||||
// Write the buffered content to the response
|
||||
_, err = c.Response().Write(buf.Bytes())
|
||||
return err
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package ipfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotInitialized = fmt.Errorf("IPFS client not initialized")
|
||||
ErrNotMounted = fmt.Errorf("IPFS client not mounted")
|
||||
ErrCIDNotFound = fmt.Errorf("CID not found")
|
||||
ErrIPNSNotFound = fmt.Errorf("IPNS not found")
|
||||
ErrInternal = fmt.Errorf("internal error")
|
||||
)
|
||||
|
||||
type FileSystem interface {
|
||||
// NewFile initializes a File on the specified volume at path 'absFilePath'.
|
||||
//
|
||||
// * Accepts volume and an absolute file path.
|
||||
// * Upon success, a vfs.File, representing the file's new path (location path + file relative path), will be returned.
|
||||
// * On error, nil is returned for the file.
|
||||
// * Note that not all file systems will have a "volume" and will therefore be "":
|
||||
// file:///path/to/file has a volume of "" and name /path/to/file
|
||||
// whereas
|
||||
// s3://mybucket/path/to/file has a volume of "mybucket and name /path/to/file
|
||||
// results in /tmp/dir1/newerdir/file.txt for the final vfs.File path.
|
||||
// * The file may or may not already exist.
|
||||
NewFile(volume string, absFilePath string) (File, error)
|
||||
|
||||
// Name returns the name of the FileSystem ie: Amazon S3, os, Google Cloud Storage, etc.
|
||||
Name() string
|
||||
}
|
||||
|
||||
type File interface {
|
||||
io.Closer
|
||||
io.Reader
|
||||
io.Seeker
|
||||
io.Writer
|
||||
fmt.Stringer
|
||||
|
||||
// Exists returns boolean if the file exists on the file system. Returns an error, if any.
|
||||
Exists() (bool, error)
|
||||
|
||||
// CopyToFile will copy the current file to the provided file instance.
|
||||
//
|
||||
// * In the case of an error, nil is returned for the file.
|
||||
// * CopyToLocation should use native functions when possible within the same scheme.
|
||||
// * If the file already exists, the contents will be overwritten with the current file's contents.
|
||||
// * CopyToFile will Close both the source and target Files which therefore can't be appended to without first
|
||||
// calling Seek() to move the cursor to the end of the file.
|
||||
CopyToFile(file File) error
|
||||
|
||||
// MoveToFile will move the current file to the provided file instance.
|
||||
//
|
||||
// * If the file already exists, the contents will be overwritten with the current file's contents.
|
||||
// * The current instance of the file will be removed.
|
||||
// * MoveToFile will Close both the source and target Files which therefore can't be appended to without first
|
||||
// calling Seek() to move the cursor to the end of the file.
|
||||
MoveToFile(file File) error
|
||||
|
||||
// Delete unlinks the File on the file system.
|
||||
Delete() error
|
||||
|
||||
// LastModified returns the timestamp the file was last modified (as *time.Time).
|
||||
LastModified() (*time.Time, error)
|
||||
|
||||
// Size returns the size of the file in bytes.
|
||||
Size() (uint64, error)
|
||||
|
||||
// Path returns absolute path, including filename, ie /some/path/to/file.txt
|
||||
//
|
||||
// If the directory portion of a file is desired, call
|
||||
// someFile.Location().Path()
|
||||
Path() string
|
||||
|
||||
// Name returns the base name of the file path.
|
||||
//
|
||||
// For file:///some/path/to/file.txt, it would return file.txt
|
||||
Name() string
|
||||
|
||||
// Touch creates a zero-length file on the vfs.File if no File exists. Update File's last modified timestamp.
|
||||
// Returns error if unable to touch File.
|
||||
Touch() error
|
||||
|
||||
// URI returns the fully qualified absolute URI for the File. IE, s3://bucket/some/path/to/file.txt
|
||||
URI() string
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package ipfs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/ipfs/boxo/files"
|
||||
"github.com/ipfs/boxo/path"
|
||||
"github.com/ipfs/kubo/client/rpc"
|
||||
)
|
||||
|
||||
var (
|
||||
initialized bool
|
||||
localMount bool
|
||||
ipfsClient *rpc.HttpApi
|
||||
ipfsFS FileSystem
|
||||
)
|
||||
|
||||
// init initializes the IPFS client and checks for local mounts
|
||||
func init() {
|
||||
var err error
|
||||
ipfsClient, err = rpc.NewLocalApi()
|
||||
if err != nil {
|
||||
initialized = false
|
||||
localMount = false
|
||||
return
|
||||
}
|
||||
|
||||
initialized = true
|
||||
ipfsFS = &IPFSFileSystem{client: ipfsClient}
|
||||
|
||||
// Check if /ipfs and /ipns are mounted using os package
|
||||
_, errIPFS := os.Stat("/ipfs")
|
||||
_, errIPNS := os.Stat("/ipns")
|
||||
localMount = !os.IsNotExist(errIPFS) && !os.IsNotExist(errIPNS)
|
||||
}
|
||||
|
||||
// GetFileSystem returns the IPFS FileSystem implementation
|
||||
func GetFileSystem() FileSystem {
|
||||
return ipfsFS
|
||||
}
|
||||
|
||||
// AddFile adds a single file to IPFS and returns its CID
|
||||
func AddFile(ctx context.Context, filePath string) (string, error) {
|
||||
if !initialized {
|
||||
return "", ErrNotInitialized
|
||||
}
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to open file: %w", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
fileNode := files.NewReaderFile(file)
|
||||
|
||||
cidFile, err := ipfsClient.Unixfs().Add(ctx, fileNode)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to add file to IPFS: %w", err)
|
||||
}
|
||||
|
||||
return cidFile.String(), nil
|
||||
}
|
||||
|
||||
// AddFolder adds a folder and its contents to IPFS and returns the CID of the folder
|
||||
func AddFolder(ctx context.Context, folderPath string) (string, error) {
|
||||
if !initialized {
|
||||
return "", ErrNotInitialized
|
||||
}
|
||||
|
||||
stat, err := os.Stat(folderPath)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get folder info: %w", err)
|
||||
}
|
||||
|
||||
if !stat.IsDir() {
|
||||
return "", fmt.Errorf("provided path is not a directory")
|
||||
}
|
||||
|
||||
folderNode, err := files.NewSerialFile(folderPath, false, stat)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create folder node: %w", err)
|
||||
}
|
||||
|
||||
cidFolder, err := ipfsClient.Unixfs().Add(ctx, folderNode)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to add folder to IPFS: %w", err)
|
||||
}
|
||||
|
||||
return cidFolder.String(), nil
|
||||
}
|
||||
|
||||
func GetCID(ctx context.Context, cid string) ([]byte, error) {
|
||||
if !initialized {
|
||||
return nil, ErrNotInitialized
|
||||
}
|
||||
|
||||
if localMount {
|
||||
// Try to read from local filesystem first
|
||||
data, err := os.ReadFile(filepath.Join("/ipfs", cid))
|
||||
if err == nil {
|
||||
return data, nil
|
||||
}
|
||||
// If local read fails, fall back to IPFS client
|
||||
}
|
||||
|
||||
// Use IPFS client to fetch the data
|
||||
p, err := path.NewPath("/ipfs/" + cid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
n, err := ipfsClient.Unixfs().Get(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return readNodeData(n)
|
||||
}
|
||||
|
||||
func GetIPNS(ctx context.Context, name string) ([]byte, error) {
|
||||
if !initialized {
|
||||
return nil, ErrNotInitialized
|
||||
}
|
||||
|
||||
if localMount {
|
||||
// Try to read from local filesystem first
|
||||
data, err := os.ReadFile(filepath.Join("/ipns", name))
|
||||
if err == nil {
|
||||
return data, nil
|
||||
}
|
||||
// If local read fails, fall back to IPFS client
|
||||
}
|
||||
|
||||
// Use IPFS client to fetch the data
|
||||
p, err := path.NewPath("/ipns/" + name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
n, err := ipfsClient.Unixfs().Get(ctx, p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return readNodeData(n)
|
||||
}
|
||||
|
||||
func PinCID(ctx context.Context, cid string, name string) error {
|
||||
if !initialized {
|
||||
return ErrNotInitialized
|
||||
}
|
||||
|
||||
p, err := path.NewPath(cid)
|
||||
if err != nil {
|
||||
return ErrNotInitialized
|
||||
}
|
||||
err = ipfsClient.Pin().Add(ctx, p)
|
||||
if err != nil {
|
||||
return ErrInternal
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func readNodeData(n files.Node) ([]byte, error) {
|
||||
switch n := n.(type) {
|
||||
case files.File:
|
||||
return io.ReadAll(n)
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported node type: %T", n)
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package ipfs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/ipfs/boxo/files"
|
||||
"github.com/ipfs/boxo/path"
|
||||
"github.com/ipfs/kubo/client/rpc"
|
||||
)
|
||||
|
||||
type IPFSFile struct {
|
||||
node files.Node
|
||||
path string
|
||||
name string
|
||||
client *rpc.HttpApi
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Close() error {
|
||||
return nil // IPFS nodes don't need to be closed
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Read(p []byte) (n int, err error) {
|
||||
if file, ok := f.node.(files.File); ok {
|
||||
return file.Read(p)
|
||||
}
|
||||
return 0, fmt.Errorf("not a file")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Seek(offset int64, whence int) (int64, error) {
|
||||
if file, ok := f.node.(files.File); ok {
|
||||
return file.Seek(offset, whence)
|
||||
}
|
||||
return 0, fmt.Errorf("not a file")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Write(p []byte) (n int, err error) {
|
||||
return 0, fmt.Errorf("write operation not supported for IPFS files")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) String() string {
|
||||
return f.path
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Exists() (bool, error) {
|
||||
// In IPFS, if we have the node, it exists
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (f *IPFSFile) CopyToFile(file File) error {
|
||||
// Implementation depends on how you want to handle copying between IPFS and other file types
|
||||
return fmt.Errorf("CopyToFile not implemented for IPFS files")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) MoveToFile(file File) error {
|
||||
// Moving files in IPFS doesn't make sense in the traditional way
|
||||
return fmt.Errorf("MoveToFile not applicable for IPFS files")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Delete() error {
|
||||
// Deleting in IPFS is not straightforward, might need to implement unpinning
|
||||
return fmt.Errorf("Delete operation not supported for IPFS files")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) LastModified() (*time.Time, error) {
|
||||
// IPFS doesn't have a concept of last modified time
|
||||
return nil, fmt.Errorf("LastModified not applicable for IPFS files")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Size() (uint64, error) {
|
||||
if file, ok := f.node.(files.File); ok {
|
||||
s, _ := file.Size()
|
||||
return uint64(s), nil
|
||||
}
|
||||
return 0, fmt.Errorf("not a file")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Path() string {
|
||||
return f.path
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Name() string {
|
||||
return f.name
|
||||
}
|
||||
|
||||
func (f *IPFSFile) Touch() error {
|
||||
return fmt.Errorf("Touch operation not supported for IPFS files")
|
||||
}
|
||||
|
||||
func (f *IPFSFile) URI() string {
|
||||
return fmt.Sprintf("ipfs://%s", f.path)
|
||||
}
|
||||
|
||||
type IPFSFileSystem struct {
|
||||
client *rpc.HttpApi
|
||||
}
|
||||
|
||||
func (fs *IPFSFileSystem) NewFile(volume string, absFilePath string) (File, error) {
|
||||
p, err := path.NewPath(absFilePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err := fs.client.Unixfs().Get(context.Background(), p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &IPFSFile{
|
||||
node: node,
|
||||
path: absFilePath,
|
||||
name: p.String(),
|
||||
client: fs.client,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (fs *IPFSFileSystem) Name() string {
|
||||
return "IPFS"
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package mdw
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
echojwt "github.com/labstack/echo-jwt/v4"
|
||||
"github.com/labstack/echo/v4"
|
||||
"gopkg.in/macaroon.v2"
|
||||
)
|
||||
|
||||
type Authz struct {
|
||||
echo.Context
|
||||
echojwt.Config
|
||||
|
||||
signKey []byte
|
||||
}
|
||||
|
||||
func newAuthz(c echo.Context, signKey []byte) *Authz {
|
||||
return &Authz{Context: c, signKey: signKey}
|
||||
}
|
||||
|
||||
func (a *Authz) Accessible(route string, handler echo.HandlerFunc) echo.HandlerFunc {
|
||||
// Verify the macaroon
|
||||
// verified := a.Verify(a.signKey, func(caveat string) error {
|
||||
// Implement your caveat verification logic here
|
||||
// For example, you might check if the caveat is still valid (e.g., not expired)
|
||||
// return nil // Return nil if the caveat is valid
|
||||
// }, nil)
|
||||
// if !verified {
|
||||
// return func(c echo.Context) error {
|
||||
// return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Invalid macaroon"})
|
||||
// }
|
||||
// }
|
||||
a.SetPath(route)
|
||||
return handler
|
||||
}
|
||||
|
||||
func ValidateMacaroonMiddleware(secretKey []byte, location string) echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
// Extract the macaroon from the Authorization header
|
||||
auth := c.Request().Header.Get("Authorization")
|
||||
if auth == "" {
|
||||
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Missing Authorization header"})
|
||||
}
|
||||
|
||||
// Decode the macaroon
|
||||
mac, err := macaroon.Base64Decode([]byte(auth))
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid macaroon encoding"})
|
||||
}
|
||||
|
||||
token, err := macaroon.New(secretKey, mac, location, macaroon.LatestVersion)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusBadRequest, map[string]string{"error": "Invalid macaroon"})
|
||||
}
|
||||
|
||||
// Verify the macaroon
|
||||
err = token.Verify(secretKey, func(caveat string) error {
|
||||
// Implement your caveat verification logic here
|
||||
// For example, you might check if the caveat is still valid (e.g., not expired)
|
||||
return nil // Return nil if the caveat is valid
|
||||
}, nil)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusUnauthorized, map[string]string{"error": "Invalid macaroon"})
|
||||
}
|
||||
|
||||
// Macaroon is valid, proceed to the next handler
|
||||
return next(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package mdw
|
||||
|
||||
import "github.com/labstack/echo/v4"
|
||||
|
||||
type RequestHeaders struct {
|
||||
Authorization *string `header:"Authorization"`
|
||||
CacheControl *string `header:"Cache-Control"`
|
||||
DeviceMemory *string `header:"Device-Memory"`
|
||||
Forwarded *string `header:"Forwarded"`
|
||||
From *string `header:"From"`
|
||||
Host *string `header:"Host"`
|
||||
Link *string `header:"Link"`
|
||||
PermissionsPolicy *string `header:"Permissions-Policy"`
|
||||
ProxyAuthorization *string `header:"Proxy-Authorization"`
|
||||
Referer *string `header:"Referer"`
|
||||
UserAgent *string `header:"User-Agent"`
|
||||
ViewportWidth *string `header:"Viewport-Width"`
|
||||
Width *string `header:"Width"`
|
||||
WWWAuthenticate *string `header:"WWW-Authenticate"`
|
||||
|
||||
// HTMX Specific
|
||||
HXBoosted *string `header:"HX-Boosted"`
|
||||
HXCurrentURL *string `header:"HX-Current-URL"`
|
||||
HXHistoryRestoreRequest *string `header:"HX-History-Restore-Request"`
|
||||
HXPrompt *string `header:"HX-Prompt"`
|
||||
HXRequest *string `header:"HX-Request"`
|
||||
HXTarget *string `header:"HX-Target"`
|
||||
HXTriggerName *string `header:"HX-Trigger-Name"`
|
||||
HXTrigger *string `header:"HX-Trigger"`
|
||||
}
|
||||
|
||||
type ResponseHeaders struct {
|
||||
AcceptCH *string `header:"Accept-CH"`
|
||||
AccessControlAllowCredentials *string `header:"Access-Control-Allow-Credentials"`
|
||||
AccessControlAllowHeaders *string `header:"Access-Control-Allow-Headers"`
|
||||
AccessControlAllowMethods *string `header:"Access-Control-Allow-Methods"`
|
||||
AccessControlExposeHeaders *string `header:"Access-Control-Expose-Headers"`
|
||||
AccessControlRequestHeaders *string `header:"Access-Control-Request-Headers"`
|
||||
ContentSecurityPolicy *string `header:"Content-Security-Policy"`
|
||||
CrossOriginEmbedderPolicy *string `header:"Cross-Origin-Embedder-Policy"`
|
||||
PermissionsPolicy *string `header:"Permissions-Policy"`
|
||||
ProxyAuthorization *string `header:"Proxy-Authorization"`
|
||||
WWWAuthenticate *string `header:"WWW-Authenticate"`
|
||||
|
||||
// HTMX Specific
|
||||
HXLocation *string `header:"HX-Location"`
|
||||
HXPushURL *string `header:"HX-Push-Url"`
|
||||
HXRedirect *string `header:"HX-Redirect"`
|
||||
HXRefresh *string `header:"HX-Refresh"`
|
||||
HXReplaceURL *string `header:"HX-Replace-Url"`
|
||||
HXReswap *string `header:"HX-Reswap"`
|
||||
HXRetarget *string `header:"HX-Retarget"`
|
||||
HXReselect *string `header:"HX-Reselect"`
|
||||
HXTrigger *string `header:"HX-Trigger"`
|
||||
HXTriggerAfterSettle *string `header:"HX-Trigger-After-Settle"`
|
||||
HXTriggerAfterSwap *string `header:"HX-Trigger-After-Swap"`
|
||||
}
|
||||
|
||||
func bindRequestHeaders(c echo.Context) {
|
||||
headers := new(RequestHeaders)
|
||||
c.Bind(headers)
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package mdw
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/donseba/go-htmx"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/db"
|
||||
"github.com/segmentio/ksuid"
|
||||
)
|
||||
|
||||
// UseSession establishes a Session Cookie.
|
||||
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
sc := newSession(c)
|
||||
bindRequestHeaders(sc)
|
||||
return next(sc)
|
||||
}
|
||||
}
|
||||
|
||||
// GetSession returns the current Session
|
||||
func GetSession(c echo.Context) *Session {
|
||||
return c.(*Session)
|
||||
}
|
||||
|
||||
type Session struct {
|
||||
echo.Context
|
||||
htmx *htmx.HTMX
|
||||
dB *db.DB
|
||||
}
|
||||
|
||||
func (c *Session) ID() string {
|
||||
return readCookie(c, "session")
|
||||
}
|
||||
|
||||
func (c *Session) Htmx() *htmx.HTMX {
|
||||
return c.htmx
|
||||
}
|
||||
|
||||
func (c *Session) DB() *db.DB {
|
||||
return c.dB
|
||||
}
|
||||
|
||||
func newSession(c echo.Context) *Session {
|
||||
s := &Session{Context: c}
|
||||
if val := readCookie(c, "session"); val == "" {
|
||||
id := ksuid.New().String()
|
||||
writeCookie(c, "session", id)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func readCookie(c echo.Context, key string) string {
|
||||
cookie, err := c.Cookie(key)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
if cookie == nil {
|
||||
return ""
|
||||
}
|
||||
return cookie.Value
|
||||
}
|
||||
|
||||
func writeCookie(c echo.Context, key string, value string) {
|
||||
cookie := new(http.Cookie)
|
||||
cookie.Name = key
|
||||
cookie.Value = value
|
||||
cookie.Expires = time.Now().Add(24 * time.Hour)
|
||||
c.SetCookie(cookie)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user