From 8beac53f5f367e12875c6baadf236d154c8e018d Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 21 May 2022 11:21:03 -0500 Subject: [PATCH] Update:Send source back with auth request --- client/components/app/ConfigSideNav.vue | 13 ++++++++++--- client/components/modals/libraries/EditLibrary.vue | 6 ++++-- client/pages/login.vue | 3 ++- client/store/index.js | 4 ++++ package.json | 8 ++++---- server/Auth.js | 3 ++- server/Server.js | 2 +- server/controllers/MiscController.js | 3 ++- 8 files changed, 29 insertions(+), 13 deletions(-) diff --git a/client/components/app/ConfigSideNav.vue b/client/components/app/ConfigSideNav.vue index 8de98961..57c9f66c 100644 --- a/client/components/app/ConfigSideNav.vue +++ b/client/components/app/ConfigSideNav.vue @@ -9,9 +9,13 @@
-
-

v{{ $config.version }}

- Update available: {{ latestVersion }} +
+
+

v{{ $config.version }}

+ +

{{ Source }}

+
+ Latest: {{ latestVersion }}
@@ -25,6 +29,9 @@ export default { return {} }, computed: { + Source() { + return this.$store.state.Source + }, currentLibraryId() { return this.$store.state.libraries.currentLibraryId }, diff --git a/client/components/modals/libraries/EditLibrary.vue b/client/components/modals/libraries/EditLibrary.vue index 60d7875f..db87d1db 100644 --- a/client/components/modals/libraries/EditLibrary.vue +++ b/client/components/modals/libraries/EditLibrary.vue @@ -28,10 +28,9 @@
- Browse for Folder + Browse for Folder - @@ -77,6 +76,9 @@ export default { } }, methods: { + browseForFolder() { + this.showDirectoryPicker = true + }, getLibraryData() { return { name: this.name, diff --git a/client/pages/login.vue b/client/pages/login.vue index ea9e995c..cf604a57 100644 --- a/client/pages/login.vue +++ b/client/pages/login.vue @@ -124,8 +124,9 @@ export default { location.reload() }, - setUser({ user, userDefaultLibraryId, serverSettings }) { + setUser({ user, userDefaultLibraryId, serverSettings, Source }) { this.$store.commit('setServerSettings', serverSettings) + this.$store.commit('setSource', Source) if (serverSettings.chromecastEnabled) { console.log('Chromecast enabled import script') diff --git a/client/store/index.js b/client/store/index.js index 2ac4a312..2b9a70ea 100644 --- a/client/store/index.js +++ b/client/store/index.js @@ -2,6 +2,7 @@ import { checkForUpdate } from '@/plugins/version' import Vue from 'vue' export const state = () => ({ + Source: null, versionData: null, serverSettings: null, streamLibraryItem: null, @@ -81,6 +82,9 @@ export const actions = { } export const mutations = { + setSource(state, source) { + state.Source = source + }, setLastBookshelfScrollData(state, { scrollTop, path, name }) { state.lastBookshelfScrollData[name] = { scrollTop, path } }, diff --git a/package.json b/package.json index c1ddcffc..678f8cb8 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "watch": "npm-watch", "dev": "node index.js", "start": "node index.js", - "client": "cd client && npm install && npm run generate", - "prod": "npm run client && npm install && node prod.js", - "build-win": "pkg -t node16-win-x64 -o ./dist/win/audiobookshelf -C GZip .", + "client": "cd client && npm ci && npm run generate", + "prod": "npm run client && npm ci && node prod.js", + "build-win": "npm run client && pkg -t node16-win-x64 -o ./dist/win/audiobookshelf -C GZip .", "build-linux": "build/linuxpackager", "docker": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push . -t advplyr/audiobookshelf", "deploy": "node dist/autodeploy" @@ -60,4 +60,4 @@ "devDependencies": { "npm-watch": "^0.11.0" } -} +} \ No newline at end of file diff --git a/server/Auth.js b/server/Auth.js index b30e060f..1548854b 100644 --- a/server/Auth.js +++ b/server/Auth.js @@ -96,7 +96,8 @@ class Auth { return { user: user.toJSONForBrowser(), userDefaultLibraryId: user.getDefaultLibraryId(this.db.libraries), - serverSettings: this.db.serverSettings.toJSON() + serverSettings: this.db.serverSettings.toJSON(), + Source: global.Source } } diff --git a/server/Server.js b/server/Server.js index 41496f53..c34fde26 100644 --- a/server/Server.js +++ b/server/Server.js @@ -35,9 +35,9 @@ const RssFeedManager = require('./managers/RssFeedManager') class Server { constructor(SOURCE, PORT, HOST, UID, GID, CONFIG_PATH, METADATA_PATH) { - this.Source = SOURCE this.Port = PORT this.Host = HOST + global.Source = SOURCE global.Uid = isNaN(UID) ? 0 : Number(UID) global.Gid = isNaN(GID) ? 0 : Number(GID) global.ConfigPath = Path.normalize(CONFIG_PATH) diff --git a/server/controllers/MiscController.js b/server/controllers/MiscController.js index 852af27d..d16c9c8f 100644 --- a/server/controllers/MiscController.js +++ b/server/controllers/MiscController.js @@ -242,7 +242,8 @@ class MiscController { const userResponse = { user: req.user, userDefaultLibraryId: req.user.getDefaultLibraryId(this.db.libraries), - serverSettings: this.db.serverSettings.toJSON() + serverSettings: this.db.serverSettings.toJSON(), + Source: global.Source } res.json(userResponse) }