fix player embed image not updating (maybe?)
This commit is contained in:
parent
d086e922c4
commit
4be0b072b2
@ -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";
|
||||||
|
14
projects/common/src/utils/string.util.ts
Normal file
14
projects/common/src/utils/string.util.ts
Normal file
@ -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)}`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user