diff --git a/src/App.vue b/src/App.vue index 9b52acc0..b59c4442 100644 --- a/src/App.vue +++ b/src/App.vue @@ -44,26 +44,31 @@ export default { darkModePreference.addEventListener("change", () => { this.setTheme(); }); - if (this.getPreferenceBoolean("watchHistory", false)) - if ("indexedDB" in window) { - const request = indexedDB.open("piped-db", 2); - request.onupgradeneeded = ev => { - const db = request.result; - console.log("Upgrading object store."); - if (!db.objectStoreNames.contains("watch_history")) { - const store = db.createObjectStore("watch_history", { keyPath: "videoId" }); - store.createIndex("video_id_idx", "videoId", { unique: true }); - store.createIndex("id_idx", "id", { unique: true, autoIncrement: true }); - } - if (ev.oldVersion < 2) { - const store = request.transaction.objectStore("watch_history"); - store.createIndex("watchedAt", "watchedAt", { unique: false }); - } - }; - request.onsuccess = e => { - window.db = e.target.result; - }; - } else console.log("This browser doesn't support IndexedDB"); + + if ("indexedDB" in window) { + const request = indexedDB.open("piped-db", 3); + request.onupgradeneeded = ev => { + const db = request.result; + console.log("Upgrading object store."); + if (!db.objectStoreNames.contains("watch_history")) { + const store = db.createObjectStore("watch_history", { keyPath: "videoId" }); + store.createIndex("video_id_idx", "videoId", { unique: true }); + store.createIndex("id_idx", "id", { unique: true, autoIncrement: true }); + } + if (ev.oldVersion < 2) { + const store = request.transaction.objectStore("watch_history"); + store.createIndex("watchedAt", "watchedAt", { unique: false }); + } + if (!db.objectStoreNames.contains("playlist_bookmarks")) { + const store = db.createObjectStore("playlist_bookmarks", { keyPath: "playlistId" }); + store.createIndex("playlist_id_idx", "playlistId", { unique: true }); + store.createIndex("id_idx", "id", { unique: true, autoIncrement: true }); + } + }; + request.onsuccess = e => { + window.db = e.target.result; + }; + } else console.log("This browser doesn't support IndexedDB"); const App = this; diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 5f59af83..b3f94abf 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -50,7 +50,7 @@