feat:移除了弹窗,服务器添加sls

This commit is contained in:
2026-09-08 22:39:45 +08:00
commit 6a295f9a7a
4082 changed files with 1322534 additions and 0 deletions

View File

@ -0,0 +1,36 @@
export type MinecraftAccountSortable = {
account_type?: string
profile?: {
id?: string
name?: string
}
}
const ACCOUNT_TYPE_ORDER: Record<string, number> = {
microsoft: 0,
yggdrasil: 1,
offline: 2,
}
export function compareMinecraftAccounts(
left: MinecraftAccountSortable,
right: MinecraftAccountSortable,
): number {
const nameCmp = (left.profile?.name ?? '').localeCompare(right.profile?.name ?? '')
if (nameCmp !== 0) return nameCmp
const typeCmp =
(ACCOUNT_TYPE_ORDER[left.account_type ?? ''] ?? 3) -
(ACCOUNT_TYPE_ORDER[right.account_type ?? ''] ?? 3)
if (typeCmp !== 0) return typeCmp
const leftId = left.profile?.id ?? ''
const rightId = right.profile?.id ?? ''
return leftId < rightId ? -1 : leftId > rightId ? 1 : 0
}
export function sortMinecraftAccounts<T extends MinecraftAccountSortable>(
accounts: readonly T[],
): T[] {
return [...accounts].sort(compareMinecraftAccounts)
}