aboutsummaryrefslogtreecommitdiff
path: root/webAO/client/aoHost.ts
blob: 906d4a6946e57f51d652776772aa5aa0d3c9f219 (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;
};