hot fix #3 dev day #70

This commit is contained in:
Tomas Dvorak
2025-10-24 18:15:36 +02:00
parent 80f833b926
commit 36f0f454ce
42 changed files with 124 additions and 127 deletions
+3 -4
View File
@@ -12,6 +12,7 @@ import { ExternalLink, ArrowRight, Eye, Clock } from 'lucide-react';
import React from 'react';
import { trackEvent as umamiTrackEvent, trackMatchView as umamiTrackMatchView, trackVideoPlay as umamiTrackVideoPlay, trackArticleView as umamiTrackArticleView } from '../utils/umami';
import { assetUrl } from '../utils/url';
import { API_URL } from '../services/api';
const toText = (html?: string) => {
if (!html) return '';
@@ -60,8 +61,7 @@ const ArticleDetailPage: React.FC = () => {
queryKey: ['facr-cached-match', (matchLinkQuery.data as any)?.external_match_id],
enabled: Boolean((matchLinkQuery.data as any)?.external_match_id),
queryFn: async () => {
const apiUrl = process.env.REACT_APP_API_URL || 'http://localhost:8080/api/v1';
const origin = new URL(apiUrl).origin;
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
const url = `${origin}/cache/prefetch/facr_club_info.json`;
const res = await fetch(url, { cache: 'no-cache' });
if (!res.ok) return null as any;
@@ -167,8 +167,7 @@ const ArticleDetailPage: React.FC = () => {
const toAbsoluteUploads = React.useCallback((html?: string) => {
if (!html) return '';
try {
const base = process.env.REACT_APP_API_BASE_URL || process.env.REACT_APP_API_URL || 'http://localhost:8080/api/v1';
const origin = new URL(base).origin;
const origin = new URL(API_URL, typeof window !== 'undefined' ? window.location.origin : 'http://localhost:3000').origin;
// Replace src="/uploads... and href="/uploads...
return html
.replace(/src=("|')\s*(\/uploads\/[^"']+)("|')/g, (_m, q1, p2, q3) => `src=${q1}${origin}${p2}${q3}`)