feat: dynamic backend
This commit is contained in:
18
src/App.js
18
src/App.js
@@ -36,6 +36,24 @@ class App extends Component {
|
||||
this.show_sidebar_bound = this.show_sidebar.bind(this);
|
||||
this.set_mode_bound = this.set_mode.bind(this);
|
||||
this.on_pressure_bound = this.on_pressure.bind(this);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static is_darkmode() {
|
||||
|
||||
Reference in New Issue
Block a user