diff options
| -rw-r--r-- | auth/dpop.go (renamed from backend/auth/dpop.go) | 0 | ||||
| -rw-r--r-- | auth/oauth.go (renamed from backend/auth/oauth.go) | 0 | ||||
| -rw-r--r-- | fetchers/app.bsky.actor.go (renamed from backend/fetchers/app.bsky.actor.go) | 6 | ||||
| -rw-r--r-- | fetchers/app.bsky.feed.go (renamed from backend/fetchers/app.bsky.feed.go) | 6 | ||||
| -rw-r--r-- | fetchers/cache.go (renamed from backend/fetchers/cache.go) | 2 | ||||
| -rw-r--r-- | fetchers/config.go (renamed from backend/fetchers/config.go) | 0 | ||||
| -rw-r--r-- | general/records.go (renamed from backend/general/records.go) | 2 | ||||
| -rw-r--r-- | general/utils.go (renamed from backend/general/utils.go) | 0 | ||||
| -rw-r--r-- | go.mod (renamed from backend/go.mod) | 2 | ||||
| -rw-r--r-- | go.sum (renamed from backend/go.sum) | 0 | ||||
| -rw-r--r-- | main.go (renamed from backend/main.go) | 25 | ||||
| -rw-r--r-- | notes/app.bsky.actor.go (renamed from backend/notes/app.bsky.actor.go) | 0 | ||||
| -rw-r--r-- | notes/app.bsky.feed.go (renamed from backend/notes/app.bsky.feed.go) | 2 | ||||
| -rw-r--r-- | notes/author.go (renamed from backend/notes/author.go) | 0 | ||||
| -rw-r--r-- | notes/note.go (renamed from backend/notes/note.go) | 0 |
15 files changed, 29 insertions, 16 deletions
diff --git a/backend/auth/dpop.go b/auth/dpop.go index 2a8f6ed..2a8f6ed 100644 --- a/backend/auth/dpop.go +++ b/auth/dpop.go diff --git a/backend/auth/oauth.go b/auth/oauth.go index a1b0419..a1b0419 100644 --- a/backend/auth/oauth.go +++ b/auth/oauth.go diff --git a/backend/fetchers/app.bsky.actor.go b/fetchers/app.bsky.actor.go index 41a9c17..ebac250 100644 --- a/backend/fetchers/app.bsky.actor.go +++ b/fetchers/app.bsky.actor.go @@ -4,9 +4,9 @@ import ( "encoding/json" "fmt" "io" - "llostre/backend/auth" - "llostre/backend/general" - "llostre/backend/notes" + "llostre/auth" + "llostre/general" + "llostre/notes" "net" "net/http" "strings" diff --git a/backend/fetchers/app.bsky.feed.go b/fetchers/app.bsky.feed.go index 8562a9c..5eebec9 100644 --- a/backend/fetchers/app.bsky.feed.go +++ b/fetchers/app.bsky.feed.go @@ -3,9 +3,9 @@ package fetchers import ( "encoding/json" "fmt" - "llostre/backend/auth" - "llostre/backend/general" - "llostre/backend/notes" + "llostre/auth" + "llostre/general" + "llostre/notes" "time" ) diff --git a/backend/fetchers/cache.go b/fetchers/cache.go index ac91259..dc43c53 100644 --- a/backend/fetchers/cache.go +++ b/fetchers/cache.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "llostre/backend/notes" + "llostre/notes" "sort" "time" diff --git a/backend/fetchers/config.go b/fetchers/config.go index 090eb09..090eb09 100644 --- a/backend/fetchers/config.go +++ b/fetchers/config.go diff --git a/backend/general/records.go b/general/records.go index d82b289..12825bd 100644 --- a/backend/general/records.go +++ b/general/records.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" "io" - "llostre/backend/auth" + "llostre/auth" "log/slog" "net/http" ) diff --git a/backend/general/utils.go b/general/utils.go index ac27443..ac27443 100644 --- a/backend/general/utils.go +++ b/general/utils.go @@ -1,4 +1,4 @@ -module llostre/backend +module llostre go 1.25.7 diff --git a/backend/main.go b/main.go index 6585e56..6907fa4 100644 --- a/backend/main.go +++ b/main.go @@ -1,11 +1,13 @@ package main import ( + "embed" "encoding/json" "fmt" - "llostre/backend/auth" - "llostre/backend/fetchers" - "llostre/backend/notes" + "io/fs" + "llostre/auth" + "llostre/fetchers" + "llostre/notes" "log/slog" "net/http" "net/url" @@ -24,10 +26,12 @@ var ( sessionsMutex sync.RWMutex sessions = make(map[string]*auth.OAuthState) config *fetchers.Config + //go:embed frontend/dist + embeddedFrontend embed.FS ) func init() { - godotenv.Load("../.env") + godotenv.Load(".env") // setup URLs appDomain := os.Getenv("APP_DOMAIN") @@ -55,6 +59,8 @@ func init() { Level: logLevel, })) + logger.Debug("Logging configured", "log level", logLevel) + slingshotURL := os.Getenv("SLINGSHOT_URL") ttlMin := os.Getenv("TTL_MIN") @@ -415,8 +421,15 @@ func main() { defer config.Cache.Close() // serve static files - fs := http.FileServer(http.Dir("../frontend/dist")) - http.Handle("/", fs) + distFS, err := fs.Sub(embeddedFrontend, "frontend/dist") + if err != nil { + panic(err) + } + entries, _ := embeddedFrontend.ReadDir("frontend/dist") + for _, e := range entries { + config.Logger.Debug("embedded file", "name", e.Name()) + } + http.Handle("/", http.FileServer(http.FS(distFS))) // api routes http.HandleFunc("/api/posts", postsHandler) diff --git a/backend/notes/app.bsky.actor.go b/notes/app.bsky.actor.go index 00a1ff1..00a1ff1 100644 --- a/backend/notes/app.bsky.actor.go +++ b/notes/app.bsky.actor.go diff --git a/backend/notes/app.bsky.feed.go b/notes/app.bsky.feed.go index 3dd7b95..21b94f9 100644 --- a/backend/notes/app.bsky.feed.go +++ b/notes/app.bsky.feed.go @@ -2,7 +2,7 @@ package notes import ( "fmt" - "llostre/backend/general" + "llostre/general" "time" ) diff --git a/backend/notes/author.go b/notes/author.go index faf4f7b..faf4f7b 100644 --- a/backend/notes/author.go +++ b/notes/author.go diff --git a/backend/notes/note.go b/notes/note.go index 15f6f67..15f6f67 100644 --- a/backend/notes/note.go +++ b/notes/note.go |
