aboutsummaryrefslogtreecommitdiff
path: root/src/server/index.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-09-07 23:15:32 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-09-07 23:15:32 -0400
commitc24f5f29dff8dd22f1d4029a2722ee4d1a725aad (patch)
tree0834eb51c28a0ccc167626308318099b48650f52 /src/server/index.ts
parent32cd51e2bcc0a8cf498c0b31a5ead60802f672de (diff)
collection of search
Diffstat (limited to 'src/server/index.ts')
-rw-r--r--src/server/index.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index aadadb11a..49010e7e2 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -848,18 +848,16 @@ app.post(RouteStore.googlePhotosMediaUpload, async (req, res) => {
);
});
+const prefix = "google_photos_";
app.post(RouteStore.googlePhotosMediaDownload, async (req, res) => {
const contents = req.body;
if (!contents) {
return res.send(undefined);
}
await GooglePhotosUploadUtils.initialize({ uploadDirectory, credentialsPath, tokenPath });
- let bundles: GooglePhotosUploadUtils.DownloadInformation[] = [];
- await Promise.all(contents.mediaItems.forEach(async (item: any) => {
- const information = await GooglePhotosUploadUtils.IOUtils.Download(item.baseUrl, item.filename);
- information && bundles.push(information);
- }));
- res.send(bundles);
+ res.send(await Promise.all(contents.mediaItems.map((item: any) =>
+ GooglePhotosUploadUtils.IOUtils.Download(item.baseUrl, undefined, prefix)))
+ );
});
const suffixMap: { [type: string]: (string | [string, string | ((json: any) => any)]) } = {