forked from mirror/OpenTTD
Fix: [Emscripten] Force secure WebSockets over HTTPS (#9248)
This commit is contained in:
@@ -9,7 +9,15 @@ Module['websocket'] = { url: function(host, port, proto) {
|
|||||||
* If you run your own server you can setup your own WebSocket proxy in
|
* If you run your own server you can setup your own WebSocket proxy in
|
||||||
* front of it and let people connect to your server via the proxy. You
|
* front of it and let people connect to your server via the proxy. You
|
||||||
* are best to add another "if" statement as above for this. */
|
* are best to add another "if" statement as above for this. */
|
||||||
|
|
||||||
|
if (location.protocol === 'https:') {
|
||||||
|
/* Insecure WebSockets do not work over HTTPS, so we force
|
||||||
|
* secure ones. */
|
||||||
|
return 'wss://';
|
||||||
|
} else {
|
||||||
|
/* Use the default provided by Emscripten. */
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
} };
|
} };
|
||||||
|
|
||||||
Module.preRun.push(function() {
|
Module.preRun.push(function() {
|
||||||
|
Reference in New Issue
Block a user