fix crypto.randomUUID() is not a function in an insecure context
This commit is contained in:
parent
25a3adea2a
commit
61f90b99af
|
@ -24,7 +24,10 @@ internal static class Endpoints
|
|||
if (name.Length > 12)
|
||||
return Results.BadRequest("name too long");
|
||||
|
||||
var player = playerService.GetOrAdd(name, id ?? Guid.NewGuid());
|
||||
if (!id.HasValue || id.Value == Guid.Empty)
|
||||
id = Guid.NewGuid();
|
||||
|
||||
var player = playerService.GetOrAdd(name, id.Value);
|
||||
return player != null
|
||||
? Results.Ok(new NameId(player.Name, player.Id))
|
||||
: Results.Unauthorized();
|
||||
|
|
|
@ -11,9 +11,10 @@ import Scoreboard from "./Scoreboard.tsx";
|
|||
import Button from "./components/Button.tsx";
|
||||
import './App.css';
|
||||
import {getRandomTheme, useStoredTheme} from "./theme.ts";
|
||||
import {EmptyGuid} from "./Guid.ts";
|
||||
|
||||
const getNewNameId = () => ({
|
||||
id: crypto.randomUUID(),
|
||||
id: EmptyGuid,
|
||||
name: ''
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue