feat: 新增皮肤站账号设置弹窗
Sync source to CNB / Sync Git ref (push) Skipped

- API 层补充改名、改网站密码、改 Minecraft 密码、上传头像。
- SkinSiteProfileModal:用户名修改、头像上传(居中裁剪为 256×256)、
  网站密码修改、Minecraft 密码修改与恢复默认。
- 主页账号卡增加「Account」入口打开该弹窗。
This commit is contained in:
AxTps committed 2026-10-17 19:33:48 +08:00
1 parent 86306b8ddd
commit 041d288b25
4 files changed
+464 -2

No files matched your search

@@ -431,3 +431,52 @@ export interface SkinSiteAnnouncement {
export function skinSiteAnnouncements(): Promise<SkinSiteResponse<SkinSiteAnnouncement[]>> {
return skinSiteRequest<SkinSiteAnnouncement[]>('broadcast/all', { type: 'skin' })
}
// ---------------------------------------------------------------------------
// Account updates (requires the JWT)
// ---------------------------------------------------------------------------
export function skinSiteChangeUsername(newUsername: string): Promise<SkinSiteResponse<string>> {
return skinSiteRequest<string>('update/username', {
method: 'POST',
body: { newUsername },
})
}
export function skinSiteChangePassword(
oldPassword: string,
newPassword: string,
): Promise<SkinSiteResponse<string>> {
return skinSiteRequest<string>('update/password', {
method: 'POST',
body: { oldPassword, newPassword },
})
}
/** Pass null to reset the Minecraft password back to the website password. */
export function skinSiteChangeYggdrasilPassword(
newPassword: string | null,
): Promise<SkinSiteResponse<string>> {
return skinSiteRequest<string>('update/yggdrasilPassword', {
method: 'POST',
body: { newPassword },
})
}
/** Upload a new avatar image (multipart). */
export async function skinSiteUploadAvatar(blob: Blob): Promise<SkinSiteResponse<string>> {
const form = new FormData()
form.append('avatar', blob)
const url = `${SKIN_SITE_ORIGIN}/starlight/update/avatar`
const headers: Record<string, string> = {}
const token = getSkinSiteToken()
if (token) headers['Authorization'] = `Bearer ${token}`
let response: Response
try {
response = await tauriFetch(url, { method: 'POST', headers, body: form })
} catch {
return handleException(0)
}
return processResponse<string>(response)
}