diff --git a/docs/Bot.md b/docs/Bot.md index 665846ed..2ab86cbc 100644 --- a/docs/Bot.md +++ b/docs/Bot.md @@ -10,7 +10,7 @@ ### Requirement - Your Osu! IRC credentials user and password these are not the same as your Osu! account credentials (Get them at https://osu.ppy.sh/p/irc) -- An Osu! API key, it will be used to fetch infos about beatmaps and matchs (Get it at https://osu.ppy.sh/p/api) +- A Osu! API key V1 (V2 api is not compatible), it will be used to fetch infos about beatmaps and matchs (Get it at https://osu.ppy.sh/p/api) ### Setup process diff --git a/src/App/modules/Settings/helpers/baseConf.js b/src/App/modules/Settings/helpers/baseConf.js index b861efcb..e3361bde 100644 --- a/src/App/modules/Settings/helpers/baseConf.js +++ b/src/App/modules/Settings/helpers/baseConf.js @@ -21,7 +21,7 @@ export default Object.freeze({ isBotAccount: false, }, osuApi: { - key: '', + key: process.env.API_KEY_V1, }, }, beatconnectAPI: { diff --git a/src/App/modules/common/Beatmap/Cover.js b/src/App/modules/common/Beatmap/Cover.js index e08a0d23..5cdea02e 100644 --- a/src/App/modules/common/Beatmap/Cover.js +++ b/src/App/modules/common/Beatmap/Cover.js @@ -32,7 +32,8 @@ const Cover = ({ url, width, height, paddingBottom, roundedTop, noFade, canLoad }; return (
- + {beatmapSet && parentRef && beatmapSet.beatmaps && + }
); }; diff --git a/src/App/modules/common/Beatmap/index.js b/src/App/modules/common/Beatmap/index.js index aec60249..d5af0f18 100644 --- a/src/App/modules/common/Beatmap/index.js +++ b/src/App/modules/common/Beatmap/index.js @@ -93,7 +93,8 @@ const Beatmap = ({ beatmap, noFade, autoDl, width, ...otherProps }) => { const theme = useTheme(); const [isPlaying, setIsPLaying] = useState(false); const { beatmapset_id, id, title, artist, creator, version, bpm, beatconnectDlLink, beatmaps } = beatmap; - const wallpaperBeatmapId = beatmaps[Math.max(beatmaps.length - 2, 0)].id; + // beatmap.beatmap_id only when beatmap comes from mpMatch (for bot displays) + const wallpaperBeatmapId = beatmaps ? beatmaps[Math.max(beatmaps.length - 2, 0)].id : beatmap.beatmap_id; const classes = useStyles({ width, theme, isPlaying, bpm: beatmap.bpm, ...otherProps }); return ( diff --git a/src/Bot/actions.js b/src/Bot/actions.js index 765b33c0..a6df490d 100644 --- a/src/Bot/actions.js +++ b/src/Bot/actions.js @@ -13,7 +13,7 @@ export const updateMatchsList = newMatchs => { trackEvent('bot', 'matchs', 'connectedMatchsCount', newMatchs.length || 0); }; export const updateSingleMatch = matchUpdate => { - const newMatchs = store.getState().bot.mpMatchs.map(match => (match.id === matchUpdate.id ? matchUpdate : match)); - store.dispatch({ type: 'UPDATE_SINGLE_MATCH', newMatchs }); - trackEvent('bot', 'matchs', 'connectedMatchsCount', newMatchs.length || 0); + const matchCount = store.getState().bot.mpMatchs.length + store.dispatch({ type: 'UPDATE_SINGLE_MATCH', newMatch:matchUpdate }); + trackEvent('bot', 'matchs', 'connectedMatchsCount', matchCount || 0); }; diff --git a/src/Bot/msg/mpSettings.js b/src/Bot/msg/mpSettings.js index a2af4c0b..b1a8d017 100644 --- a/src/Bot/msg/mpSettings.js +++ b/src/Bot/msg/mpSettings.js @@ -3,7 +3,7 @@ import store from '../../shared/store'; import { updateSingleMatch } from '../actions'; export default function(msg) { - const osuApi = store.getState().main.bot.osuApi; + const osuApi = store.getState().bot.instance.osuApi; let msgDatas = msg.split(',').map(data => data.split(/:(?!\/)/g)); //msgDatas = msgDatas diff --git a/src/mirage/index.js b/src/mirage/index.js index 9f557952..a39f79b4 100644 --- a/src/mirage/index.js +++ b/src/mirage/index.js @@ -25,6 +25,8 @@ export function makeServer() { return mock; }); + + this.passthrough('https://osu.ppy.sh/api/**'); }, }); }