fix: 完善整合包同步与启动器交互
Some checks failed
Axolotl desktop CI / guardrails (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
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
Sync LobeHub models / sync (push) Has been cancelled
Some checks failed
Axolotl desktop CI / guardrails (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
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
Sync LobeHub models / sync (push) Has been cancelled
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { readonly, ref } from 'vue'
|
||||
import { readonly, ref, watch } from 'vue'
|
||||
|
||||
export const SKIN_SITE_ORIGIN = 'https://skin.starlight.cool'
|
||||
export type SkinSiteUser = { uuid: string; username: string }
|
||||
@ -113,6 +113,22 @@ export const skinSitePlayersStatus = readonly(playersStatus)
|
||||
export const selectedSkinSitePlayerId = readonly(selectedPlayerId)
|
||||
export const skinSiteFrameUrl = readonly(frameUrl)
|
||||
|
||||
export async function waitForSkinSiteSession() {
|
||||
if (status.value !== 'checking') return
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const stop = watch(status, next => {
|
||||
if (next === 'checking') return
|
||||
clearTimeout(timer)
|
||||
stop()
|
||||
resolve()
|
||||
})
|
||||
const timer = setTimeout(() => {
|
||||
stop()
|
||||
reject(new Error('皮肤站登录状态仍在检查,请稍后重试。'))
|
||||
}, 10_000)
|
||||
})
|
||||
}
|
||||
|
||||
function rejectPendingLuckRequests(message: string) {
|
||||
for (const request of pendingLuckRequests.values()) {
|
||||
clearTimeout(request.timeout)
|
||||
@ -138,6 +154,7 @@ function rejectPendingSkinUpdateRequests(message: string) {
|
||||
}
|
||||
|
||||
export function setSkinSiteFrame(frame: Window | null) {
|
||||
if (frame && !user.value) status.value = 'checking'
|
||||
if (connectedFrame === frame) return
|
||||
rejectPendingPackTokens()
|
||||
rejectPendingLuckRequests('The skin site connection changed.')
|
||||
|
||||
Reference in New Issue
Block a user