fix: update Schema service to use new API endpoint

This commit is contained in:
Prad Nukala
2024-10-07 21:22:56 -04:00
parent af6e07323b
commit fbc640b7c4
11 changed files with 1481 additions and 122 deletions
-15
View File
@@ -1,22 +1,16 @@
package nebula
import (
"context"
"embed"
"io/fs"
"net/http"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/models"
)
//go:embed assets
var embeddedFiles embed.FS
//go:embed nebula.pkl
var config []byte
func getHTTPFS() (http.FileSystem, error) {
fsys, err := fs.Sub(embeddedFiles, "assets")
if err != nil {
@@ -27,10 +21,6 @@ func getHTTPFS() (http.FileSystem, error) {
// UseAssets is a middleware that serves static files from the embedded assets
func UseAssets(e *echo.Echo) error {
err := models.LoadFromString(context.Background(), string(config))
if err != nil {
return err
}
fsys, err := getHTTPFS()
if err != nil {
return err
@@ -38,10 +28,5 @@ func UseAssets(e *echo.Echo) error {
assets := http.FileServer(fsys)
e.GET("/", echo.WrapHandler(assets))
e.GET("/assets/*", echo.WrapHandler(http.StripPrefix("/assets/", assets)))
e.GET("/_nebula/config", handleGetConfig)
return nil
}
func handleGetConfig(c echo.Context) error {
return c.Blob(http.StatusOK, "application/octet-stream", config)
}
-61
View File
@@ -1,61 +0,0 @@
amends "https://pkl.sh/UIUX.pkl";
home = new Home {
hero = new Hero {
titleFirst = "Simplified";
titleEmphasis = "self-custody";
titleSecond = "for everyone";
subtitle = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
image = new Image {
src = "https://cdn.sonr.id/img/hero-clipped.svg";
width = "500";
height = "500";
};
stats {
new Stat {
value = "476K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.44K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.5M+";
label = "Assets packed with power beyond your imagination.";
}
};
};
};
register = new ModalForm {
title = "Register";
description = "Register your Sonr account to start using the platform.";
id = "register-start";
};
login = new ModalForm {
title = "Login";
description = "Login to your Sonr account to start using the platform.";
id = "login-start";
};
authorize = new ModalForm {
title = "Authorize";
description = "Authorize your Sonr account to start using the platform.";
id = "authorize-start";
};
privacyConsent = new ModalForm {
title = "Privacy Consent";
description = "Privacy Consent";
id = "privacy-consent-start";
};