mirror of
https://github.com/Octops/quake-kube.git
synced 2026-04-05 17:20:33 +00:00
Fixes for running with https frontend (#20)
* use browser protocol * Update zz_generated.static.go * set host args with proper port * Update zz_generated.static.go * use proper protocol for the websocket
This commit is contained in:
@ -135,7 +135,7 @@
|
||||
localStorage.setItem("playerName", inputPlayerName.value);
|
||||
}
|
||||
host = document.location.host
|
||||
if (!host.includes(":")) { host = host + ":80" }
|
||||
if (!host.includes(":")) { host = host + (window.location.protocol == 'https:' ? ":443" : ":80") }
|
||||
var args = ['+set', 'fs_cdn', host, '+connect', host];
|
||||
args.push.apply(args, ['+set', 'cl_allowDownload', '1'])
|
||||
args.push.apply(args, ['+set', 'cl_timeout', '15'])
|
||||
|
||||
8
public/ioquake3.js
vendored
8
public/ioquake3.js
vendored
@ -15225,7 +15225,7 @@ function copyTempDouble(ptr) {
|
||||
//var root = SYSC.GetCDN();
|
||||
var root = Pointer_stringify(_Cvar_VariableString(allocate(intArrayFromString('fs_cdn'), 'i8', ALLOC_STACK)));
|
||||
var name = asset.name.replace(/(.+\/|)(.+?)$/, '$1' + asset.checksum + '-$2');
|
||||
var url = 'http://' + root + '/assets/' + name;
|
||||
var url = document.location.protocol + '//' + root + '/assets/' + name;
|
||||
|
||||
SYS.DoXHR(url, {
|
||||
dataType: 'arraybuffer',
|
||||
@ -15274,9 +15274,9 @@ function copyTempDouble(ptr) {
|
||||
var fs_cdn = Pointer_stringify(_Cvar_VariableString(allocate(intArrayFromString('fs_cdn'), 'i8', ALLOC_STACK)));
|
||||
var fs_game = Pointer_stringify(_Cvar_VariableString(allocate(intArrayFromString('fs_game'), 'i8', ALLOC_STACK)));
|
||||
var com_basegame = Pointer_stringify(_Cvar_VariableString(allocate(intArrayFromString('com_basegame'), 'i8', ALLOC_STACK)));
|
||||
var url = 'http://' + fs_cdn + '/assets/manifest.json';
|
||||
var url = document.location.protocol + '//' + fs_cdn + '/assets/manifest.json';
|
||||
|
||||
SYS.DoXHR('http://' + fs_cdn + '/info', {
|
||||
SYS.DoXHR(document.location.protocol + '//' + fs_cdn + '/info', {
|
||||
dataType: 'json',
|
||||
onload: function (err, info) {
|
||||
var mapname = info["mapname"];
|
||||
@ -16601,7 +16601,7 @@ function copyTempDouble(ptr) {
|
||||
} else {
|
||||
// create the actual websocket object and connect
|
||||
try {
|
||||
var url = 'ws://' + addr + ':' + port;
|
||||
var url = (window.location.protocol == 'https:' ? "wss://" : "ws://") + addr + ':' + port;
|
||||
// the node ws library API is slightly different than the browser's
|
||||
var opts = ENVIRONMENT_IS_NODE ? {headers: {'websocket-protocol': ['binary']}} : ['binary'];
|
||||
// If node we use the ws library.
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user