From 3c6d4b5f1917c235ee03f545e4a72de75ee60153 Mon Sep 17 00:00:00 2001 From: advplyr Date: Fri, 22 Mar 2024 17:54:56 -0500 Subject: [PATCH] Add:Nav button in side drawer and item more menu to go to web client #1079 --- components/app/SideDrawer.vue | 16 +++++++++++++++- components/modals/ItemMoreMenuModal.vue | 10 ++++++++++ store/user.js | 17 +++++++++++++++++ strings/cs.json | 1 + strings/da.json | 3 ++- strings/de.json | 3 ++- strings/en-us.json | 3 ++- strings/es.json | 1 + strings/fr.json | 1 + strings/gu.json | 1 + strings/hi.json | 1 + strings/hr.json | 1 + strings/hu.json | 1 + strings/it.json | 1 + strings/lt.json | 1 + strings/nl.json | 1 + strings/no.json | 1 + strings/pl.json | 1 + strings/pt-br.json | 3 ++- strings/ru.json | 1 + strings/sv.json | 1 + strings/uk.json | 3 ++- strings/vi-vn.json | 3 ++- strings/zh-cn.json | 1 + 24 files changed, 69 insertions(+), 7 deletions(-) diff --git a/components/app/SideDrawer.vue b/components/app/SideDrawer.vue index 72111e98..f9c1cef0 100644 --- a/components/app/SideDrawer.vue +++ b/components/app/SideDrawer.vue @@ -79,7 +79,10 @@ export default { return this.$store.state.serverSettings || {} }, username() { - return this.user ? this.user.username : '' + return this.user?.username || '' + }, + userIsAdminOrUp() { + return this.$store.getters['user/getIsAdminOrUp'] }, navItems() { var items = [ @@ -132,6 +135,13 @@ export default { }) if (this.serverConnectionConfig) { + if (this.userIsAdminOrUp) { + items.push({ + icon: 'language', + text: this.$strings.ButtonGoToWebClient, + action: 'openWebClient' + }) + } items.push({ icon: 'login', text: this.$strings.ButtonSwitchServerUser, @@ -151,6 +161,10 @@ export default { if (action === 'logout') { await this.logout() this.$router.push('/connect') + } else if (action === 'openWebClient') { + this.show = false + let path = `/library/${this.$store.state.libraries.currentLibraryId}` + await this.$store.dispatch('user/openWebClient', path) } }, clickBackground() { diff --git a/components/modals/ItemMoreMenuModal.vue b/components/modals/ItemMoreMenuModal.vue index bf46c092..de63ffd4 100644 --- a/components/modals/ItemMoreMenuModal.vue +++ b/components/modals/ItemMoreMenuModal.vue @@ -135,6 +135,14 @@ export default { } } + if (this.isConnectedToServer && this.userIsAdminOrUp) { + items.push({ + text: this.$strings.ButtonGoToWebClient, + value: 'openWebClient', + icon: 'language' + }) + } + if (!this.episode) { items.push({ text: this.$strings.LabelMoreInfo, @@ -285,6 +293,8 @@ export default { this.clickRSSFeed() } else if (action === 'sendEbook') { this.showSendEbookDevicesModal = true + } else if (action === 'openWebClient') { + this.$store.dispatch('user/openWebClient', `/item/${this.serverLibraryItemId}`) } }, async toggleFinished() { diff --git a/store/user.js b/store/user.js index aa69588e..78c2fcfe 100644 --- a/store/user.js +++ b/store/user.js @@ -1,3 +1,5 @@ +import { Browser } from '@capacitor/browser' + export const state = () => ({ user: null, serverConnectionConfig: null, @@ -115,6 +117,21 @@ export const actions = { commit('setSettings', userSettings) this.$eventBus.$emit('user-settings', state.settings) } + }, + async openWebClient({ getters }, path = null) { + const serverAddress = getters.getServerAddress + if (!serverAddress) { + console.error('openWebClient: No server address') + return + } + try { + let url = serverAddress.replace(/\/$/, '') // Remove trailing slash + if (path?.startsWith('/')) url += path + + await Browser.open({ url }) + } catch (error) { + console.error('Error opening browser', error) + } } } diff --git a/strings/cs.json b/strings/cs.json index 2c342dc5..b4a769a2 100644 --- a/strings/cs.json +++ b/strings/cs.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Smazat místní položku", "ButtonDisableAutoTimer": "Zakázat automatický časovač", "ButtonDisconnect": "Odpojit", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Historie", "ButtonHome": "Domů", "ButtonIssues": "Problémy", diff --git a/strings/da.json b/strings/da.json index 497ea7bd..28e33f7d 100644 --- a/strings/da.json +++ b/strings/da.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Hjem", "ButtonIssues": "Problemer", @@ -291,4 +292,4 @@ "ToastPodcastCreateSuccess": "Podcast oprettet med succes", "ToastRSSFeedCloseFailed": "Mislykkedes lukning af RSS-feed", "ToastRSSFeedCloseSuccess": "RSS-feed lukket" -} +} \ No newline at end of file diff --git a/strings/de.json b/strings/de.json index 2ea2ea5f..f3377260 100644 --- a/strings/de.json +++ b/strings/de.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Lösche lokales Element", "ButtonDisableAutoTimer": "Deaktiviere automatischen Timer", "ButtonDisconnect": "Trennen", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Historie", "ButtonHome": "Startseite", "ButtonIssues": "Probleme", @@ -291,4 +292,4 @@ "ToastPodcastCreateSuccess": "Podcast erstellt", "ToastRSSFeedCloseFailed": "RSS-Feed konnte nicht geschlossen werden", "ToastRSSFeedCloseSuccess": "RSS-Feed geschlossen" -} +} \ No newline at end of file diff --git a/strings/en-us.json b/strings/en-us.json index 733656c3..2d78334a 100644 --- a/strings/en-us.json +++ b/strings/en-us.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Home", "ButtonIssues": "Issues", @@ -291,4 +292,4 @@ "ToastPodcastCreateSuccess": "Podcast created successfully", "ToastRSSFeedCloseFailed": "Failed to close RSS feed", "ToastRSSFeedCloseSuccess": "RSS feed closed" -} +} \ No newline at end of file diff --git a/strings/es.json b/strings/es.json index 9a09bdd5..b119264c 100644 --- a/strings/es.json +++ b/strings/es.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Inicio", "ButtonIssues": "Problemas", diff --git a/strings/fr.json b/strings/fr.json index 437fe1e2..4a60993b 100644 --- a/strings/fr.json +++ b/strings/fr.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Accueil", "ButtonIssues": "Parutions", diff --git a/strings/gu.json b/strings/gu.json index 0b011652..70ff221a 100644 --- a/strings/gu.json +++ b/strings/gu.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "ઘર", "ButtonIssues": "સમસ્યાઓ", diff --git a/strings/hi.json b/strings/hi.json index eaa8fea2..16a5a7ab 100644 --- a/strings/hi.json +++ b/strings/hi.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "घर", "ButtonIssues": "समस्याएं", diff --git a/strings/hr.json b/strings/hr.json index 9acf4b2a..aee04b4b 100644 --- a/strings/hr.json +++ b/strings/hr.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Početna stranica", "ButtonIssues": "Problemi", diff --git a/strings/hu.json b/strings/hu.json index 0b8ffb4b..f0f92686 100644 --- a/strings/hu.json +++ b/strings/hu.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Helyi elem törlése", "ButtonDisableAutoTimer": "Automatikus időzítő letiltása", "ButtonDisconnect": "Kapcsolat bontása", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Előzmények", "ButtonHome": "Kezdőlap", "ButtonIssues": "Problémák", diff --git a/strings/it.json b/strings/it.json index efb01ef6..759891c8 100644 --- a/strings/it.json +++ b/strings/it.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Elimina oggetto locale", "ButtonDisableAutoTimer": "Disattiva Auto Timer", "ButtonDisconnect": "Disconnetti", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Cronologia", "ButtonHome": "Home", "ButtonIssues": "Errori", diff --git a/strings/lt.json b/strings/lt.json index bbd58b36..0a33ab99 100644 --- a/strings/lt.json +++ b/strings/lt.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Pradžia", "ButtonIssues": "Problemos", diff --git a/strings/nl.json b/strings/nl.json index 8b8e212d..e4587e60 100644 --- a/strings/nl.json +++ b/strings/nl.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Home", "ButtonIssues": "Issues", diff --git a/strings/no.json b/strings/no.json index 535642e3..01e7e680 100644 --- a/strings/no.json +++ b/strings/no.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Hjem", "ButtonIssues": "Problemer", diff --git a/strings/pl.json b/strings/pl.json index 9a347c82..1ad087b6 100644 --- a/strings/pl.json +++ b/strings/pl.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Usuń lokalny element", "ButtonDisableAutoTimer": "Wyłącz automatyczny wyłącznik", "ButtonDisconnect": "Rozłącz", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Historia", "ButtonHome": "Strona główna", "ButtonIssues": "Błędy", diff --git a/strings/pt-br.json b/strings/pt-br.json index 23cccbbd..85381df1 100644 --- a/strings/pt-br.json +++ b/strings/pt-br.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Apagar item local", "ButtonDisableAutoTimer": "Desativar Timer Automático", "ButtonDisconnect": "Desconectar", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Histórico", "ButtonHome": "Principal", "ButtonIssues": "Problemas", @@ -291,4 +292,4 @@ "ToastPodcastCreateSuccess": "Podcast criado", "ToastRSSFeedCloseFailed": "Falha ao fechar feed RSS", "ToastRSSFeedCloseSuccess": "Feed RSS fechado" -} +} \ No newline at end of file diff --git a/strings/ru.json b/strings/ru.json index 39d008fe..ca1f6bac 100644 --- a/strings/ru.json +++ b/strings/ru.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Удалить локальный элемент", "ButtonDisableAutoTimer": "Отключить автоматический таймер", "ButtonDisconnect": "Отключиться", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "История", "ButtonHome": "Домой", "ButtonIssues": "Проблемы", diff --git a/strings/sv.json b/strings/sv.json index 816ab080..2676d09c 100644 --- a/strings/sv.json +++ b/strings/sv.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Delete local item", "ButtonDisableAutoTimer": "Disable Auto Timer", "ButtonDisconnect": "Disconnect", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "History", "ButtonHome": "Hem", "ButtonIssues": "Problem", diff --git a/strings/uk.json b/strings/uk.json index 5332f286..b09129c9 100644 --- a/strings/uk.json +++ b/strings/uk.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Видалити локальний елемент", "ButtonDisableAutoTimer": "Вимкнути автотаймер", "ButtonDisconnect": "Відключитися", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Історія", "ButtonHome": "Головна", "ButtonIssues": "Проблеми", @@ -291,4 +292,4 @@ "ToastPodcastCreateSuccess": "Подкаст успішно створено", "ToastRSSFeedCloseFailed": "Не вдалося закрити RSS-канал", "ToastRSSFeedCloseSuccess": "RSS-канал закрито" -} +} \ No newline at end of file diff --git a/strings/vi-vn.json b/strings/vi-vn.json index 2b962ea4..48d16124 100644 --- a/strings/vi-vn.json +++ b/strings/vi-vn.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "Xóa mục địa phương", "ButtonDisableAutoTimer": "Tắt Bộ Đếm Tự Động", "ButtonDisconnect": "Ngắt Kết Nối", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "Lịch Sử", "ButtonHome": "Trang Chủ", "ButtonIssues": "Vấn Đề", @@ -291,4 +292,4 @@ "ToastPodcastCreateSuccess": "Tạo podcast thành công", "ToastRSSFeedCloseFailed": "Không thể đóng RSS feed", "ToastRSSFeedCloseSuccess": "Đóng RSS feed thành công" -} +} \ No newline at end of file diff --git a/strings/zh-cn.json b/strings/zh-cn.json index 79149b9f..2c688c01 100644 --- a/strings/zh-cn.json +++ b/strings/zh-cn.json @@ -19,6 +19,7 @@ "ButtonDeleteLocalItem": "删除本地项目", "ButtonDisableAutoTimer": "禁用自动定时器", "ButtonDisconnect": "断开连接", + "ButtonGoToWebClient": "Go to Web Client", "ButtonHistory": "历史", "ButtonHome": "首页", "ButtonIssues": "问题",