upgraded electron
This commit is contained in:
parent
6f0c949a91
commit
939c59655f
|
@ -44,4 +44,4 @@ before_script:
|
||||||
- sleep 3
|
- sleep 3
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- npm run dist
|
- npm run travis
|
|
@ -1,8 +1,8 @@
|
||||||
const { app, Menu, server, BrowserWindow, shell } = require("electron");
|
const { app, Menu, BrowserWindow, shell } = require("electron"); //server,
|
||||||
const path = require("path");
|
// const path = require("path");
|
||||||
const url = require("url");
|
// const url = require("url");
|
||||||
const http = require("http");
|
// const http = require("http");
|
||||||
const fs = require("fs");
|
// const fs = require("fs");
|
||||||
|
|
||||||
// Keep a global reference of the window object, if you don't, the window will
|
// Keep a global reference of the window object, if you don't, the window will
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
|
@ -14,15 +14,23 @@ function createWindow() {
|
||||||
width: 377,
|
width: 377,
|
||||||
height: 800,
|
height: 800,
|
||||||
title: "Sengi",
|
title: "Sengi",
|
||||||
backgroundColor: "#FFF",
|
backgroundColor: "#131925",
|
||||||
useContentSize: true
|
useContentSize: true,
|
||||||
|
webPreferences: {
|
||||||
|
contextIsolation: true,
|
||||||
|
nodeIntegration: false,
|
||||||
|
nodeIntegrationInWorker: false
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
win.setAutoHideMenuBar(true);
|
win.setAutoHideMenuBar(true);
|
||||||
win.setMenuBarVisibility(false);
|
win.setMenuBarVisibility(false);
|
||||||
|
|
||||||
var server = http.createServer(requestHandler).listen(9527);
|
//var server = http.createServer(requestHandler).listen(9527);
|
||||||
const sengiUrl = "http://localhost:9527";
|
//const sengiUrl = "http://localhost:9527";
|
||||||
|
|
||||||
|
const sengiUrl = "https://sengi.nicolas-constant.com";
|
||||||
|
|
||||||
win.loadURL(sengiUrl);
|
win.loadURL(sengiUrl);
|
||||||
|
|
||||||
const template = [
|
const template = [
|
||||||
|
@ -157,39 +165,39 @@ function createWindow() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestHandler(req, res) {
|
// function requestHandler(req, res) {
|
||||||
var file = req.url == "/" ? "/index.html" : req.url,
|
// var file = req.url == "/" ? "/index.html" : req.url,
|
||||||
root = __dirname + "/dist",
|
// root = __dirname + "/dist",
|
||||||
page404 = root + "/404.html";
|
// page404 = root + "/404.html";
|
||||||
|
|
||||||
if (file.includes("register") || file.includes("home")) file = "/index.html";
|
// if (file.includes("register") || file.includes("home")) file = "/index.html";
|
||||||
|
|
||||||
getFile(root + file, res, page404);
|
// getFile(root + file, res, page404);
|
||||||
}
|
// }
|
||||||
|
|
||||||
function getFile(filePath, res, page404) {
|
// function getFile(filePath, res, page404) {
|
||||||
console.warn(`filePath: ${filePath}`);
|
// console.warn(`filePath: ${filePath}`);
|
||||||
fs.exists(filePath, function (exists) {
|
// fs.exists(filePath, function (exists) {
|
||||||
if (exists) {
|
// if (exists) {
|
||||||
fs.readFile(filePath, function (err, contents) {
|
// fs.readFile(filePath, function (err, contents) {
|
||||||
if (!err) {
|
// if (!err) {
|
||||||
res.end(contents);
|
// res.end(contents);
|
||||||
} else {
|
// } else {
|
||||||
console.dir(err);
|
// console.dir(err);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
fs.readFile(page404, function (err, contents) {
|
// fs.readFile(page404, function (err, contents) {
|
||||||
if (!err) {
|
// if (!err) {
|
||||||
res.writeHead(404, { "Content-Type": "text/html" });
|
// res.writeHead(404, { "Content-Type": "text/html" });
|
||||||
res.end(contents);
|
// res.end(contents);
|
||||||
} else {
|
// } else {
|
||||||
console.dir(err);
|
// console.dir(err);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
app.commandLine.appendSwitch("force-color-profile", "srgb");
|
app.commandLine.appendSwitch("force-color-profile", "srgb");
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,7 +23,9 @@
|
||||||
"e2e": "ng e2e",
|
"e2e": "ng e2e",
|
||||||
"electron": "ng build --prod && electron .",
|
"electron": "ng build --prod && electron .",
|
||||||
"electron-debug": "ng build && electron .",
|
"electron-debug": "ng build && electron .",
|
||||||
"dist": "npm run build && electron-builder --publish onTagOrDraft"
|
"electron-test": "electron .",
|
||||||
|
"dist": "npm run build && electron-builder --publish onTagOrDraft",
|
||||||
|
"travis": "electron-builder --publish onTagOrDraft"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -68,7 +70,7 @@
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"@types/node": "~8.9.4",
|
"@types/node": "~8.9.4",
|
||||||
"codelyzer": "~4.2.1",
|
"codelyzer": "~4.2.1",
|
||||||
"electron": "^4.0.6",
|
"electron": "^8.0.2",
|
||||||
"electron-builder": "^20.39.0",
|
"electron-builder": "^20.39.0",
|
||||||
"jasmine-core": "~2.99.1",
|
"jasmine-core": "~2.99.1",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
|
|
Loading…
Reference in New Issue