fix song cover art

This commit is contained in:
Lee 2023-10-18 03:11:58 +01:00
parent f8344ba1d3
commit a7385028c0
4 changed files with 18 additions and 14 deletions

View File

@ -1,13 +1,13 @@
<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 {opt} from '../../utils/js'
import {scrollToTargetAdjusted} from '../../utils/browser'
import SongScore from './SongScore.svelte'
import Error from '../Common/Error.svelte'
import ScoreServiceSwitcher from './ScoreServiceSwitcher.svelte'
import ScoresPager from './ScoresPager.svelte'
import stringify from 'json-stable-stringify'
import { scrollToTargetAdjusted } from '../../utils/browser';
import { opt } from '../../utils/js';
import Error from '../Common/Error.svelte';
import ScoreServiceSwitcher from './ScoreServiceSwitcher.svelte';
import ScoresPager from './ScoresPager.svelte';
import SongScore from './SongScore.svelte';
const dispatch = createEventDispatcher();

View File

@ -1,7 +1,7 @@
<script>
import {SS_HOST} from '../../network/queues/scoresaber/page-queue'
import {navigate} from 'svelte-routing'
import Difficulty from '../Song/Difficulty.svelte'
import { navigate } from 'svelte-routing';
import { SS_CDN_HOST } from '../../network/queues/scoresaber/page-queue';
import Difficulty from '../Song/Difficulty.svelte';
export let leaderboard = null;
export let url = null;
@ -31,10 +31,12 @@
}
$: 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;
$: 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;
</script>

View File

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

View File

@ -8,6 +8,7 @@ import { extractDiffAndType } from "../../../utils/scoresaber/format";
import { PRIORITY, default as createQueue } from "../http-queue";
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 RANKEDS_URL =
SS_CORS_HOST +