aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/util/Import & Export/DirectoryImportBox.tsx26
-rw-r--r--src/server/credentials/google_docs_token.json2
2 files changed, 13 insertions, 15 deletions
diff --git a/src/client/util/Import & Export/DirectoryImportBox.tsx b/src/client/util/Import & Export/DirectoryImportBox.tsx
index 7634d8234..87c187162 100644
--- a/src/client/util/Import & Export/DirectoryImportBox.tsx
+++ b/src/client/util/Import & Export/DirectoryImportBox.tsx
@@ -101,23 +101,22 @@ export default class DirectoryImportBox extends React.Component<FieldViewProps>
let sizes: number[] = [];
let modifiedDates: number[] = [];
- const uploadLocally = async (batch: File[]) => {
- sizes.push(...batch.map(file => file.size));
- modifiedDates.push(...batch.map(file => file.lastModified));
+ runInAction(() => this.phase = `Internal: uploading ${this.quota - this.completed} files to Dash...`);
- let formData = new FormData();
- batch.forEach(file => formData.append(Utils.GenerateGuid(), file));
+ const uploads = await validated.convertInBatchesAsync<FileResponse>(15, async (batch: File[]) => {
+ const formData = new FormData();
const parameters = { method: 'POST', body: formData };
- runInAction(() => this.completed += batch.length);
- return (await fetch(Utils.prepend(RouteStore.upload), parameters)).json();
- };
-
- runInAction(() => this.phase = `Internal: uploading ${this.quota - this.completed} files to Dash...`);
-
- const uploads = await validated.convertInBatchesAsync<FileResponse>(15, uploadLocally);
+ batch.forEach(file => {
+ sizes.push(file.size);
+ modifiedDates.push(file.lastModified);
+ formData.append(Utils.GenerateGuid(), file);
+ });
- runInAction(() => this.phase = `Creating documents from uploads...`);
+ const responses = (await fetch(RouteStore.upload, parameters)).json();
+ runInAction(() => this.completed += batch.length);
+ return responses;
+ });
await Promise.all(uploads.map(async upload => {
const type = upload.type;
@@ -163,7 +162,6 @@ export default class DirectoryImportBox extends React.Component<FieldViewProps>
runInAction(() => this.phase = 'External: uploading files to Google Photos...');
importContainer.singleColumn = false;
await GooglePhotos.Export.CollectionToAlbum({ collection: importContainer });
- runInAction(() => this.phase = 'All files uploaded to Google Photos...');
Doc.AddDocToList(Doc.GetProto(parent.props.Document), "data", importContainer);
!this.persistent && this.props.removeDocument && this.props.removeDocument(doc);
DocumentManager.Instance.jumpToDocument(importContainer, true);
diff --git a/src/server/credentials/google_docs_token.json b/src/server/credentials/google_docs_token.json
index 5d7fe5455..293404853 100644
--- a/src/server/credentials/google_docs_token.json
+++ b/src/server/credentials/google_docs_token.json
@@ -1 +1 @@
-{"access_token":"ya29.ImCDB3rM9R_0Sg7kblgjz0CJvz43FxDGnbC97xBSDhV20QyzQLrom5uJB-eEOOwrvRbP3e4LiumtI_ghx-6a0q9ydDsctF0-0Npohmo5cWFtwpcph7bmbBoPmJIJvQrjQ1Q","refresh_token":"1/HTv_xFHszu2Nf3iiFrUTaeKzC_Vp2-6bpIB06xW_WHI","scope":"https://www.googleapis.com/auth/presentations.readonly https://www.googleapis.com/auth/documents.readonly https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/documents https://www.googleapis.com/auth/photoslibrary https://www.googleapis.com/auth/photoslibrary.appendonly https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/presentations https://www.googleapis.com/auth/photoslibrary.sharing","token_type":"Bearer","expiry_date":1568452654650} \ No newline at end of file
+{"access_token":"ya29.ImCDB68jWP3W09KYIKQwzO_9eizRTpSx9UhP4tIPbSeMvjDsDyNOOl2hmffWHBrRFqz8kgaDxl_6lp-rlfbArI0x1Wm13J2h7wm5kBvOlCToqR-5qoINHetlWisCb11ig9A","refresh_token":"1/HTv_xFHszu2Nf3iiFrUTaeKzC_Vp2-6bpIB06xW_WHI","scope":"https://www.googleapis.com/auth/presentations.readonly https://www.googleapis.com/auth/documents.readonly https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/documents https://www.googleapis.com/auth/photoslibrary https://www.googleapis.com/auth/photoslibrary.appendonly https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/presentations https://www.googleapis.com/auth/photoslibrary.sharing","token_type":"Bearer","expiry_date":1568480323588} \ No newline at end of file