diff options
author | Vijay A <vraravam@users.noreply.github.com> | 2023-05-25 13:04:39 +0530 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2023-05-25 13:04:39 +0530 |
commit | 44c5193ab8b25422ae5cb679ce788a8c636108ac (patch) | |
tree | dc29c85d019bb5f807d7f2041eaf3ebba3215431 /src/models/Service.ts | |
parent | Bump eslint-plugin-unicorn from 42.0.0 to 46.0.0 (diff) | |
download | ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.gz ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.tar.zst ferdium-app-44c5193ab8b25422ae5cb679ce788a8c636108ac.zip |
Minor refactoring to remove code duplication
Diffstat (limited to 'src/models/Service.ts')
-rw-r--r-- | src/models/Service.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/models/Service.ts b/src/models/Service.ts index 0cbfa60e2..af0085185 100644 --- a/src/models/Service.ts +++ b/src/models/Service.ts | |||
@@ -1,12 +1,11 @@ | |||
1 | import { autorun, action, computed, makeObservable, observable } from 'mobx'; | 1 | import { autorun, action, computed, makeObservable, observable } from 'mobx'; |
2 | import { ipcRenderer } from 'electron'; | 2 | import { ipcRenderer } from 'electron'; |
3 | import { webContents } from '@electron/remote'; | 3 | import { webContents } from '@electron/remote'; |
4 | import normalizeUrl from 'normalize-url'; | ||
5 | import { join } from 'path'; | 4 | import { join } from 'path'; |
6 | import ElectronWebView from 'react-electron-web-view'; | 5 | import ElectronWebView from 'react-electron-web-view'; |
7 | 6 | ||
8 | import { todosStore } from '../features/todos'; | 7 | import { todosStore } from '../features/todos'; |
9 | import { isValidExternalURL } from '../helpers/url-helpers'; | 8 | import { isValidExternalURL, normalizedUrl } from '../helpers/url-helpers'; |
10 | import UserAgent from './UserAgent'; | 9 | import UserAgent from './UserAgent'; |
11 | import { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } from '../config'; | 10 | import { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } from '../config'; |
12 | import { ifUndefined } from '../jsUtils'; | 11 | import { ifUndefined } from '../jsUtils'; |
@@ -327,11 +326,7 @@ export default class Service { | |||
327 | if (this.recipe.hasCustomUrl && this.customUrl) { | 326 | if (this.recipe.hasCustomUrl && this.customUrl) { |
328 | let url: string = ''; | 327 | let url: string = ''; |
329 | try { | 328 | try { |
330 | url = normalizeUrl(this.customUrl, { | 329 | url = normalizedUrl(this.customUrl); |
331 | stripAuthentication: false, | ||
332 | stripWWW: false, | ||
333 | removeTrailingSlash: false, | ||
334 | }); | ||
335 | } catch { | 330 | } catch { |
336 | console.error( | 331 | console.error( |
337 | `Service (${this.recipe.name}): '${this.customUrl}' is not a valid Url.`, | 332 | `Service (${this.recipe.name}): '${this.customUrl}' is not a valid Url.`, |