diff --git a/web/http.go b/app/app.go similarity index 99% rename from web/http.go rename to app/app.go index a2f6c43..228ca41 100644 --- a/web/http.go +++ b/app/app.go @@ -1,4 +1,4 @@ -package web +package app import ( "context" diff --git a/web/favicon.ico b/app/favicon.ico similarity index 100% rename from web/favicon.ico rename to app/favicon.ico diff --git a/web/relay_metadata.example.json b/app/relay_metadata.example.json similarity index 100% rename from web/relay_metadata.example.json rename to app/relay_metadata.example.json diff --git a/web/relay_metadata.go b/app/relay_metadata.go similarity index 94% rename from web/relay_metadata.go rename to app/relay_metadata.go index 1e28ab8..1366dbd 100644 --- a/web/relay_metadata.go +++ b/app/relay_metadata.go @@ -1,4 +1,4 @@ -package web +package app import ( "encoding/json" @@ -19,7 +19,7 @@ type RelayMetadata struct { var relayMetadata RelayMetadata func LoadRelayMetadataJSON() error { - return LoadRelayMetadata("relay_metadata.json") + return LoadRelayMetadata("app/relay_metadata.json") } func LoadRelayMetadata(filename string) error { diff --git a/web/static/custom.min.css b/app/static/custom.min.css similarity index 100% rename from web/static/custom.min.css rename to app/static/custom.min.css diff --git a/web/static/img/favicon.ico b/app/static/img/favicon.ico similarity index 100% rename from web/static/img/favicon.ico rename to app/static/img/favicon.ico diff --git a/web/style/input.css b/app/style/input.css similarity index 100% rename from web/style/input.css rename to app/style/input.css diff --git a/web/style/readme.md b/app/style/readme.md similarity index 100% rename from web/style/readme.md rename to app/style/readme.md diff --git a/web/style/tailwind.config.js b/app/style/tailwind.config.js similarity index 100% rename from web/style/tailwind.config.js rename to app/style/tailwind.config.js diff --git a/web/views/index.html b/app/views/index.html similarity index 100% rename from web/views/index.html rename to app/views/index.html diff --git a/web/views/templates/footer.html b/app/views/templates/footer.html similarity index 100% rename from web/views/templates/footer.html rename to app/views/templates/footer.html diff --git a/web/views/templates/header.html b/app/views/templates/header.html similarity index 100% rename from web/views/templates/header.html rename to app/views/templates/header.html diff --git a/web/views/templates/layout.html b/app/views/templates/layout.html similarity index 100% rename from web/views/templates/layout.html rename to app/views/templates/layout.html diff --git a/main.go b/main.go index 409880c..461012b 100644 --- a/main.go +++ b/main.go @@ -2,12 +2,12 @@ package main import ( "fmt" + "grain/app" "grain/config" configTypes "grain/config/types" - "grain/relay" - "grain/relay/db" - "grain/relay/utils" - "grain/web" + relay "grain/server" + "grain/server/db" + "grain/server/utils" "log" "net/http" @@ -17,7 +17,7 @@ import ( func main() { utils.EnsureFileExists("config.yml", "config/config.example.yml") - utils.EnsureFileExists("relay_metadata.json", "web/relay_metadata.example.json") + utils.EnsureFileExists("app/relay_metadata.json", "app/relay_metadata.example.json") cfg, err := config.LoadConfig("config.yml") if err != nil { @@ -33,7 +33,7 @@ func main() { config.SetupRateLimiter(cfg) config.SetupSizeLimiter(cfg) - err = web.LoadRelayMetadataJSON() + err = app.LoadRelayMetadataJSON() if err != nil { log.Fatal("Failed to load relay metadata: ", err) } @@ -67,8 +67,8 @@ func ListenAndServe(w http.ResponseWriter, r *http.Request) { relay.WebSocketHandler(ws) }).ServeHTTP(w, r) } else if r.Header.Get("Accept") == "application/nostr+json" { - web.RelayInfoHandler(w, r) + app.RelayInfoHandler(w, r) } else { - web.RootHandler(w, r) + app.RootHandler(w, r) } } diff --git a/relay/db/db.go b/server/db/db.go similarity index 100% rename from relay/db/db.go rename to server/db/db.go diff --git a/relay/handlers/close.go b/server/handlers/close.go similarity index 100% rename from relay/handlers/close.go rename to server/handlers/close.go diff --git a/relay/handlers/event.go b/server/handlers/event.go similarity index 96% rename from relay/handlers/event.go rename to server/handlers/event.go index 81fb1dd..cbeabc5 100644 --- a/relay/handlers/event.go +++ b/server/handlers/event.go @@ -5,12 +5,12 @@ import ( "encoding/json" "fmt" "grain/config" - "grain/relay/db" - "grain/relay/handlers/kinds" - "grain/relay/handlers/response" - "grain/relay/utils" + "grain/server/db" + "grain/server/handlers/kinds" + "grain/server/handlers/response" + "grain/server/utils" - relay "grain/relay/types" + relay "grain/server/types" "golang.org/x/net/websocket" ) diff --git a/relay/handlers/kinds/kind0.go b/server/handlers/kinds/kind0.go similarity index 95% rename from relay/handlers/kinds/kind0.go rename to server/handlers/kinds/kind0.go index ad8ffb1..ec1826e 100644 --- a/relay/handlers/kinds/kind0.go +++ b/server/handlers/kinds/kind0.go @@ -3,8 +3,8 @@ package kinds import ( "context" "fmt" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" diff --git a/relay/handlers/kinds/kind1.go b/server/handlers/kinds/kind1.go similarity index 90% rename from relay/handlers/kinds/kind1.go rename to server/handlers/kinds/kind1.go index 78c3611..5f2fdcc 100644 --- a/relay/handlers/kinds/kind1.go +++ b/server/handlers/kinds/kind1.go @@ -4,8 +4,8 @@ package kinds import ( "context" "fmt" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "go.mongodb.org/mongo-driver/mongo" "golang.org/x/net/websocket" diff --git a/relay/handlers/kinds/kind2.go b/server/handlers/kinds/kind2.go similarity index 83% rename from relay/handlers/kinds/kind2.go rename to server/handlers/kinds/kind2.go index c626e97..cdb9ee6 100644 --- a/relay/handlers/kinds/kind2.go +++ b/server/handlers/kinds/kind2.go @@ -2,8 +2,8 @@ package kinds import ( "context" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "golang.org/x/net/websocket" ) diff --git a/relay/handlers/kinds/kind5.go b/server/handlers/kinds/kind5.go similarity index 98% rename from relay/handlers/kinds/kind5.go rename to server/handlers/kinds/kind5.go index 17dafb1..f314b2d 100644 --- a/relay/handlers/kinds/kind5.go +++ b/server/handlers/kinds/kind5.go @@ -3,8 +3,8 @@ package kinds import ( "context" "fmt" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "strings" "go.mongodb.org/mongo-driver/bson" diff --git a/relay/handlers/kinds/regular.go b/server/handlers/kinds/regular.go similarity index 90% rename from relay/handlers/kinds/regular.go rename to server/handlers/kinds/regular.go index 86c7d65..f4b57d1 100644 --- a/relay/handlers/kinds/regular.go +++ b/server/handlers/kinds/regular.go @@ -3,8 +3,8 @@ package kinds import ( "context" "fmt" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "go.mongodb.org/mongo-driver/mongo" "golang.org/x/net/websocket" diff --git a/relay/handlers/kinds/replaceable.go b/server/handlers/kinds/replaceable.go similarity index 95% rename from relay/handlers/kinds/replaceable.go rename to server/handlers/kinds/replaceable.go index 1a6e810..a9f020e 100644 --- a/relay/handlers/kinds/replaceable.go +++ b/server/handlers/kinds/replaceable.go @@ -3,8 +3,8 @@ package kinds import ( "context" "fmt" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" diff --git a/relay/handlers/kinds/replaceableParameters.go b/server/handlers/kinds/replaceableParameters.go similarity index 95% rename from relay/handlers/kinds/replaceableParameters.go rename to server/handlers/kinds/replaceableParameters.go index 72ec25c..cdb8f7e 100644 --- a/relay/handlers/kinds/replaceableParameters.go +++ b/server/handlers/kinds/replaceableParameters.go @@ -3,8 +3,8 @@ package kinds import ( "context" "fmt" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" diff --git a/relay/handlers/kinds/unknown.go b/server/handlers/kinds/unknown.go similarity index 88% rename from relay/handlers/kinds/unknown.go rename to server/handlers/kinds/unknown.go index acb2e54..3ac357f 100644 --- a/relay/handlers/kinds/unknown.go +++ b/server/handlers/kinds/unknown.go @@ -2,8 +2,8 @@ package kinds import ( "context" - "grain/relay/handlers/response" - relay "grain/relay/types" + "grain/server/handlers/response" + relay "grain/server/types" "go.mongodb.org/mongo-driver/mongo" "golang.org/x/net/websocket" diff --git a/relay/handlers/req.go b/server/handlers/req.go similarity index 97% rename from relay/handlers/req.go rename to server/handlers/req.go index 23f3546..71a9496 100644 --- a/relay/handlers/req.go +++ b/server/handlers/req.go @@ -4,10 +4,10 @@ import ( "context" "encoding/json" "fmt" - "grain/relay/db" - "grain/relay/handlers/response" - relay "grain/relay/types" - "grain/relay/utils" + "grain/server/db" + "grain/server/handlers/response" + relay "grain/server/types" + "grain/server/utils" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" diff --git a/relay/handlers/response/closed.go b/server/handlers/response/closed.go similarity index 100% rename from relay/handlers/response/closed.go rename to server/handlers/response/closed.go diff --git a/relay/handlers/response/notice.go b/server/handlers/response/notice.go similarity index 100% rename from relay/handlers/response/notice.go rename to server/handlers/response/notice.go diff --git a/relay/handlers/response/ok.go b/server/handlers/response/ok.go similarity index 100% rename from relay/handlers/response/ok.go rename to server/handlers/response/ok.go diff --git a/relay/relay.go b/server/relay.go similarity index 98% rename from relay/relay.go rename to server/relay.go index b55d7f8..e72e3d8 100644 --- a/relay/relay.go +++ b/server/relay.go @@ -3,7 +3,7 @@ package relay import ( "encoding/json" "fmt" - "grain/relay/handlers" + "grain/server/handlers" "grain/config" diff --git a/relay/types/event.go b/server/types/event.go similarity index 100% rename from relay/types/event.go rename to server/types/event.go diff --git a/relay/types/filter.go b/server/types/filter.go similarity index 100% rename from relay/types/filter.go rename to server/types/filter.go diff --git a/relay/types/subscription.go b/server/types/subscription.go similarity index 100% rename from relay/types/subscription.go rename to server/types/subscription.go diff --git a/relay/utils/checkSig.go b/server/utils/checkSig.go similarity index 98% rename from relay/utils/checkSig.go rename to server/utils/checkSig.go index f77b495..d505b7d 100644 --- a/relay/utils/checkSig.go +++ b/server/utils/checkSig.go @@ -6,7 +6,7 @@ import ( "encoding/json" "log" - relay "grain/relay/types" + relay "grain/server/types" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr" diff --git a/relay/utils/convertType.go b/server/utils/convertType.go similarity index 100% rename from relay/utils/convertType.go rename to server/utils/convertType.go diff --git a/relay/utils/copyFile.go b/server/utils/copyFile.go similarity index 100% rename from relay/utils/copyFile.go rename to server/utils/copyFile.go diff --git a/relay/utils/ensureFileExists.go b/server/utils/ensureFileExists.go similarity index 100% rename from relay/utils/ensureFileExists.go rename to server/utils/ensureFileExists.go