Use 'localhost' as a fallback for hostname

a42337ad0ad98c5cbf77f312776faaf41ccf4b0b

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

1 files changed, +2 -1Ignore whitespace
src/users.js+2 -1
@@ -458,7 +458,8 @@ export function getPasswordSalt() {
458 */458 */
459export function getCookieSessionName() {459export function getCookieSessionName() {
460 // Get server hostname and hash it to generate a session suffix460 // 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);
462 return `session-${suffix}`;463 return `session-${suffix}`;
463}464}
464465