feat: prepare for push notification

This commit is contained in:
2022-08-13 18:05:04 +08:00
parent 7df8b39061
commit c1431ba051
6 changed files with 105 additions and 29 deletions

View File

@@ -39,21 +39,24 @@ class App extends Component {
window.BACKEND =
localStorage['BACKEND'] || process.env.REACT_APP_BACKEND || '/';
setTimeout(() => {
fetch('https://api.github.com/users/hole-thu')
.then((resp) => resp.json())
.then((data) => {
let x = data.bio;
let len = x.length;
let address = atob(
Array.from({ length: len }, (_, i) => x[(i * 38) % len])
.join('')
.split('|')[0],
);
window.BACKEND = `https://${address}/`;
localStorage['BACKEND'] = window.BACKEND;
});
}, 12345);
if (process.env.NODE_ENV === 'production') {
setTimeout(() => {
fetch('https://api.github.com/users/hole-thu')
.then((resp) => resp.json())
.then((data) => {
let x = data.bio;
let len = x.length;
let address = atob(
Array.from({ length: len }, (_, i) => x[(i * 38) % len])
.join('')
.split('|')[0],
);
window.BACKEND = `https://${address}/`;
localStorage['BACKEND'] = window.BACKEND;
});
}, 12345);
}
}
static is_darkmode() {