Added imagekit optimization support

This commit is contained in:
2025-07-29 17:52:39 +03:30
parent 48b893a403
commit 051408fcdd
6 changed files with 43 additions and 5 deletions

View File

@@ -16,9 +16,14 @@ func InitApiEndpointHandler() {
ApiEndpointHandlerInstance = &ApiEndpointHandler{
PostService: *services.PostServiceInstance,
}
}
func (ps *ApiEndpointHandler) GetRandomPost(c *gin.Context) {
c.JSON(200,ps.PostService.GetRandomPost())
}
post := ps.PostService.GetRandomPost()
for _, attachment := range post.Attachments {
attachment.RemoteUrl = services.GetRemoteUrl(attachment.RemoteUrl)
attachment.PreviewUrl = services.GetPreviewUrl(attachment.RemoteUrl)
}
c.JSON(200, post)
}