@Rekoo-PS reported that gallery URLs sent via the WhatsApp Business API render an unbranded "PicPeak - Photo Sharing Platform" preview even though manual link sends from the WhatsApp app pick up the per-event rich preview correctly. Two root causes, two fixes: 1. WhatsApp Business and 3rd-party preview services (Twilio, LinkPreview.net, etc.) don't always crawl with the recognisable "WhatsApp/X.Y.Z" UA we matched in nginx + galleryOgService. Extend the regex (both copies) to also catch WhatsAppBot, wa-bot, LinkPreview, and Slack-ImgProxy. 2. Even with broader UA coverage, some senders cache metadata with no UA at all and fetch the static SPA shell. That shell's <title> was hard-coded to "PicPeak - Photo Sharing Platform" — embarrassingly generic for any self-hosted brand. Switch to Vite's %VITE_DEFAULT_TITLE% / %VITE_DEFAULT_DESCRIPTION% HTML substitution so self-hosters can bake their brand into the fallback at build time. Defaults stay "PicPeak" so the upstream image doesn't change behaviour for anyone. The per-event rich preview path (handleGalleryOgRequest, fired on matched crawler UAs) is unchanged — this only improves the fallback for unrecognised UAs and for the SPA-shell title that humans see in their browser tab. Adds a vite.config plugin to provide the defaults when env vars aren't set, so unsubstituted "%VITE_..." literals never reach the built HTML. Adds .env.example entries explaining the override. Tests: extend galleryOgService.shareImage.test.js with an isSocialCrawler suite that pins every documented UA (incl. the new ones) plus three browser UAs (negative) and null/empty edge cases. Verified locally: `vite build` with VITE_DEFAULT_TITLE="MyBrand" produces <title>MyBrand</title> + og:title="MyBrand"; without the env var falls back to "PicPeak". Refs: #521
24 lines
1.0 KiB
Bash
24 lines
1.0 KiB
Bash
# Production Environment Configuration
|
|
# When running behind a reverse proxy like Traefik, use relative URLs
|
|
|
|
# Static HTML fallback for social-link previews (#521).
|
|
# Override these with your brand so previews that hit the static
|
|
# index.html (vs the per-event OG endpoint) aren't generic.
|
|
VITE_DEFAULT_TITLE=PicPeak
|
|
VITE_DEFAULT_DESCRIPTION=Photo gallery shared with PicPeak.
|
|
|
|
# Backend API URL
|
|
# For production behind reverse proxy, use relative URL:
|
|
VITE_API_URL=/api
|
|
|
|
# For development or if frontend/backend are on different domains:
|
|
# VITE_API_URL=https://api.yourdomain.com
|
|
|
|
# Umami Analytics Configuration (OPTIONAL - Fallback only)
|
|
# NOTE: Primary Umami configuration should be done through Admin UI > Settings > Analytics
|
|
# These environment variables serve as fallbacks when backend settings are not available
|
|
#
|
|
# Real-world example values:
|
|
# VITE_UMAMI_URL=https://analytics.picpeak.com
|
|
# VITE_UMAMI_WEBSITE_ID=b4d3c2a1-5678-90ab-cdef-1234567890ab
|
|
# VITE_UMAMI_SHARE_URL=https://analytics.picpeak.com/share/Ab3Cd5Fg/picpeak-gallery |