fix: 修复皮肤站登录后侧栏玩家选择器未立即显示
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled

侧栏直接合并皮肤站角色与已保存账户并按 UUID 去重,无需先启动实例。
选择角色时才进行认证并保存默认账户,认证失败时保留原选择并允许重试。
移除逐个预认证角色的流程,修复无皮肤玩家的默认头像引用异常。

补充组件回归测试,覆盖首次登录、默认玩家切换、失败重试、退出登录和无皮肤角色。
验证:14 项相关测试及 ESLint 通过,前端生产构建通过。
全量检查仍有既有的设置搜索、升级结果组件测试失败及类型错误。
This commit is contained in:
Disy committed 2026-09-24 14:15:00 +08:00
1 parent 42b0c7e7af
commit e4fa234df1
3 files changed
+365 -79

No files matched your search

@@ -6,9 +6,9 @@ import {
skinSiteUser,
waitForSkinSiteSession,
} from '../composables/skin-site-session.ts'
export { waitForSkinSiteSession } from '../composables/skin-site-session.ts'
import { users } from './auth.js'
import { isOfflineMode } from '../composables/useNetworkStatus.ts'
import { users } from './auth.js'
export { waitForSkinSiteSession } from '../composables/skin-site-session.ts'
export type InstancePlayer = {
id: string
@@ -68,52 +68,6 @@ export async function authenticateInstancePlayer(player: InstancePlayer) {
}
}
/**
* Registers every skin-site player as a launcher account so they show up in the
* account picker immediately after signing in to the skin site, instead of only
* after a first launch. Idempotent: players that already exist in the account
* list (matched by profile UUID) are skipped, and already-signed-in players are
* not re-requested. Best-effort: a single player failing does not abort the rest.
*/
export async function registerSkinSitePlayers(
playerIds: string[],
userUuid: string,
): Promise<void> {
if (playerIds.length === 0) return
if (skinSiteStatus.value !== 'signed-in' || skinSiteUser.value?.uuid !== userUuid) return
let known = new Set<string>()
try {
const existing = await users()
known = new Set(
(existing as Array<{ profile?: { id?: string } }>)
.map((account) => account?.profile?.id)
.filter((id): id is string => typeof id === 'string'),
)
} catch {
// If the account list cannot be read, still attempt to register; the
// backend upsert is idempotent.
}
for (const playerId of playerIds) {
if (known.has(playerId)) continue
if (skinSiteStatus.value !== 'signed-in' || skinSiteUser.value?.uuid !== userUuid) return
try {
// Request a fresh download token per player: the skin site login
// endpoint may bind a token to a single player id.
const token = await requestSkinSiteDownloadToken()
await invoke('plugin:auth|login_skin_site_player', {
token,
playerId,
userId: userUuid,
})
known.add(playerId)
} catch (error) {
console.warn(`Failed to register skin site player ${playerId}:`, error)
}
}
}
export async function saveInstancePlayer(instanceId: string, player: InstancePlayer) {
await authenticateInstancePlayer(player)
await invoke('plugin:auth|set_instance_player', { instanceId, player })