Compare commits

...

3 Commits

Author SHA1 Message Date
6055783404 fix beat savior
All checks were successful
deploy / deploy (push) Successful in 48s
2023-10-18 03:12:34 +01:00
f5a838442c fix accsaber not being proxied 2023-10-18 03:12:22 +01:00
a7385028c0 fix song cover art 2023-10-18 03:11:58 +01:00
6 changed files with 23 additions and 17 deletions

@ -1,13 +1,13 @@
<script> <script>
import {createEventDispatcher} from 'svelte' import stringify from 'json-stable-stringify';
import { createEventDispatcher } from 'svelte';
import createScoresStore from '../../stores/http/http-scores-store.js'; import createScoresStore from '../../stores/http/http-scores-store.js';
import {opt} from '../../utils/js' import { scrollToTargetAdjusted } from '../../utils/browser';
import {scrollToTargetAdjusted} from '../../utils/browser' import { opt } from '../../utils/js';
import SongScore from './SongScore.svelte' import Error from '../Common/Error.svelte';
import Error from '../Common/Error.svelte' import ScoreServiceSwitcher from './ScoreServiceSwitcher.svelte';
import ScoreServiceSwitcher from './ScoreServiceSwitcher.svelte' import ScoresPager from './ScoresPager.svelte';
import ScoresPager from './ScoresPager.svelte' import SongScore from './SongScore.svelte';
import stringify from 'json-stable-stringify'
const dispatch = createEventDispatcher(); const dispatch = createEventDispatcher();

@ -1,7 +1,7 @@
<script> <script>
import {SS_HOST} from '../../network/queues/scoresaber/page-queue' import { navigate } from 'svelte-routing';
import {navigate} from 'svelte-routing' import { SS_CDN_HOST } from '../../network/queues/scoresaber/page-queue';
import Difficulty from '../Song/Difficulty.svelte' import Difficulty from '../Song/Difficulty.svelte';
export let leaderboard = null; export let leaderboard = null;
export let url = null; export let url = null;
@ -31,10 +31,12 @@
} }
$: hash = leaderboard?.song?.hash ?? null; $: hash = leaderboard?.song?.hash ?? null;
$: ssCoverUrl = hash ? `${SS_HOST}/imports/images/songs/${encodeURIComponent(hash)}.png` : null; $: ssCoverUrl = hash ? `${SS_CDN_HOST}/covers/${encodeURIComponent(hash.toUpperCase())}.png` : null;
$: beatSaverCoverUrl = leaderboard?.beatMaps?.versions?.[0]?.coverURL ?? null; $: beatSaverCoverUrl = leaderboard?.beatMaps?.versions?.[0]?.coverURL ?? null;
$: preloadImages([{url: ssCoverUrl, priority: 10}, {url: beatSaverCoverUrl, priority: 5}]); console.log(leaderboard)
$: preloadImages([{url: ssCoverUrl, priority: 10}, {url: beatSaverCoverUrl, priority: 15}]);
$: coverUrl = loadedImages.length ? (loadedImages.sort((a, b) => a?.priority - b?.priority))[0].url : DEFAULT_IMG; $: coverUrl = loadedImages.length ? (loadedImages.sort((a, b) => a?.priority - b?.priority))[0].url : DEFAULT_IMG;
</script> </script>

@ -1,3 +1,4 @@
import { SS_CDN_HOST } from "../../../network/queues/scoresaber/page-queue";
import tweened from "../../../svelte-utils/tweened"; import tweened from "../../../svelte-utils/tweened";
import { opt } from "../../../utils/js"; import { opt } from "../../../utils/js";
@ -170,7 +171,7 @@ function updateSsBadges(playerData) {
if (!opt(playerData, "playerInfo.badges.length")) return null; if (!opt(playerData, "playerInfo.badges.length")) return null;
return playerData.playerInfo.badges.map((b) => ({ return playerData.playerInfo.badges.map((b) => ({
src: `https://cdn.scoresaber.com/badges/${b.image}`, src: `${SS_CDN_HOST}/badges/${b.image}`,
title: b.description, title: b.description,
})); }));
} }

@ -1,7 +1,8 @@
import { default as createQueue, PRIORITY } from "../http-queue"; import ssrConfig from "../../../ssr-config";
import { substituteVars } from "../../../utils/format"; import { substituteVars } from "../../../utils/format";
import { default as createQueue, PRIORITY } from "../http-queue";
const ACCSABER_API_URL = "https://api.accsaber.com"; const ACCSABER_API_URL = ssrConfig.proxy + "/https://api.accsaber.com";
const CATEGORIES_URL = ACCSABER_API_URL + "/categories"; const CATEGORIES_URL = ACCSABER_API_URL + "/categories";
const RANKING_URL = ACCSABER_API_URL + "/categories/${category}/standings"; const RANKING_URL = ACCSABER_API_URL + "/categories/${category}/standings";
const PLAYER_SCORES_URL = ACCSABER_API_URL + "/players/${playerId}/scores"; const PLAYER_SCORES_URL = ACCSABER_API_URL + "/players/${playerId}/scores";

@ -2,7 +2,8 @@ import ssrConfig from "../../../ssr-config";
import { substituteVars } from "../../../utils/format"; import { substituteVars } from "../../../utils/format";
import { default as createQueue, PRIORITY } from "../http-queue"; import { default as createQueue, PRIORITY } from "../http-queue";
const BEATSAVIOR_API_URL = "https://www.beatsavior.io/api/livescores/player/"; const BEATSAVIOR_API_URL =
"https://beat-savior.herokuapp.com/api/livescores/player/";
const PLAYER_URL = ssrConfig.proxy + "/" + BEATSAVIOR_API_URL + "/${playerId}"; const PLAYER_URL = ssrConfig.proxy + "/" + BEATSAVIOR_API_URL + "/${playerId}";
export default (options = {}) => { export default (options = {}) => {

@ -8,6 +8,7 @@ import { extractDiffAndType } from "../../../utils/scoresaber/format";
import { PRIORITY, default as createQueue } from "../http-queue"; import { PRIORITY, default as createQueue } from "../http-queue";
export const SS_HOST = "https://scoresaber.com"; export const SS_HOST = "https://scoresaber.com";
export const SS_CDN_HOST = "https://cdn.scoresaber.com";
const SS_CORS_HOST = `${ssrConfig.proxy}/${SS_HOST}`; const SS_CORS_HOST = `${ssrConfig.proxy}/${SS_HOST}`;
const RANKEDS_URL = const RANKEDS_URL =
SS_CORS_HOST + SS_CORS_HOST +