Use 'localhost' as a fallback for hostname

This commit is contained in:
Cohee
2025-01-26 16:50:59 +02:00
parent 9aac5a22f1
commit a42337ad0a

View File

@@ -458,7 +458,8 @@ export function getPasswordSalt() {
*/
export function getCookieSessionName() {
// Get server hostname and hash it to generate a session suffix
const suffix = crypto.createHash('sha256').update(os.hostname()).digest('hex').slice(0, 8);
const hostname = os.hostname() || 'localhost';
const suffix = crypto.createHash('sha256').update(hostname).digest('hex').slice(0, 8);
return `session-${suffix}`;
}