From f10920883d212f1c2cd231d0617d583b84406378 Mon Sep 17 00:00:00 2001 From: Ap_Tx <3045929398@qq.com> Date: Sat, 24 Oct 2026 06:39:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=AC=E5=91=8A?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=B4=A9=E6=BA=83=E3=80=81=E7=9A=AE=E8=82=A4?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=94=99=E4=B9=B1=E3=80=81=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=B8=8D=E5=88=B7=E6=96=B0=E4=B8=8E=E5=9C=B0=E5=9B=BE=E8=A2=AB?= =?UTF-8?q?=E6=8B=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 补回公告中心缺失的配图状态与加载函数,组件此前因引用未定义变量而崩溃 - 皮肤预览按玩家与纹理重建渲染器,避免切换后纹理错位 - 设置分组后同步本地实例分组字段,无需刷新页面 - 地图 iframe 的 CSP frame-src 放开 https,适配服务端可配置的地图地址 --- .../src/components/ui/RemoteAnnouncements.vue | 26 +++++++++++++++++++ .../ui/skin-site/SkinSiteProfileView.vue | 1 + .../src/composables/useInstanceGroups.ts | 7 +++++ apps/app/tauri.conf.json | 4 +-- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/app-frontend/src/components/ui/RemoteAnnouncements.vue b/apps/app-frontend/src/components/ui/RemoteAnnouncements.vue index a743cc7..a21985a 100644 --- a/apps/app-frontend/src/components/ui/RemoteAnnouncements.vue +++ b/apps/app-frontend/src/components/ui/RemoteAnnouncements.vue @@ -219,6 +219,32 @@ function saveCache(next: RemoteAnnouncement[]) { // localStorage may be unavailable (private mode / quota) } } +const imageUrls = reactive>({}) + +async function loadImage(item: RemoteAnnouncement, token: string) { + const name = item.image_name + if (!name || imageUrls[item.id]) return + try { + const url = `https://skin.starlight.cool/starlight/skin/image/BROADCAST_ATTACHMENT/${encodeURIComponent(name)}` + const response = await tauriFetch(url, { + method: 'GET', + headers: { Authorization: `Bearer ${token}` }, + }) + if (!response.ok) return + const type = response.headers.get('content-type') ?? '' + if (type.includes('application/json') || type.includes('text/')) return + const blob = await response.blob() + imageUrls[item.id] = URL.createObjectURL(blob) + } catch { + // 图片加载失败不影响公告本身展示 + } +} + +function revokeImages() { + for (const url of Object.values(imageUrls)) URL.revokeObjectURL(url) + for (const key of Object.keys(imageUrls)) delete imageUrls[key] +} + async function refresh() { if (disposed) return loadCache() diff --git a/apps/app-frontend/src/components/ui/skin-site/SkinSiteProfileView.vue b/apps/app-frontend/src/components/ui/skin-site/SkinSiteProfileView.vue index 5858458..9ef45d4 100644 --- a/apps/app-frontend/src/components/ui/skin-site/SkinSiteProfileView.vue +++ b/apps/app-frontend/src/components/ui/skin-site/SkinSiteProfileView.vue @@ -622,6 +622,7 @@ watch(signedIn, (value) => { { await set_group_memberships(updates) + // 接口成功后同步本地实例的 groups 字段,否则依赖 instances 的分组视图不会重算, + // 用户必须刷新页面才能看到新的分组归属。 + const byId = new Map(updates.map((update) => [update.instance_id, update.group_ids])) + instances.value = instances.value.map((instance) => { + const nextGroups = byId.get(instance.id) + return nextGroups ? { ...instance, groups: [...nextGroups] } : instance + }) return true } diff --git a/apps/app/tauri.conf.json b/apps/app/tauri.conf.json index f5ec734..01c6847 100644 --- a/apps/app/tauri.conf.json +++ b/apps/app/tauri.conf.json @@ -126,7 +126,7 @@ "script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'", "worker-src": "'self' blob:", - "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' http://axolotl-skin.localhost axolotl-skin://localhost https://skin.starlight.cool https://map.starlight.cool", + "frame-src": "https: http://axolotl-skin.localhost axolotl-skin://localhost 'self'", "media-src": "'self' data: https://*.githubusercontent.com" }, "csp": { @@ -136,7 +136,7 @@ "img-src": "https: 'unsafe-inline' 'self' asset: http://asset.localhost http://textures.minecraft.net blob: data:", "style-src": "'unsafe-inline' 'self'", "script-src": "'self' 'unsafe-eval' 'wasm-unsafe-eval'", - "frame-src": "https://www.youtube.com https://www.youtube-nocookie.com https://discord.com 'self' axolotl-skin://localhost http://axolotl-skin.localhost https://skin.starlight.cool https://map.starlight.cool", + "frame-src": "https: axolotl-skin://localhost http://axolotl-skin.localhost 'self'", "media-src": "'self' data: https://*.githubusercontent.com" } }