aboutsummaryrefslogtreecommitdiff
path: root/webAO/client
diff options
context:
space:
mode:
authorstonedDiscord <Tukz@gmx.de>2023-11-22 19:27:10 +0100
committerGitHub <noreply@github.com>2023-11-22 19:27:10 +0100
commit26e3cd4bfe08a78e65935cf494c24193f59c8a7e (patch)
treed5bc00fd748bceedb8693003916beed1f242ee3e /webAO/client
parent6480caf604d06778109cb58e5983d883725838a9 (diff)
parentf848f34b9979740e85b9648eb42ecafd20dd3926 (diff)
Merge pull request #201 from Troid-Tech/connect-to-wss
Fix https and add wss support
Diffstat (limited to 'webAO/client')
-rw-r--r--webAO/client/aoHost.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/webAO/client/aoHost.ts b/webAO/client/aoHost.ts
index 6cad62a..33e010d 100644
--- a/webAO/client/aoHost.ts
+++ b/webAO/client/aoHost.ts
@@ -3,5 +3,14 @@ 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;
}