diff options
author | 2024-05-03 00:54:12 +0100 | |
---|---|---|
committer | 2024-05-03 00:47:11 +0000 | |
commit | 6c9475cfb6243b25420335f472a54d614716e55b (patch) | |
tree | c7397da4553f42967e2b9a7e96605fe9b55463e0 /src/models | |
parent | fix: screenshare feature not working on Teams (#1733) (diff) | |
download | ferdium-app-6c9475cfb6243b25420335f472a54d614716e55b.tar.gz ferdium-app-6c9475cfb6243b25420335f472a54d614716e55b.tar.zst ferdium-app-6c9475cfb6243b25420335f472a54d614716e55b.zip |
feat: use favicons instead of icons
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/Service.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/models/Service.ts b/src/models/Service.ts index 6d19f44f1..525661172 100644 --- a/src/models/Service.ts +++ b/src/models/Service.ts | |||
@@ -8,6 +8,7 @@ import { v4 as uuidV4 } from 'uuid'; | |||
8 | import { needsToken } from '../api/apiBase'; | 8 | import { needsToken } from '../api/apiBase'; |
9 | import { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } from '../config'; | 9 | import { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } from '../config'; |
10 | import { todosStore } from '../features/todos'; | 10 | import { todosStore } from '../features/todos'; |
11 | import { getFaviconUrl } from '../helpers/favicon-helpers'; | ||
11 | import { isValidExternalURL, normalizedUrl } from '../helpers/url-helpers'; | 12 | import { isValidExternalURL, normalizedUrl } from '../helpers/url-helpers'; |
12 | import { ifUndefined } from '../jsUtils'; | 13 | import { ifUndefined } from '../jsUtils'; |
13 | import type { IRecipe } from './Recipe'; | 14 | import type { IRecipe } from './Recipe'; |
@@ -134,6 +135,8 @@ export default class Service { | |||
134 | 135 | ||
135 | @observable isMediaPlaying: boolean = false; | 136 | @observable isMediaPlaying: boolean = false; |
136 | 137 | ||
138 | @observable useFavicon: boolean = DEFAULT_SERVICE_SETTINGS.useFavicon; | ||
139 | |||
137 | @action _setAutoRun() { | 140 | @action _setAutoRun() { |
138 | if (!this.isEnabled) { | 141 | if (!this.isEnabled) { |
139 | this.webview = null; | 142 | this.webview = null; |
@@ -167,6 +170,7 @@ export default class Service { | |||
167 | this.team = ifUndefined<string>(data.team, this.team); | 170 | this.team = ifUndefined<string>(data.team, this.team); |
168 | this.customUrl = ifUndefined<string>(data.customUrl, this.customUrl); | 171 | this.customUrl = ifUndefined<string>(data.customUrl, this.customUrl); |
169 | this.iconUrl = ifUndefined<string>(data.iconUrl, this.iconUrl); | 172 | this.iconUrl = ifUndefined<string>(data.iconUrl, this.iconUrl); |
173 | this.useFavicon = ifUndefined<boolean>(data.useFavicon, this.useFavicon); | ||
170 | this.order = ifUndefined<number>(data.order, this.order); | 174 | this.order = ifUndefined<number>(data.order, this.order); |
171 | this.isEnabled = ifUndefined<boolean>(data.isEnabled, this.isEnabled); | 175 | this.isEnabled = ifUndefined<boolean>(data.isEnabled, this.isEnabled); |
172 | this.isNotificationEnabled = ifUndefined<boolean>( | 176 | this.isNotificationEnabled = ifUndefined<boolean>( |
@@ -350,6 +354,10 @@ export default class Service { | |||
350 | } | 354 | } |
351 | 355 | ||
352 | @computed get icon(): string { | 356 | @computed get icon(): string { |
357 | if (this.useFavicon) { | ||
358 | return getFaviconUrl(this.url); | ||
359 | } | ||
360 | |||
353 | if (this.iconUrl) { | 361 | if (this.iconUrl) { |
354 | if (needsToken()) { | 362 | if (needsToken()) { |
355 | let url: URL; | 363 | let url: URL; |