修复: 走查批修22项缺陷(样式常量/配置原子写/壁纸下载校验/前端泄漏)
- GWL_EXSTYLE 常量多写一个F致样式写入错误偏移 - 配置读写加锁+临时文件原子替换;更新窗口Promise化修白屏 - Bing壁纸: 裁剪后索引同步/下载校验状态码/超2000裁剪/隐藏图切换 - 天气假兜底不再入缓存; 相册循环重入保护; 中文日志按rune截断 - 主题壁纸rAF泄漏清理钩子; 知识卡热区复位; 照片清空指令透传 - 设置窗双开竞态+销毁后可重建; 消息循环-1退出; 重启失败不退出
This commit is contained in:
1 parent
5342c5e489
commit
5e93e04581
21 files changed
+217
-58
No files matched your search
@@ -24,6 +24,8 @@ const bgMount = ref<HTMLElement>()
|
||||
function mountBackground(html: string) {
|
||||
const el = bgMount.value
|
||||
if (!el) return
|
||||
// 主题被替换前先终止其自续 rAF / 监听,防 CPU 累积
|
||||
;(window as any).__themeCleanup?.()
|
||||
el.innerHTML = html
|
||||
|
||||
// v-html skips <script>; manually execute them
|
||||
@@ -54,6 +56,9 @@ watch(() => state.wallpaperVisible, (visible) => {
|
||||
const el = bgMount.value
|
||||
if (!el) return
|
||||
if (visible && state.backgroundHtml) mountBackground(state.backgroundHtml)
|
||||
else el.innerHTML = ''
|
||||
else {
|
||||
;(window as any).__themeCleanup?.()
|
||||
el.innerHTML = ''
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -38,6 +38,10 @@ export function registerGoBridge() {
|
||||
|
||||
w.updatePhotoFromGo = (data: any) => {
|
||||
const parsed = parseArg(data)
|
||||
if (parsed == null) {
|
||||
if (shouldUpdate('photo', parsed)) state.photo = null
|
||||
return
|
||||
}
|
||||
if (parsed?.src && shouldUpdate('photo', parsed)) state.photo = parsed
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted } from 'vue'
|
||||
import { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { state } from '../composables/useOverlayState'
|
||||
|
||||
function refresh() {
|
||||
@@ -36,14 +36,26 @@ function updateHitRect() {
|
||||
)
|
||||
}
|
||||
|
||||
function clearHitRect() {
|
||||
;(window as any).setInteractiveRect?.(0, 0, 0, 0)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
updateHitRect()
|
||||
window.addEventListener('resize', updateHitRect)
|
||||
})
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', updateHitRect)
|
||||
clearHitRect()
|
||||
})
|
||||
|
||||
// 卡片隐藏时复位热区,重新显示/内容变化(布局改变)后重新上报
|
||||
watch(() => state.cardVisibility.knowledge, (v) => {
|
||||
if (v) nextTick(updateHitRect)
|
||||
else clearHitRect()
|
||||
})
|
||||
watch(() => state.knowledge.content, () => nextTick(updateHitRect))
|
||||
|
||||
function renderMarkdown(text: string): string {
|
||||
let html = text
|
||||
// 代码块 (```...```) → <pre><code>
|
||||
|
||||
Reference in new issue
Block a user