[READ-ONLY] Mirror of https://github.com/mrgnw/ananas. learn multiple languages at once ananas.xcc.es
0

Configure Feed

Select the types of activity you want to include in your feed.

Update auth.js

+16 -1
+16 -1
src/lib/server/auth.js
··· 1 - import { randomUUID } from 'crypto'; 2 1 import { eq } from 'drizzle-orm'; 3 2 import { users, sessions } from './schema/users'; 3 + 4 + // Generate UUID using the Web Crypto API instead of Node's crypto 5 + function randomUUID() { 6 + // Use standard Web Crypto API to generate UUID 7 + if (typeof crypto !== 'undefined' && crypto.randomUUID) { 8 + return crypto.randomUUID(); 9 + } 10 + 11 + // Fallback implementation if crypto.randomUUID is not available 12 + const getRandomHex = (c) => { 13 + const r = crypto.getRandomValues(new Uint8Array(1))[0]; 14 + return (c === 'x' ? r & 0x3 | 0x8 : r & 0xf).toString(16); 15 + }; 16 + 17 + return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, getRandomHex); 18 + } 4 19 5 20 // For password hashing in a web environment, we'll use the Web Crypto API 6 21 async function hashPassword(password) {