diff --git a/init.js b/init.js index 22179e6..a3e4661 100644 --- a/init.js +++ b/init.js @@ -2,8 +2,8 @@ /*global GET, decryptAndMaybeUngzip, sjcl, files_hmac, files_key, getFile */ -GET('object/' + sjcl.codec.hex.fromBits(files_hmac.mac('/Core/modules/core/core.js')), function(response) { - window.eval(decryptAndMaybeUngzip(files_key, response)); +GET('/v2/live/Core/modules/core/core.js', function(response) { + window.eval(response); getFile('/Core/modules/startup/startup.js', function(contents) { window.eval(contents); diff --git a/modules/core/core.js b/modules/core/core.js index 315bd4a..dd5e68e 100644 --- a/modules/core/core.js +++ b/modules/core/core.js @@ -327,6 +327,7 @@ window.getFile = function(file, options, callback) { if(callback === undefined) { callback = function() {}; } + const fromlive = file.startsWith('/Core/') || file.startsWith('/Apps/firetext/') || file.startsWith('/Apps/strut/'); if((options.S3Prefix && options.S3Prefix !== window.S3Prefix) || options.object) { options.cache = false; @@ -364,7 +365,7 @@ window.getFile = function(file, options, callback) { } req.addEventListener('readystatechange', cb); if(!requestCache) { - req.open('GET', getObjectUrl('GET', file, options)); + req.open('GET', fromlive ? '/v2/live' + file : getObjectUrl('GET', file, options)); if(options.S3Prefix) { req.setRequestHeader('X-S3Prefix', options.S3Prefix); } req.send(null); } @@ -377,6 +378,10 @@ window.getFile = function(file, options, callback) { currentFilename = file; var outparams = {}; new Promise(function(resolve, reject) { + if (fromlive) { + resolve(req.response); + return; + } decrypt(options.password != null ? options.password : files_key, req.response, outparams, function(decrypted, e) { if(e) { decrypt(password, req.response, outparams, function(decrypted, e2) {