Changeset - r27697:240cfede70d1
[Not reviewed]
master
0 1 0
Patric Stout - 12 months ago 2023-07-04 12:39:55
truebrain@openttd.org
Fix: [Emscripten] switch to URL for content-service that supports WebSocket (#11106)

In the old days, content.openttd.org and bananas-server.openttd.org
ended up on the same route. But with a recent migration, they do not.
content.openttd.org only serves the custom TCP protocol, and
bananas-server.openttd.org only serves the HTTP(S).

Websockets use HTTPS, and as such, should be routed via the latter.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
os/emscripten/pre.js
Show inline comments
 
@@ -2,7 +2,7 @@ Module.arguments.push('-mnull', '-snull'
 
Module['websocket'] = { url: function(host, port, proto) {
 
    /* openttd.org hosts a WebSocket proxy for the content service. */
 
    if (host == "content.openttd.org" && port == 3978 && proto == "tcp") {
 
        return "wss://content.openttd.org/";
 
        return "wss://bananas-server.openttd.org/";
 
    }
 

	
 
    /* Everything else just tries to make a default WebSocket connection.
 
@@ -41,7 +41,7 @@ Module.preRun.push(function() {
 
        /* Check if the OpenGFX baseset is already downloaded. */
 
        if (!FS.analyzePath(content_download_dir + '/baseset/opengfx-0.6.0.tar').exists) {
 
            window.openttd_downloaded_opengfx = true;
 
            FS.createPreloadedFile(content_download_dir + '/baseset', 'opengfx-0.6.0.tar', 'https://installer.cdn.openttd.org/emscripten/opengfx-0.6.0.tar', true, true);
 
            FS.createPreloadedFile(content_download_dir + '/baseset', 'opengfx-0.6.0.tar', 'https://binaries.openttd.org/installer/emscripten/opengfx-0.6.0.tar', true, true);
 
        } else {
 
            /* Fake dependency increase, so the counter is stable. */
 
            Module.addRunDependency('opengfx');
0 comments (0 inline, 0 general)