mirror of
https://github.com/mue/mue.git
synced 2026-07-25 17:51:14 +02:00
Merge branch 'master' of https://github.com/mue/mue
This commit is contained in:
@@ -58,7 +58,7 @@ export default class Background extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async determineMode() {
|
async determineMode() {
|
||||||
if (localStorage.getItem('offlineMode') === 'true') return this.doOffline();
|
const offlineMode = localStorage.getItem('offlineMode');
|
||||||
|
|
||||||
const photoPack = JSON.parse(localStorage.getItem('photo_packs'));
|
const photoPack = JSON.parse(localStorage.getItem('photo_packs'));
|
||||||
const customBackgroundColour = localStorage.getItem('customBackgroundColour');
|
const customBackgroundColour = localStorage.getItem('customBackgroundColour');
|
||||||
@@ -66,10 +66,12 @@ export default class Background extends React.PureComponent {
|
|||||||
const favourited = JSON.parse(localStorage.getItem('favourite'));
|
const favourited = JSON.parse(localStorage.getItem('favourite'));
|
||||||
|
|
||||||
if (favourited) {
|
if (favourited) {
|
||||||
|
if (offlineMode === 'true') return this.doOffline();
|
||||||
this.setBackground(favourited.url, null, 'true');
|
this.setBackground(favourited.url, null, 'true');
|
||||||
this.setCredit(favourited.credit);
|
this.setCredit(favourited.credit);
|
||||||
document.getElementById('location').textContent = favourited.location;
|
document.getElementById('location').textContent = favourited.location;
|
||||||
} else if (photoPack) {
|
} else if (photoPack) {
|
||||||
|
if (offlineMode === 'true') return this.doOffline();
|
||||||
const randomPhoto = photoPack[Math.floor(Math.random() * photoPack.length)];
|
const randomPhoto = photoPack[Math.floor(Math.random() * photoPack.length)];
|
||||||
this.setBackground(randomPhoto.url.default, null, randomPhoto.photographer);
|
this.setBackground(randomPhoto.url.default, null, randomPhoto.photographer);
|
||||||
this.setCredit(randomPhoto.photographer);
|
this.setCredit(randomPhoto.photographer);
|
||||||
@@ -79,6 +81,7 @@ export default class Background extends React.PureComponent {
|
|||||||
} else if (customBackground !== '') { // Local
|
} else if (customBackground !== '') { // Local
|
||||||
this.setBackground(customBackground, null, 'false');
|
this.setBackground(customBackground, null, 'false');
|
||||||
} else { // Online
|
} else { // Online
|
||||||
|
if (offlineMode === 'true') return this.doOffline();
|
||||||
try { // First we try and get an image from the API...
|
try { // First we try and get an image from the API...
|
||||||
const enabled = localStorage.getItem('webp');
|
const enabled = localStorage.getItem('webp');
|
||||||
let requestURL;
|
let requestURL;
|
||||||
|
|||||||
Reference in New Issue
Block a user