fix: random domains

This commit is contained in:
diced 2023-02-18 14:08:49 -08:00
parent 83718d7b31
commit 1b3d3a867b
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1

View file

@ -175,8 +175,7 @@ async function handler(req: NextApiReq, res: NextApiRes) {
if (req.headers['override-domain']) { if (req.headers['override-domain']) {
domain = `${zconfig.core.return_https ? 'https' : 'http'}://${req.headers['override-domain']}`; domain = `${zconfig.core.return_https ? 'https' : 'http'}://${req.headers['override-domain']}`;
} else if (user.domains.length) { } else if (user.domains.length) {
const randomDomain = user.domains[Math.floor(Math.random() * user.domains.length)]; domain = user.domains[Math.floor(Math.random() * user.domains.length)];
domain = `${zconfig.core.return_https ? 'https' : 'http'}://${randomDomain}`;
} else { } else {
domain = `${zconfig.core.return_https ? 'https' : 'http'}://${req.headers.host}`; domain = `${zconfig.core.return_https ? 'https' : 'http'}://${req.headers.host}`;
} }