浏览代码

fix: delete "remember song time" entries with outdated format

Sv443 1 月之前
父节点
当前提交
4ca0c6200c
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/features/behavior.ts

+ 6 - 0
src/features/behavior.ts

@@ -139,6 +139,12 @@ export async function initRememberSongTime() {
     remVids = [];
   }
 
+  if(remVids.some(e => "watchID" in e)) {
+    remVids = remVids.filter(e => "id" in e);
+    await GM.setValue("bytm-rem-songs", JSON.stringify(remVids));
+    log(`Removed ${remVids.length} ${autoPlural("entry", remVids)} with an outdated format from the video time cache`);
+  }
+
   log(`Initialized video time restoring with ${remVids.length} initial ${autoPlural("entry", remVids)}:`, remVids);
 
   await remTimeRestoreTime();