Skip to content

Commit

Permalink
🐛 完善数据库完整性检测,修复视频加载失败
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Jan 15, 2024
1 parent db9b75d commit 10edf60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ onBeforeMount(async () => {
});
onMounted(async () => {
// 获取当前主题
document.documentElement.className = theme.value;
await listenOnTheme();
});
Expand Down Expand Up @@ -82,19 +81,17 @@ async function listenOnInit(): Promise<void> {
}
async function checkAppLoad(): Promise<void> {
if (appStore.loading) {
console.info("数据已加载!");
return;
}
const checkDB = await TGSqlite.check();
if (!checkDB) {
appStore.loading = false;
await TGSqlite.reset();
showSnackbar({
text: "检测到数据库不完整!已重置数据库!",
color: "error",
timeout: 3000,
});
await createDataDir();
router.go(0);
} else {
appStore.loading = true;
console.info("数据库已加载!");
Expand Down
2 changes: 1 addition & 1 deletion src/components/post/tp-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:src="props.data.insert.video"
:allowfullscreen="false"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
sandbox="allow-forms allow-same-origin allow-popups allow-presentation"
sandbox="allow-forms allow-same-origin allow-popups allow-presentation allow-scripts"
>
</iframe>
<!-- todo 优化 -->
Expand Down
3 changes: 2 additions & 1 deletion src/pages/common/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ const timer = ref<any>(null);
function readLoading(): void {
if (!loading.value) return;
const loadingMap = itemRefs.value.map((item) => {
let loadingMap = itemRefs.value.map((item) => {
return item.loading ? item.name : null;
});
if (!appStore.loading) loadingMap.push("数据库");
loadingSubtitle.value = "正在加载 " + loadingMap.filter((item) => item)?.join("");
if (loadingMap.every((item) => !item)) {
loading.value = false;
Expand Down

0 comments on commit 10edf60

Please sign in to comment.