-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
981 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { PageServerLoad } from './$types'; | ||
import { getSkin } from '$lib/server/ddtracker'; | ||
import { getPlayer } from '$lib/server/players'; | ||
import { decodeAsciiURIComponent } from '$lib/link'; | ||
|
||
export const load = (async ({ url, parent }) => { | ||
const year = parseInt(url.searchParams.get('year') || '2024'); | ||
const name = decodeAsciiURIComponent(url.searchParams.get('name') || ''); | ||
|
||
if (!name) { | ||
return { year, ...(await parent()) }; | ||
} | ||
|
||
const player = await getPlayer(name); | ||
if (!player || !player.name) { | ||
const error = `未找到名为${name}的玩家`; | ||
return { year, error, ...(await parent()) }; | ||
} | ||
|
||
const skin = getSkin(name, 'as:cn') || getSkin(name); | ||
|
||
return { year, name, skin, player, ...(await parent()) }; | ||
}) satisfies PageServerLoad; |
Oops, something went wrong.