diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-12-24 22:11:36 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2017-12-24 22:11:36 +0100 |
commit | df44b69c4655415fe1e44689ece443ec06ef0f52 (patch) | |
tree | e677ed5f5328bb3b14bc976c7392d8e259f89034 /src/models/Recipe.js | |
parent | [wip] add icon upload (diff) | |
parent | Merge pull request #494 from heavypackets/websecurity-enable-patch (diff) | |
download | ferdium-app-df44b69c4655415fe1e44689ece443ec06ef0f52.tar.gz ferdium-app-df44b69c4655415fe1e44689ece443ec06ef0f52.tar.zst ferdium-app-df44b69c4655415fe1e44689ece443ec06ef0f52.zip |
Merge branch 'develop' into feature/icon-upload
Diffstat (limited to 'src/models/Recipe.js')
-rw-r--r-- | src/models/Recipe.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/models/Recipe.js b/src/models/Recipe.js index 9971df77c..1fc23ac89 100644 --- a/src/models/Recipe.js +++ b/src/models/Recipe.js | |||
@@ -1,10 +1,11 @@ | |||
1 | import emailParser from 'address-rfc2822'; | 1 | import emailParser from 'address-rfc2822'; |
2 | import semver from 'semver'; | ||
2 | 3 | ||
3 | export default class Recipe { | 4 | export default class Recipe { |
4 | id = ''; | 5 | id = ''; |
5 | name = ''; | 6 | name = ''; |
6 | description = ''; | 7 | description = ''; |
7 | version = '1.0'; | 8 | version = ''; |
8 | path = ''; | 9 | path = ''; |
9 | 10 | ||
10 | serviceURL = ''; | 11 | serviceURL = ''; |
@@ -15,6 +16,7 @@ export default class Recipe { | |||
15 | hasTeamId = false; | 16 | hasTeamId = false; |
16 | hasPredefinedUrl = false; | 17 | hasPredefinedUrl = false; |
17 | hasCustomUrl = false; | 18 | hasCustomUrl = false; |
19 | hasHostedOption = false; | ||
18 | urlInputPrefix = ''; | 20 | urlInputPrefix = ''; |
19 | urlInputSuffix = ''; | 21 | urlInputSuffix = ''; |
20 | 22 | ||
@@ -30,6 +32,10 @@ export default class Recipe { | |||
30 | throw Error(`Recipe '${data.name}' requires Id`); | 32 | throw Error(`Recipe '${data.name}' requires Id`); |
31 | } | 33 | } |
32 | 34 | ||
35 | if (!semver.valid(data.version)) { | ||
36 | throw Error(`Version ${data.version} of recipe '${data.name}' is not a valid semver version`); | ||
37 | } | ||
38 | |||
33 | this.id = data.id || this.id; | 39 | this.id = data.id || this.id; |
34 | this.name = data.name || this.name; | 40 | this.name = data.name || this.name; |
35 | this.rawAuthor = data.author || this.author; | 41 | this.rawAuthor = data.author || this.author; |
@@ -45,6 +51,7 @@ export default class Recipe { | |||
45 | this.hasTeamId = data.config.hasTeamId || this.hasTeamId; | 51 | this.hasTeamId = data.config.hasTeamId || this.hasTeamId; |
46 | this.hasPredefinedUrl = data.config.hasPredefinedUrl || this.hasPredefinedUrl; | 52 | this.hasPredefinedUrl = data.config.hasPredefinedUrl || this.hasPredefinedUrl; |
47 | this.hasCustomUrl = data.config.hasCustomUrl || this.hasCustomUrl; | 53 | this.hasCustomUrl = data.config.hasCustomUrl || this.hasCustomUrl; |
54 | this.hasHostedOption = data.config.hasHostedOption || this.hasHostedOption; | ||
48 | 55 | ||
49 | this.urlInputPrefix = data.config.urlInputPrefix || this.urlInputPrefix; | 56 | this.urlInputPrefix = data.config.urlInputPrefix || this.urlInputPrefix; |
50 | this.urlInputSuffix = data.config.urlInputSuffix || this.urlInputSuffix; | 57 | this.urlInputSuffix = data.config.urlInputSuffix || this.urlInputSuffix; |