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:
Hördle Bot
2025-12-01 19:53:26 +01:00
parent a8867ac42e
commit bba6b9ef31

View File

@@ -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 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)
if (locale !== 'en') {
shareUrl += `/${locale}`;