mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-24 22:46:39 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
1a87356048
commit
878f8be45c
2 changed files with 8 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue