From f4497acd488b2588ea5c1d8712b548d2dc93163d Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 9 Jul 2023 14:07:30 -0500 Subject: [PATCH] Remove API routes for removing all items and purging media progress --- client/pages/config/index.vue | 18 ------------- client/pages/config/users/_id/index.vue | 30 +-------------------- client/strings/de.json | 1 - client/strings/en-us.json | 1 - client/strings/es.json | 1 - client/strings/fr.json | 1 - client/strings/gu.json | 1 - client/strings/hi.json | 1 - client/strings/hr.json | 1 - client/strings/it.json | 1 - client/strings/nl.json | 1 - client/strings/pl.json | 1 - client/strings/ru.json | 1 - client/strings/zh-cn.json | 1 - server/controllers/LibraryItemController.js | 14 ---------- server/routers/ApiRouter.js | 1 - 16 files changed, 1 insertion(+), 74 deletions(-) diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue index eaaa408f..af84317d 100644 --- a/client/pages/config/index.vue +++ b/client/pages/config/index.vue @@ -192,7 +192,6 @@
{{ $strings.ButtonPurgeAllCache }} {{ $strings.ButtonPurgeItemsCache }} - {{ $strings.ButtonRemoveAllLibraryItems }}
@@ -368,23 +367,6 @@ export default { this.homepageUseBookshelfView = this.newServerSettings.homeBookshelfView != this.$constants.BookshelfView.DETAIL this.useBookshelfView = this.newServerSettings.bookshelfView != this.$constants.BookshelfView.DETAIL }, - resetLibraryItems() { - if (confirm(this.$strings.MessageRemoveAllItemsWarning)) { - this.isResettingLibraryItems = true - this.$axios - .$delete('/api/items/all') - .then(() => { - this.isResettingLibraryItems = false - this.$toast.success('Successfully reset items') - location.reload() - }) - .catch((error) => { - console.error('failed to reset items', error) - this.isResettingLibraryItems = false - this.$toast.error('Failed to reset items - manually remove the /config/libraryItems folder') - }) - } - }, purgeCache() { this.showConfirmPurgeCache = true }, diff --git a/client/pages/config/users/_id/index.vue b/client/pages/config/users/_id/index.vue index ee136b43..3477a5be 100644 --- a/client/pages/config/users/_id/index.vue +++ b/client/pages/config/users/_id/index.vue @@ -47,12 +47,6 @@

{{ $strings.HeaderSavedMediaProgress }}

-
-

User has media progress for {{ mediaProgressWithoutMedia.length }} items that no longer exist.

-
- {{ $strings.ButtonPurgeMediaProgress }} -
- @@ -111,8 +105,7 @@ export default { data() { return { listeningSessions: {}, - listeningStats: {}, - purgingMediaProgress: false + listeningStats: {} } }, computed: { @@ -134,9 +127,6 @@ export default { mediaProgressWithMedia() { return this.mediaProgress.filter((mp) => mp.media) }, - mediaProgressWithoutMedia() { - return this.mediaProgress.filter((mp) => !mp.media) - }, totalListeningTime() { return this.listeningStats.totalTime || 0 }, @@ -176,24 +166,6 @@ export default { return [] }) console.log('Loaded user listening data', this.listeningSessions, this.listeningStats) - }, - purgeMediaProgress() { - this.purgingMediaProgress = true - - this.$axios - .$post(`/api/users/${this.user.id}/purge-media-progress`) - .then((updatedUser) => { - console.log('Updated user', updatedUser) - this.$toast.success('Media progress purged') - this.user = updatedUser - }) - .catch((error) => { - console.error('Failed to purge media progress', error) - this.$toast.error('Failed to purge media progress') - }) - .finally(() => { - this.purgingMediaProgress = false - }) } }, mounted() { diff --git a/client/strings/de.json b/client/strings/de.json index 62a0c2b1..7627f5f3 100644 --- a/client/strings/de.json +++ b/client/strings/de.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Erstelle eine Wiedergabeliste aus der Sammlung", "MessagePodcastHasNoRSSFeedForMatching": "Podcast hat keine RSS-Feed-Url welche für den Online-Abgleich verwendet werden kann", "MessageQuickMatchDescription": "Füllt leere Details und Titelbilder mit dem ersten Treffer aus '{0}'. Überschreibt keine Details, es sei denn, die Server-Einstellung \"Passende Metadaten bevorzugen\" ist aktiviert.", - "MessageRemoveAllItemsWarning": "WARNUNG! Bei dieser Aktion werden alle Bibliotheksobjekte aus der Datenbank entfernt, einschließlich aller Aktualisierungen oder Online-Abgleichs, die Sie vorgenommen haben. Ihre eigentlichen Dateien bleiben davon unberührt. Sind Sie sicher?", "MessageRemoveChapter": "Kapitel löschen", "MessageRemoveEpisodes": "Entferne {0} Episode(n)", "MessageRemoveFromPlayerQueue": "Aus der Abspielwarteliste löschen", diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 6348ee0c..cdab08f1 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Create playlist from collection", "MessagePodcastHasNoRSSFeedForMatching": "Podcast has no RSS feed url to use for matching", "MessageQuickMatchDescription": "Populate empty item details & cover with first match result from '{0}'. Does not overwrite details unless 'Prefer matched metadata' server setting is enabled.", - "MessageRemoveAllItemsWarning": "WARNING! This action will remove all library items from the database including any updates or matches you have made. This does not do anything to your actual files. Are you sure?", "MessageRemoveChapter": "Remove chapter", "MessageRemoveEpisodes": "Remove {0} episode(s)", "MessageRemoveFromPlayerQueue": "Remove from player queue", diff --git a/client/strings/es.json b/client/strings/es.json index ad33e6ec..cfd940ea 100644 --- a/client/strings/es.json +++ b/client/strings/es.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Crear lista de reproducción a partir de colección", "MessagePodcastHasNoRSSFeedForMatching": "El podcast no tiene una URL de fuente RSS que pueda usar que coincida", "MessageQuickMatchDescription": "Rellenar detalles de elementos vacíos y portada con los primeros resultados de '{0}'. No sobrescribe los detalles a menos que la configuración 'Prefer matched metadata' del servidor este habilita.", - "MessageRemoveAllItemsWarning": "ADVERTENCIA! Esta acción eliminará todos los elementos de la biblioteca de la base de datos incluyendo cualquier actualización o match. Esto no hace nada a sus archivos reales. Esta seguro que desea continuar?", "MessageRemoveChapter": "Remover capítulos", "MessageRemoveEpisodes": "Remover {0} episodio(s)", "MessageRemoveFromPlayerQueue": "Romover la cola de reporduccion", diff --git a/client/strings/fr.json b/client/strings/fr.json index 17b229d1..06581158 100644 --- a/client/strings/fr.json +++ b/client/strings/fr.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Créer une liste de lecture depuis la collection", "MessagePodcastHasNoRSSFeedForMatching": "Le Podcast n’a pas d’URL de flux RSS à utiliser pour la correspondance", "MessageQuickMatchDescription": "Renseigne les détails manquants ainsi que la couverture avec la première correspondance de « {0} ». N’écrase pas les données présentes à moins que le paramètre « Préférer les Métadonnées par correspondance » soit activé.", - "MessageRemoveAllItemsWarning": "ATTENTION ! Cette action supprimera toute la base de données de la bibliothèque ainsi que les mises à jour ou correspondances qui auraient été effectuées. Cela n’a aucune incidence sur les fichiers de la bibliothèque. Souhaitez-vous continuer ?", "MessageRemoveChapter": "Supprimer le chapitre", "MessageRemoveEpisodes": "Suppression de {0} épisode(s)", "MessageRemoveFromPlayerQueue": "Supprimer de la liste d’écoute", diff --git a/client/strings/gu.json b/client/strings/gu.json index b52e765b..8a6130db 100644 --- a/client/strings/gu.json +++ b/client/strings/gu.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Create playlist from collection", "MessagePodcastHasNoRSSFeedForMatching": "Podcast has no RSS feed url to use for matching", "MessageQuickMatchDescription": "Populate empty item details & cover with first match result from '{0}'. Does not overwrite details unless 'Prefer matched metadata' server setting is enabled.", - "MessageRemoveAllItemsWarning": "WARNING! This action will remove all library items from the database including any updates or matches you have made. This does not do anything to your actual files. Are you sure?", "MessageRemoveChapter": "Remove chapter", "MessageRemoveEpisodes": "Remove {0} episode(s)", "MessageRemoveFromPlayerQueue": "Remove from player queue", diff --git a/client/strings/hi.json b/client/strings/hi.json index 652f1f74..2a11ff34 100644 --- a/client/strings/hi.json +++ b/client/strings/hi.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Create playlist from collection", "MessagePodcastHasNoRSSFeedForMatching": "Podcast has no RSS feed url to use for matching", "MessageQuickMatchDescription": "Populate empty item details & cover with first match result from '{0}'. Does not overwrite details unless 'Prefer matched metadata' server setting is enabled.", - "MessageRemoveAllItemsWarning": "WARNING! This action will remove all library items from the database including any updates or matches you have made. This does not do anything to your actual files. Are you sure?", "MessageRemoveChapter": "Remove chapter", "MessageRemoveEpisodes": "Remove {0} episode(s)", "MessageRemoveFromPlayerQueue": "Remove from player queue", diff --git a/client/strings/hr.json b/client/strings/hr.json index b7ace807..5cd244e2 100644 --- a/client/strings/hr.json +++ b/client/strings/hr.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Create playlist from collection", "MessagePodcastHasNoRSSFeedForMatching": "Podcast nema RSS feed url za matchanje", "MessageQuickMatchDescription": "Popuni prazne detalje stavki i cover sa prvim match rezultato iz '{0}'. Ne briše detalje osim ako 'Prefer matched metadata' server postavka nije uključena.", - "MessageRemoveAllItemsWarning": "UPOZORENJE! Ova radnja briše sve stavke iz biblioteke uključujući bilokakve aktualizacije ili matcheve. Ovo ne mjenja vaše lokalne datoteke. Jeste li sigurni?", "MessageRemoveChapter": "Remove chapter", "MessageRemoveEpisodes": "ukloni {0} epizoda/-e", "MessageRemoveFromPlayerQueue": "Remove from player queue", diff --git a/client/strings/it.json b/client/strings/it.json index 339a65e8..ae1c89b5 100644 --- a/client/strings/it.json +++ b/client/strings/it.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Crea playlist da una Raccolta", "MessagePodcastHasNoRSSFeedForMatching": "Podcast non ha l'URL del feed RSS da utilizzare per il match", "MessageQuickMatchDescription": "Compila i dettagli dell'articolo vuoto e copri con il risultato della prima corrispondenza di '{0}'. Non sovrascrive i dettagli a meno che non sia abilitata l'impostazione del server \"Preferisci metadati corrispondenti\".", - "MessageRemoveAllItemsWarning": "AVVERTIMENTO! Questa azione rimuoverà tutti gli elementi della libreria dal database, inclusi eventuali aggiornamenti o corrispondenze apportate. Questo non fa nulla ai tuoi file effettivi. Sei sicuro?", "MessageRemoveChapter": "Rimuovi Capitolo", "MessageRemoveEpisodes": "rimuovi {0} episodio(i)", "MessageRemoveFromPlayerQueue": "Rimuovi dalla coda di riproduzione", diff --git a/client/strings/nl.json b/client/strings/nl.json index 1763830b..9f8bfe89 100644 --- a/client/strings/nl.json +++ b/client/strings/nl.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Afspeellijst aanmaken vanuit collectie", "MessagePodcastHasNoRSSFeedForMatching": "Podcast heeft geen RSS-feed URL om te gebruiken voor matching", "MessageQuickMatchDescription": "Vul lege onderdeeldetails & cover met eerste matchresultaat van '{0}'. Overschrijft geen details tenzij 'Prefereer gematchte metadata' serverinstelling is ingeschakeld.", - "MessageRemoveAllItemsWarning": "WAARSCHUWING! Deze actie zal alle onderdelen in de bibliotheek verwijderen uit de database, inclusief enige bijwerkingen of matches die je hebt gemaakt. Dit doet niets met je onderliggende bestanden. Weet je het zeker?", "MessageRemoveChapter": "Verwijder hoofdstuk", "MessageRemoveEpisodes": "Verwijder {0} aflevering(en)", "MessageRemoveFromPlayerQueue": "Verwijder uit afspeelwachtrij", diff --git a/client/strings/pl.json b/client/strings/pl.json index c83300ee..fb5a3898 100644 --- a/client/strings/pl.json +++ b/client/strings/pl.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Create playlist from collection", "MessagePodcastHasNoRSSFeedForMatching": "Podcast nie ma adresu url kanału RSS, który mógłby zostać użyty do dopasowania", "MessageQuickMatchDescription": "Wypełnij puste informacje i okładkę pierwszym wynikiem dopasowania z '{0}'. Nie nadpisuje szczegółów, chyba że włączone jest ustawienie serwera 'Preferuj dopasowane metadane'.", - "MessageRemoveAllItemsWarning": "UWAGA! Ta akcja usunie wszystkie elementy biblioteki z bazy danych, w tym wszystkie aktualizacje lub dopasowania, które zostały wykonane. Pliki pozostaną niezmienione. Czy jesteś pewien?", "MessageRemoveChapter": "Usuń rozdział", "MessageRemoveEpisodes": "Usuń {0} odcinków", "MessageRemoveFromPlayerQueue": "Remove from player queue", diff --git a/client/strings/ru.json b/client/strings/ru.json index a852a42e..abf391e5 100644 --- a/client/strings/ru.json +++ b/client/strings/ru.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "Создать плейлист из коллекции", "MessagePodcastHasNoRSSFeedForMatching": "Подкаст не имеет URL-адреса RSS-канала, который можно использовать для поиска", "MessageQuickMatchDescription": "Заполняет пустые детали элемента и обложку первым результатом поиска из «{0}». Не перезаписывает сведения, если не включен параметр сервера 'Предпочитать метаданные поиска'.", - "MessageRemoveAllItemsWarning": "ПРЕДУПРЕЖДЕНИЕ! Это действие удалит все элементы библиотеки из базы данных, включая все сделанные обновления или совпадения. Ничего не произойдет с вашими фактическими файлами. Уверены?", "MessageRemoveChapter": "Удалить главу", "MessageRemoveEpisodes": "Удалить {0} эпизод(ов)", "MessageRemoveFromPlayerQueue": "Удалить из очереди воспроизведения", diff --git a/client/strings/zh-cn.json b/client/strings/zh-cn.json index 660c7de1..3451288b 100644 --- a/client/strings/zh-cn.json +++ b/client/strings/zh-cn.json @@ -592,7 +592,6 @@ "MessagePlaylistCreateFromCollection": "从收藏中创建播放列表", "MessagePodcastHasNoRSSFeedForMatching": "播客没有可用于匹配 RSS 源的 url", "MessageQuickMatchDescription": "使用来自 '{0}' 的第一个匹配结果填充空白详细信息和封面. 除非启用 '首选匹配元数据' 服务器设置, 否则不会覆盖详细信息.", - "MessageRemoveAllItemsWarning": "警告! 此操作将从数据库中删除所有的媒体库项, 包括您所做的任何更新或匹配. 这不会对实际文件产生任何影响. 你确定吗?", "MessageRemoveChapter": "移除章节", "MessageRemoveEpisodes": "移除 {0} 剧集", "MessageRemoveFromPlayerQueue": "从播放队列中移除", diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index d86211bb..0d78e06a 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -441,20 +441,6 @@ class LibraryItemController { } } - // DELETE: api/items/all - // TODO: Remove - async deleteAll(req, res) { - return res.sendStatus(404) - // if (!req.user.isAdminOrUp) { - // Logger.warn('User other than admin attempted to delete all library items', req.user) - // return res.sendStatus(403) - // } - // Logger.info('Removing all Library Items') - // var success = await this.db.recreateLibraryItemsDb() - // if (success) res.sendStatus(200) - // else res.sendStatus(500) - } - // POST: api/items/:id/scan (admin) async scan(req, res) { if (!req.user.isAdminOrUp) { diff --git a/server/routers/ApiRouter.js b/server/routers/ApiRouter.js index 5acac48d..cac0a183 100644 --- a/server/routers/ApiRouter.js +++ b/server/routers/ApiRouter.js @@ -104,7 +104,6 @@ class ApiRouter { this.router.post('/items/batch/get', LibraryItemController.batchGet.bind(this)) this.router.post('/items/batch/quickmatch', LibraryItemController.batchQuickMatch.bind(this)) this.router.post('/items/batch/scan', LibraryItemController.batchScan.bind(this)) - this.router.delete('/items/all', LibraryItemController.deleteAll.bind(this)) this.router.get('/items/:id', LibraryItemController.middleware.bind(this), LibraryItemController.findOne.bind(this)) this.router.patch('/items/:id', LibraryItemController.middleware.bind(this), LibraryItemController.update.bind(this))
{{ $strings.LabelItem }}