Fix crypto.randomUUID crash on non-HTTPS origins
CI / build-and-push (push) Successful in 33s

Replace all crypto.randomUUID() calls with a uuid() utility that
falls back to Math.random-based generation when the Web Crypto API
is unavailable (plain HTTP contexts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-24 18:50:37 -04:00
parent 68540ebcf9
commit 617b29bd85
5 changed files with 19 additions and 6 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import { useState } from 'react';
import { Database, ShoppingCart, Zap } from 'lucide-react';
import { useGameStore } from '@/store';
import { formatNumber, formatMoney } from '@ai-tycoon/shared';
import { formatNumber, formatMoney, uuid } from '@ai-tycoon/shared';
import type { OwnedDataset, DataDomain } from '@ai-tycoon/shared';
interface MarketplaceDataset {
@@ -49,7 +49,7 @@ export function DataPage() {
const handlePurchase = (item: MarketplaceDataset) => {
const dataset: OwnedDataset = {
id: crypto.randomUUID(),
id: uuid(),
name: item.name,
domain: item.domain,
sizeTokens: item.sizeTokens,