diff options
author | Ricardo Cino <ricardo@cino.io> | 2022-06-26 14:24:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-26 14:24:06 +0200 |
commit | 070a441fafc173dc286a884739da536903452736 (patch) | |
tree | 5c4aec94cfd36c01f57746bf48f7593be45bdef1 /src/models/Service.ts | |
parent | 6.0.0-nightly.78 [skip ci] (diff) | |
download | ferdium-app-070a441fafc173dc286a884739da536903452736.tar.gz ferdium-app-070a441fafc173dc286a884739da536903452736.tar.zst ferdium-app-070a441fafc173dc286a884739da536903452736.zip |
fix: solve recipe function calls that were broken cause of js=>ts con… (#369)
* fix: solve recipe function calls that were broken cause of js=>ts conversion
* fix: use an interface instead to keep type-safety
* fix: remove faulty test
Diffstat (limited to 'src/models/Service.ts')
-rw-r--r-- | src/models/Service.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/models/Service.ts b/src/models/Service.ts index c4165e59a..dfc074204 100644 --- a/src/models/Service.ts +++ b/src/models/Service.ts | |||
@@ -10,7 +10,7 @@ import { isValidExternalURL } from '../helpers/url-helpers'; | |||
10 | import UserAgent from './UserAgent'; | 10 | import UserAgent from './UserAgent'; |
11 | import { DEFAULT_SERVICE_ORDER } from '../config'; | 11 | import { DEFAULT_SERVICE_ORDER } from '../config'; |
12 | import { ifUndefined } from '../jsUtils'; | 12 | import { ifUndefined } from '../jsUtils'; |
13 | import Recipe from './Recipe'; | 13 | import { IRecipe } from './Recipe'; |
14 | 14 | ||
15 | const debug = require('../preload-safe-debug')('Ferdium:Service'); | 15 | const debug = require('../preload-safe-debug')('Ferdium:Service'); |
16 | 16 | ||
@@ -18,7 +18,7 @@ const debug = require('../preload-safe-debug')('Ferdium:Service'); | |||
18 | export default class Service { | 18 | export default class Service { |
19 | id: string = ''; | 19 | id: string = ''; |
20 | 20 | ||
21 | recipe: Recipe; | 21 | recipe: IRecipe; |
22 | 22 | ||
23 | _webview: ElectronWebView | null = null; | 23 | _webview: ElectronWebView | null = null; |
24 | 24 | ||
@@ -117,7 +117,7 @@ export default class Service { | |||
117 | 117 | ||
118 | @observable proxy: string | null = null; | 118 | @observable proxy: string | null = null; |
119 | 119 | ||
120 | constructor(data, recipe: Recipe) { | 120 | constructor(data, recipe: IRecipe) { |
121 | if (!data) { | 121 | if (!data) { |
122 | throw new Error('Service config not valid'); | 122 | throw new Error('Service config not valid'); |
123 | } | 123 | } |
@@ -270,8 +270,9 @@ export default class Service { | |||
270 | ); | 270 | ); |
271 | } | 271 | } |
272 | 272 | ||
273 | if (typeof this.recipe.buildUrl === 'function') { | 273 | const { buildUrl } = this.recipe; |
274 | url = this.recipe.buildUrl(url); | 274 | if (typeof buildUrl === 'function') { |
275 | url = buildUrl(url); | ||
275 | } | 276 | } |
276 | 277 | ||
277 | return url; | 278 | return url; |