Working with IE11

This commit is contained in:
Sebastian Seedorf
2020-11-15 00:45:41 +01:00
parent b56d0f0676
commit da4cda2507
4 changed files with 19 additions and 13 deletions

View File

@@ -10,7 +10,6 @@ import indexRouter from './routes';
import {HttpLogger, Redis, Config, setupAuthProxy, getReloadRouter, polyfillRoute} from './utils'; import {HttpLogger, Redis, Config, setupAuthProxy, getReloadRouter, polyfillRoute} from './utils';
import {Store} from 'express-session'; import {Store} from 'express-session';
export const app = express(); export const app = express();
// view engine setup // view engine setup
@@ -29,7 +28,7 @@ app.use(express.json());
app.use(express.urlencoded({extended: false})); app.use(express.urlencoded({extended: false}));
// compression // compression
app.use(compression); app.use(compression());
// auth proxy middleware // auth proxy middleware
router.use(setupAuthProxy); router.use(setupAuthProxy);

View File

@@ -26,18 +26,24 @@ export function getReloadRouter(): Router {
res.send(` res.send(`
const loc = window.location; const loc = window.location;
const url = loc.protocol+'//'+loc.host+'${urlJoin(req.baseUrl, "/auto-reload")}'; const url = loc.protocol+'//'+loc.host+'${urlJoin(req.baseUrl, "/auto-reload")}';
const parse = async res => (await res.json()).uuid; // const parse = async res => (await res.json()).uuid;
const parse = function(res) {
return res.json()
.then(function(json) {return json.uuid;}) }
let hash = undefined; let hash = undefined;
let hadError = false; let hadError = false;
setInterval(async () => { setInterval(function() {
try { try {
const data = await parse(await fetch(url)); fetch(url)
.then(function(res) { return parse(res) })
.then(function(data) {
if (data) { if (data) {
hash = hash === undefined ? data : hash; hash = hash === undefined ? data : hash;
if (hash !== data) { if (hash !== data) {
window.location.reload(); window.location.reload();
} }
} }
});
} catch (e) { } catch (e) {
if (hadError === false) { if (hadError === false) {
console.log(e); console.log(e);

View File

@@ -16,6 +16,7 @@ const features = new WaitForSync<PolyfillFeatureList>();
return feats; return feats;
})() })()
.then(feats => { .then(feats => {
feats["fetch"] = {};
Logger.debug("Polyfill analysed:", Object.keys(feats)); Logger.debug("Polyfill analysed:", Object.keys(feats));
features.setData(feats); features.setData(feats);
}) })

View File

@@ -4,8 +4,6 @@ html
head head
title= title title= title
link(rel='stylesheet', href=baseUrl+'/styles/style.css') link(rel='stylesheet', href=baseUrl+'/styles/style.css')
if !Config.isProduction
script(type='text/javascript', async, src=baseUrl+'/auto-reload/client.js')
body body
block content block content
script(type='text/javascript', src=baseUrl+'/js/polyfill.js') script(type='text/javascript', src=baseUrl+'/js/polyfill.js')
@@ -15,3 +13,5 @@ html
require(['src/index'], function (index) { require(['src/index'], function (index) {
index.setConfig({EXTERNAL_BASE_URL: '#{baseUrl}'}); index.setConfig({EXTERNAL_BASE_URL: '#{baseUrl}'});
}); });
if !Config.isProduction
script(type='text/javascript', src=baseUrl+'/auto-reload/client.js')