From 878f8be45cd0298588bcf2da164961b12bb11891 Mon Sep 17 00:00:00 2001 From: Thomas Reitz Date: Tue, 10 Mar 2026 11:08:21 +0100 Subject: [PATCH] fix: replace crypto.randomUUID with HTTP-compatible alternative crypto.randomUUID() is only available in secure contexts (HTTPS). Since the app runs over HTTP in development, this caused a blank page crash on the external links admin page. Co-Authored-By: Claude Opus 4.6 --- .../core-service/src/core/settings/settings.controller.ts | 3 ++- packages/frontend/src/admin/AdminExternalLinksPage.tsx | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core-service/src/core/settings/settings.controller.ts b/packages/core-service/src/core/settings/settings.controller.ts index 2b7243f..3e6edfb 100644 --- a/packages/core-service/src/core/settings/settings.controller.ts +++ b/packages/core-service/src/core/settings/settings.controller.ts @@ -10,6 +10,7 @@ import { import { ApiTags, ApiOperation } from '@nestjs/swagger'; import { Roles } from '../../common/decorators/roles.decorator'; import { RolesGuard } from '../../common/guards/roles.guard'; +import { randomUUID } from 'crypto'; import { RedisService } from '../../redis/redis.service'; /** @@ -84,7 +85,7 @@ export class SettingsController { // Sortierung sicherstellen const sorted = body.links.map((link, index) => ({ - id: link.id || crypto.randomUUID(), + id: link.id || randomUUID(), label: link.label.trim(), url: link.url.trim(), icon: link.icon || undefined, diff --git a/packages/frontend/src/admin/AdminExternalLinksPage.tsx b/packages/frontend/src/admin/AdminExternalLinksPage.tsx index afcc8f8..e3ff546 100644 --- a/packages/frontend/src/admin/AdminExternalLinksPage.tsx +++ b/packages/frontend/src/admin/AdminExternalLinksPage.tsx @@ -2,6 +2,11 @@ import { useState, useEffect, useRef } from 'react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import api from '../api/client'; +/** Einfache ID-Generierung (crypto.randomUUID ist nur ueber HTTPS verfuegbar) */ +function generateId(): string { + return Date.now().toString(36) + Math.random().toString(36).slice(2, 10); +} + interface ExternalLink { id: string; label: string; @@ -300,7 +305,7 @@ export function AdminExternalLinksPage() { setLinks((prev) => [ ...prev, { - id: crypto.randomUUID(), + id: generateId(), label: '', url: '', icon: undefined,