Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 7814e3c

Browse files
committed
✨ Allow loading experimental features through a settings.json parameter
1 parent 6aae877 commit 7814e3c

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/_boot.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ app.on('ready', () => {
128128
devTools: true,
129129
backgroundThrottling: false,
130130
webSecurity: true,
131-
allowRunningInsecureContent: false
131+
allowRunningInsecureContent: false,
132+
experimentalFeatures: settings.experimentalFeatures || false
132133
}
133134
});
134135

src/_renderer.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ window._escapeHtml = (text) => {
1414
return text.replace(/[&<>"']/g, m => {return map[m];});
1515
};
1616
window._purifyCSS = (str) => {
17-
let map = {
18-
'<': '&lt;',
19-
'>': '&gt;'
20-
};
21-
return str.replace(/[&<>"']/g, m => {return map[m];});
17+
return str.replace(/[<]/g, "");
2218
};
2319

2420
// Initiate basic error handling
@@ -46,7 +42,7 @@ window._loadTheme = (theme) => {
4642
document.querySelector("style.theming").remove();
4743
}
4844

49-
document.querySelector("head").innerHTML += `<style class="theming" id="theme_${settings.theme}_css">
45+
document.querySelector("head").innerHTML += `<style class="theming" id="theme_${theme}_css">
5046
@font-face {
5147
font-family: "${theme.cssvars.font_main}";
5248
src: url("${path.join(fontsDir, theme.cssvars.font_main.toLowerCase().replace(/ /g, '_')+'.woff2')}") format("woff2");
@@ -297,7 +293,11 @@ initGreeter = () => {
297293
};
298294

299295
window.themeChanger = (theme) => {
300-
window._loadTheme(require(path.join(themesDir, theme || settings.theme+".json")));
296+
let src = path.join(themesDir, theme+".json" || settings.theme+".json");
297+
// Always get fresh theme files
298+
delete require.cache[src];
299+
300+
window._loadTheme(require(src));
301301
for (let i; i < 99999; i++) {
302302
clearInterval(i);
303303
}
@@ -320,6 +320,10 @@ window.themeChanger = (theme) => {
320320
window.fsDisp = new FilesystemDisplay({
321321
parentId: "filesystem"
322322
});
323+
324+
setTimeout(() => {
325+
window.term.fit();
326+
}, 2700);
323327
};
324328

325329
// Prevent showing menu, exiting fullscreen or app with keyboard shortcuts

0 commit comments

Comments
 (0)