Use 'localhost' as a fallback for hostname

a42337ad0ad98c5cbf77f312776faaf41ccf4b0b

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +2 -1Showing whitespace changes
src/users.js+2 -1
@@ -458,7 +458,8 @@ export function getPasswordSalt() {
458458 */
459459export function getCookieSessionName() {
460460 // Get server hostname and hash it to generate a session suffix
461- const suffix = crypto.createHash('sha256').update(os.hostname()).digest('hex').slice(0, 8);
461+ const hostname = os.hostname() || 'localhost';
462+ const suffix = crypto.createHash('sha256').update(hostname).digest('hex').slice(0, 8);
462463 return `session-${suffix}`;
463464}
464465