feat: duckduckgo image proxy option

This commit is contained in:
David Ralph
2021-04-01 19:51:30 +01:00
parent ceb68012d5
commit 6c7ca7a0a9
4 changed files with 13 additions and 6 deletions

View File

@@ -86,6 +86,8 @@ export default class BackgroundSettings extends React.PureComponent {
<>
<h2>{background.title}</h2>
<Switch name='background' text={this.language.enabled} />
<Checkbox name='ddgProxy' text={background.ddg_proxy} />
<h3>{background.buttons.title}</h3>
<Checkbox name='view' text={background.buttons.view} />
<Checkbox name='favouriteEnabled' text={background.buttons.favourite} />

View File

@@ -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 {