fix: background proxy and offline mode hot reload bugs

This commit is contained in:
David Ralph
2021-08-01 15:02:18 +01:00
parent 9db7b210bc
commit 141da4ba36
3 changed files with 14 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ export default class Background extends React.PureComponent {
const backgroundImage = document.getElementById('backgroundImage');
if (this.state.url !== '') {
const url = (localStorage.getItem('ddgProxy') === 'true' && this.state.photoInfo.offline !== true) ? window.constants.DDG_IMAGE_PROXY + this.state.url : this.state.url;
const url = (localStorage.getItem('ddgProxy') === 'true' && this.state.photoInfo.offline !== true && !this.state.url.startsWith('data:')) ? window.constants.DDG_IMAGE_PROXY + this.state.url : this.state.url;
const photoInformation = document.querySelector('.photoInformation');
// just set the background
@@ -322,6 +322,10 @@ export default class Background extends React.PureComponent {
if (backgroundType !== this.state.type || (this.state.type === 'api' && localStorage.getItem('backgroundAPI') !== this.state.currentAPI) || (this.state.type === 'custom' && localStorage.getItem('customBackground') !== this.state.url)) {
return refresh();
}
} else {
if (backgroundType !== this.state.type) {
return refresh();
}
}
// background effects so we don't get another image again

View File

@@ -56,7 +56,7 @@ export default function PhotoInformation(props) {
setWidth(event.target.width);
setHeight(event.target.height);
}
img.src = props.url;
img.src = (localStorage.getItem('ddgProxy') === 'true' && !props.info.offline && !props.url.startsWith('data:')) ? window.constants.DDG_IMAGE_PROXY + props.url : props.url;
return (
<div className='photoInformation'>