aboutsummaryrefslogtreecommitdiff
path: root/src/server/index.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-09-07 17:08:49 -0400
committerSam Wilkins <samwilkins333@gmail.com>2019-09-07 17:08:49 -0400
commit32cd51e2bcc0a8cf498c0b31a5ead60802f672de (patch)
treee353f730591ee9b7d1a5661364679dc33fe38fa1 /src/server/index.ts
parentd94509864920b2bbe7f4af8837f3af3f721b7dad (diff)
working on import from google photos
Diffstat (limited to 'src/server/index.ts')
-rw-r--r--src/server/index.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index 99d8a02d4..aadadb11a 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -113,7 +113,7 @@ function addSecureRoute(method: Method,
) {
let abstracted = (req: express.Request, res: express.Response) => {
if (req.user) {
- handler(req.user as any, res, req);
+ handler(req.user, res, req);
} else {
req.session!.target = req.originalUrl;
onRejection(res, req);
@@ -848,6 +848,20 @@ app.post(RouteStore.googlePhotosMediaUpload, async (req, res) => {
);
});
+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);
+});
+
const suffixMap: { [type: string]: (string | [string, string | ((json: any) => any)]) } = {
"number": "_n",
"string": "_t",