feature/1109 grpc session model (#1141)

- **feat: remove Hway deployment**
- **feat: introduce session middleware for requests**
- **refactor: update path imports to use new pkg folder**
- **feat: add gRPC client for interacting with services**
- **feat: remove grpc client and use REST api**
- **refactor: move  from  to**
- **feat: add client views endpoint**
- **feat: add webauthn support**
- **closes: #1124**
- **refactor: Improve PR labeler configuration**
- **feat: add milestone discussion template**
- **feat: remove OKR tracking issue template**
- **feat: use gorilla sessions for session management**
- **refactor: move pubkey related code to**
- **<no value>**
- **refactor: remove unused identifier type**
- **feat: integrate Macaroon Keeper with Service Module**
- **refactor: rename worker routes for clarity**
This commit is contained in:
Prad Nukala 2024-10-11 16:47:52 -04:00 committed by GitHub
parent 1d569d35b4
commit 3790e926de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
121 changed files with 869 additions and 589 deletions

View File

@ -0,0 +1,30 @@
title: "[Milestone] "
labels: ["#OKR", "#PLANNING"]
body:
- type: input
id: has-version
attributes:
label: Version
description: A tag for the associated milestone.
placeholder: v0.6.0
validations:
required: true
- type: textarea
attributes:
label: Objective
description: Explain the objective of the OKR in less than 100 characters.
placeholder: Ethereum IBC integration with Sonr.
render: markdown
validations:
required: true
- type: textarea
attributes:
label: Task List
description: |
Break down the objective into a list of tasks to be completed.
value: |
- [ ] #
- [ ] #
- [ ] #
validations:
required: true

View File

@ -1,30 +0,0 @@
name: Tracking issue
description: Use this template for tracking new features.
title: "(v0.6): FEATURE NAME"
labels: ["#TRACK", "#OKR"]
assignees: ["prnk28"]
projects: ["onsonr/37"]
body:
- type: checkboxes
attributes:
label: Is this associated with a milestone?
description: This is a tracking issue for tracking a new feature for a given milestone.
options:
- label: I have confirmed this is an OKR tracking issue
required: true
- type: textarea
attributes:
label: Objective
description: Explain the objective of the feature and add any relevant links.
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Task List
description: |
Break down the objective into a list of tasks to be completed.
value: |
- [ ]
validations:
required: false

View File

@ -1,3 +1,5 @@
feature: ["feature/*", "feat/*"]
fix: fix/*
chore :hammer:: chore/*
"@pr/feature": ["feature/*", "feat/*"]
"@pr/fix": fix/*
"@pr/chore": chore/*
"@pr/docs": docs/*
"@pr/refactor": refactor/*

View File

@ -1,20 +0,0 @@
name: Deploy Hway (sonr.id)
on:
push:
branches:
- develop
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy Sonr.ID on Cloudflare
steps:
- uses: actions/checkout@v4
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.11.0
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_WORKERS_TOKEN }}
workingDirectory: web

1
.gitignore vendored
View File

@ -75,6 +75,7 @@ nebula/node_modules
mprocs.yaml
build
sonr.wiki
!devbox.lock
!buf.lock

View File

@ -113,6 +113,7 @@ draw-deps:
@goviz -i ./cmd/sonrd -d 2 | dot -Tpng -o dependency-graph.png
clean:
rm -rf pkg/nebula/node_modules
rm -rf snapcraft-local.yaml build/
distclean: clean
@ -315,10 +316,9 @@ pkl-gen:
nebula-build:
@echo "(ui) Building nebula"
cd nebula && bun install && bun run build
rm -rf ./nebula/node_modules
cd pkg/nebula && bun install && bun run build
motr-build: templ-gen pkl-gen
motr-build: nebula-build templ-gen pkl-gen
@echo "(dwn) Building motr.wasm -> Service Worker IPFS Vault"
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/motr/main.go

View File

@ -632,15 +632,6 @@ func NewChainApp(
app.StakingKeeper,
)
// Create the vault Keeper
app.VaultKeeper = vaultkeeper.NewKeeper(
appCodec,
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
logger,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.AccountKeeper,
app.DidKeeper,
)
// Create the macaroon Keeper
app.MacaroonKeeper = macaroonkeeper.NewKeeper(
appCodec,
@ -651,6 +642,17 @@ func NewChainApp(
app.DidKeeper,
)
// Create the vault Keeper
app.VaultKeeper = vaultkeeper.NewKeeper(
appCodec,
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
logger,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.AccountKeeper,
app.DidKeeper,
app.MacaroonKeeper,
)
// Create the service Keeper
app.ServiceKeeper = servicekeeper.NewKeeper(
appCodec,
@ -661,6 +663,7 @@ func NewChainApp(
app.GroupKeeper,
app.MacaroonKeeper,
app.NFTKeeper,
app.VaultKeeper,
)
// Create the globalfee keeper

View File

@ -5,13 +5,13 @@ package main
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/ctx"
"github.com/onsonr/sonr/workers/routes"
"github.com/onsonr/sonr/pkg/workers/routes"
"github.com/syumai/workers"
)
func main() {
s := echo.New()
s.Use(ctx.UseSession)
s.Use(ctx.SessionMiddleware)
routes.RegisterProxyViews(s)
routes.RegisterProxyAPI(s)
workers.Serve(s)

View File

@ -4,16 +4,43 @@
package main
import (
"encoding/json"
"os"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/cmd/motr/fetch"
"github.com/onsonr/sonr/internal/ctx"
"github.com/onsonr/sonr/workers/routes"
"github.com/onsonr/sonr/internal/dwn"
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
"github.com/onsonr/sonr/pkg/workers/routes"
)
var config *dwngen.Config
func main() {
// Load dwn config
if err := loadDwnConfig(); err != nil {
panic(err)
}
// Setup HTTP server
e := echo.New()
e.Use(ctx.UseSession)
routes.RegisterClientViews(e)
e.Use(ctx.SessionMiddleware)
routes.RegisterClientAPI(e)
fetch.Serve(e)
routes.RegisterClientViews(e)
dwn.Serve(e)
}
func loadDwnConfig() error {
// Read dwn.json config
dwnBz, err := os.ReadFile("dwn.json")
if err != nil {
return err
}
dwnConfig := &dwngen.Config{}
err = json.Unmarshal(dwnBz, dwnConfig)
if err != nil {
return err
}
config = dwnConfig
return nil
}

View File

@ -49,54 +49,6 @@
}
}
},
"cloudflared@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#cloudflared",
"source": "devbox-search",
"version": "2024.8.3",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3",
"default": true
}
],
"store_path": "/nix/store/nmmh1dx4rvqayxq31c99gxpbwvcchx9w-cloudflared-2024.8.3"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3",
"default": true
}
],
"store_path": "/nix/store/kwikn13v0rddmr8kjhnj67li8aq8qwa6-cloudflared-2024.8.3"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3",
"default": true
}
],
"store_path": "/nix/store/9630bavr6jb44g0pcwwqn0zpgin39dc7-cloudflared-2024.8.3"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3",
"default": true
}
],
"store_path": "/nix/store/hybva7brncispiqm6f0qrpn897r3y3ja-cloudflared-2024.8.3"
}
}
},
"go@1.22": {
"last_modified": "2024-09-12T11:58:09Z",
"resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go",
@ -151,54 +103,6 @@
"source": "devbox-search",
"version": "0.17.0"
},
"skate@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#skate",
"source": "devbox-search",
"version": "1.0.0",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0",
"default": true
}
],
"store_path": "/nix/store/5hn4s18zy08inhimckf3794zszxjn077-skate-1.0.0"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0",
"default": true
}
],
"store_path": "/nix/store/jxwx4fn5qbaz2nan3gmpydqx6vv8ldp1-skate-1.0.0"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0",
"default": true
}
],
"store_path": "/nix/store/zs6ik66kpz9q8mdmzxqmgjv51y39r76h-skate-1.0.0"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0",
"default": true
}
],
"store_path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0"
}
}
},
"templ@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#templ",

11
go.mod
View File

@ -1,6 +1,8 @@
module github.com/onsonr/sonr
go 1.22.5
go 1.23
toolchain go1.23.1
// overrides
replace (
@ -44,7 +46,7 @@ require (
cosmossdk.io/x/evidence v0.1.0
cosmossdk.io/x/feegrant v0.1.0
cosmossdk.io/x/nft v0.1.0
cosmossdk.io/x/tx v0.13.3
cosmossdk.io/x/tx v0.13.5
cosmossdk.io/x/upgrade v0.1.1
github.com/a-h/templ v0.2.778
github.com/apple/pkl-go v0.8.0
@ -56,15 +58,15 @@ require (
github.com/cosmos/cosmos-db v1.0.2
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.5
github.com/cosmos/gogoproto v1.4.12
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/cosmos/ibc-go/v8 v8.2.0
github.com/donseba/go-htmx v1.10.0
github.com/ethereum/go-ethereum v1.14.6
github.com/go-webauthn/webauthn v0.10.2
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
github.com/gorilla/sessions v1.4.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ipfs/boxo v0.21.0
github.com/ipfs/kubo v0.29.0
@ -181,6 +183,7 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect

14
go.sum
View File

@ -794,8 +794,8 @@ cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk=
cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU=
cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM=
cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g=
cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g=
cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys=
cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw=
cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w=
cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc=
cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
@ -1024,8 +1024,8 @@ github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4x
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI=
github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU=
github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE=
github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY=
github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro=
github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0=
github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y=
github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM=
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2-0.20240228211029-91e486ec4dbb h1:jcSPWsQTcbpQcFKmZppgD37GIXAzvFmYRH4E6kxPBFQ=
@ -1091,8 +1091,6 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
github.com/donseba/go-htmx v1.10.0 h1:ByeQd8frMPSX38vkjvsprSQ7+xTkHMDrkzBV0ljfYvA=
github.com/donseba/go-htmx v1.10.0/go.mod h1:8PTAYvNKf8+QYis+DpAsggKz+sa2qljtMgvdAeNBh5s=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
@ -1377,6 +1375,10 @@ github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyE
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
github.com/gorilla/sessions v1.4.0/go.mod h1:FLWm50oby91+hl7p/wRxDth9bWSuk0qVL2emc7lT5ik=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=

View File

@ -1,41 +0,0 @@
package ctx
import (
"net/http"
"time"
"github.com/donseba/go-htmx"
"github.com/labstack/echo/v4"
)
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 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)
}

View File

@ -1,33 +1,80 @@
package ctx
import (
"context"
"errors"
"net/http"
"time"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
"github.com/segmentio/ksuid"
)
// GetSession returns the current Session
func GetSession(c echo.Context) *Session {
return c.(*Session)
}
var store sessions.Store
// UseSession establishes a Session Cookie.
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
type ctxKeySessionID struct{}
// SessionMiddleware establishes a Session Cookie.
func SessionMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
store = sessions.NewCookieStore([]byte("SESSION_KEY"))
return func(c echo.Context) error {
sc := initSession(c)
headers := new(RequestHeaders)
err := sc.Bind(headers)
ctx := c.Request().Context()
// Attempt to read the session ID from the "session" cookie
sessionID, err := readSessionIDFromCookie(c)
if err != nil {
return err
// Generate a new KSUID if the session cookie is missing or invalid
sessionID = ksuid.New().String()
// Write the new session ID to the "session" cookie
err = writeSessionIDToCookie(c, sessionID)
if err != nil {
return c.JSON(
http.StatusInternalServerError,
map[string]string{"error": "Failed to set session cookie"},
)
}
return next(sc)
}
// Inject the session ID into the context
ctx = context.WithValue(ctx, ctxKeySessionID{}, sessionID)
// Update the request with the new context
c.SetRequest(c.Request().WithContext(ctx))
return next(c)
}
}
func initSession(c echo.Context) *Session {
s := &Session{Context: c}
if val := ReadCookie(c, "session"); val == "" {
id := ksuid.New().String()
WriteCookie(c, "session", id)
func getSessionID(ctx context.Context) (string, error) {
sessionID, ok := ctx.Value(ctxKeySessionID{}).(string)
if !ok || sessionID == "" {
return "", errors.New("session ID not found in context")
}
return s
return sessionID, nil
}
func readSessionIDFromCookie(c echo.Context) (string, error) {
cookie, err := c.Cookie("session")
if err != nil {
// Cookie not found or other error
return "", err
}
if cookie == nil || cookie.Value == "" {
// Cookie is empty
return "", http.ErrNoCookie
}
return cookie.Value, nil
}
func writeSessionIDToCookie(c echo.Context, sessionID string) error {
cookie := &http.Cookie{
Name: "session",
Value: sessionID,
Expires: time.Now().Add(24 * time.Hour),
HttpOnly: true,
Path: "/",
// Add Secure and SameSite attributes as needed
}
c.SetCookie(cookie)
return nil
}

61
internal/ctx/state.go Normal file
View File

@ -0,0 +1,61 @@
package ctx
import "github.com/labstack/echo/v4"
type State string
const (
StateAuthenticated State = "authenticated"
StateUnauthenticated State = "unauthenticated"
StatePendingCredentials State = "pending_credentials"
StatePendingAssertion State = "pending_assertion"
StateDisabled State = "disabled"
StateDisconnected State = "disconnected"
)
func (s State) String() string {
return string(s)
}
func StateFromString(s string) State {
switch s {
case StateAuthenticated.String():
return StateAuthenticated
case StateUnauthenticated.String():
return StateUnauthenticated
case StatePendingCredentials.String():
return StatePendingCredentials
case StatePendingAssertion.String():
return StatePendingAssertion
case StateDisabled.String():
return StateDisabled
case StateDisconnected.String():
return StateDisconnected
default:
return State("")
}
}
func readSessionFromStore(c echo.Context, id string) (*session, error) {
sess, err := store.Get(c.Request(), id)
if err != nil {
return nil, err
}
return NewSessionFromValues(sess.Values), nil
}
func writeSessionToStore(
c echo.Context,
id string,
) error {
sess, err := store.Get(c.Request(), id)
if err != nil {
return err
}
s := defaultSession(id, sess)
err = s.SaveHTTP(c)
if err != nil {
return err
}
return nil
}

142
internal/ctx/store.go Normal file
View File

@ -0,0 +1,142 @@
package ctx
import (
"fmt"
"github.com/go-webauthn/webauthn/protocol"
"github.com/gorilla/sessions"
"github.com/labstack/echo/v4"
)
type WebBytes = protocol.URLEncodedBase64
type Session interface {
ID() string
Origin() string
Address() string
ChainID() string
GetChallenge(subject string) (WebBytes, error)
ValidateChallenge(challenge WebBytes, subject string) error
IsState(State) bool
SaveHTTP(c echo.Context) error
}
func defaultSession(id string, s *sessions.Session) *session {
return &session{
session: s,
id: id,
origin: "",
address: "",
chainID: "",
state: StateUnauthenticated,
}
}
func NewSessionFromValues(vals map[interface{}]interface{}) *session {
s := &session{
id: vals["id"].(string),
origin: vals["origin"].(string),
address: vals["address"].(string),
chainID: vals["chainID"].(string),
state: StateFromString(vals["state"].(string)),
challenge: vals["challenge"].(WebBytes),
subject: vals["subject"].(string),
}
return s
}
type session struct {
// Defaults
session *sessions.Session
id string // Generated ksuid http cookie; Initialized on first request
origin string // Webauthn mapping to Relaying Party ID; Initialized on first request
// Initialization
address string // Webauthn mapping to User ID; Supplied by DWN frontend
chainID string // Macaroon mapping to location; Supplied by DWN frontend
// Authentication
challenge WebBytes // Webauthn mapping to Challenge; Per session based on origin
subject string // Webauthn mapping to User Displayable Name; Supplied by DWN frontend
// State
state State
}
func (s *session) ID() string {
return s.id
}
func (s *session) Origin() string {
return s.origin
}
func (s *session) Address() string {
return s.address
}
func (s *session) ChainID() string {
return s.chainID
}
func (s *session) GetChallenge(subject string) (WebBytes, error) {
if s.challenge == nil {
return nil, nil
}
return s.challenge, nil
}
func (s *session) ValidateChallenge(challenge WebBytes, subject string) error {
if s.challenge == nil {
return nil
}
if s.challenge.String() != challenge.String() {
return fmt.Errorf("invalid challenge")
}
s.subject = subject
s.state = StateAuthenticated
return nil
}
func (s *session) IsState(state State) bool {
return s.state == state
}
func (s *session) SaveHTTP(c echo.Context) error {
sess, err := store.Get(c.Request(), s.id)
if err != nil {
return err
}
sess.Values = s.Values()
err = sess.Save(c.Request(), c.Response().Writer)
if err != nil {
return err
}
return nil
}
func (s *session) Values() map[interface{}]interface{} {
vals := make(map[interface{}]interface{})
vals["id"] = s.id
vals["address"] = s.address
vals["chainID"] = s.chainID
vals["state"] = s.state
vals["challenge"] = s.challenge
vals["subject"] = s.subject
return vals
}
func GetSession(c echo.Context) Session {
id, _ := getSessionID(c.Request().Context())
sess, _ := store.Get(c.Request(), id)
if sess.IsNew {
s := defaultSession(id, sess)
s.SaveHTTP(c)
return s
}
s, _ := readSessionFromStore(c, id)
return s
}

View File

@ -5,7 +5,7 @@ import (
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/internal/dwn/gen"
"github.com/onsonr/sonr/nebula/components/index"
"github.com/onsonr/sonr/pkg/nebula/components/index"
)
//go:embed app.wasm

View File

@ -1,7 +1,7 @@
//go:build js && wasm
// +build js,wasm
package fetch
package dwn
import (
"bytes"

View File

@ -1,4 +1,4 @@
package models
package marketing
type Button struct {
Text string

58
internal/orm/webauthn.go Normal file
View File

@ -0,0 +1,58 @@
package orm
import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/go-webauthn/webauthn/protocol/webauthncose"
)
func NewCredentialCreationOptions(subject, address string) (*protocol.PublicKeyCredentialCreationOptions, error) {
chl, err := protocol.CreateChallenge()
if err != nil {
return nil, err
}
return &protocol.PublicKeyCredentialCreationOptions{
Challenge: chl,
User: protocol.UserEntity{
DisplayName: subject,
ID: address,
},
Attestation: defaultAttestation(),
AuthenticatorSelection: defaultAuthenticatorSelection(),
Parameters: defaultCredentialParameters(),
}, nil
}
func buildUserEntity(userID string) protocol.UserEntity {
return protocol.UserEntity{
ID: userID,
}
}
func defaultAttestation() protocol.ConveyancePreference {
return protocol.PreferDirectAttestation
}
func defaultAuthenticatorSelection() protocol.AuthenticatorSelection {
return protocol.AuthenticatorSelection{
AuthenticatorAttachment: "platform",
ResidentKey: protocol.ResidentKeyRequirementPreferred,
UserVerification: "preferred",
}
}
func defaultCredentialParameters() []protocol.CredentialParameter {
return []protocol.CredentialParameter{
{
Type: "public-key",
Algorithm: webauthncose.AlgES256,
},
{
Type: "public-key",
Algorithm: webauthncose.AlgES256K,
},
{
Type: "public-key",
Algorithm: webauthncose.AlgEdDSA,
},
}
}

View File

@ -1,13 +0,0 @@
package auth
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/nebula/components/auth/sections"
"github.com/onsonr/sonr/nebula/global/styles"
)
templ Modal(c echo.Context) {
@styles.OpenModal("Account Registration", "Enter your account information below to create your account.") {
@sections.RegisterStart()
}
}

View File

@ -1,64 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package auth
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/nebula/components/auth/sections"
"github.com/onsonr/sonr/nebula/global/styles"
)
func Modal(c echo.Context) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,15 +0,0 @@
package dash
import (
"github.com/onsonr/sonr/nebula/components/home/sections"
"github.com/onsonr/sonr/nebula/global/styles"
)
templ View() {
@styles.LayoutNoBody("Sonr.ID", true) {
@sections.Header()
@sections.Lowlights()
@sections.CallToAction()
@sections.Footer()
}
}

View File

@ -1,87 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package dash
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/nebula/components/home/sections"
"github.com/onsonr/sonr/nebula/global/styles"
)
func View() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = sections.Header().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = sections.Lowlights().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = sections.CallToAction().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = sections.Footer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = styles.LayoutNoBody("Sonr.ID", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,10 +0,0 @@
package dash
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/ctx"
)
func Route(c echo.Context) error {
return ctx.RenderTempl(c, View())
}

View File

@ -1,10 +0,0 @@
package pay
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/ctx"
)
func Route(c echo.Context) error {
return ctx.RenderTempl(c, nil)
}

View File

@ -26,9 +26,9 @@ A Templ component library for the Sonr DWN (Decentralized Web Node) client.
package main
import (
"github.com/onsonr/sonr/nebula"
"github.com/onsonr/sonr/nebula/components"
"github.com/onsonr/sonr/nebula/pages"
"github.com/onsonr/sonr/pkg/nebula"
"github.com/onsonr/sonr/pkg/nebula/components"
"github.com/onsonr/sonr/pkg/nebula/pages"
)
func main() {

View File

@ -0,0 +1,25 @@
package auth
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/auth/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
)
templ RegisterModal(c echo.Context) {
@styles.OpenModal("Account Registration", "Enter your account information below to create your account.") {
@sections.RegisterStart()
}
}
templ LoginModal(c echo.Context) {
@styles.OpenModal("Account Registration", "Enter your account information below to create your account.") {
@sections.RegisterStart()
}
}
templ AuthorizeModal(c echo.Context) {
@styles.OpenModal("Account Registration", "Enter your account information below to create your account.") {
@sections.RegisterStart()
}
}

View File

@ -0,0 +1,158 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package auth
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/auth/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
)
func RegisterModal(c echo.Context) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func LoginModal(c echo.Context) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
if templ_7745c5c3_Var3 == nil {
templ_7745c5c3_Var3 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var4 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func AuthorizeModal(c echo.Context) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
if templ_7745c5c3_Var5 == nil {
templ_7745c5c3_Var5 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = sections.RegisterStart().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = styles.OpenModal("Account Registration", "Enter your account information below to create your account.").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -6,13 +6,13 @@ import (
)
func AuthorizeRoute(c echo.Context) error {
return ctx.RenderTempl(c, Modal(c))
return ctx.RenderTempl(c, AuthorizeModal(c))
}
func LoginRoute(c echo.Context) error {
return ctx.RenderTempl(c, Modal(c))
return ctx.RenderTempl(c, LoginModal(c))
}
func RegisterRoute(c echo.Context) error {
return ctx.RenderTempl(c, Modal(c))
return ctx.RenderTempl(c, RegisterModal(c))
}

View File

@ -1,9 +1,9 @@
package sections
import (
"github.com/onsonr/sonr/nebula/components/auth/forms"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/nebula/global/ui"
"github.com/onsonr/sonr/pkg/nebula/components/auth/forms"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
templ AuthorizeStart() {

View File

@ -9,9 +9,9 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/nebula/components/auth/forms"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/nebula/global/ui"
"github.com/onsonr/sonr/pkg/nebula/components/auth/forms"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
func AuthorizeStart() templ.Component {

View File

@ -1,9 +1,9 @@
package sections
import (
"github.com/onsonr/sonr/nebula/components/auth/forms"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/nebula/global/ui"
"github.com/onsonr/sonr/pkg/nebula/components/auth/forms"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
templ LoginStart() {

View File

@ -9,9 +9,9 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/nebula/components/auth/forms"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/nebula/global/ui"
"github.com/onsonr/sonr/pkg/nebula/components/auth/forms"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
func LoginStart() templ.Component {

View File

@ -1,9 +1,9 @@
package sections
import (
"github.com/onsonr/sonr/nebula/components/auth/forms"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/nebula/global/ui"
"github.com/onsonr/sonr/pkg/nebula/components/auth/forms"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
templ RegisterStart() {

View File

@ -9,9 +9,9 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/nebula/components/auth/forms"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/nebula/global/ui"
"github.com/onsonr/sonr/pkg/nebula/components/auth/forms"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
func RegisterStart() templ.Component {

View File

@ -1,8 +1,8 @@
package home
import (
"github.com/onsonr/sonr/nebula/components/home/sections"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
)
templ View() {

View File

@ -9,8 +9,8 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/nebula/components/home/sections"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/pkg/nebula/components/home/sections"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
)
func View() templ.Component {

View File

@ -1,10 +1,15 @@
package home
import (
"log"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/ctx"
)
func Route(c echo.Context) error {
s := ctx.GetSession(c)
log.Println(s.ID())
return ctx.RenderTempl(c, View())
}

View File

@ -1,8 +1,8 @@
package sections
import (
"github.com/onsonr/sonr/internal/orm/models"
"github.com/onsonr/sonr/nebula/global/ui"
models "github.com/onsonr/sonr/internal/orm/marketing"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
templ Hero(hero *models.Hero) {

View File

@ -9,8 +9,8 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/internal/orm/models"
"github.com/onsonr/sonr/nebula/global/ui"
models "github.com/onsonr/sonr/internal/orm/marketing"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
)
func Hero(hero *models.Hero) templ.Component {
@ -41,7 +41,7 @@ func Hero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleFirst)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 17, Col: 24}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 17, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@ -54,7 +54,7 @@ func Hero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleEmphasis)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 19, Col: 28}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 19, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -67,7 +67,7 @@ func Hero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleSecond)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 24, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 24, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@ -80,7 +80,7 @@ func Hero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Subtitle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 27, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 27, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@ -146,7 +146,7 @@ func heroImage(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 47, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 47, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@ -159,7 +159,7 @@ func heroImage(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 48, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 48, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
@ -172,7 +172,7 @@ func heroImage(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 49, Col: 29}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 49, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@ -219,7 +219,7 @@ func stats(stats []*models.Stat) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Value)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 61, Col: 145}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 61, Col: 145}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@ -232,7 +232,7 @@ func stats(stats []*models.Stat) templ.Component {
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Denom)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 61, Col: 166}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 61, Col: 166}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@ -245,7 +245,7 @@ func stats(stats []*models.Stat) templ.Component {
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(item.Label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/hero.templ`, Line: 62, Col: 50}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/hero.templ`, Line: 62, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@ -274,8 +274,8 @@ func stats(stats []*models.Stat) templ.Component {
func counterAnimation() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_counterAnimation_524d`,
Function: `function __templ_counterAnimation_524d(){document.addEventListener('alpine:init', () => {
Name: `__templ_counterAnimation_cac3`,
Function: `function __templ_counterAnimation_cac3(){document.addEventListener('alpine:init', () => {
Alpine.data('counter', (target = 0, duration = 3000) => ({
startTimestamp: null,
step: null,
@ -324,8 +324,8 @@ func counterAnimation() templ.ComponentScript {
}))
})
}`,
Call: templ.SafeScript(`__templ_counterAnimation_524d`),
CallInline: templ.SafeScriptInline(`__templ_counterAnimation_524d`),
Call: templ.SafeScript(`__templ_counterAnimation_cac3`),
CallInline: templ.SafeScriptInline(`__templ_counterAnimation_cac3`),
}
}

View File

@ -1,6 +1,6 @@
package sections
import "github.com/onsonr/sonr/internal/orm/models"
import models "github.com/onsonr/sonr/internal/orm/marketing"
templ Highlights(highlights *models.Highlights) {
<!-- Features -->

View File

@ -8,7 +8,7 @@ package sections
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "github.com/onsonr/sonr/internal/orm/models"
import models "github.com/onsonr/sonr/internal/orm/marketing"
func Highlights(highlights *models.Highlights) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
@ -38,7 +38,7 @@ func Highlights(highlights *models.Highlights) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(highlights.Heading)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/highlights.templ`, Line: 14, Col: 26}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/highlights.templ`, Line: 14, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@ -51,7 +51,7 @@ func Highlights(highlights *models.Highlights) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(highlights.Subtitle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/components/home/sections/highlights.templ`, Line: 17, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/sections/highlights.templ`, Line: 17, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {

View File

@ -1,6 +1,6 @@
package home
import "github.com/onsonr/sonr/internal/orm/models"
import models "github.com/onsonr/sonr/internal/orm/marketing"
var hero = &models.Hero{
TitleFirst: "Simplified",

View File

@ -1,10 +1,14 @@
package index
import (
"github.com/onsonr/sonr/nebula/global/state"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/internal/dwn/gen"
"github.com/onsonr/sonr/pkg/nebula/global/state"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
)
func ConfigFile(dwnConfig *gen.Config) {
}
templ IndexFile() {
<!DOCTYPE html>
<html lang="en">

View File

@ -9,10 +9,14 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/onsonr/sonr/nebula/global/state"
"github.com/onsonr/sonr/nebula/global/styles"
"github.com/onsonr/sonr/internal/dwn/gen"
"github.com/onsonr/sonr/pkg/nebula/global/state"
"github.com/onsonr/sonr/pkg/nebula/global/styles"
)
func ConfigFile(dwnConfig *gen.Config) {
}
func IndexFile() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context

View File

@ -0,0 +1 @@
package state

View File

@ -167,7 +167,7 @@ func Layout(title string, remote bool) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 38, Col: 17}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 38, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@ -237,7 +237,7 @@ func LayoutNoBody(title string, remote bool) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 63, Col: 17}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 63, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@ -287,7 +287,7 @@ func OpenModal(title, description string) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 111, Col: 47}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 111, Col: 47}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@ -300,7 +300,7 @@ func OpenModal(title, description string) templ.Component {
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(description)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/layout.templ`, Line: 117, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/layout.templ`, Line: 117, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {

View File

@ -76,7 +76,7 @@ func Styles() templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/css/styles.css")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 20, Col: 50}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 20, Col: 50}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -118,7 +118,7 @@ func Alpine() templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/alpine.min.js")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 24, Col: 53}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 24, Col: 53}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@ -160,7 +160,7 @@ func Dexie() templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/dexie.min.js")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 28, Col: 52}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 28, Col: 52}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@ -202,7 +202,7 @@ func Htmx() templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs("https://cdn.sonr.id/js/htmx.min.js")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/styles/scripts.templ`, Line: 32, Col: 51}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/scripts.templ`, Line: 32, Col: 51}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {

View File

@ -54,7 +54,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: `nebula/global/styles/typography.templ`, Line: 23, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 23, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@ -72,7 +72,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: `nebula/global/styles/typography.templ`, Line: 27, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 27, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -90,7 +90,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: `nebula/global/styles/typography.templ`, Line: 31, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 31, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@ -108,7 +108,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: `nebula/global/styles/typography.templ`, Line: 35, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 35, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@ -159,7 +159,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: `nebula/global/styles/typography.templ`, Line: 42, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 42, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@ -209,7 +209,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: `nebula/global/styles/typography.templ`, Line: 48, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 48, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@ -259,7 +259,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: `nebula/global/styles/typography.templ`, Line: 54, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 54, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@ -309,7 +309,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: `nebula/global/styles/typography.templ`, Line: 60, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/styles/typography.templ`, Line: 60, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {

View File

@ -1,6 +1,6 @@
package ui
import "github.com/onsonr/sonr/nebula/global/styles"
import "github.com/onsonr/sonr/pkg/nebula/global/styles"
templ PrimaryButton(href string, text string) {
<div>

View File

@ -8,7 +8,7 @@ package ui
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "github.com/onsonr/sonr/nebula/global/styles"
import "github.com/onsonr/sonr/pkg/nebula/global/styles"
func PrimaryButton(href string, text string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
@ -38,7 +38,7 @@ func PrimaryButton(href string, text string) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 7, Col: 124}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 7, Col: 124}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@ -51,7 +51,7 @@ func PrimaryButton(href string, 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: `nebula/global/ui/button.templ`, Line: 7, Col: 133}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 7, Col: 133}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@ -93,7 +93,7 @@ func SecondaryButton(href string, text string) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 13, Col: 123}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 13, Col: 123}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@ -106,7 +106,7 @@ func SecondaryButton(href string, text string) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 13, Col: 132}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 13, Col: 132}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@ -269,7 +269,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxGet)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@ -282,7 +282,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 69}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@ -295,7 +295,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 96}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 96}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@ -308,7 +308,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 100, Col: 117}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 100, Col: 117}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
@ -366,7 +366,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxPost)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil {
@ -379,7 +379,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 52}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 52}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
@ -392,7 +392,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
@ -405,7 +405,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `nebula/global/ui/button.templ`, Line: 106, Col: 100}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/global/ui/button.templ`, Line: 106, Col: 100}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {

View File

@ -1,6 +1,6 @@
package ui
import "github.com/onsonr/sonr/nebula/global/styles"
import "github.com/onsonr/sonr/pkg/nebula/global/styles"
func Card(id string, size styles.Size) templ.Component {
return renderCard(id, size.CardAttributes())

Some files were not shown because too many files have changed in this diff Show More