aboutsummaryrefslogtreecommitdiff
path: root/webAO/client/aoHost.ts
blob: 33e010d82b96e3c125b8d59d24e127dd91be1c90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import queryParser from '../utils/queryParser'

const { asset } = queryParser();
export let AO_HOST = asset;
export const setAOhost = (val: string) => {
    const currentProtocol = window.location.protocol;
    const assetProtocol = val.split(':')[0] + ':';

    if (currentProtocol === 'https:' && assetProtocol === 'http:') {
        // In this specific case, we need to request assets over HTTPS
        console.log('Upgrading asset link to https');
        val = val.replace('http:', 'https:');
    }

    AO_HOST = val;
}