fix: Use current domain in share URL instead of static config.domain
- Share URL now uses window.location.hostname to support both hoerdle.de and hördle.de - Protocol is automatically detected from window.location.protocol - Fixes issue where share URL always used hoerdle.de even when accessed via hördle.de
This commit is contained in:
@@ -274,7 +274,10 @@ export default function Game({ dailyPuzzle, genre = null, isSpecial = false, max
|
|||||||
const bonusStar = (hasWon && gameState.yearGuessed && dailyPuzzle.releaseYear && gameState.scoreBreakdown.some(item => item.reason === 'Bonus: Correct Year')) ? '⭐' : '';
|
const bonusStar = (hasWon && gameState.yearGuessed && dailyPuzzle.releaseYear && gameState.scoreBreakdown.some(item => item.reason === 'Bonus: Correct Year')) ? '⭐' : '';
|
||||||
const genreText = genre ? `${isSpecial ? t('special') : t('genre')}: ${genre}\n` : '';
|
const genreText = genre ? `${isSpecial ? t('special') : t('genre')}: ${genre}\n` : '';
|
||||||
|
|
||||||
let shareUrl = `https://${config.domain}`;
|
// Use current domain from window.location to support both hoerdle.de and hördle.de
|
||||||
|
const currentHost = typeof window !== 'undefined' ? window.location.hostname : config.domain;
|
||||||
|
const protocol = typeof window !== 'undefined' ? window.location.protocol : 'https:';
|
||||||
|
let shareUrl = `${protocol}//${currentHost}`;
|
||||||
// Add locale prefix if not default (en)
|
// Add locale prefix if not default (en)
|
||||||
if (locale !== 'en') {
|
if (locale !== 'en') {
|
||||||
shareUrl += `/${locale}`;
|
shareUrl += `/${locale}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user