diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/settings/services/EditServiceForm.tsx | 1 | ||||
-rw-r--r-- | src/config.ts | 1 | ||||
-rw-r--r-- | src/containers/settings/EditServiceScreen.tsx | 13 | ||||
-rw-r--r-- | src/helpers/favicon-helpers.ts | 3 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/ServiceController.js | 3 | ||||
-rw-r--r-- | src/models/Service.ts | 8 | ||||
-rw-r--r-- | src/stores/ServicesStore.ts | 1 |
8 files changed, 31 insertions, 0 deletions
diff --git a/src/components/settings/services/EditServiceForm.tsx b/src/components/settings/services/EditServiceForm.tsx index 69893c16c..00629b6b6 100644 --- a/src/components/settings/services/EditServiceForm.tsx +++ b/src/components/settings/services/EditServiceForm.tsx | |||
@@ -396,6 +396,7 @@ class EditServiceForm extends Component<IProps, IState> { | |||
396 | 396 | ||
397 | <div className="settings__settings-group"> | 397 | <div className="settings__settings-group"> |
398 | <H3>{intl.formatMessage(messages.headlineAppearance)}</H3> | 398 | <H3>{intl.formatMessage(messages.headlineAppearance)}</H3> |
399 | <Toggle {...form.$('useFavicon').bind()} /> | ||
399 | <Toggle {...form.$('isDarkModeEnabled').bind()} /> | 400 | <Toggle {...form.$('isDarkModeEnabled').bind()} /> |
400 | {form.$('isDarkModeEnabled').value && ( | 401 | {form.$('isDarkModeEnabled').value && ( |
401 | <> | 402 | <> |
diff --git a/src/config.ts b/src/config.ts index 612aa6871..348b4b85d 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -443,6 +443,7 @@ export const DEFAULT_SERVICE_SETTINGS = { | |||
443 | isBadgeEnabled: true, | 443 | isBadgeEnabled: true, |
444 | isMediaBadgeEnabled: false, | 444 | isMediaBadgeEnabled: false, |
445 | trapLinkClicks: false, | 445 | trapLinkClicks: false, |
446 | useFavicon: false, | ||
446 | isMuted: false, | 447 | isMuted: false, |
447 | customIcon: false, | 448 | customIcon: false, |
448 | isDarkModeEnabled: false, | 449 | isDarkModeEnabled: false, |
diff --git a/src/containers/settings/EditServiceScreen.tsx b/src/containers/settings/EditServiceScreen.tsx index f3b9b0857..e890e8695 100644 --- a/src/containers/settings/EditServiceScreen.tsx +++ b/src/containers/settings/EditServiceScreen.tsx | |||
@@ -96,6 +96,10 @@ const messages = defineMessages({ | |||
96 | id: 'settings.service.form.trapLinkClicks', | 96 | id: 'settings.service.form.trapLinkClicks', |
97 | defaultMessage: 'Open URLs within Ferdium', | 97 | defaultMessage: 'Open URLs within Ferdium', |
98 | }, | 98 | }, |
99 | useFavicon: { | ||
100 | id: 'settings.service.form.useFavicon', | ||
101 | defaultMessage: 'Use service favicon instead of default or custom icon', | ||
102 | }, | ||
99 | onlyShowFavoritesInUnreadCount: { | 103 | onlyShowFavoritesInUnreadCount: { |
100 | id: 'settings.service.form.onlyShowFavoritesInUnreadCount', | 104 | id: 'settings.service.form.onlyShowFavoritesInUnreadCount', |
101 | defaultMessage: 'Only show Favorites in unread count', | 105 | defaultMessage: 'Only show Favorites in unread count', |
@@ -258,6 +262,15 @@ class EditServiceScreen extends Component<IProps> { | |||
258 | default: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, | 262 | default: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, |
259 | type: 'checkbox', | 263 | type: 'checkbox', |
260 | }, | 264 | }, |
265 | useFavicon: { | ||
266 | label: intl.formatMessage(messages.useFavicon), | ||
267 | value: ifUndefined<boolean>( | ||
268 | service?.useFavicon, | ||
269 | DEFAULT_SERVICE_SETTINGS.useFavicon, | ||
270 | ), | ||
271 | default: DEFAULT_SERVICE_SETTINGS.useFavicon, | ||
272 | type: 'checkbox', | ||
273 | }, | ||
261 | isMuted: { | 274 | isMuted: { |
262 | label: intl.formatMessage(messages.enableAudio), | 275 | label: intl.formatMessage(messages.enableAudio), |
263 | value: !ifUndefined<boolean>( | 276 | value: !ifUndefined<boolean>( |
diff --git a/src/helpers/favicon-helpers.ts b/src/helpers/favicon-helpers.ts new file mode 100644 index 000000000..5743d938f --- /dev/null +++ b/src/helpers/favicon-helpers.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export function getFaviconUrl(url: string, size: number = 128): string { | ||
2 | return `https://www.google.com/s2/favicons?sz=${size}&domain_url=${url}`; | ||
3 | } | ||
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 1941ecd86..1835854e1 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -394,6 +394,7 @@ | |||
394 | "settings.service.form.tabOnPremise": "Self hosted ⭐️", | 394 | "settings.service.form.tabOnPremise": "Self hosted ⭐️", |
395 | "settings.service.form.team": "Team", | 395 | "settings.service.form.team": "Team", |
396 | "settings.service.form.trapLinkClicks": "Open URLs within Ferdium", | 396 | "settings.service.form.trapLinkClicks": "Open URLs within Ferdium", |
397 | "settings.service.form.useFavicon": "Use service favicon instead of default or custom icon", | ||
397 | "settings.service.form.useHostedService": "Use the hosted {name} service.", | 398 | "settings.service.form.useHostedService": "Use the hosted {name} service.", |
398 | "settings.service.form.yourServices": "Your services", | 399 | "settings.service.form.yourServices": "Your services", |
399 | "settings.service.reloadRequired": "Changes require reload of the service", | 400 | "settings.service.reloadRequired": "Changes require reload of the service", |
diff --git a/src/internal-server/app/Controllers/Http/ServiceController.js b/src/internal-server/app/Controllers/Http/ServiceController.js index 8e8aa97a8..4e3c63515 100644 --- a/src/internal-server/app/Controllers/Http/ServiceController.js +++ b/src/internal-server/app/Controllers/Http/ServiceController.js | |||
@@ -53,6 +53,7 @@ class ServiceController { | |||
53 | isNotificationEnabled: DEFAULT_SERVICE_SETTINGS.isNotificationEnabled, | 53 | isNotificationEnabled: DEFAULT_SERVICE_SETTINGS.isNotificationEnabled, |
54 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, | 54 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, |
55 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, | 55 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, |
56 | useFavicon: DEFAULT_SERVICE_SETTINGS.useFavicon, | ||
56 | isMuted: DEFAULT_SERVICE_SETTINGS.isMuted, | 57 | isMuted: DEFAULT_SERVICE_SETTINGS.isMuted, |
57 | isDarkModeEnabled: '', // TODO: This should ideally be a boolean (false). But, changing it caused the sidebar toggle to not work. | 58 | isDarkModeEnabled: '', // TODO: This should ideally be a boolean (false). But, changing it caused the sidebar toggle to not work. |
58 | isProgressbarEnabled: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, | 59 | isProgressbarEnabled: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, |
@@ -83,6 +84,7 @@ class ServiceController { | |||
83 | hasCustomIcon: DEFAULT_SERVICE_SETTINGS.hasCustomIcon, | 84 | hasCustomIcon: DEFAULT_SERVICE_SETTINGS.hasCustomIcon, |
84 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, | 85 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, |
85 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, | 86 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, |
87 | useFavicon: DEFAULT_SERVICE_SETTINGS.useFavicon, | ||
86 | isDarkModeEnabled: '', // TODO: This should ideally be a boolean (false). But, changing it caused the sidebar toggle to not work. | 88 | isDarkModeEnabled: '', // TODO: This should ideally be a boolean (false). But, changing it caused the sidebar toggle to not work. |
87 | isProgressbarEnabled: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, | 89 | isProgressbarEnabled: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, |
88 | isEnabled: DEFAULT_SERVICE_SETTINGS.isEnabled, | 90 | isEnabled: DEFAULT_SERVICE_SETTINGS.isEnabled, |
@@ -232,6 +234,7 @@ class ServiceController { | |||
232 | hasCustomIcon: DEFAULT_SERVICE_SETTINGS.customIcon, | 234 | hasCustomIcon: DEFAULT_SERVICE_SETTINGS.customIcon, |
233 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, | 235 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, |
234 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, | 236 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, |
237 | useFavicon: DEFAULT_SERVICE_SETTINGS.useFavicon, | ||
235 | isDarkModeEnabled: '', // TODO: This should ideally be a boolean (false). But, changing it caused the sidebar toggle to not work. | 238 | isDarkModeEnabled: '', // TODO: This should ideally be a boolean (false). But, changing it caused the sidebar toggle to not work. |
236 | isProgressbarEnabled: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, | 239 | isProgressbarEnabled: DEFAULT_SERVICE_SETTINGS.isProgressbarEnabled, |
237 | isEnabled: DEFAULT_SERVICE_SETTINGS.isEnabled, | 240 | isEnabled: DEFAULT_SERVICE_SETTINGS.isEnabled, |
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; |
diff --git a/src/stores/ServicesStore.ts b/src/stores/ServicesStore.ts index fd7414004..9f2cfeca3 100644 --- a/src/stores/ServicesStore.ts +++ b/src/stores/ServicesStore.ts | |||
@@ -472,6 +472,7 @@ export default class ServicesStore extends TypedStore { | |||
472 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, | 472 | isBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isBadgeEnabled, |
473 | isMediaBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isMediaBadgeEnabled, | 473 | isMediaBadgeEnabled: DEFAULT_SERVICE_SETTINGS.isMediaBadgeEnabled, |
474 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, | 474 | trapLinkClicks: DEFAULT_SERVICE_SETTINGS.trapLinkClicks, |
475 | useFavicon: DEFAULT_SERVICE_SETTINGS.useFavicon, | ||
475 | isMuted: DEFAULT_SERVICE_SETTINGS.isMuted, | 476 | isMuted: DEFAULT_SERVICE_SETTINGS.isMuted, |
476 | customIcon: DEFAULT_SERVICE_SETTINGS.customIcon, | 477 | customIcon: DEFAULT_SERVICE_SETTINGS.customIcon, |
477 | isDarkModeEnabled: DEFAULT_SERVICE_SETTINGS.isDarkModeEnabled, | 478 | isDarkModeEnabled: DEFAULT_SERVICE_SETTINGS.isDarkModeEnabled, |