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" />
</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' }">
<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>
<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-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>
</template>
@ -25,6 +29,9 @@ export default {
return {}
},
computed: {
Source() {
return this.$store.state.Source
},
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" />
</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>
<modals-libraries-folder-chooser v-else :paths="folderPaths" @back="showDirectoryPicker = false" @select="selectFolder" />
</div>
</template>
@ -77,6 +76,9 @@ export default {
}
},
methods: {
browseForFolder() {
this.showDirectoryPicker = true
},
getLibraryData() {
return {
name: this.name,

View File

@ -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')

View File

@ -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 }
},

View File

@ -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"
}
}
}

View File

@ -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
}
}

View File

@ -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)

View File

@ -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)
}