17 lines
501 B
JavaScript
17 lines
501 B
JavaScript
|
import Config from '../config.json';
|
||
|
|
||
|
module.exports = {
|
||
|
BEATSAVER_MAP_API: Config.proxy_url + "/https://api.beatsaver.com/maps/hash/%s",
|
||
|
// todo: cache map data for 12 hrs
|
||
|
async getMapData(hash) {
|
||
|
const data = await fetch(this.BEATSAVER_MAP_API.replace("%s", hash), {
|
||
|
headers: {
|
||
|
"origin": "Fascinated Overlay"
|
||
|
}
|
||
|
});
|
||
|
if (data.status === 404) {
|
||
|
return undefined;
|
||
|
}
|
||
|
return await data.json();
|
||
|
}
|
||
|
}
|