diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index c5819bf..43f17bd 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -7,6 +7,28 @@ import { toast } from 'sonner'; import { getSupportedExtension, convertToGLB, ACCEPTED_EXTENSIONS } from '@/lib/convertToGLB'; import { convertIFCtoGLB } from '@/lib/convertIFC'; +/** + * Normaliza URLs comuns para apontar ao binário direto. + * - Dropbox: força dl=1 + * - OneDrive (1drv.ms / onedrive.live.com): força download=1 + */ +function normalizeCloudUrl(input: string): string { + try { + const u = new URL(input); + if (/(^|\.)dropbox\.com$/.test(u.hostname)) { + u.searchParams.set('dl', '1'); + return u.toString(); + } + if (/(^|\.)1drv\.ms$|onedrive\.live\.com$/.test(u.hostname)) { + u.searchParams.set('download', '1'); + return u.toString(); + } + return input; + } catch { + return input; + } +} + const Index = () => { const navigate = useNavigate(); const fileInputRef = useRef(null);