{{ t('photos', 'Choose the folders from where photos and videos are shown.') }}
diff --git a/src/mixins/FetchFilesMixin.js b/src/mixins/FetchFilesMixin.js
index b58031973..e0130d114 100644
--- a/src/mixins/FetchFilesMixin.js
+++ b/src/mixins/FetchFilesMixin.js
@@ -102,7 +102,8 @@ export default {
} catch (error) {
if (error.response?.status === 404) {
this.errorFetchingFiles = 404
- const source = joinPaths(davRootPath, store.state.userConfig.photosSourceFolder ?? '/Photos') + '/'
+ // TODO improve error handling
+ const source = joinPaths(davRootPath, store.state.userConfig.photosSourceFolders ?? ['/Photos']) + '/'
logger.debug('Photo source does not exist, creating it.')
try {
await davGetClient().createDirectory(source)
diff --git a/src/services/PhotoSearch.js b/src/services/PhotoSearch.js
index 435297da1..091734340 100644
--- a/src/services/PhotoSearch.js
+++ b/src/services/PhotoSearch.js
@@ -27,6 +27,7 @@ import client from './DavClient.js'
import { props } from './DavRequest.js'
import moment from '@nextcloud/moment'
import store from '../store/index.js'
+import { davRootPath } from '@nextcloud/files'
/**
* List files from a folder and filter out unwanted mimes
@@ -95,15 +96,14 @@ export default async function(options = {}) {
}).join('\n')}`
: ''
- // TODO: uncomment when SEARCH on multiple folders is implemented.
- // const sourceFolders = store.state.userConfig.photosSourceFolder
- // .map(folder => `
- //
- // ${davRootPath}/${folder}
- // infinity
- //
- // `)
- // .join('\n')
+ const sourceFolders = store.state.userConfig.photosSourceFolders
+ .map(folder => `
+
+ ${davRootPath}/${folder}
+ infinity
+ `
+ )
+ .join('\n')
options = Object.assign({
method: 'SEARCH',
@@ -123,10 +123,7 @@ export default async function(options = {}) {
-
- ${prefixPath}/${store.state.userConfig.photosSourceFolder ?? '/Photos'}
- infinity
-
+ ${sourceFolders}
diff --git a/src/store/userConfig.js b/src/store/userConfig.js
index ae201bdac..7fbb6f9a1 100644
--- a/src/store/userConfig.js
+++ b/src/store/userConfig.js
@@ -58,7 +58,7 @@ export async function getFolder(path) {
/**
* @typedef {object} UserConfigState
* @property {boolean} croppedLayout
- * @property {string} photosSourceFolder
+ * @property {string[]} photosSourceFolders
* @property {string} photosLocation
* @property {import('@nextcloud/files').Folder} [photosLocationFolder]
*/
@@ -68,7 +68,7 @@ const module = {
state() {
return {
croppedLayout: loadState('photos', 'croppedLayout', 'false') === 'true',
- photosSourceFolder: loadState('photos', 'photosSourceFolder', ''),
+ photosSourceFolders: loadState('photos', 'photosSourceFolders', ''),
photosLocation: loadState('photos', 'photosLocation', ''),
photosLocationFolder: undefined,
}
diff --git a/src/views/Timeline.vue b/src/views/Timeline.vue
index 5cf0e6a05..88d1f5fd1 100644
--- a/src/views/Timeline.vue
+++ b/src/views/Timeline.vue
@@ -314,7 +314,7 @@ export default {
},
handleUserConfigChange({ key }) {
- if (key === 'photosSourceFolder') {
+ if (key === 'photosSourceFolders') {
this.resetFetchFilesState()
}
},