Skip to content

Commit

Permalink
Add cors and meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
thechubbypanda committed Jun 16, 2024
1 parent 0afe997 commit aa9fc29
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/alexedwards/scs/v2 v2.8.0
github.com/chi-middleware/logrus-logger v0.3.0
github.com/go-chi/chi/v5 v5.0.12
github.com/go-chi/cors v1.2.1
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/maragudk/gomponents v0.20.3
github.com/maragudk/gomponents-htmx v0.5.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/chi-middleware/logrus-logger"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/go-chi/cors"
"github.com/ilyakaznacheev/cleanenv"
"github.com/sirupsen/logrus"
"github.com/thechubbypanda/syncify/views"
Expand Down Expand Up @@ -48,6 +49,13 @@ func main() {
logger.Logger("router", logrus.StandardLogger()),
middleware.StripSlashes,
sm.LoadAndSave,
cors.Handler(cors.Options{
AllowedOrigins: []string{"http://localhost:8000", "https://spotisync.thechubbypanda.dev"},
AllowedMethods: []string{"GET"},
AllowedHeaders: []string{},
ExposedHeaders: []string{},
AllowCredentials: true,
}),
)

r.Route("/", func(r chi.Router) {
Expand Down
3 changes: 3 additions & 0 deletions views/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ func Page(contents ...g.Node) g.Node {
Title: "Syncify",
Language: "en",
Head: []g.Node{
Meta(Name("description"), Content("Sync your Spotify 'Liked Songs' playlist to a sharable one.")),
Meta(Name("keywords"), Content("spotify, sync, likes, liked, songs, public, playlist")),
Meta(Name("author"), Content("Keval \"thechubbypanda\" Kapdee")),
Script(Src("https://unpkg.com/[email protected]")),
Script(Src("https://cdn.tailwindcss.com")),
Link(Rel("stylesheet"), Href("/stylesheet.css")),
Expand Down

0 comments on commit aa9fc29

Please sign in to comment.