aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Service.ts')
-rw-r--r--src/models/Service.ts8
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';
8import { needsToken } from '../api/apiBase'; 8import { needsToken } from '../api/apiBase';
9import { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } from '../config'; 9import { DEFAULT_SERVICE_ORDER, DEFAULT_SERVICE_SETTINGS } from '../config';
10import { todosStore } from '../features/todos'; 10import { todosStore } from '../features/todos';
11import { getFaviconUrl } from '../helpers/favicon-helpers';
11import { isValidExternalURL, normalizedUrl } from '../helpers/url-helpers'; 12import { isValidExternalURL, normalizedUrl } from '../helpers/url-helpers';
12import { ifUndefined } from '../jsUtils'; 13import { ifUndefined } from '../jsUtils';
13import type { IRecipe } from './Recipe'; 14import 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;