diff --git a/cmd/CatsOfMastodonBotGo/main.go b/cmd/CatsOfMastodonBotGo/main.go index 040f260..996f2af 100644 --- a/cmd/CatsOfMastodonBotGo/main.go +++ b/cmd/CatsOfMastodonBotGo/main.go @@ -15,7 +15,6 @@ import ( func main() { // Setup config config.Init() - // Initialize database database.Init() @@ -26,7 +25,7 @@ func main() { runFetchPosts := func() { // Get posts - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel() var posts []domain.Post = nil err, posts := services.PostServiceInstance.GetPostsFromApi(ctx, config.Config.Tag, config.Config.Instance) @@ -56,14 +55,14 @@ func main() { runFetchPosts() } }() - + // Run initial fetch on startup go func() { runFetchPosts() }() // https://seefnasrul.medium.com/create-your-first-go-rest-api-with-jwt-authentication-in-gin-framework-dbe5bda72817 - + r := server.SetupRouter() err := r.Run(":8080") if err != nil { diff --git a/internal/web/handlers/embedCard.go b/internal/web/handlers/embedCard.go index 992828f..01951ca 100644 --- a/internal/web/handlers/embedCard.go +++ b/internal/web/handlers/embedCard.go @@ -22,6 +22,6 @@ func (ps *EmbedCardHandler) GetEmbedCard(c *gin.Context) { post := ps.PostService.GetRandomPost() c.HTML(200, "home/embed.html", gin.H{ "postUrl": post.Url, - "imageUrl": post.Attachments[0].PreviewUrl, + "imageUrl": post.Attachments[0].RemoteUrl, }) }