Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/photos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-11-14 19:25:39 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2019-11-14 19:25:42 +0300
commite6e6b217ded9ebcae3475eda0c00a7c82fd173e3 (patch)
treeddf147a44feac68c3d9463cab20a2b938618093e /lib
parent2653815dbf99f18128de6325ba79eecaecaff46a (diff)
Use albums/shared endpoint
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/AlbumsController.php27
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/Controller/AlbumsController.php b/lib/Controller/AlbumsController.php
index 4493ec51..bedcd4c9 100644
--- a/lib/Controller/AlbumsController.php
+++ b/lib/Controller/AlbumsController.php
@@ -81,17 +81,27 @@ class AlbumsController extends Controller {
}
private function formatData(iterable $nodes): array {
+ $userFolder = $this->rootFolder->getUserFolder($this->userId);
+
$result = [];
/** @var Node $node */
foreach ($nodes as $node) {
+ // properly format full path and make sure
+ // we're relative to the user home folder
+ $isRoot = $node === $userFolder;
+ $path = $isRoot ? '/' : str_replace($userFolder->getPath(), '', $node->getPath());
+
$result[] = [
- 'id' => $node->getName(),
- 'basename' => $node->getName(),
- 'id' => $node->getName(),
- 'id' => $node->getName(),
- 'id' => $node->getName(),
- 'id' => $node->getName(),
- ]
+ 'basename' => $isRoot ? '' : $node->getName(),
+ 'etag' => $node->getEtag(),
+ 'fileid' => $node->getId(),
+ 'filename' => $path,
+ 'etag' => $node->getEtag(),
+ 'lastmod' => $node->getMTime(),
+ 'mime' => $node->getMimetype(),
+ 'size' => $node->getSize(),
+ 'type' => $node->getType()
+ ];
}
return $result;
@@ -100,6 +110,9 @@ class AlbumsController extends Controller {
private function scanCurrentFolder(Folder $folder, bool $shared): iterable {
$nodes = $folder->getDirectoryListing();
+ // add current folder to iterable set
+ yield $folder;
+
foreach ($nodes as $node) {
if ($node instanceof Folder) {
yield from $this->scanFolder($node, 0, $shared);