mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-09 06:28:26 +00:00
Validate url before building the app
This commit is contained in:
parent
10c1a9c97a
commit
5411e9c71a
@ -27,7 +27,8 @@
|
|||||||
"commander": "^2.9.0",
|
"commander": "^2.9.0",
|
||||||
"electron-packager": "^5.2.1",
|
"electron-packager": "^5.2.1",
|
||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"tmp": "0.0.28"
|
"tmp": "0.0.28",
|
||||||
|
"validator": "^4.5.0"
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
|
import validator from 'validator';
|
||||||
|
|
||||||
const TEMPLATE_APP_DIR = path.join(__dirname, '../', 'app');
|
const TEMPLATE_APP_DIR = path.join(__dirname, '../', 'app');
|
||||||
const ELECTRON_VERSION = '0.36.4';
|
const ELECTRON_VERSION = '0.36.4';
|
||||||
|
|
||||||
@ -16,6 +18,11 @@ function optionsFactory(name = 'MyApp',
|
|||||||
badge = false,
|
badge = false,
|
||||||
width = 1280,
|
width = 1280,
|
||||||
height = 800) {
|
height = 800) {
|
||||||
|
|
||||||
|
if (!validator.isURL(targetUrl, {require_protocol: true})) {
|
||||||
|
throw 'Your Url is invalid!, did you remember to include \'http://\'?';
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
dir: TEMPLATE_APP_DIR,
|
dir: TEMPLATE_APP_DIR,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user