This commit is contained in:
parent
e54d106a53
commit
58ddf3d79a
@ -15,7 +15,7 @@ export const metadata: Metadata = {
|
|||||||
openGraph: {
|
openGraph: {
|
||||||
title: "Scoresaber Reloaded",
|
title: "Scoresaber Reloaded",
|
||||||
description: "Aggregate your scores with other leaderboards together!",
|
description: "Aggregate your scores with other leaderboards together!",
|
||||||
url: "https://ssrdev.fascinated.cc",
|
url: "https://ssr.fascinated.cc",
|
||||||
locale: "en_US",
|
locale: "en_US",
|
||||||
type: "website",
|
type: "website",
|
||||||
},
|
},
|
||||||
|
@ -16,9 +16,36 @@ interface PlayerScoresStore {
|
|||||||
lastUpdated: number;
|
lastUpdated: number;
|
||||||
players: Player[];
|
players: Player[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets when the player scores were last updated
|
||||||
|
*
|
||||||
|
* @param lastUpdated when the player scores were last updated
|
||||||
|
*/
|
||||||
setLastUpdated: (lastUpdated: number) => void;
|
setLastUpdated: (lastUpdated: number) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player exists
|
||||||
|
*
|
||||||
|
* @param playerId the player id
|
||||||
|
* @returns if the player exists
|
||||||
|
*/
|
||||||
exists: (playerId: string) => boolean;
|
exists: (playerId: string) => boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the given player
|
||||||
|
*
|
||||||
|
* @param playerId the player id
|
||||||
|
* @returns the player
|
||||||
|
*/
|
||||||
get(playerId: string): Player | undefined;
|
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: (
|
addPlayer: (
|
||||||
playerId: string,
|
playerId: string,
|
||||||
callback?: (page: number, totalPages: number) => void,
|
callback?: (page: number, totalPages: number) => void,
|
||||||
@ -26,6 +53,10 @@ interface PlayerScoresStore {
|
|||||||
error: boolean;
|
error: boolean;
|
||||||
message: string;
|
message: string;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refreshes the player scores and adds any new scores to the local database
|
||||||
|
*/
|
||||||
updatePlayerScores: () => void;
|
updatePlayerScores: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +224,7 @@ export const usePlayerScoresStore = create<PlayerScoresStore>()(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Update the player scores every 30 minutes
|
||||||
usePlayerScoresStore.getState().updatePlayerScores();
|
usePlayerScoresStore.getState().updatePlayerScores();
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
usePlayerScoresStore.getState().updatePlayerScores();
|
usePlayerScoresStore.getState().updatePlayerScores();
|
||||||
|
@ -125,6 +125,7 @@ export const useSettingsStore = create<SettingsStore>()(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Refresh profiles every 10 minutes
|
||||||
useSettingsStore.getState().refreshProfiles();
|
useSettingsStore.getState().refreshProfiles();
|
||||||
setInterval(
|
setInterval(
|
||||||
() => useSettingsStore.getState().refreshProfiles(),
|
() => 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(
|
export async function fetchAllScores(
|
||||||
playerId: string,
|
playerId: string,
|
||||||
searchType: string,
|
searchType: string,
|
||||||
|
Loading…
Reference in New Issue
Block a user