Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): use fqdn for og:image meta tag value #11082

Merged
merged 11 commits into from
Jul 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
join host and pathname/params safely
eleith authored and eleith committed Jul 18, 2024
commit d0a0e5244cbbe4805904e74e1fd69cea42dcbab2
3 changes: 1 addition & 2 deletions server/src/services/shared-link.service.ts
Original file line number Diff line number Diff line change
@@ -196,15 +196,14 @@ export class SharedLinkService {
const sharedLink = await this.findOrFail(auth.sharedLink.userId, auth.sharedLink.id);
const assetId = sharedLink.album?.albumThumbnailAssetId || sharedLink.assets[0]?.id;
const assetCount = sharedLink.assets.length > 0 ? sharedLink.assets.length : sharedLink.album?.assets.length || 0;
const domain = config.server.externalDomain || DEFAULT_EXTERNAL_DOMAIN;
const imagePath = assetId
? `/api/assets/${assetId}/thumbnail?key=${sharedLink.key.toString('base64url')}`
: '/feature-panel.png';

return {
title: sharedLink.album ? sharedLink.album.albumName : 'Public Share',
description: sharedLink.description || `${assetCount} shared photos & videos`,
imageUrl: `${domain}${imagePath}`,
imageUrl: new URL(imagePath, config.server.externalDomain || DEFAULT_EXTERNAL_DOMAIN).href,
};
}

4 changes: 2 additions & 2 deletions web/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -96,13 +96,13 @@
<meta property="og:type" content="website" />
<meta property="og:title" content={$page.data.meta.title} />
<meta property="og:description" content={$page.data.meta.description} />
<meta property="og:image" content={$serverConfig.externalDomain + $page.data.meta.imageUrl} />
<meta property="og:image" content={new URL($page.data.meta.imageUrl, $serverConfig.externalDomain || window.location.host).href} />

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={$page.data.meta.title} />
<meta name="twitter:description" content={$page.data.meta.description} />
<meta name="twitter:image" content={$serverConfig.externalDomain + $page.data.meta.imageUrl} />
<meta name="twitter:image" content={new URL($page.data.meta.imageUrl, $serverConfig.externalDomain || window.location.host).href} />
{/if}
</svelte:head>