fix song cover art
This commit is contained in:
parent
f8344ba1d3
commit
a7385028c0
@ -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,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -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 +
|
||||||
|
Reference in New Issue
Block a user