update folder structure, apply security fixes, apply ts and tslint adjustments

This commit is contained in:
Xymorot 2019-06-09 02:47:46 +02:00
parent d55457bdbf
commit 19f4f303eb
9 changed files with 46 additions and 114 deletions

1
global.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module '*.svelte';

101
package-lock.json generated
View File

@ -916,12 +916,6 @@
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
"dev": true "dev": true
}, },
"ast-types": {
"version": "0.9.6",
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz",
"integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=",
"dev": true
},
"async-each": { "async-each": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz",
@ -2448,16 +2442,6 @@
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"dev": true "dev": true
}, },
"es6-templates": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/es6-templates/-/es6-templates-0.2.3.tgz",
"integrity": "sha1-XLmsn7He1usSOTQrgdeSu7QHjuQ=",
"dev": true,
"requires": {
"recast": "~0.11.12",
"through": "~2.3.6"
}
},
"escape-html": { "escape-html": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@ -2819,12 +2803,6 @@
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=",
"dev": true "dev": true
}, },
"fastparse": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz",
"integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==",
"dev": true
},
"fd-slicer": { "fd-slicer": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
@ -3921,53 +3899,6 @@
"integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=", "integrity": "sha1-DfKTUfByEWNRXfueVUPl9u7VFi8=",
"dev": true "dev": true
}, },
"html-loader": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/html-loader/-/html-loader-0.5.5.tgz",
"integrity": "sha512-7hIW7YinOYUpo//kSYcPB6dCKoceKLmOwjEMmhIobHuWGDVl0Nwe4l68mdG/Ru0wcUxQjVMEoZpkalZ/SE7zog==",
"dev": true,
"requires": {
"es6-templates": "^0.2.3",
"fastparse": "^1.1.1",
"html-minifier": "^3.5.8",
"loader-utils": "^1.1.0",
"object-assign": "^4.1.1"
},
"dependencies": {
"big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
"dev": true
},
"json5": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz",
"integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==",
"dev": true,
"requires": {
"minimist": "^1.2.0"
}
},
"loader-utils": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.2.3.tgz",
"integrity": "sha512-fkpz8ejdnEMG3s37wGL07iSBDg99O9D5yflE9RGNH3hRdx9SOwYfnGYdZOUIZitN8E+E2vkq3MUMYMvPYl5ZZA==",
"dev": true,
"requires": {
"big.js": "^5.2.2",
"emojis-list": "^2.0.0",
"json5": "^1.0.1"
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
}
}
},
"html-minifier": { "html-minifier": {
"version": "3.5.21", "version": "3.5.21",
"resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.21.tgz", "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-3.5.21.tgz",
@ -5812,12 +5743,6 @@
"parse-ms": "^2.1.0" "parse-ms": "^2.1.0"
} }
}, },
"private": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz",
"integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==",
"dev": true
},
"process": { "process": {
"version": "0.5.2", "version": "0.5.2",
"resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz",
@ -6151,32 +6076,6 @@
"readable-stream": "^2.0.2" "readable-stream": "^2.0.2"
} }
}, },
"recast": {
"version": "0.11.23",
"resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz",
"integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=",
"dev": true,
"requires": {
"ast-types": "0.9.6",
"esprima": "~3.1.0",
"private": "~0.1.5",
"source-map": "~0.5.0"
},
"dependencies": {
"esprima": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
"integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=",
"dev": true
},
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
}
}
},
"redent": { "redent": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz",

View File

@ -1,14 +1,17 @@
import { app, BrowserWindow } from 'electron'; import { app, BrowserWindow } from 'electron';
import session from './main/service/session';
let mainWindow: Electron.BrowserWindow; let mainWindow: Electron.BrowserWindow;
function createWindow() { function createWindow() {
session.init();
// Create the browser window. // Create the browser window.
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
height: 600, height: 600,
width: 800, width: 800,
webPreferences: { webPreferences: {
nodeIntegration: true, nodeIntegration: false,
}, },
}); });

View File

@ -0,0 +1,19 @@
import { session } from 'electron';
import OnResponseStartedDetails = Electron.OnResponseStartedDetails;
function initSession(): void {
session.defaultSession.webRequest.onHeadersReceived(
(details: OnResponseStartedDetails, callback: (response: any) => void) => {
callback({
responseHeaders: {
...details.responseHeaders,
'Content-Security-Policy': [
"default-src 'self'; style-src 'unsafe-eval' 'unsafe-inline'",
],
},
});
}
);
}
export default { init: initSession };

View File

@ -2,13 +2,13 @@
// be executed in the renderer process for that window. // be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process. // All of the Node.js APIs are available in this process.
// @ts-ignore import App from './renderer/view/App.svelte';
import App from './app/App.svelte';
export default new App({ (() =>
new App({
target: document.querySelector('#app'), target: document.querySelector('#app'),
props: { props: {
// we'll learn about props later // we'll learn about props later
answer: 42, answer: 42,
}, },
}); }))();

View File

@ -5,6 +5,12 @@
"noImplicitAny": true, "noImplicitAny": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"allowJs": true "allowJs": true,
"checkJs": true,
"lib": [
"es6",
"dom"
]
} }
} }

View File

@ -8,6 +8,7 @@
"no-implicit-dependencies": [true, "dev"] "no-implicit-dependencies": [true, "dev"]
}, },
"linterOptions": { "linterOptions": {
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", ".webpack"]
} },
"jsRules": true
} }

View File

@ -8,4 +8,7 @@ module.exports = {
module: { module: {
rules: require('./webpack.rules'), rules: require('./webpack.rules'),
}, },
resolve: {
extensions: ['.js', '.ts', '.html'],
},
}; };