diff options
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/components/settings/services/EditServiceForm.js | 6 | ||||
-rw-r--r-- | src/lib/Menu.js | 2 | ||||
-rw-r--r-- | src/models/Recipe.js | 16 | ||||
-rw-r--r-- | yarn.lock | 10 |
5 files changed, 27 insertions, 8 deletions
diff --git a/package.json b/package.json index 1c0aad789..fc0954e94 100644 --- a/package.json +++ b/package.json | |||
@@ -27,6 +27,7 @@ | |||
27 | "license": "Apache-2.0", | 27 | "license": "Apache-2.0", |
28 | "dependencies": { | 28 | "dependencies": { |
29 | "@paulcbetts/system-idle-time": "^1.0.4", | 29 | "@paulcbetts/system-idle-time": "^1.0.4", |
30 | "address-rfc2822": "^2.0.1", | ||
30 | "auto-launch": "https://github.com/meetfranz/node-auto-launch.git", | 31 | "auto-launch": "https://github.com/meetfranz/node-auto-launch.git", |
31 | "babel-polyfill": "^6.23.0", | 32 | "babel-polyfill": "^6.23.0", |
32 | "babel-runtime": "^6.23.0", | 33 | "babel-runtime": "^6.23.0", |
diff --git a/src/components/settings/services/EditServiceForm.js b/src/components/settings/services/EditServiceForm.js index fac0f6b9a..9b359a78e 100644 --- a/src/components/settings/services/EditServiceForm.js +++ b/src/components/settings/services/EditServiceForm.js | |||
@@ -69,10 +69,6 @@ const messages = defineMessages({ | |||
69 | export default class EditServiceForm extends Component { | 69 | export default class EditServiceForm extends Component { |
70 | static propTypes = { | 70 | static propTypes = { |
71 | recipe: PropTypes.instanceOf(Recipe).isRequired, | 71 | recipe: PropTypes.instanceOf(Recipe).isRequired, |
72 | // service: PropTypes.oneOfType([ | ||
73 | // PropTypes.object, | ||
74 | // PropTypes.instanceOf(Service), | ||
75 | // ]), | ||
76 | service(props, propName) { | 72 | service(props, propName) { |
77 | if (props.action === 'edit' && !(props[propName] instanceof Service)) { | 73 | if (props.action === 'edit' && !(props[propName] instanceof Service)) { |
78 | return new Error(`'${propName}'' is expected to be of type 'Service' | 74 | return new Error(`'${propName}'' is expected to be of type 'Service' |
@@ -207,7 +203,7 @@ export default class EditServiceForm extends Component { | |||
207 | )} | 203 | )} |
208 | {recipe.hasCustomUrl && ( | 204 | {recipe.hasCustomUrl && ( |
209 | <TabItem title={intl.formatMessage(messages.tabOnPremise)}> | 205 | <TabItem title={intl.formatMessage(messages.tabOnPremise)}> |
210 | {user.isPremium ? ( | 206 | {user.isPremium || recipe.author.find(a => a.email === user.email) ? ( |
211 | <div> | 207 | <div> |
212 | <Input field={form.$('customUrl')} /> | 208 | <Input field={form.$('customUrl')} /> |
213 | {form.error === 'url-validation-error' && ( | 209 | {form.error === 'url-validation-error' && ( |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 9f62cc8c2..8f0a92c3d 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import { remote, shell } from 'electron'; | 1 | import { remote, shell } from 'electron'; |
2 | import { autorun, computed, observable, toJS } from 'mobx'; | 2 | import { autorun, computed, observable, toJS } from 'mobx'; |
3 | 3 | ||
4 | import { isMac, isLinux } from '../environment'; | 4 | import { isMac } from '../environment'; |
5 | 5 | ||
6 | const { app, Menu, dialog } = remote; | 6 | const { app, Menu, dialog } = remote; |
7 | 7 | ||
diff --git a/src/models/Recipe.js b/src/models/Recipe.js index 43a3450b1..4b613a40c 100644 --- a/src/models/Recipe.js +++ b/src/models/Recipe.js | |||
@@ -1,7 +1,8 @@ | |||
1 | import emailParser from 'address-rfc2822'; | ||
2 | |||
1 | export default class Recipe { | 3 | export default class Recipe { |
2 | id = ''; | 4 | id = ''; |
3 | name = ''; | 5 | name = ''; |
4 | author = ''; | ||
5 | description = ''; | 6 | description = ''; |
6 | version = '1.0'; | 7 | version = '1.0'; |
7 | path = ''; | 8 | path = ''; |
@@ -30,7 +31,7 @@ export default class Recipe { | |||
30 | 31 | ||
31 | this.id = data.id || this.id; | 32 | this.id = data.id || this.id; |
32 | this.name = data.name || this.name; | 33 | this.name = data.name || this.name; |
33 | this.author = data.author || this.author; | 34 | this.rawAuthor = data.author || this.author; |
34 | this.description = data.description || this.description; | 35 | this.description = data.description || this.description; |
35 | this.version = data.version || this.version; | 36 | this.version = data.version || this.version; |
36 | this.path = data.path; | 37 | this.path = data.path; |
@@ -49,4 +50,15 @@ export default class Recipe { | |||
49 | 50 | ||
50 | this.message = data.config.message || this.message; | 51 | this.message = data.config.message || this.message; |
51 | } | 52 | } |
53 | |||
54 | get author() { | ||
55 | try { | ||
56 | const addresses = emailParser.parse(this.rawAuthor); | ||
57 | return addresses.map(a => ({ email: a.address, name: a.phrase })); | ||
58 | } catch (err) { | ||
59 | console.warn(`Not a valid author for ${this.name}`); | ||
60 | } | ||
61 | |||
62 | return []; | ||
63 | } | ||
52 | } | 64 | } |
@@ -80,6 +80,12 @@ acorn@^5.1.1: | |||
80 | version "5.1.2" | 80 | version "5.1.2" |
81 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" | 81 | resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" |
82 | 82 | ||
83 | address-rfc2822@^2.0.1: | ||
84 | version "2.0.1" | ||
85 | resolved "https://registry.yarnpkg.com/address-rfc2822/-/address-rfc2822-2.0.1.tgz#1a1bdb942b5e20e2c1ba5d5f396d5824ff7ae6ea" | ||
86 | dependencies: | ||
87 | email-addresses "^3.0.0" | ||
88 | |||
83 | after@0.8.2: | 89 | after@0.8.2: |
84 | version "0.8.2" | 90 | version "0.8.2" |
85 | resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" | 91 | resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" |
@@ -2049,6 +2055,10 @@ electron@^1.7.9: | |||
2049 | electron-download "^3.0.1" | 2055 | electron-download "^3.0.1" |
2050 | extract-zip "^1.0.3" | 2056 | extract-zip "^1.0.3" |
2051 | 2057 | ||
2058 | email-addresses@^3.0.0: | ||
2059 | version "3.0.1" | ||
2060 | resolved "https://registry.yarnpkg.com/email-addresses/-/email-addresses-3.0.1.tgz#c1fc20c189e7f96d4012d375db5feaccdd24391c" | ||
2061 | |||
2052 | emojis-list@^2.0.0: | 2062 | emojis-list@^2.0.0: |
2053 | version "2.1.0" | 2063 | version "2.1.0" |
2054 | resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" | 2064 | resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" |