update embed
All checks were successful
deploy / deploy (push) Successful in 58s

This commit is contained in:
Lee 2023-10-22 05:20:59 +01:00
parent e54d106a53
commit 58ddf3d79a
4 changed files with 42 additions and 1 deletions

@ -15,7 +15,7 @@ export const metadata: Metadata = {
openGraph: {
title: "Scoresaber Reloaded",
description: "Aggregate your scores with other leaderboards together!",
url: "https://ssrdev.fascinated.cc",
url: "https://ssr.fascinated.cc",
locale: "en_US",
type: "website",
},

@ -16,9 +16,36 @@ interface PlayerScoresStore {
lastUpdated: number;
players: Player[];
/**
* Sets when the player scores were last updated
*
* @param lastUpdated when the player scores were last updated
*/
setLastUpdated: (lastUpdated: number) => void;
/**
* Checks if the player exists
*
* @param playerId the player id
* @returns if the player exists
*/
exists: (playerId: string) => boolean;
/**
* Gets the given player
*
* @param playerId the player id
* @returns the player
*/
get(playerId: string): Player | undefined;
/**
* Adds the player to the local database
*
* @param playerId the player id
* @param callback a callback to call when a score page is fetched
* @returns if the player was added successfully
*/
addPlayer: (
playerId: string,
callback?: (page: number, totalPages: number) => void,
@ -26,6 +53,10 @@ interface PlayerScoresStore {
error: boolean;
message: string;
}>;
/**
* Refreshes the player scores and adds any new scores to the local database
*/
updatePlayerScores: () => void;
}
@ -193,6 +224,7 @@ export const usePlayerScoresStore = create<PlayerScoresStore>()(
),
);
// Update the player scores every 30 minutes
usePlayerScoresStore.getState().updatePlayerScores();
setInterval(() => {
usePlayerScoresStore.getState().updatePlayerScores();

@ -125,6 +125,7 @@ export const useSettingsStore = create<SettingsStore>()(
),
);
// Refresh profiles every 10 minutes
useSettingsStore.getState().refreshProfiles();
setInterval(
() => useSettingsStore.getState().refreshProfiles(),

@ -117,6 +117,14 @@ export async function fetchScores(
};
}
/**
* Gets all of the players for the given player id
*
* @param playerId the id of the player
* @param searchType the type of search to perform
* @param callback a callback to call when a page is fetched
* @returns a list of scores
*/
export async function fetchAllScores(
playerId: string,
searchType: string,