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].LinkPreviewURL = &lp.URL
|
||||||
posts[i].LinkPreviewTitle = &lp.Title
|
posts[i].LinkPreviewTitle = &lp.Title
|
||||||
posts[i].LinkPreviewDescription = &lp.Description
|
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
|
posts[i].LinkPreviewSiteName = &lp.SiteName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +80,8 @@ func (h *PostHandler) enrichSinglePostLinkPreview(ctx context.Context, post *mod
|
||||||
post.LinkPreviewURL = &lp.URL
|
post.LinkPreviewURL = &lp.URL
|
||||||
post.LinkPreviewTitle = &lp.Title
|
post.LinkPreviewTitle = &lp.Title
|
||||||
post.LinkPreviewDescription = &lp.Description
|
post.LinkPreviewDescription = &lp.Description
|
||||||
post.LinkPreviewImageURL = &lp.ImageURL
|
signed := h.assetService.SignImageURL(lp.ImageURL)
|
||||||
|
post.LinkPreviewImageURL = &signed
|
||||||
post.LinkPreviewSiteName = &lp.SiteName
|
post.LinkPreviewSiteName = &lp.SiteName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -642,7 +644,8 @@ func (h *PostHandler) CreatePost(c *gin.Context) {
|
||||||
post.LinkPreviewURL = &lp.URL
|
post.LinkPreviewURL = &lp.URL
|
||||||
post.LinkPreviewTitle = &lp.Title
|
post.LinkPreviewTitle = &lp.Title
|
||||||
post.LinkPreviewDescription = &lp.Description
|
post.LinkPreviewDescription = &lp.Description
|
||||||
post.LinkPreviewImageURL = &lp.ImageURL
|
signedImg := h.assetService.SignImageURL(lp.ImageURL)
|
||||||
|
post.LinkPreviewImageURL = &signedImg
|
||||||
post.LinkPreviewSiteName = &lp.SiteName
|
post.LinkPreviewSiteName = &lp.SiteName
|
||||||
} else if lpErr != nil {
|
} else if lpErr != nil {
|
||||||
// Timed out or failed — fire async so it's saved for later views
|
// 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) {
|
Widget build(BuildContext context) {
|
||||||
// On web, use the full API URL
|
// On web, use the full API URL
|
||||||
// On mobile, Turnstile handles its own endpoints
|
// On mobile, Turnstile handles its own endpoints
|
||||||
final effectiveBaseUrl = kIsWeb ? (baseUrl ?? ApiConfig.baseUrl) : null;
|
final effectiveBaseUrl = baseUrl ?? ApiConfig.baseUrl;
|
||||||
|
|
||||||
return CloudflareTurnstile(
|
return CloudflareTurnstile(
|
||||||
siteKey: siteKey,
|
siteKey: siteKey,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue