fix player embed image not updating (maybe?)
All checks were successful
Deploy Backend / docker (ubuntu-latest) (push) Successful in 47s
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m23s

This commit is contained in:
Lee 2024-10-27 13:30:51 +00:00
parent d086e922c4
commit 4be0b072b2
4 changed files with 17 additions and 2 deletions

@ -7,7 +7,7 @@ import ScoreSaberPlayerScoresPageToken from "../../types/token/scoresaber/score-
import ScoreSaberLeaderboardToken from "../../types/token/scoresaber/score-saber-leaderboard-token"; import ScoreSaberLeaderboardToken from "../../types/token/scoresaber/score-saber-leaderboard-token";
import ScoreSaberLeaderboardScoresPageToken from "../../types/token/scoresaber/score-saber-leaderboard-scores-page-token"; import ScoreSaberLeaderboardScoresPageToken from "../../types/token/scoresaber/score-saber-leaderboard-scores-page-token";
import { clamp, lerp } from "../../utils/math-utils"; import { clamp, lerp } from "../../utils/math-utils";
import { CurvePoint } from "../../utils/curve-point"; import { CurvePoint } from "../../curve-point";
import { SSRCache } from "../../cache"; import { SSRCache } from "../../cache";
const API_BASE = "https://scoresaber.com/api"; const API_BASE = "https://scoresaber.com/api";

@ -0,0 +1,14 @@
/**
* Generates a random string
*
* @param length the length of the string
* @returns the random string
*/
export function randomString(length: number) {
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let result = "";
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
}

@ -14,6 +14,7 @@ import { fetchPlayerScores } from "@ssr/common/utils/score-utils";
import PlayerScoresResponse from "@ssr/common/response/player-scores-response"; import PlayerScoresResponse from "@ssr/common/response/player-scores-response";
import { getScoreSaberPlayerFromToken } from "@ssr/common/token-creators"; import { getScoreSaberPlayerFromToken } from "@ssr/common/token-creators";
import { cache } from "react"; import { cache } from "react";
import { randomString } from "@ssr/common/utils/string.util";
const UNKNOWN_PLAYER = { const UNKNOWN_PLAYER = {
title: "ScoreSaber Reloaded - Unknown Player", title: "ScoreSaber Reloaded - Unknown Player",
@ -91,7 +92,7 @@ export async function generateMetadata(props: Props): Promise<Metadata> {
description: `Click here to view the scores for ${player.name}!`, description: `Click here to view the scores for ${player.name}!`,
images: [ images: [
{ {
url: `${Config.apiUrl}/image/player/${player.id}`, url: `${Config.apiUrl}/image/player/${player.id}?id=${randomString(8)}`,
}, },
], ],
}, },