fix: sign link preview image URLs through assetService for R2 paths
This commit is contained in:
parent
bacffc759c
commit
858d556d25
|
|
@ -60,7 +60,8 @@ func (h *PostHandler) enrichLinkPreviews(ctx context.Context, posts []models.Pos
|
|||
posts[i].LinkPreviewURL = &lp.URL
|
||||
posts[i].LinkPreviewTitle = &lp.Title
|
||||
posts[i].LinkPreviewDescription = &lp.Description
|
||||
posts[i].LinkPreviewImageURL = &lp.ImageURL
|
||||
signed := h.assetService.SignImageURL(lp.ImageURL)
|
||||
posts[i].LinkPreviewImageURL = &signed
|
||||
posts[i].LinkPreviewSiteName = &lp.SiteName
|
||||
}
|
||||
}
|
||||
|
|
@ -79,7 +80,8 @@ func (h *PostHandler) enrichSinglePostLinkPreview(ctx context.Context, post *mod
|
|||
post.LinkPreviewURL = &lp.URL
|
||||
post.LinkPreviewTitle = &lp.Title
|
||||
post.LinkPreviewDescription = &lp.Description
|
||||
post.LinkPreviewImageURL = &lp.ImageURL
|
||||
signed := h.assetService.SignImageURL(lp.ImageURL)
|
||||
post.LinkPreviewImageURL = &signed
|
||||
post.LinkPreviewSiteName = &lp.SiteName
|
||||
}
|
||||
}
|
||||
|
|
@ -642,7 +644,8 @@ func (h *PostHandler) CreatePost(c *gin.Context) {
|
|||
post.LinkPreviewURL = &lp.URL
|
||||
post.LinkPreviewTitle = &lp.Title
|
||||
post.LinkPreviewDescription = &lp.Description
|
||||
post.LinkPreviewImageURL = &lp.ImageURL
|
||||
signedImg := h.assetService.SignImageURL(lp.ImageURL)
|
||||
post.LinkPreviewImageURL = &signedImg
|
||||
post.LinkPreviewSiteName = &lp.SiteName
|
||||
} else if lpErr != nil {
|
||||
// Timed out or failed — fire async so it's saved for later views
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class TurnstileWidget extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
// On web, use the full API URL
|
||||
// On mobile, Turnstile handles its own endpoints
|
||||
final effectiveBaseUrl = kIsWeb ? (baseUrl ?? ApiConfig.baseUrl) : null;
|
||||
final effectiveBaseUrl = baseUrl ?? ApiConfig.baseUrl;
|
||||
|
||||
return CloudflareTurnstile(
|
||||
siteKey: siteKey,
|
||||
|
|
|
|||
Loading…
Reference in a new issue