Update:Send source back with auth request

This commit is contained in:
advplyr 2022-05-21 11:21:03 -05:00
parent f083d4b5f6
commit 8beac53f5f
8 changed files with 29 additions and 13 deletions

View File

@ -9,9 +9,13 @@
<div v-show="routeName === route.iod" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" /> <div v-show="routeName === route.iod" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" />
</nuxt-link> </nuxt-link>
<div class="w-full h-10 px-4 border-t border-black border-opacity-20 absolute left-0 flex flex-col justify-center" :style="{ bottom: streamLibraryItem && isMobileLandscape ? '300px' : '65px' }"> <div class="w-full h-12 px-4 border-t border-black border-opacity-20 absolute left-0 flex flex-col justify-center" :style="{ bottom: streamLibraryItem && isMobileLandscape ? '300px' : '65px' }">
<div class="flex justify-between">
<p class="font-mono text-sm">v{{ $config.version }}</p> <p class="font-mono text-sm">v{{ $config.version }}</p>
<a v-if="hasUpdate" :href="githubTagUrl" target="_blank" class="text-warning text-sm">Update available: {{ latestVersion }}</a>
<p class="font-mono text-xs text-gray-300 italic">{{ Source }}</p>
</div>
<a v-if="hasUpdate" :href="githubTagUrl" target="_blank" class="text-warning text-xs">Latest: {{ latestVersion }}</a>
</div> </div>
</div> </div>
</template> </template>
@ -25,6 +29,9 @@ export default {
return {} return {}
}, },
computed: { computed: {
Source() {
return this.$store.state.Source
},
currentLibraryId() { currentLibraryId() {
return this.$store.state.libraries.currentLibraryId return this.$store.state.libraries.currentLibraryId
}, },

View File

@ -28,10 +28,9 @@
<ui-editable-text v-model="newFolderPath" placeholder="New folder path" type="text" class="w-full" @blur="newFolderInputBlurred" /> <ui-editable-text v-model="newFolderPath" placeholder="New folder path" type="text" class="w-full" @blur="newFolderInputBlurred" />
</div> </div>
<ui-btn class="w-full mt-2" color="primary" @click="showDirectoryPicker = true">Browse for Folder</ui-btn> <ui-btn class="w-full mt-2" color="primary" @click="browseForFolder">Browse for Folder</ui-btn>
</div> </div>
</div> </div>
<modals-libraries-folder-chooser v-else :paths="folderPaths" @back="showDirectoryPicker = false" @select="selectFolder" /> <modals-libraries-folder-chooser v-else :paths="folderPaths" @back="showDirectoryPicker = false" @select="selectFolder" />
</div> </div>
</template> </template>
@ -77,6 +76,9 @@ export default {
} }
}, },
methods: { methods: {
browseForFolder() {
this.showDirectoryPicker = true
},
getLibraryData() { getLibraryData() {
return { return {
name: this.name, name: this.name,

View File

@ -124,8 +124,9 @@ export default {
location.reload() location.reload()
}, },
setUser({ user, userDefaultLibraryId, serverSettings }) { setUser({ user, userDefaultLibraryId, serverSettings, Source }) {
this.$store.commit('setServerSettings', serverSettings) this.$store.commit('setServerSettings', serverSettings)
this.$store.commit('setSource', Source)
if (serverSettings.chromecastEnabled) { if (serverSettings.chromecastEnabled) {
console.log('Chromecast enabled import script') console.log('Chromecast enabled import script')

View File

@ -2,6 +2,7 @@ import { checkForUpdate } from '@/plugins/version'
import Vue from 'vue' import Vue from 'vue'
export const state = () => ({ export const state = () => ({
Source: null,
versionData: null, versionData: null,
serverSettings: null, serverSettings: null,
streamLibraryItem: null, streamLibraryItem: null,
@ -81,6 +82,9 @@ export const actions = {
} }
export const mutations = { export const mutations = {
setSource(state, source) {
state.Source = source
},
setLastBookshelfScrollData(state, { scrollTop, path, name }) { setLastBookshelfScrollData(state, { scrollTop, path, name }) {
state.lastBookshelfScrollData[name] = { scrollTop, path } state.lastBookshelfScrollData[name] = { scrollTop, path }
}, },

View File

@ -10,9 +10,9 @@
"watch": "npm-watch", "watch": "npm-watch",
"dev": "node index.js", "dev": "node index.js",
"start": "node index.js", "start": "node index.js",
"client": "cd client && npm install && npm run generate", "client": "cd client && npm ci && npm run generate",
"prod": "npm run client && npm install && node prod.js", "prod": "npm run client && npm ci && node prod.js",
"build-win": "pkg -t node16-win-x64 -o ./dist/win/audiobookshelf -C GZip .", "build-win": "npm run client && pkg -t node16-win-x64 -o ./dist/win/audiobookshelf -C GZip .",
"build-linux": "build/linuxpackager", "build-linux": "build/linuxpackager",
"docker": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push . -t advplyr/audiobookshelf", "docker": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push . -t advplyr/audiobookshelf",
"deploy": "node dist/autodeploy" "deploy": "node dist/autodeploy"

View File

@ -96,7 +96,8 @@ class Auth {
return { return {
user: user.toJSONForBrowser(), user: user.toJSONForBrowser(),
userDefaultLibraryId: user.getDefaultLibraryId(this.db.libraries), userDefaultLibraryId: user.getDefaultLibraryId(this.db.libraries),
serverSettings: this.db.serverSettings.toJSON() serverSettings: this.db.serverSettings.toJSON(),
Source: global.Source
} }
} }

View File

@ -35,9 +35,9 @@ const RssFeedManager = require('./managers/RssFeedManager')
class Server { class Server {
constructor(SOURCE, PORT, HOST, UID, GID, CONFIG_PATH, METADATA_PATH) { constructor(SOURCE, PORT, HOST, UID, GID, CONFIG_PATH, METADATA_PATH) {
this.Source = SOURCE
this.Port = PORT this.Port = PORT
this.Host = HOST this.Host = HOST
global.Source = SOURCE
global.Uid = isNaN(UID) ? 0 : Number(UID) global.Uid = isNaN(UID) ? 0 : Number(UID)
global.Gid = isNaN(GID) ? 0 : Number(GID) global.Gid = isNaN(GID) ? 0 : Number(GID)
global.ConfigPath = Path.normalize(CONFIG_PATH) global.ConfigPath = Path.normalize(CONFIG_PATH)

View File

@ -242,7 +242,8 @@ class MiscController {
const userResponse = { const userResponse = {
user: req.user, user: req.user,
userDefaultLibraryId: req.user.getDefaultLibraryId(this.db.libraries), userDefaultLibraryId: req.user.getDefaultLibraryId(this.db.libraries),
serverSettings: this.db.serverSettings.toJSON() serverSettings: this.db.serverSettings.toJSON(),
Source: global.Source
} }
res.json(userResponse) res.json(userResponse)
} }