mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
chore: add nebula assets to proxy server
This commit is contained in:
parent
de05777261
commit
a785d3a01f
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/labstack/gommon/log"
|
"github.com/labstack/gommon/log"
|
||||||
|
"github.com/onsonr/sonr/nebula"
|
||||||
"github.com/onsonr/sonr/nebula/pages"
|
"github.com/onsonr/sonr/nebula/pages"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ func startServer() {
|
|||||||
e.Logger.SetLevel(log.INFO)
|
e.Logger.SetLevel(log.INFO)
|
||||||
|
|
||||||
// Configure the server
|
// Configure the server
|
||||||
|
nebula.UseAssets(e)
|
||||||
e.GET("/", pages.Home)
|
e.GET("/", pages.Home)
|
||||||
e.GET("/allocate", pages.Profile)
|
e.GET("/allocate", pages.Profile)
|
||||||
|
|
||||||
|
17
devbox.json
17
devbox.json
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
|
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
|
||||||
"packages": [
|
"packages": [
|
||||||
"go@1.22"
|
"go@1.22",
|
||||||
|
"bun@latest"
|
||||||
],
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"CLOUDFLARE_API_TOKEN": "$CLOUDFLARE_API_TOKEN",
|
"CLOUDFLARE_API_TOKEN": "$CLOUDFLARE_API_TOKEN",
|
||||||
@ -28,6 +29,9 @@
|
|||||||
"build:image": [
|
"build:image": [
|
||||||
"make local-image"
|
"make local-image"
|
||||||
],
|
],
|
||||||
|
"build:nebula": [
|
||||||
|
"cd nebula && bun run build"
|
||||||
|
],
|
||||||
"gen:proto": [
|
"gen:proto": [
|
||||||
"make proto-gen"
|
"make proto-gen"
|
||||||
],
|
],
|
||||||
@ -37,9 +41,6 @@
|
|||||||
"gen:templ": [
|
"gen:templ": [
|
||||||
"make templ"
|
"make templ"
|
||||||
],
|
],
|
||||||
"serve:air": [
|
|
||||||
"make air"
|
|
||||||
],
|
|
||||||
"serve:ipfs": [
|
"serve:ipfs": [
|
||||||
"make ipfs"
|
"make ipfs"
|
||||||
],
|
],
|
||||||
@ -50,7 +51,13 @@
|
|||||||
"make sh-testnet"
|
"make sh-testnet"
|
||||||
],
|
],
|
||||||
"serve:proxy": [
|
"serve:proxy": [
|
||||||
"make sh-testnet"
|
"go run ./cmd/sonrd/main.go dwn-proxy"
|
||||||
|
],
|
||||||
|
"watch:air": [
|
||||||
|
"make air"
|
||||||
|
],
|
||||||
|
"watch:nebula": [
|
||||||
|
"cd nebula && bun run watch"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
48
devbox.lock
48
devbox.lock
@ -1,6 +1,54 @@
|
|||||||
{
|
{
|
||||||
"lockfile_version": "1",
|
"lockfile_version": "1",
|
||||||
"packages": {
|
"packages": {
|
||||||
|
"bun@latest": {
|
||||||
|
"last_modified": "2024-09-20T22:35:44Z",
|
||||||
|
"resolved": "github:NixOS/nixpkgs/a1d92660c6b3b7c26fb883500a80ea9d33321be2#bun",
|
||||||
|
"source": "devbox-search",
|
||||||
|
"version": "1.1.29",
|
||||||
|
"systems": {
|
||||||
|
"aarch64-darwin": {
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "out",
|
||||||
|
"path": "/nix/store/1hn8dddmy3l99x502d0fqz901gfk74px-bun-1.1.29",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"store_path": "/nix/store/1hn8dddmy3l99x502d0fqz901gfk74px-bun-1.1.29"
|
||||||
|
},
|
||||||
|
"aarch64-linux": {
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "out",
|
||||||
|
"path": "/nix/store/q1k3hsk9hwsg6xllgd25pb0lrh51ym7z-bun-1.1.29",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"store_path": "/nix/store/q1k3hsk9hwsg6xllgd25pb0lrh51ym7z-bun-1.1.29"
|
||||||
|
},
|
||||||
|
"x86_64-darwin": {
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "out",
|
||||||
|
"path": "/nix/store/0wi8b58g19k1gpvniyvax2hpb77sp0w6-bun-1.1.29",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"store_path": "/nix/store/0wi8b58g19k1gpvniyvax2hpb77sp0w6-bun-1.1.29"
|
||||||
|
},
|
||||||
|
"x86_64-linux": {
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "out",
|
||||||
|
"path": "/nix/store/mqzlk40bnhx54by2m4lyyc02syippzad-bun-1.1.29",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"store_path": "/nix/store/mqzlk40bnhx54by2m4lyyc02syippzad-bun-1.1.29"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"go@1.22": {
|
"go@1.22": {
|
||||||
"last_modified": "2024-09-12T11:58:09Z",
|
"last_modified": "2024-09-12T11:58:09Z",
|
||||||
"resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go",
|
"resolved": "github:NixOS/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1#go",
|
||||||
|
3
nebula/assets/main.js
Normal file
3
nebula/assets/main.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"use strict";
|
||||||
|
// src/ts/main.ts
|
||||||
|
console.log("Hello from TypeScript!");
|
1764
nebula/assets/styles.css
Normal file
1764
nebula/assets/styles.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,47 +0,0 @@
|
|||||||
package blocks
|
|
||||||
|
|
||||||
import (
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/a-h/templ"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Icon interface {
|
|
||||||
Render() templ.Component
|
|
||||||
}
|
|
||||||
|
|
||||||
type Variant interface {
|
|
||||||
Attributes() templ.Attributes
|
|
||||||
}
|
|
||||||
|
|
||||||
func clsxMerge(variants ...Variant) templ.Attributes {
|
|
||||||
combinedAttrs := templ.Attributes{}
|
|
||||||
var classElements []string
|
|
||||||
|
|
||||||
for _, variant := range variants {
|
|
||||||
attrs := variant.Attributes()
|
|
||||||
if class, ok := attrs["class"].(string); ok {
|
|
||||||
classElements = append(classElements, strings.Fields(class)...)
|
|
||||||
}
|
|
||||||
for key, value := range attrs {
|
|
||||||
if key != "class" {
|
|
||||||
combinedAttrs[key] = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(classElements) > 0 {
|
|
||||||
combinedAttrs["class"] = strings.Join(classElements, " ")
|
|
||||||
}
|
|
||||||
return combinedAttrs
|
|
||||||
}
|
|
||||||
|
|
||||||
func clsxBuilder(classes ...string) templ.Attributes {
|
|
||||||
if len(classes) == 0 {
|
|
||||||
return templ.Attributes{}
|
|
||||||
}
|
|
||||||
class := strings.Join(classes, " ")
|
|
||||||
return templ.Attributes{
|
|
||||||
"class": class,
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,46 @@
|
|||||||
package blocks
|
package blocks
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
type Icon interface {
|
||||||
|
Render() templ.Component
|
||||||
|
}
|
||||||
|
|
||||||
|
type Variant interface {
|
||||||
|
Attributes() templ.Attributes
|
||||||
|
}
|
||||||
|
|
||||||
|
func clsxMerge(variants ...Variant) templ.Attributes {
|
||||||
|
combinedAttrs := templ.Attributes{}
|
||||||
|
var classElements []string
|
||||||
|
|
||||||
|
for _, variant := range variants {
|
||||||
|
attrs := variant.Attributes()
|
||||||
|
if class, ok := attrs["class"].(string); ok {
|
||||||
|
classElements = append(classElements, strings.Fields(class)...)
|
||||||
|
}
|
||||||
|
for key, value := range attrs {
|
||||||
|
if key != "class" {
|
||||||
|
combinedAttrs[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(classElements) > 0 {
|
||||||
|
combinedAttrs["class"] = strings.Join(classElements, " ")
|
||||||
|
}
|
||||||
|
return combinedAttrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func clsxBuilder(classes ...string) templ.Attributes {
|
||||||
|
if len(classes) == 0 {
|
||||||
|
return templ.Attributes{}
|
||||||
|
}
|
||||||
|
class := strings.Join(classes, " ")
|
||||||
|
return templ.Attributes{
|
||||||
|
"class": class,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
templ Spacer() {
|
templ Spacer() {
|
||||||
<br/>
|
<br/>
|
||||||
|
@ -8,6 +8,48 @@ package blocks
|
|||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
type Icon interface {
|
||||||
|
Render() templ.Component
|
||||||
|
}
|
||||||
|
|
||||||
|
type Variant interface {
|
||||||
|
Attributes() templ.Attributes
|
||||||
|
}
|
||||||
|
|
||||||
|
func clsxMerge(variants ...Variant) templ.Attributes {
|
||||||
|
combinedAttrs := templ.Attributes{}
|
||||||
|
var classElements []string
|
||||||
|
|
||||||
|
for _, variant := range variants {
|
||||||
|
attrs := variant.Attributes()
|
||||||
|
if class, ok := attrs["class"].(string); ok {
|
||||||
|
classElements = append(classElements, strings.Fields(class)...)
|
||||||
|
}
|
||||||
|
for key, value := range attrs {
|
||||||
|
if key != "class" {
|
||||||
|
combinedAttrs[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(classElements) > 0 {
|
||||||
|
combinedAttrs["class"] = strings.Join(classElements, " ")
|
||||||
|
}
|
||||||
|
return combinedAttrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func clsxBuilder(classes ...string) templ.Attributes {
|
||||||
|
if len(classes) == 0 {
|
||||||
|
return templ.Attributes{}
|
||||||
|
}
|
||||||
|
class := strings.Join(classes, " ")
|
||||||
|
return templ.Attributes{
|
||||||
|
"class": class,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func Spacer() templ.Component {
|
func Spacer() templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||||
|
14
nebula/package.json
Normal file
14
nebula/package.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"build:ts": "tsc",
|
||||||
|
"build:css": "bunx tailwindcss -i ./src/styles.css -o ./assets/styles.css",
|
||||||
|
"build": "bun run build:ts && bun run build:css",
|
||||||
|
"watch:ts": "tsc -w",
|
||||||
|
"watch:css": "bunx tailwindcss -i ./src/styles.css -o ./assets/styles.css --watch",
|
||||||
|
"watch": "bun run watch:ts & bun run watch:css"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"tailwindcss": "^3.3.0",
|
||||||
|
"typescript": "^4.9.0"
|
||||||
|
}
|
||||||
|
}
|
2
nebula/src/main.ts
Normal file
2
nebula/src/main.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// src/ts/main.ts
|
||||||
|
console.log("Hello from TypeScript!");
|
6
nebula/src/styles.css
Normal file
6
nebula/src/styles.css
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/* src/css/styles.css */
|
||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
/* Custom styles */
|
12
nebula/tailwind.config.js
Normal file
12
nebula/tailwind.config.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// tailwind.config.js
|
||||||
|
module.exports = {
|
||||||
|
content: [
|
||||||
|
"./blocks/**/*.{templ,html}",
|
||||||
|
"./pages/**/*.{templ,html}",
|
||||||
|
"./src/**/*.ts",
|
||||||
|
],
|
||||||
|
theme: {
|
||||||
|
extend: {},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
};
|
13
nebula/tsconfig.json
Normal file
13
nebula/tsconfig.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./assets",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"target": "ES6",
|
||||||
|
"module": "ES6",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user