From 6c7ca7a0a9f0e88fd1406dca093945f666b29254 Mon Sep 17 00:00:00 2001 From: David Ralph Date: Thu, 1 Apr 2021 19:51:30 +0100 Subject: [PATCH] feat: duckduckgo image proxy option --- .../settings/sections/background/Background.jsx | 2 ++ src/components/widgets/background/Background.jsx | 13 ++++++++----- src/modules/constants.js | 3 ++- src/translations/en_GB.json | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/modals/main/settings/sections/background/Background.jsx b/src/components/modals/main/settings/sections/background/Background.jsx index e17eba62..7949a5f3 100644 --- a/src/components/modals/main/settings/sections/background/Background.jsx +++ b/src/components/modals/main/settings/sections/background/Background.jsx @@ -86,6 +86,8 @@ export default class BackgroundSettings extends React.PureComponent { <>

{background.title}

+ +

{background.buttons.title}

diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index f951676a..480acc67 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -20,6 +20,7 @@ export default class Background extends React.PureComponent { } }; this.language = window.language.widgets.background; + this.ddgproxy = (localStorage.getItem('ddgProxy') === 'true'); } gradientStyleBuilder(gradientSettings) { @@ -43,9 +44,11 @@ export default class Background extends React.PureComponent { } if (this.state.url !== '') { + const url = this.ddgproxy ? window.constants.DDG_PROXY + this.state.url : this.state.url; + document.querySelector('#backgroundImage').setAttribute( 'style', - `background-image: url(${this.state.url}); -webkit-filter: blur(${localStorage.getItem('blur')}px) brightness(${brightness}%);` + `background-image: url(${url}); -webkit-filter: blur(${localStorage.getItem('blur')}px) brightness(${brightness}%);` ); } else { document.querySelector('#backgroundImage').setAttribute( @@ -157,10 +160,10 @@ export default class Background extends React.PureComponent { if (customBackground.includes('.mp4') || customBackground.includes('.webm') || customBackground.includes('.ogg')) { return this.setState({ url: customBackground, - video: true, - photoInfo: { - hidden: true - } + video: true, + photoInfo: { + hidden: true + } }); // normal background } else { diff --git a/src/modules/constants.js b/src/modules/constants.js index 3689cf5e..93677f96 100644 --- a/src/modules/constants.js +++ b/src/modules/constants.js @@ -5,6 +5,7 @@ export const WEBSITE_URL = 'https://muetab.com'; export const SPONSORS_URL = 'https://sponsors.muetab.com'; export const GITHUB_URL = 'https://api.github.com'; export const FEEDBACK_FORM = 'https://api.formcake.com/api/form/349b56cb-7e2b-4004-b32b-e8964d217dd1/submission'; +export const DDG_PROXY = 'https://external-content.duckduckgo.com/iu/?u='; export const OFFLINE_IMAGES = 20; export const BETA_VERSION = false; -export const VERSION = '5.0'; +export const VERSION = '5.0'; \ No newline at end of file diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index 28f66363..1623eb88 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -93,6 +93,7 @@ }, "background": { "title": "Background", + "ddg_proxy": "Use DuckDuckGo Image Proxy", "buttons": { "title": "Buttons", "view": "View",