mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-30 13:11:37 +03:00
Added https redirect
This commit is contained in:
parent
3c374b5940
commit
cca6998efe
5 changed files with 30 additions and 4 deletions
client/src/helpers
|
@ -140,3 +140,15 @@ export const getWebAddress = (ip, port = '') => {
|
|||
|
||||
return address;
|
||||
};
|
||||
|
||||
export const redirectToCurrentProtocol = (values) => {
|
||||
const { protocol, hostname, hash } = window.location;
|
||||
const { enabled, port_https } = values;
|
||||
|
||||
if (protocol !== 'https:' && enabled && port_https) {
|
||||
const port = port_https !== 443 ? `:${port_https}` : '';
|
||||
window.location.replace(`https://${hostname}${port}/${hash}`);
|
||||
} else if (protocol === 'https:' && (!enabled || !port_https)) {
|
||||
window.location.replace(`http://${hostname}/${hash}`);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue