mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
feature/driver indexed db (#14)
* fix: update commitizen version * feat: add WASM build tags to db actions * feat: Update all actions to follow `AddAsset` for error handling * feat: remove database dependency in dwn and motr commands * feat: add basic info form to registration view * feat: implement basic browser navigation component * refactor: move database related files to middleware * fix: remove unused test command * fix: update source directory for buf-publish workflow * feat: embed dwn config data * feat: add Sync RPC to query service * refactor: rename package to for better organization * feat: add new javascript exception handling for server requests * refactor: move dwn.wasm to embed directory * refactor: move server files to a new directory * refactor: move session related code to client package * refactor: Update dwn.wasm build path * refactor: move dwn wasm build to vfs * feat: introduce config loading middleware * feat: introduce DWN config and address JSON * refactor: move dwn wasm build output to embed directory * feat: introduce config and IndexedDB model * refactor: move DWN config file generation to vfs * refactor: move config package to * feat: add Sonr.ID IPFS gateway proxy * feat: add SWT data structure * feat: update index.html to use Sonr styles and scripts * feat(dwn): remove index.html server endpoint * feat: add Navigator API for web credential management
This commit is contained in:
parent
8022428e37
commit
2c1cf56e3c
@ -16,6 +16,7 @@ include_ext = ["go", "templ", "html", "pkl", "js", "mjs"]
|
||||
include_file = [
|
||||
"wrangler.toml",
|
||||
"Dockerfile",
|
||||
"Makefile",
|
||||
".goreleaser.yaml",
|
||||
"go.mod",
|
||||
"devbox.json",
|
||||
|
2
Makefile
2
Makefile
@ -303,7 +303,7 @@ sh-testnet: mod-tidy
|
||||
|
||||
dwn:
|
||||
@echo "(dwn) Building dwn.wasm -> IPFS Vault"
|
||||
GOOS=js GOARCH=wasm go build -o ./internal/vfs/dwn.wasm ./internal/dwn/dwn.go
|
||||
GOOS=js GOARCH=wasm go build -o ./internal/vfs/app.wasm ./internal/dwn/wasm/main.go
|
||||
|
||||
motr:
|
||||
@echo "(web) Building app.wasm -> Deploy to Cloudflare Workers"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,12 +20,9 @@ const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Query_Params_FullMethodName = "/did.v1.Query/Params"
|
||||
Query_ParamsAssets_FullMethodName = "/did.v1.Query/ParamsAssets"
|
||||
Query_ParamsByAsset_FullMethodName = "/did.v1.Query/ParamsByAsset"
|
||||
Query_ParamsKeys_FullMethodName = "/did.v1.Query/ParamsKeys"
|
||||
Query_ParamsByKey_FullMethodName = "/did.v1.Query/ParamsByKey"
|
||||
Query_Resolve_FullMethodName = "/did.v1.Query/Resolve"
|
||||
Query_Service_FullMethodName = "/did.v1.Query/Service"
|
||||
Query_Sync_FullMethodName = "/did.v1.Query/Sync"
|
||||
)
|
||||
|
||||
// QueryClient is the client API for Query service.
|
||||
@ -34,20 +31,14 @@ const (
|
||||
type QueryClient interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
// ParamsAssets queries all parameters of the module.
|
||||
ParamsAssets(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsAssetsResponse, error)
|
||||
// Params queries all parameters of the module.
|
||||
ParamsByAsset(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsByAssetResponse, error)
|
||||
// ParamsKeys queries all parameters of the module.
|
||||
ParamsKeys(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsKeysResponse, error)
|
||||
// Params queries all parameters of the module.
|
||||
ParamsByKey(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsByKeyResponse, error)
|
||||
// Resolve queries the DID document by its id.
|
||||
Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error)
|
||||
// Service returns associated ServiceInfo for a given Origin
|
||||
// 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) (*QueryServiceResponse, error)
|
||||
// Sync queries the DID document by its id. And returns the required PKL information
|
||||
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
@ -67,42 +58,6 @@ func (c *queryClient) Params(ctx context.Context, in *QueryRequest, opts ...grpc
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ParamsAssets(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsAssetsResponse, error) {
|
||||
out := new(QueryParamsAssetsResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ParamsAssets_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ParamsByAsset(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsByAssetResponse, error) {
|
||||
out := new(QueryParamsByAssetResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ParamsByAsset_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ParamsKeys(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsKeysResponse, error) {
|
||||
out := new(QueryParamsKeysResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ParamsKeys_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ParamsByKey(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsByKeyResponse, error) {
|
||||
out := new(QueryParamsByKeyResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ParamsByKey_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error) {
|
||||
out := new(QueryResolveResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Resolve_FullMethodName, in, out, opts...)
|
||||
@ -121,26 +76,29 @@ func (c *queryClient) Service(ctx context.Context, in *QueryRequest, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
|
||||
out := new(SyncResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
// All implementations must embed UnimplementedQueryServer
|
||||
// for forward compatibility
|
||||
type QueryServer interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(context.Context, *QueryRequest) (*QueryParamsResponse, error)
|
||||
// ParamsAssets queries all parameters of the module.
|
||||
ParamsAssets(context.Context, *QueryRequest) (*QueryParamsAssetsResponse, error)
|
||||
// Params queries all parameters of the module.
|
||||
ParamsByAsset(context.Context, *QueryRequest) (*QueryParamsByAssetResponse, error)
|
||||
// ParamsKeys queries all parameters of the module.
|
||||
ParamsKeys(context.Context, *QueryRequest) (*QueryParamsKeysResponse, error)
|
||||
// Params queries all parameters of the module.
|
||||
ParamsByKey(context.Context, *QueryRequest) (*QueryParamsByKeyResponse, error)
|
||||
// Resolve queries the DID document by its id.
|
||||
Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error)
|
||||
// Service returns associated ServiceInfo for a given Origin
|
||||
// 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) (*QueryServiceResponse, error)
|
||||
// Sync queries the DID document by its id. And returns the required PKL information
|
||||
Sync(context.Context, *SyncRequest) (*SyncResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
@ -151,24 +109,15 @@ type UnimplementedQueryServer struct {
|
||||
func (UnimplementedQueryServer) Params(context.Context, *QueryRequest) (*QueryParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ParamsAssets(context.Context, *QueryRequest) (*QueryParamsAssetsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ParamsAssets not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ParamsByAsset(context.Context, *QueryRequest) (*QueryParamsByAssetResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ParamsByAsset not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ParamsKeys(context.Context, *QueryRequest) (*QueryParamsKeysResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ParamsKeys not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ParamsByKey(context.Context, *QueryRequest) (*QueryParamsByKeyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ParamsByKey not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Resolve not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Service(context.Context, *QueryRequest) (*QueryServiceResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Service not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) Sync(context.Context, *SyncRequest) (*SyncResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||
|
||||
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
|
||||
@ -200,78 +149,6 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ParamsAssets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ParamsAssets(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ParamsAssets_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ParamsAssets(ctx, req.(*QueryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ParamsByAsset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ParamsByAsset(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ParamsByAsset_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ParamsByAsset(ctx, req.(*QueryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ParamsKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ParamsKeys(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ParamsKeys_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ParamsKeys(ctx, req.(*QueryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ParamsByKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ParamsByKey(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ParamsByKey_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ParamsByKey(ctx, req.(*QueryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Resolve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@ -308,6 +185,24 @@ func _Query_Service_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SyncRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).Sync(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_Sync_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).Sync(ctx, req.(*SyncRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@ -319,22 +214,6 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ParamsAssets",
|
||||
Handler: _Query_ParamsAssets_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ParamsByAsset",
|
||||
Handler: _Query_ParamsByAsset_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ParamsKeys",
|
||||
Handler: _Query_ParamsKeys_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ParamsByKey",
|
||||
Handler: _Query_ParamsByKey_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Resolve",
|
||||
Handler: _Query_Resolve_Handler,
|
||||
@ -343,6 +222,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "Service",
|
||||
Handler: _Query_Service_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Sync",
|
||||
Handler: _Query_Sync_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "did/v1/query.proto",
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,6 @@ const (
|
||||
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
|
||||
Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService"
|
||||
Msg_AllocateVault_FullMethodName = "/did.v1.Msg/AllocateVault"
|
||||
Msg_SyncController_FullMethodName = "/did.v1.Msg/SyncController"
|
||||
Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController"
|
||||
Msg_RegisterService_FullMethodName = "/did.v1.Msg/RegisterService"
|
||||
)
|
||||
@ -40,8 +39,6 @@ type MsgClient interface {
|
||||
// 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)
|
||||
// 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.
|
||||
@ -83,15 +80,6 @@ func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opt
|
||||
return out, nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error) {
|
||||
out := new(MsgRegisterControllerResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_RegisterController_FullMethodName, in, out, opts...)
|
||||
@ -123,8 +111,6 @@ type MsgServer interface {
|
||||
// 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)
|
||||
// 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.
|
||||
@ -145,9 +131,6 @@ func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgAuthorizeSer
|
||||
func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AllocateVault 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")
|
||||
}
|
||||
@ -221,24 +204,6 @@ func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
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).SyncController(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_SyncController_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).SyncController(ctx, req.(*MsgSyncController))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_RegisterController_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgRegisterController)
|
||||
if err := dec(in); err != nil {
|
||||
@ -294,10 +259,6 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "AllocateVault",
|
||||
Handler: _Msg_AllocateVault_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SyncController",
|
||||
Handler: _Msg_SyncController_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterController",
|
||||
Handler: _Msg_RegisterController_Handler,
|
||||
|
14
config/dwn/Config.pkl.go
Normal file
14
config/dwn/Config.pkl.go
Normal file
@ -0,0 +1,14 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type Config struct {
|
||||
Ipfs *IPFS `pkl:"ipfs" json:"ipfs,omitempty"`
|
||||
|
||||
Sonr *Sonr `pkl:"sonr" json:"sonr,omitempty"`
|
||||
|
||||
Keyshare *string `pkl:"keyshare" json:"keyshare,omitempty"`
|
||||
|
||||
Address *string `pkl:"address" json:"address,omitempty"`
|
||||
|
||||
Vault *IndexedDB `pkl:"vault" json:"vault,omitempty"`
|
||||
}
|
37
config/dwn/Dwn.pkl.go
Normal file
37
config/dwn/Dwn.pkl.go
Normal file
@ -0,0 +1,37 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Dwn struct {
|
||||
Config any `pkl:"config"`
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Dwn
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Dwn, err error) {
|
||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
cerr := evaluator.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Dwn
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Dwn, error) {
|
||||
var ret Dwn
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
8
config/dwn/IPFS.pkl.go
Normal file
8
config/dwn/IPFS.pkl.go
Normal file
@ -0,0 +1,8 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type IPFS struct {
|
||||
ApiUrl string `pkl:"apiUrl"`
|
||||
|
||||
GatewayUrl string `pkl:"gatewayUrl"`
|
||||
}
|
8
config/dwn/IndexedDB.pkl.go
Normal file
8
config/dwn/IndexedDB.pkl.go
Normal file
@ -0,0 +1,8 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type IndexedDB struct {
|
||||
Name string `pkl:"name"`
|
||||
|
||||
Version int `pkl:"version"`
|
||||
}
|
12
config/dwn/Sonr.pkl.go
Normal file
12
config/dwn/Sonr.pkl.go
Normal file
@ -0,0 +1,12 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type Sonr struct {
|
||||
ApiUrl string `pkl:"apiUrl"`
|
||||
|
||||
GrpcUrl string `pkl:"grpcUrl"`
|
||||
|
||||
RpcUrl string `pkl:"rpcUrl"`
|
||||
|
||||
WebSocketUrl string `pkl:"webSocketUrl"`
|
||||
}
|
12
config/dwn/init.pkl.go
Normal file
12
config/dwn/init.pkl.go
Normal file
@ -0,0 +1,12 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("dwn", Dwn{})
|
||||
pkl.RegisterMapping("dwn#Config", Config{})
|
||||
pkl.RegisterMapping("dwn#IPFS", IPFS{})
|
||||
pkl.RegisterMapping("dwn#Sonr", Sonr{})
|
||||
pkl.RegisterMapping("dwn#IndexedDB", IndexedDB{})
|
||||
}
|
62
config/pkl/dwn.pkl
Normal file
62
config/pkl/dwn.pkl
Normal file
@ -0,0 +1,62 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/config/dwn" }
|
||||
|
||||
module dwn
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
typealias JSON = String
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class Config {
|
||||
@JsonField
|
||||
ipfs: IPFS
|
||||
|
||||
@JsonField
|
||||
sonr: Sonr
|
||||
|
||||
@JsonField
|
||||
keyshare: JSON?
|
||||
|
||||
@JsonField
|
||||
address: String?
|
||||
|
||||
@JsonField
|
||||
vault: IndexedDB
|
||||
}
|
||||
|
||||
class IndexedDB {
|
||||
name: String = "vault"
|
||||
version: Int = 1
|
||||
}
|
||||
|
||||
class IPFS {
|
||||
apiUrl: String
|
||||
gatewayUrl: String
|
||||
}
|
||||
|
||||
class Sonr {
|
||||
apiUrl: String
|
||||
grpcUrl: String
|
||||
rpcUrl: String
|
||||
webSocketUrl: String
|
||||
}
|
||||
|
||||
|
||||
config = new Config {
|
||||
ipfs = new IPFS {
|
||||
apiUrl = "https://api.sonr-ipfs.land"
|
||||
gatewayUrl = "https://ipfs.sonr.land"
|
||||
}
|
||||
|
||||
sonr = new Sonr {
|
||||
apiUrl = "https://api.sonr.land"
|
||||
grpcUrl = "https://grpc.sonr.land"
|
||||
rpcUrl = "https://rpc.sonr.land"
|
||||
webSocketUrl = "wss://rpc.sonr.land/ws"
|
||||
}
|
||||
}
|
@ -1,64 +1,56 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/dwn/models" }
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/vfs/models" }
|
||||
|
||||
module models
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
typealias Base58 = String
|
||||
typealias Base64 = String
|
||||
|
||||
typealias Bech32 = String
|
||||
typealias Keccak = String
|
||||
|
||||
typealias DID = String
|
||||
typealias ChainCode = UInt
|
||||
typealias Scope = String
|
||||
|
||||
typealias Hex = String
|
||||
typealias UTF8 = String
|
||||
|
||||
class PrimaryKey extends go.Field {
|
||||
structTags {
|
||||
["gorm"] = "primaryKey,autoIncrement"
|
||||
["json"] = "%{name},omitempty"
|
||||
["query"] = "%{name}"
|
||||
}
|
||||
}
|
||||
|
||||
class Unique extends go.Field {
|
||||
structTags {
|
||||
["gorm"] = "unique"
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class Default extends go.Field {
|
||||
defaultValue: String
|
||||
structTags {
|
||||
["gorm"] = "default:%{defaultValue}"
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class NotNull extends go.Field {
|
||||
structTags {
|
||||
["gorm"] = "not null"
|
||||
}
|
||||
}
|
||||
|
||||
class ForeignKey extends go.Field {
|
||||
references: String
|
||||
structTags {
|
||||
["gorm"] = "foreignKey:%{references}"
|
||||
}
|
||||
}
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
["param"] = "%{name}"
|
||||
}
|
||||
}
|
||||
|
||||
class Account {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
address: String
|
||||
address: Bech32|Keccak|String
|
||||
|
||||
@JsonField
|
||||
publicKey: String
|
||||
publicKey: Base58
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
index: Int
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
@ -66,7 +58,7 @@ class Account {
|
||||
|
||||
class Asset {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
@ -78,7 +70,7 @@ class Asset {
|
||||
decimals: Int
|
||||
|
||||
@JsonField
|
||||
chainId: Int?
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
@ -86,7 +78,7 @@ class Asset {
|
||||
|
||||
class Chain {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
@ -94,19 +86,22 @@ class Chain {
|
||||
@JsonField
|
||||
networkId: String
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Credential {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: String
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
attestationType: String
|
||||
@ -115,13 +110,13 @@ class Credential {
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
credentialId: String
|
||||
credentialId: Base64
|
||||
|
||||
@JsonField
|
||||
publicKey: String
|
||||
publicKey: Base64
|
||||
|
||||
@JsonField
|
||||
transport: String
|
||||
transport: List<String>
|
||||
|
||||
@JsonField
|
||||
signCount: UInt
|
||||
@ -148,6 +143,54 @@ class Credential {
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class Grant {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
token: String
|
||||
|
||||
@JsonField
|
||||
scopes: List<String>
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class Keyshare {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
data: Base64
|
||||
|
||||
@JsonField
|
||||
role: Int
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
lastRefreshed: String?
|
||||
}
|
||||
|
||||
class PublicKey {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
}
|
||||
|
||||
class Profile {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
@ -156,7 +199,7 @@ class Profile {
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: String
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
originUri: String?
|
||||
@ -174,103 +217,4 @@ class Profile {
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class Property {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
profileId: String
|
||||
|
||||
@JsonField
|
||||
key: String
|
||||
|
||||
@JsonField
|
||||
accumulator: String
|
||||
|
||||
@JsonField
|
||||
propertyKey: String
|
||||
}
|
||||
|
||||
class Keyshare {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
data: String
|
||||
|
||||
@JsonField
|
||||
role: Int
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Permission {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
serviceId: String
|
||||
|
||||
@JsonField
|
||||
grants: String
|
||||
|
||||
@JsonField
|
||||
scopes: String
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class DiscoveryDocument {
|
||||
@JsonField
|
||||
issuer: String
|
||||
|
||||
@JsonField
|
||||
authorization_endpoint: String
|
||||
|
||||
@JsonField
|
||||
token_endpoint: String
|
||||
|
||||
@JsonField
|
||||
userinfo_endpoint: String
|
||||
|
||||
@JsonField
|
||||
jwks_uri: String
|
||||
|
||||
@JsonField
|
||||
registration_endpoint: String
|
||||
|
||||
@JsonField
|
||||
scopes_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
response_types_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
response_modes_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
subject_types_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
id_token_signing_alg_values_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
claims_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
grant_types_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
acr_values_supported: List<String>
|
||||
|
||||
@JsonField
|
||||
token_endpoint_auth_methods_supported: List<String>
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/dwn/txns" }
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/vfs/txns" }
|
||||
|
||||
module txns
|
||||
|
||||
@ -25,6 +25,14 @@ class Proposal {
|
||||
description: String
|
||||
}
|
||||
|
||||
class SWT {
|
||||
origin: String
|
||||
location: String
|
||||
identifier: String
|
||||
scopes: List<String>
|
||||
properties: Map<String, String>
|
||||
expiryBlock: Int
|
||||
}
|
||||
|
||||
/// Gov module messages
|
||||
class MsgGovSubmitProposal extends Msg {
|
||||
|
@ -37,6 +37,7 @@
|
||||
"make proto-gen"
|
||||
],
|
||||
"gen:pkl": [
|
||||
"go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/dwn.pkl",
|
||||
"go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/orm.pkl",
|
||||
"go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/txns.pkl"
|
||||
],
|
||||
|
2
go.mod
2
go.mod
@ -74,7 +74,7 @@ require (
|
||||
github.com/labstack/echo/v4 v4.10.2
|
||||
github.com/mr-tron/base58 v1.2.0
|
||||
github.com/nlepage/go-js-promise v1.0.0
|
||||
github.com/onsonr/crypto v1.30.0
|
||||
github.com/onsonr/crypto v1.31.0
|
||||
github.com/segmentio/ksuid v1.0.4
|
||||
github.com/spf13/cast v1.6.0
|
||||
github.com/spf13/cobra v1.8.0
|
||||
|
4
go.sum
4
go.sum
@ -1851,8 +1851,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.30.0 h1:1zSKy/zZR0r1iT7d6bwy6/EiiWKNIb7ZhdoRp1tLirU=
|
||||
github.com/onsonr/crypto v1.30.0/go.mod h1:NSfeCO6XoyQeSDEp6Jy42UGG5047GvzG6lW9lRnjrR0=
|
||||
github.com/onsonr/crypto v1.31.0 h1:kI5oNIQ84bOfICqJBIxJxPguEPfLPe+kUD6x2QHZTa4=
|
||||
github.com/onsonr/crypto v1.31.0/go.mod h1:NSfeCO6XoyQeSDEp6Jy42UGG5047GvzG6lW9lRnjrR0=
|
||||
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=
|
||||
|
@ -1,47 +1,17 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package main
|
||||
package dwn
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/wasm"
|
||||
|
||||
svc "github.com/onsonr/sonr/internal/dwn/handlers"
|
||||
mdw "github.com/onsonr/sonr/internal/dwn/middleware"
|
||||
"github.com/onsonr/sonr/internal/dwn/views"
|
||||
"github.com/onsonr/sonr/internal/dwn/front"
|
||||
"github.com/onsonr/sonr/internal/dwn/handlers"
|
||||
"github.com/onsonr/sonr/internal/dwn/middleware"
|
||||
)
|
||||
|
||||
func main() {
|
||||
e := New()
|
||||
wasm.Serve(e)
|
||||
}
|
||||
|
||||
func registerFrontend(e *echo.Echo) {
|
||||
// Add Public Pages
|
||||
e.GET("/", views.HomeView)
|
||||
e.GET("/login", views.LoginView)
|
||||
e.POST("/login/:identifier", svc.HandleCredentialAssertion)
|
||||
e.GET("/register", views.RegisterView)
|
||||
e.POST("/register/:subject", svc.HandleCredentialCreation)
|
||||
e.POST("/register/:subject/check", svc.CheckSubjectIsValid)
|
||||
e.GET("/profile", views.ProfileView)
|
||||
}
|
||||
|
||||
func registerOpenID(g *echo.Group) {
|
||||
// Add Authenticated Pages
|
||||
g.Use(mdw.MacaroonMiddleware("test", "test"))
|
||||
g.GET("/", views.AuthorizeView)
|
||||
g.GET("/discovery", svc.GetDiscovery)
|
||||
g.GET("/jwks", svc.GetJWKS)
|
||||
g.GET("/token", svc.GetToken)
|
||||
g.POST("/:origin/grant/:subject", svc.GrantAuthorization)
|
||||
}
|
||||
|
||||
func New() *echo.Echo {
|
||||
// NewServer creates a new dwn server using echo
|
||||
func NewServer() *echo.Echo {
|
||||
e := echo.New()
|
||||
e.Use(mdw.UseSession)
|
||||
registerFrontend(e)
|
||||
registerOpenID(e.Group("/authorize"))
|
||||
e.Use(middleware.UseSession)
|
||||
front.RegisterViews(e)
|
||||
handlers.RegisterState(e)
|
||||
return e
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
func Alert(variant Variant, icon Icon, title, message string) templ.Component {
|
||||
return alertElement(variant.Attributes(), title, message, icon.Render())
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -53,7 +53,7 @@ func alertElement(attrs templ.Attributes, title, message string, icon templ.Comp
|
||||
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/dwn/elements/alert.templ`, Line: 10, Col: 66}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/alert.templ`, Line: 10, Col: 66}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -66,7 +66,7 @@ func alertElement(attrs templ.Attributes, title, message string, icon templ.Comp
|
||||
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/dwn/elements/alert.templ`, Line: 11, Col: 43}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/alert.templ`, Line: 11, Col: 43}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
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,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
templ PoweredBySonr() {
|
||||
<div class="mx-auto w-fit pt-8">
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
import (
|
||||
"strings"
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
templ Breadcrumbs() {
|
||||
<nav class="flex justify-between px-3.5 py-1 rounded-md pb-3">
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -92,7 +92,7 @@ func breadcrumbItem(title string, active bool) templ.Component {
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/breadcrumbs.templ`, Line: 23, Col: 126}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/breadcrumbs.templ`, Line: 23, Col: 126}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -110,7 +110,7 @@ func breadcrumbItem(title string, active bool) templ.Component {
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/breadcrumbs.templ`, Line: 25, Col: 118}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/breadcrumbs.templ`, Line: 25, Col: 118}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
type button struct {
|
||||
variant Variant
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -151,7 +151,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxGet)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 25}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 86, Col: 25}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -164,7 +164,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 69}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 86, Col: 69}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -177,7 +177,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 96}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 86, Col: 96}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -190,7 +190,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 117}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 86, Col: 117}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -245,7 +245,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxPost)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 27}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 92, Col: 27}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -258,7 +258,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 52}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 92, Col: 52}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -271,7 +271,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 79}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 92, Col: 79}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -284,7 +284,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 100}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/button.templ`, Line: 92, Col: 100}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
func Card(id string, size Size) templ.Component {
|
||||
return renderCard(id, size.CardAttributes())
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -37,7 +37,7 @@ func renderCard(id string, attrs templ.Attributes) templ.Component {
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/card.templ`, Line: 8, Col: 13}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/card.templ`, Line: 8, Col: 13}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
func H1(content string) templ.Component {
|
||||
return renderText(1, content)
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -51,7 +51,7 @@ func renderText(level int, text string) templ.Component {
|
||||
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/dwn/elements/fonts.templ`, Line: 23, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 23, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -69,7 +69,7 @@ func renderText(level int, text string) templ.Component {
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 27, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 27, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -87,7 +87,7 @@ func renderText(level int, text string) templ.Component {
|
||||
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/dwn/elements/fonts.templ`, Line: 31, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 31, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -105,7 +105,7 @@ func renderText(level int, text string) templ.Component {
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 35, Col: 10}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 35, Col: 10}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -153,7 +153,7 @@ func renderLink(attrs templ.Attributes, text string) templ.Component {
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 42, Col: 8}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 42, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -200,7 +200,7 @@ func renderStrong(attrs templ.Attributes, text string) templ.Component {
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 48, Col: 8}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 48, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -247,7 +247,7 @@ func renderEmphasis(attrs templ.Attributes, text string) templ.Component {
|
||||
var templ_7745c5c3_Var11 string
|
||||
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 54, Col: 8}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 54, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -294,7 +294,7 @@ func renderCode(attrs templ.Attributes, text string) templ.Component {
|
||||
var templ_7745c5c3_Var13 string
|
||||
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 60, Col: 8}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/fonts.templ`, Line: 60, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
templ Layout(title string) {
|
||||
<!DOCTYPE html>
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -41,7 +41,7 @@ func Layout(title string) templ.Component {
|
||||
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/dwn/elements/global.templ`, Line: 8, Col: 17}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/global.templ`, Line: 8, Col: 17}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
type Icons int
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
type InputState int
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
@ -43,7 +43,7 @@ func TextInput(state InputState, label string, placeholder string) templ.Compone
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/inputs.templ`, Line: 15, Col: 128}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/inputs.templ`, Line: 15, Col: 128}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -61,7 +61,7 @@ func TextInput(state InputState, label string, placeholder string) templ.Compone
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/inputs.templ`, Line: 20, Col: 128}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/inputs.templ`, Line: 20, Col: 128}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
@ -79,7 +79,7 @@ func TextInput(state InputState, label string, placeholder string) templ.Compone
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(label)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/inputs.templ`, Line: 25, Col: 128}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/front/blocks/inputs.templ`, Line: 25, Col: 128}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
import "github.com/labstack/echo/v4"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
templ RadioGroup() {
|
||||
<div
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
type Size int
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -1,4 +1,4 @@
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
templ Tabs() {
|
||||
<div
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.771
|
||||
package elements
|
||||
package blocks
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
14
internal/dwn/front/routes.go
Normal file
14
internal/dwn/front/routes.go
Normal file
@ -0,0 +1,14 @@
|
||||
package front
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/views"
|
||||
)
|
||||
|
||||
func RegisterViews(e *echo.Echo) {
|
||||
e.GET("/", views.HomeView)
|
||||
e.GET("/login", views.LoginView)
|
||||
e.GET("/register", views.RegisterView)
|
||||
e.GET("/profile", views.ProfileView)
|
||||
e.GET("/authorize", views.AuthorizeView)
|
||||
}
|
29
internal/dwn/front/views/home.templ
Normal file
29
internal/dwn/front/views/home.templ
Normal file
@ -0,0 +1,29 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func HomeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderHomeView())
|
||||
}
|
||||
|
||||
templ renderHomeView() {
|
||||
@blocks.Layout("Sonr.ID") {
|
||||
@blocks.Card("home-view", blocks.SizeLarge) {
|
||||
@blocks.H1("Sonr.ID")
|
||||
@blocks.Text("A Decentralized Web Node Client for the Sonr Network.")
|
||||
@blocks.Spacer()
|
||||
<div class="flex flex-col gap-3">
|
||||
@blocks.Button(blocks.GET("/register", "#home-view"), blocks.PrimaryButtonStyle()) {
|
||||
@blocks.Text("Get Started")
|
||||
}
|
||||
@blocks.Button(blocks.GET("/login", "#home-view")) {
|
||||
@blocks.Text("Login")
|
||||
}
|
||||
</div>
|
||||
@blocks.PoweredBySonr()
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func HomeView(c echo.Context) error {
|
||||
@ -59,7 +59,7 @@ func renderHomeView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -67,7 +67,7 @@ func renderHomeView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("A Decentralized Web Node Client for the Sonr Network.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("A Decentralized Web Node Client for the Sonr Network.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -75,7 +75,7 @@ func renderHomeView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -95,13 +95,13 @@ func renderHomeView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Button(elements.GET("/register", "#home-view"), elements.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Button(blocks.GET("/register", "#home-view"), blocks.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -117,13 +117,13 @@ func renderHomeView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Login").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("Login").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Button(elements.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Button(blocks.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -131,19 +131,19 @@ func renderHomeView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card("home-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Card("home-view", blocks.SizeLarge).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)
|
||||
templ_7745c5c3_Err = blocks.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
25
internal/dwn/front/views/login.templ
Normal file
25
internal/dwn/front/views/login.templ
Normal file
@ -0,0 +1,25 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func LoginView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderLoginView())
|
||||
}
|
||||
|
||||
templ renderLoginView() {
|
||||
@blocks.Layout("Login | Sonr.ID") {
|
||||
@blocks.Card("login-view", blocks.SizeLarge) {
|
||||
@blocks.H1("Sonr.ID")
|
||||
@blocks.Text("Neo-tree is a file manager for NeoFS.")
|
||||
@blocks.Spacer()
|
||||
@blocks.RadioGroup()
|
||||
@blocks.Spacer()
|
||||
@blocks.Button(blocks.GET("/", "#login-view")) {
|
||||
@blocks.Text("Cancel")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func LoginView(c echo.Context) error {
|
||||
@ -59,7 +59,7 @@ func renderLoginView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -67,7 +67,7 @@ func renderLoginView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -75,7 +75,7 @@ func renderLoginView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -83,7 +83,7 @@ func renderLoginView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.RadioGroup().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.RadioGroup().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -91,7 +91,7 @@ func renderLoginView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -111,25 +111,25 @@ func renderLoginView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Button(elements.GET("/", "#login-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Button(blocks.GET("/", "#login-view")).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("login-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Card("login-view", blocks.SizeLarge).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)
|
||||
templ_7745c5c3_Err = blocks.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
19
internal/dwn/front/views/openid.templ
Normal file
19
internal/dwn/front/views/openid.templ
Normal file
@ -0,0 +1,19 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func AuthorizeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderAuthorizeView())
|
||||
}
|
||||
|
||||
templ renderAuthorizeView() {
|
||||
@blocks.Layout("Login | Sonr.ID") {
|
||||
@blocks.Card("authorize-view", blocks.SizeMedium) {
|
||||
@blocks.H1("Sonr.ID")
|
||||
@blocks.Text("Neo-tree is a file manager for NeoFS.")
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func AuthorizeView(c echo.Context) error {
|
||||
@ -59,7 +59,7 @@ func renderAuthorizeView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -67,19 +67,19 @@ func renderAuthorizeView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card("authorize-view", elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Card("authorize-view", blocks.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)
|
||||
templ_7745c5c3_Err = blocks.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
@ -2,7 +2,7 @@ package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func ProfileView(c echo.Context) error {
|
||||
@ -10,10 +10,10 @@ func ProfileView(c echo.Context) error {
|
||||
}
|
||||
|
||||
templ renderProfileView() {
|
||||
@elements.Layout("Profile | Sonr.ID") {
|
||||
@elements.Card("profile-view", elements.SizeLarge) {
|
||||
@elements.ProfileCard()
|
||||
@elements.Tabs()
|
||||
@blocks.Layout("Profile | Sonr.ID") {
|
||||
@blocks.Card("profile-view", blocks.SizeLarge) {
|
||||
@blocks.ProfileCard()
|
||||
@blocks.Tabs()
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
)
|
||||
|
||||
func ProfileView(c echo.Context) error {
|
||||
@ -59,7 +59,7 @@ func renderProfileView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.ProfileCard().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.ProfileCard().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -67,19 +67,19 @@ func renderProfileView() templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Tabs().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Tabs().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Card("profile-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Card("profile-view", blocks.SizeLarge).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("Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Layout("Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
26
internal/dwn/front/views/register.templ
Normal file
26
internal/dwn/front/views/register.templ
Normal file
@ -0,0 +1,26 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/islands"
|
||||
)
|
||||
|
||||
func RegisterView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderRegisterView(c))
|
||||
}
|
||||
|
||||
templ renderRegisterView(c echo.Context) {
|
||||
@blocks.Layout("Register | Sonr.ID") {
|
||||
@blocks.Card("register-view", blocks.SizeMedium) {
|
||||
@blocks.H2("Account Registration")
|
||||
@blocks.Spacer()
|
||||
@blocks.Breadcrumbs()
|
||||
@islands.BasicInfo(c, islands.InitialForm)
|
||||
@blocks.Spacer()
|
||||
@blocks.Button(blocks.GET("/", "#register-view")) {
|
||||
@blocks.Text("Cancel")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,8 +10,8 @@ import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/islands"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/blocks"
|
||||
"github.com/onsonr/sonr/internal/dwn/front/islands"
|
||||
)
|
||||
|
||||
func RegisterView(c echo.Context) error {
|
||||
@ -60,7 +60,7 @@ func renderRegisterView(c echo.Context) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.H2("Account Registration").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.H2("Account Registration").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -68,7 +68,7 @@ func renderRegisterView(c echo.Context) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -76,7 +76,7 @@ func renderRegisterView(c echo.Context) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Breadcrumbs().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Breadcrumbs().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -92,7 +92,7 @@ func renderRegisterView(c echo.Context) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@ -112,25 +112,25 @@ func renderRegisterView(c echo.Context) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = elements.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = elements.Button(elements.GET("/", "#register-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Button(blocks.GET("/", "#register-view")).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("register-view", elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Card("register-view", blocks.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("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = blocks.Layout("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package svc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
oidc "github.com/onsonr/sonr/internal/dwn/models"
|
||||
)
|
||||
|
||||
func GrantAuthorization(e echo.Context) error {
|
||||
// Implement authorization endpoint using passkey authentication
|
||||
// Store session data in cache
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetJWKS(e echo.Context) error {
|
||||
// Implement token endpoint
|
||||
// Use cached session data for validation
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetToken(e echo.Context) error {
|
||||
// Implement token endpoint
|
||||
// Use cached session data for validation
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetDiscovery(e echo.Context) error {
|
||||
baseURL := "https://" + e.Request().Host // Ensure this is the correct base URL for your service
|
||||
discoveryDoc := &oidc.DiscoveryDocument{
|
||||
Issuer: baseURL,
|
||||
AuthorizationEndpoint: fmt.Sprintf("%s/auth", baseURL),
|
||||
TokenEndpoint: fmt.Sprintf("%s/token", baseURL),
|
||||
UserinfoEndpoint: fmt.Sprintf("%s/userinfo", baseURL),
|
||||
JwksUri: fmt.Sprintf("%s/jwks", baseURL),
|
||||
RegistrationEndpoint: fmt.Sprintf("%s/register", baseURL),
|
||||
ScopesSupported: []string{"openid", "profile", "email", "web3", "sonr"},
|
||||
ResponseTypesSupported: []string{"code"},
|
||||
ResponseModesSupported: []string{"query", "form_post"},
|
||||
GrantTypesSupported: []string{"authorization_code", "refresh_token"},
|
||||
AcrValuesSupported: []string{"passkey"},
|
||||
SubjectTypesSupported: []string{"public"},
|
||||
ClaimsSupported: []string{"sub", "iss", "name", "email"},
|
||||
}
|
||||
return e.JSON(200, discoveryDoc)
|
||||
}
|
23
internal/dwn/handlers/routes.go
Normal file
23
internal/dwn/handlers/routes.go
Normal file
@ -0,0 +1,23 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/handlers/state"
|
||||
middleware "github.com/onsonr/sonr/internal/dwn/middleware"
|
||||
)
|
||||
|
||||
func RegisterState(e *echo.Echo) {
|
||||
g := e.Group("state")
|
||||
g.POST("/login/:identifier", state.HandleCredentialAssertion)
|
||||
// g.GET("/discovery", state.GetDiscovery)
|
||||
g.GET("/jwks", state.GetJWKS)
|
||||
g.GET("/token", state.GetToken)
|
||||
g.POST("/:origin/grant/:subject", state.GrantAuthorization)
|
||||
g.POST("/register/:subject", state.HandleCredentialCreation)
|
||||
g.POST("/register/:subject/check", state.CheckSubjectIsValid)
|
||||
}
|
||||
|
||||
func RegisterSync(e *echo.Echo) {
|
||||
g := e.Group("sync")
|
||||
g.Use(middleware.MacaroonMiddleware("test", "test"))
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package svc
|
||||
package state
|
||||
|
||||
import (
|
||||
"encoding/json"
|
23
internal/dwn/handlers/state/openid.go
Normal file
23
internal/dwn/handlers/state/openid.go
Normal file
@ -0,0 +1,23 @@
|
||||
package state
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func GrantAuthorization(e echo.Context) error {
|
||||
// Implement authorization endpoint using passkey authentication
|
||||
// Store session data in cache
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetJWKS(e echo.Context) error {
|
||||
// Implement token endpoint
|
||||
// Use cached session data for validation
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetToken(e echo.Context) error {
|
||||
// Implement token endpoint
|
||||
// Use cached session data for validation
|
||||
return nil
|
||||
}
|
1
internal/dwn/handlers/sync/manifest.go
Normal file
1
internal/dwn/handlers/sync/manifest.go
Normal file
@ -0,0 +1 @@
|
||||
package sync
|
1
internal/dwn/handlers/sync/wellknown.go
Normal file
1
internal/dwn/handlers/sync/wellknown.go
Normal file
@ -0,0 +1 @@
|
||||
package sync
|
@ -1,11 +1,12 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package mdw
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/donseba/go-htmx"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/middleware/jsexc"
|
||||
)
|
||||
|
||||
type Browser struct {
|
||||
@ -20,9 +21,15 @@ type Browser struct {
|
||||
htmx *htmx.HTMX
|
||||
|
||||
// WebAPIs
|
||||
credentials CredentialsAPI
|
||||
indexedDB IndexedDBAPI
|
||||
localStorage LocalStorageAPI
|
||||
push PushAPI
|
||||
sessionStorage SessionStorageAPI
|
||||
indexedDB jsexc.IndexedDBAPI
|
||||
localStorage jsexc.LocalStorageAPI
|
||||
push jsexc.PushAPI
|
||||
sessionStorage jsexc.SessionStorageAPI
|
||||
}
|
||||
|
||||
func UseNavigator(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
cc := jsexc.NewNavigator(c)
|
||||
return next(cc)
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
package mdw
|
||||
|
||||
type AuthClient struct{}
|
@ -1,4 +1,4 @@
|
||||
package mdw
|
||||
package client
|
||||
|
||||
type RequestHeaders struct {
|
||||
Authorization *string `header:"Authorization"`
|
51
internal/dwn/middleware/client/session.go
Normal file
51
internal/dwn/middleware/client/session.go
Normal file
@ -0,0 +1,51 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/donseba/go-htmx"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/segmentio/ksuid"
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
echo.Context
|
||||
htmx *htmx.HTMX
|
||||
}
|
||||
|
||||
func (c *Session) Htmx() *htmx.HTMX {
|
||||
return c.htmx
|
||||
}
|
||||
|
||||
func (c *Session) ID() string {
|
||||
return ReadCookie(c, "session")
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
51
internal/dwn/middleware/client/token.go
Normal file
51
internal/dwn/middleware/client/token.go
Normal file
@ -0,0 +1,51 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
OriginMacroonCaveat MacroonCaveat = "origin"
|
||||
ScopesMacroonCaveat MacroonCaveat = "scopes"
|
||||
SubjectMacroonCaveat MacroonCaveat = "subject"
|
||||
ExpMacroonCaveat MacroonCaveat = "exp"
|
||||
TokenMacroonCaveat MacroonCaveat = "token"
|
||||
)
|
||||
|
||||
type MacroonCaveat string
|
||||
|
||||
func (c MacroonCaveat) Equal(other string) bool {
|
||||
return string(c) == other
|
||||
}
|
||||
|
||||
func (c MacroonCaveat) String() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
func (c MacroonCaveat) Verify(value string) error {
|
||||
switch c {
|
||||
case OriginMacroonCaveat:
|
||||
return nil
|
||||
case ScopesMacroonCaveat:
|
||||
return nil
|
||||
case SubjectMacroonCaveat:
|
||||
return nil
|
||||
case ExpMacroonCaveat:
|
||||
// Check if the expiration time is still valid
|
||||
exp, err := time.Parse(time.RFC3339, value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if time.Now().After(exp) {
|
||||
return fmt.Errorf("expired")
|
||||
}
|
||||
return nil
|
||||
case TokenMacroonCaveat:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unknown caveat: %s", c)
|
||||
}
|
||||
}
|
||||
|
||||
var MacroonCaveats = []MacroonCaveat{OriginMacroonCaveat, ScopesMacroonCaveat, SubjectMacroonCaveat, ExpMacroonCaveat, TokenMacroonCaveat}
|
@ -1,6 +0,0 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package mdw
|
||||
|
||||
type CredentialsAPI interface{}
|
72
internal/dwn/middleware/jsexc/credentials.go
Normal file
72
internal/dwn/middleware/jsexc/credentials.go
Normal file
@ -0,0 +1,72 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package jsexc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"syscall/js"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
type Navigator struct {
|
||||
echo.Context
|
||||
navigator js.Value
|
||||
hasCredentials bool
|
||||
}
|
||||
|
||||
func NewNavigator(c echo.Context) *Navigator {
|
||||
navigator := js.Global().Get("navigator")
|
||||
credentials := navigator.Get("credentials")
|
||||
hasCredentials := !credentials.IsUndefined()
|
||||
|
||||
return &Navigator{
|
||||
Context: c,
|
||||
navigator: navigator,
|
||||
hasCredentials: hasCredentials,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Navigator) CreateCredential(options js.Value) (js.Value, error) {
|
||||
if !c.hasCredentials {
|
||||
return js.Null(), errors.New("navigator.credentials is undefined")
|
||||
}
|
||||
promise := c.navigator.Get("credentials").Call("create", map[string]interface{}{"publicKey": options})
|
||||
result, err := awaitPromise(promise)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (c *Navigator) GetCredential(options js.Value) (js.Value, error) {
|
||||
if !c.hasCredentials {
|
||||
return js.Null(), errors.New("navigator.credentials is undefined")
|
||||
}
|
||||
promise := c.navigator.Get("credentials").Call("get", map[string]interface{}{"publicKey": options})
|
||||
result, err := awaitPromise(promise)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func awaitPromise(promise js.Value) (js.Value, error) {
|
||||
done := make(chan struct{})
|
||||
var result js.Value
|
||||
var err error
|
||||
|
||||
thenFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||
result = args[0]
|
||||
close(done)
|
||||
return nil
|
||||
})
|
||||
catchFunc := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
|
||||
err = errors.New(args[0].String())
|
||||
close(done)
|
||||
return nil
|
||||
})
|
||||
defer thenFunc.Release()
|
||||
defer catchFunc.Release()
|
||||
|
||||
promise.Call("then", thenFunc).Call("catch", catchFunc)
|
||||
|
||||
<-done
|
||||
|
||||
return result, err
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package mdw
|
||||
package jsexc
|
||||
|
||||
import (
|
||||
"context"
|
@ -1,6 +1,6 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package mdw
|
||||
package jsexc
|
||||
|
||||
type PushAPI interface{}
|
@ -1,6 +1,6 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package wasm
|
||||
package jsexc
|
||||
|
||||
import (
|
||||
"bytes"
|
@ -1,6 +1,6 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package wasm
|
||||
package jsexc
|
||||
|
||||
import (
|
||||
"io"
|
@ -1,6 +1,6 @@
|
||||
//go:build js && wasm
|
||||
|
||||
package wasm
|
||||
package jsexc
|
||||
|
||||
import (
|
||||
"fmt"
|
12
internal/dwn/middleware/jsexc/storage.go
Normal file
12
internal/dwn/middleware/jsexc/storage.go
Normal file
@ -0,0 +1,12 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package jsexc
|
||||
|
||||
type LocalStorageAPI interface {
|
||||
Get(key string) string
|
||||
Set(key string, value string)
|
||||
Remove(key string)
|
||||
}
|
||||
|
||||
type SessionStorageAPI interface{}
|
@ -1,59 +1,28 @@
|
||||
package mdw
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/middleware/client"
|
||||
"gopkg.in/macaroon.v2"
|
||||
)
|
||||
|
||||
const (
|
||||
OriginMacroonCaveat MacroonCaveat = "origin"
|
||||
ScopesMacroonCaveat MacroonCaveat = "scopes"
|
||||
SubjectMacroonCaveat MacroonCaveat = "subject"
|
||||
ExpMacroonCaveat MacroonCaveat = "exp"
|
||||
TokenMacroonCaveat MacroonCaveat = "token"
|
||||
)
|
||||
|
||||
type MacroonCaveat string
|
||||
|
||||
func (c MacroonCaveat) Equal(other string) bool {
|
||||
return string(c) == other
|
||||
// GetSession returns the current Session
|
||||
func GetSession(c echo.Context) *client.Session {
|
||||
return c.(*client.Session)
|
||||
}
|
||||
|
||||
func (c MacroonCaveat) String() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
func (c MacroonCaveat) Verify(value string) error {
|
||||
switch c {
|
||||
case OriginMacroonCaveat:
|
||||
return nil
|
||||
case ScopesMacroonCaveat:
|
||||
return nil
|
||||
case SubjectMacroonCaveat:
|
||||
return nil
|
||||
case ExpMacroonCaveat:
|
||||
// Check if the expiration time is still valid
|
||||
exp, err := time.Parse(time.RFC3339, value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if time.Now().After(exp) {
|
||||
return fmt.Errorf("expired")
|
||||
}
|
||||
return nil
|
||||
case TokenMacroonCaveat:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("unknown caveat: %s", c)
|
||||
// UseSession establishes a Session Cookie.
|
||||
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
sc := client.NewSession(c)
|
||||
headers := new(client.RequestHeaders)
|
||||
sc.Bind(headers)
|
||||
return next(sc)
|
||||
}
|
||||
}
|
||||
|
||||
var MacroonCaveats = []MacroonCaveat{OriginMacroonCaveat, ScopesMacroonCaveat, SubjectMacroonCaveat, ExpMacroonCaveat, TokenMacroonCaveat}
|
||||
|
||||
func MacaroonMiddleware(secretKeyStr string, location string) echo.MiddlewareFunc {
|
||||
secretKey := []byte(secretKeyStr)
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
@ -77,7 +46,7 @@ func MacaroonMiddleware(secretKeyStr string, location string) echo.MiddlewareFun
|
||||
|
||||
// Verify the macaroon
|
||||
err = token.Verify(secretKey, func(caveat string) error {
|
||||
for _, c := range MacroonCaveats {
|
||||
for _, c := range client.MacroonCaveats {
|
||||
if c.String() == caveat {
|
||||
return nil
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
package mdw
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/donseba/go-htmx"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/segmentio/ksuid"
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
echo.Context
|
||||
htmx *htmx.HTMX
|
||||
}
|
||||
|
||||
// GetSession returns the current Session
|
||||
func GetSession(c echo.Context) *Session {
|
||||
return c.(*Session)
|
||||
}
|
||||
|
||||
// UseSession establishes a Session Cookie.
|
||||
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
sc := initSession(c)
|
||||
headers := new(RequestHeaders)
|
||||
sc.Bind(headers)
|
||||
return next(sc)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Session) Htmx() *htmx.HTMX {
|
||||
return c.htmx
|
||||
}
|
||||
|
||||
func (c *Session) ID() string {
|
||||
return readCookie(c, "session")
|
||||
}
|
||||
|
||||
func initSession(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)
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package mdw
|
||||
|
||||
type LocalStorageAPI interface{}
|
||||
|
||||
type SessionStorageAPI interface{}
|
@ -1,14 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
type Keyshare struct {
|
||||
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
|
||||
|
||||
Data string `pkl:"data" json:"data,omitempty" param:"data"`
|
||||
|
||||
Role int `pkl:"role" json:"role,omitempty" param:"role"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
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"`
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package models
|
||||
|
||||
func (a *Account) Table() string {
|
||||
return "accounts"
|
||||
}
|
||||
|
||||
func (a *Asset) Table() string {
|
||||
return "assets"
|
||||
}
|
||||
|
||||
func (a *Credential) Table() string {
|
||||
return "credentials"
|
||||
}
|
||||
|
||||
func (a *Keyshare) Table() string {
|
||||
return "keyshares"
|
||||
}
|
||||
|
||||
func (a *Permission) Table() string {
|
||||
return "permissions"
|
||||
}
|
||||
|
||||
func (a *Profile) Table() string {
|
||||
return "profiles"
|
||||
}
|
||||
|
||||
func (a *Property) Table() string {
|
||||
return "properties"
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
)
|
||||
|
||||
func HomeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderHomeView())
|
||||
}
|
||||
|
||||
templ renderHomeView() {
|
||||
@elements.Layout("Sonr.ID") {
|
||||
@elements.Card("home-view", elements.SizeLarge) {
|
||||
@elements.H1("Sonr.ID")
|
||||
@elements.Text("A Decentralized Web Node Client for the Sonr Network.")
|
||||
@elements.Spacer()
|
||||
<div class="flex flex-col gap-3">
|
||||
@elements.Button(elements.GET("/register", "#home-view"), elements.PrimaryButtonStyle()) {
|
||||
@elements.Text("Get Started")
|
||||
}
|
||||
@elements.Button(elements.GET("/login", "#home-view")) {
|
||||
@elements.Text("Login")
|
||||
}
|
||||
</div>
|
||||
@elements.PoweredBySonr()
|
||||
}
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
)
|
||||
|
||||
func LoginView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderLoginView())
|
||||
}
|
||||
|
||||
templ renderLoginView() {
|
||||
@elements.Layout("Login | Sonr.ID") {
|
||||
@elements.Card("login-view", elements.SizeLarge) {
|
||||
@elements.H1("Sonr.ID")
|
||||
@elements.Text("Neo-tree is a file manager for NeoFS.")
|
||||
@elements.Spacer()
|
||||
@elements.RadioGroup()
|
||||
@elements.Spacer()
|
||||
@elements.Button(elements.GET("/", "#login-view")) {
|
||||
@elements.Text("Cancel")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
)
|
||||
|
||||
func AuthorizeView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderAuthorizeView())
|
||||
}
|
||||
|
||||
templ renderAuthorizeView() {
|
||||
@elements.Layout("Login | Sonr.ID") {
|
||||
@elements.Card("authorize-view", elements.SizeMedium) {
|
||||
@elements.H1("Sonr.ID")
|
||||
@elements.Text("Neo-tree is a file manager for NeoFS.")
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package views
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/elements"
|
||||
"github.com/onsonr/sonr/internal/dwn/islands"
|
||||
)
|
||||
|
||||
func RegisterView(c echo.Context) error {
|
||||
return echoComponentResponse(c, renderRegisterView(c))
|
||||
}
|
||||
|
||||
templ renderRegisterView(c echo.Context) {
|
||||
@elements.Layout("Register | Sonr.ID") {
|
||||
@elements.Card("register-view", elements.SizeMedium) {
|
||||
@elements.H2("Account Registration")
|
||||
@elements.Spacer()
|
||||
@elements.Breadcrumbs()
|
||||
@islands.BasicInfo(c, islands.InitialForm)
|
||||
@elements.Spacer()
|
||||
@elements.Button(elements.GET("/", "#register-view")) {
|
||||
@elements.Text("Cancel")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
internal/dwn/wasm/main.go
Normal file
20
internal/dwn/wasm/main.go
Normal file
@ -0,0 +1,20 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/dwn/front"
|
||||
"github.com/onsonr/sonr/internal/dwn/handlers"
|
||||
"github.com/onsonr/sonr/internal/dwn/middleware"
|
||||
"github.com/onsonr/sonr/internal/dwn/middleware/jsexc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.Use(middleware.UseSession)
|
||||
front.RegisterViews(e)
|
||||
handlers.RegisterState(e)
|
||||
jsexc.Serve(e)
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user