From d73aa1782e2ce54a852d2be24de5b6f7ad53975a Mon Sep 17 00:00:00 2001 From: Divyang Joshi Date: Fri, 28 Apr 2023 19:28:23 -0400 Subject: [PATCH] feat: Add option to disable showing the version and option to prevent checking for updates --- client/components/app/ConfigSideNav.vue | 5 ++++- client/components/app/SideRail.vue | 5 ++++- client/layouts/default.vue | 17 +++++++++++------ client/pages/config/index.vue | 20 ++++++++++++++++++++ client/strings/de.json | 4 ++++ client/strings/en-us.json | 4 ++++ client/strings/es.json | 4 ++++ client/strings/fr.json | 4 ++++ client/strings/gu.json | 4 ++++ client/strings/hi.json | 4 ++++ client/strings/hr.json | 4 ++++ client/strings/it.json | 4 ++++ client/strings/pl.json | 4 ++++ client/strings/ru.json | 4 ++++ client/strings/zh-cn.json | 4 ++++ server/objects/settings/ServerSettings.js | 8 ++++++++ 16 files changed, 91 insertions(+), 8 deletions(-) diff --git a/client/components/app/ConfigSideNav.vue b/client/components/app/ConfigSideNav.vue index af4645f4b..a96a472a5 100644 --- a/client/components/app/ConfigSideNav.vue +++ b/client/components/app/ConfigSideNav.vue @@ -139,7 +139,7 @@ export default { return this.$store.state.versionData || {} }, hasUpdate() { - return !!this.versionData.hasUpdate + return this.$store.getters['getServerSetting']('versionUpdateCheck') && !!this.versionData.hasUpdate }, latestVersion() { return this.versionData.latestVersion @@ -152,6 +152,9 @@ export default { }, streamLibraryItem() { return this.$store.state.streamLibraryItem + }, + showVersion() { + return this.$store.getters['getServerSetting']('showVersion') } }, methods: { diff --git a/client/components/app/SideRail.vue b/client/components/app/SideRail.vue index 25350d24d..452322bf7 100644 --- a/client/components/app/SideRail.vue +++ b/client/components/app/SideRail.vue @@ -105,7 +105,7 @@ -
+

v{{ $config.version }}

Update

{{ Source }}

@@ -214,6 +214,9 @@ export default { }, showPlaylists() { return this.$store.state.libraries.numUserPlaylists > 0 + }, + shouldshowVersion() { + return this.$store.getters['getServerSetting']('showVersion') } }, methods: { diff --git a/client/layouts/default.vue b/client/layouts/default.vue index b201fc4a8..12306180e 100644 --- a/client/layouts/default.vue +++ b/client/layouts/default.vue @@ -67,6 +67,9 @@ export default { }, appContentMarginLeft() { return this.isShowingSideRail ? 80 : 0 + }, + shouldCheckVersion() { + return this.$store.getters['getServerSetting']('versionUpdateCheck') } }, methods: { @@ -529,12 +532,14 @@ export default { this.$store.commit('globals/updateWindowSize', { width: window.innerWidth, height: window.innerHeight }) }, checkVersionUpdate() { - this.$store - .dispatch('checkForUpdate') - .then((res) => { - if (res && res.hasUpdate) this.showUpdateToast(res) - }) - .catch((err) => console.error(err)) + if (this.shouldCheckVersion) { + this.$store + .dispatch('checkForUpdate') + .then((res) => { + if (res && res.hasUpdate) this.showUpdateToast(res) + }) + .catch((err) => console.error(err)) + } }, initLocalStorage() { // If experimental features set in local storage diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue index 7f0170c76..9d6805ea7 100644 --- a/client/pages/config/index.vue +++ b/client/pages/config/index.vue @@ -44,6 +44,26 @@

{{ $strings.LabelSettingsChromecastSupport }}

+
+ + +

+ {{ $strings.LabelSettingsVersionShow }} + info_outlined +

+
+
+ +
+ + +

+ {{ $strings.LabelSettingsVersionUpdatesCheck }} + info_outlined +

+
+
+

{{ $strings.HeaderSettingsDisplay }}

diff --git a/client/strings/de.json b/client/strings/de.json index fb5b570af..46c71136f 100644 --- a/client/strings/de.json +++ b/client/strings/de.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Metadaten als OPF-Datei im Medienordner speichern", "LabelSettingsStoreMetadataWithItemHelp": "Standardmäßig werden die Metadaten in /metadata/items gespeichert. Wenn diese Option aktiviert ist, werden die Metadaten als OPF-Datei (Textdatei) in dem gleichen Ordner gespeichert in welchem sich auch das Medium befindet. Es wird immer nur eine Datei mit dem Namen \"matadata.abs\" gespeichert.", "LabelSettingsTimeFormat": "Zeitformat", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Alles anzeigen", "LabelSize": "Größe", "LabelSleepTimer": "Einschlaf-Timer", diff --git a/client/strings/en-us.json b/client/strings/en-us.json index 31b7145b0..c4ac375a8 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Store metadata with item", "LabelSettingsStoreMetadataWithItemHelp": "By default metadata files are stored in /metadata/items, enabling this setting will store metadata files in your library item folders. Uses .abs file extension", "LabelSettingsTimeFormat": "Time Format", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Show All", "LabelSize": "Size", "LabelSleepTimer": "Sleep timer", diff --git a/client/strings/es.json b/client/strings/es.json index 05fcc220a..0ea76cb49 100644 --- a/client/strings/es.json +++ b/client/strings/es.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Guardar metadata con elemento", "LabelSettingsStoreMetadataWithItemHelp": "Por defecto, los archivos de metadatos se almacenan en /metadata/items, si habilita esta configuración, los archivos de metadata se guardaran en la carpeta de elementos de tu biblioteca. Usa la extension .abs", "LabelSettingsTimeFormat": "Format de Tiempo", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Mostrar Todos", "LabelSize": "Tamaño", "LabelSleepTimer": "Temporizador para Dormir", diff --git a/client/strings/fr.json b/client/strings/fr.json index 952c2ea16..45019dcb5 100644 --- a/client/strings/fr.json +++ b/client/strings/fr.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Enregistrer les Métadonnées avec les articles", "LabelSettingsStoreMetadataWithItemHelp": "Par défaut, les métadonnées sont enregistrées dans /metadata/items. Activer ce paramètre enregistrera les métadonnées dans le dossier de l’article avec une extension « .abs ».", "LabelSettingsTimeFormat": "Format d’heure", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Afficher Tout", "LabelSize": "Taille", "LabelSleepTimer": "Minuterie", diff --git a/client/strings/gu.json b/client/strings/gu.json index 7825882e9..a4765e251 100644 --- a/client/strings/gu.json +++ b/client/strings/gu.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Store metadata with item", "LabelSettingsStoreMetadataWithItemHelp": "By default metadata files are stored in /metadata/items, enabling this setting will store metadata files in your library item folders. Uses .abs file extension", "LabelSettingsTimeFormat": "Time Format", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Show All", "LabelSize": "Size", "LabelSleepTimer": "Sleep timer", diff --git a/client/strings/hi.json b/client/strings/hi.json index fa4de440a..572b6a3a1 100644 --- a/client/strings/hi.json +++ b/client/strings/hi.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Store metadata with item", "LabelSettingsStoreMetadataWithItemHelp": "By default metadata files are stored in /metadata/items, enabling this setting will store metadata files in your library item folders. Uses .abs file extension", "LabelSettingsTimeFormat": "Time Format", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Show All", "LabelSize": "Size", "LabelSleepTimer": "Sleep timer", diff --git a/client/strings/hr.json b/client/strings/hr.json index 777aef15a..322f548db 100644 --- a/client/strings/hr.json +++ b/client/strings/hr.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Spremi metapodatke uz stavku", "LabelSettingsStoreMetadataWithItemHelp": "Po defaultu metapodatci su spremljeni u /metadata/items, uključujućite li ovu postavku, metapodatci će biti spremljeni u folderima od biblioteke. Koristi .abs ekstenziju.", "LabelSettingsTimeFormat": "Time Format", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Prikaži sve", "LabelSize": "Veličina", "LabelSleepTimer": "Sleep timer", diff --git a/client/strings/it.json b/client/strings/it.json index 9606aaf4d..738835505 100644 --- a/client/strings/it.json +++ b/client/strings/it.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Archivia i metadata con il file", "LabelSettingsStoreMetadataWithItemHelp": "Di default, i metadati sono salvati dentro /metadata/items, abilitando questa opzione si memorizzeranno i metadata nella cartella della libreria. I file avranno estensione .abs", "LabelSettingsTimeFormat": "Formato Ora", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Mostra Tutto", "LabelSize": "Dimensione", "LabelSleepTimer": "Sleep timer", diff --git a/client/strings/pl.json b/client/strings/pl.json index 7babe3f4e..66bff647c 100644 --- a/client/strings/pl.json +++ b/client/strings/pl.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Przechowuj metadane w folderze książki", "LabelSettingsStoreMetadataWithItemHelp": "Domyślnie metadane są przechowywane w folderze /metadata/items, włączenie tej opcji spowoduje, że okładka będzie przechowywana w folderze ksiązki. Tylko jedna okładka o nazwie pliku \"cover\" będzie przechowywana. Rozszerzenie pliku metadanych: .abs", "LabelSettingsTimeFormat": "Time Format", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Pokaż wszystko", "LabelSize": "Rozmiar", "LabelSleepTimer": "Wyłącznik czasowy", diff --git a/client/strings/ru.json b/client/strings/ru.json index 8ac05e056..250c972af 100644 --- a/client/strings/ru.json +++ b/client/strings/ru.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "Хранить метаинформацию с элементом", "LabelSettingsStoreMetadataWithItemHelp": "По умолчанию метаинформация сохраняется в папке /metadata/items, при включении этой настройки метаинформация будет храниться в папке элемента. Используется расширение файла .abs", "LabelSettingsTimeFormat": "Формат времени", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "Показать все", "LabelSize": "Размер", "LabelSleepTimer": "Таймер сна", diff --git a/client/strings/zh-cn.json b/client/strings/zh-cn.json index 1ad22d69e..ecf386c5a 100644 --- a/client/strings/zh-cn.json +++ b/client/strings/zh-cn.json @@ -386,6 +386,10 @@ "LabelSettingsStoreMetadataWithItem": "存储项目元数据", "LabelSettingsStoreMetadataWithItemHelp": "默认情况下元数据文件存储在/metadata/items文件夹中, 启用此设置将存储元数据在你媒体项目文件夹中. 使 .abs 文件护展名", "LabelSettingsTimeFormat": "时间格式", + "LabelSettingsVersionUpdatesCheck": "Version Updates Check", + "LabelSettingsVersionUpdatesCheckHelp": "Disabling this will prevent making requests to external services to see if a new version is out. In turn, the update view in the sidebar is hidden.", + "LabelSettingsVersionShow": "Show Version", + "LabelSettingsVersionShowHelp": "Disabling this will hide the version section on the sidebar. This info is still vailable on the settings page.", "LabelShowAll": "全部显示", "LabelSize": "文件大小", "LabelSleepTimer": "睡眠定时", diff --git a/server/objects/settings/ServerSettings.js b/server/objects/settings/ServerSettings.js index 1dbd3417b..878789967 100644 --- a/server/objects/settings/ServerSettings.js +++ b/server/objects/settings/ServerSettings.js @@ -54,6 +54,10 @@ class ServerSettings { this.timeFormat = 'HH:mm' this.language = 'en-us' + // Version + this.versionUpdateCheck = true + this.showVersion = true + this.logLevel = Logger.logLevel this.version = null @@ -95,6 +99,8 @@ class ServerSettings { this.sortingIgnorePrefix = !!settings.sortingIgnorePrefix this.sortingPrefixes = settings.sortingPrefixes || ['the'] this.chromecastEnabled = !!settings.chromecastEnabled + this.versionUpdateCheck = !!settings.versionUpdateCheck + this.showVersion = !!settings.showVersion this.enableEReader = !!settings.enableEReader this.dateFormat = settings.dateFormat || 'MM/dd/yyyy' this.timeFormat = settings.timeFormat || 'HH:mm' @@ -146,6 +152,8 @@ class ServerSettings { sortingIgnorePrefix: this.sortingIgnorePrefix, sortingPrefixes: [...this.sortingPrefixes], chromecastEnabled: this.chromecastEnabled, + versionUpdateCheck: this.versionUpdateCheck, + showVersion: this.showVersion, enableEReader: this.enableEReader, dateFormat: this.dateFormat, timeFormat: this.timeFormat,