mirror of
https://github.com/0ceanSlim/grain.git
synced 2024-10-29 17:16:31 +00:00
rename major package folers web->app, relay->server
This commit is contained in:
parent
f291c07bfa
commit
5eb6fd961e
@ -1,4 +1,4 @@
|
||||
package web
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
@ -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 {
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
16
main.go
16
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)
|
||||
}
|
||||
}
|
||||
|
@ -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"
|
||||
)
|
@ -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"
|
@ -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"
|
@ -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"
|
||||
)
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -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"
|
@ -3,7 +3,7 @@ package relay
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"grain/relay/handlers"
|
||||
"grain/server/handlers"
|
||||
|
||||
"grain/config"
|
||||
|
@ -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"
|
Loading…
Reference in New Issue
Block a user