mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-02 11:48:25 +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",
|
||||
"electron-packager": "^5.2.1",
|
||||
"ncp": "^2.0.0",
|
||||
"tmp": "0.0.28"
|
||||
"tmp": "0.0.28",
|
||||
"validator": "^4.5.0"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
|
@ -1,6 +1,8 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import validator from 'validator';
|
||||
|
||||
const TEMPLATE_APP_DIR = path.join(__dirname, '../', 'app');
|
||||
const ELECTRON_VERSION = '0.36.4';
|
||||
|
||||
@ -16,6 +18,11 @@ function optionsFactory(name = 'MyApp',
|
||||
badge = false,
|
||||
width = 1280,
|
||||
height = 800) {
|
||||
|
||||
if (!validator.isURL(targetUrl, {require_protocol: true})) {
|
||||
throw 'Your Url is invalid!, did you remember to include \'http://\'?';
|
||||
}
|
||||
|
||||
return {
|
||||
dir: TEMPLATE_APP_DIR,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user