mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-07-29 07:58:43 +02:00
Support for android 8+, selectable download location, permissions check, recursive delete
This commit is contained in:
@@ -2,6 +2,7 @@ import Vue from 'vue'
|
||||
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'
|
||||
|
||||
Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
|
||||
if (isNaN(bytes) || bytes === null) return 'Invalid Bytes'
|
||||
if (bytes === 0) {
|
||||
return '0 Bytes'
|
||||
}
|
||||
|
||||
@@ -408,6 +408,7 @@ class LocalStorage {
|
||||
this.vuexStore = vuexStore
|
||||
|
||||
this.userAudiobooksLoaded = false
|
||||
this.downloadFolder = null
|
||||
this.userAudiobooks = {}
|
||||
}
|
||||
|
||||
@@ -502,6 +503,32 @@ class LocalStorage {
|
||||
}
|
||||
}
|
||||
|
||||
async setDownloadFolder(folderObj) {
|
||||
try {
|
||||
if (folderObj) {
|
||||
await Storage.set({ key: 'downloadFolder', value: JSON.stringify(folderObj) })
|
||||
this.downloadFolder = folderObj
|
||||
} else {
|
||||
await Storage.remove({ key: 'downloadFolder' })
|
||||
this.downloadFolder = null
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[LocalStorage] Failed to set download folder', error)
|
||||
}
|
||||
}
|
||||
|
||||
async getDownloadFolder() {
|
||||
try {
|
||||
var _value = (await Storage.get({ key: 'downloadFolder' }) || {}).value || null
|
||||
if (!_value) return null
|
||||
this.downloadFolder = JSON.parse(_value)
|
||||
return this.downloadFolder
|
||||
} catch (error) {
|
||||
console.error('[LocalStorage] Failed to get download folder', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async getServerUrl() {
|
||||
try {
|
||||
return (await Storage.get({ key: 'serverUrl' }) || {}).value || null
|
||||
|
||||
Reference in New Issue
Block a user