aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/northstar/utils/Extensions.ts24
-rw-r--r--src/client/util/Import & Export/DirectoryImportBox.tsx2
-rw-r--r--src/client/views/collections/CollectionSubView.tsx10
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx64
-rw-r--r--src/new_fields/RichTextUtils.ts10
-rw-r--r--src/server/apis/google/GooglePhotosUploadUtils.ts20
-rw-r--r--src/server/apis/google/existing_uploads.json2
-rw-r--r--src/server/credentials/google_docs_token.json2
-rw-r--r--src/server/index.ts18
9 files changed, 83 insertions, 69 deletions
diff --git a/src/client/northstar/utils/Extensions.ts b/src/client/northstar/utils/Extensions.ts
index f1fddf6c8..04af36731 100644
--- a/src/client/northstar/utils/Extensions.ts
+++ b/src/client/northstar/utils/Extensions.ts
@@ -29,22 +29,22 @@ type BatchHandler<I> = BatchHandlerSync<I> | BatchHandlerAsync<I>;
interface Array<T> {
batch(batchSize: number): T[][];
- executeInBatches(batchSize: number, handler: BatchHandlerSync<T>): void;
- convertInBatches<O>(batchSize: number, handler: BatchConverterSync<T, O>): O[];
- executeInBatchesAsync(batchSize: number, handler: BatchHandler<T>): Promise<void>;
- convertInBatchesAsync<O>(batchSize: number, handler: BatchConverter<T, O>): Promise<O[]>;
- executeInBatchesAtInterval(batchSize: number, handler: BatchHandler<T>, interval: number): Promise<void>;
- convertInBatchesAtInterval<O>(batchSize: number, handler: BatchConverter<T, O>, interval: number): Promise<O[]>;
+ batchedForEach(batchSize: number, handler: BatchHandlerSync<T>): void;
+ batchedMap<O>(batchSize: number, handler: BatchConverterSync<T, O>): O[];
+ batchedForEachAsync(batchSize: number, handler: BatchHandler<T>): Promise<void>;
+ batchedMapAsync<O>(batchSize: number, handler: BatchConverter<T, O>): Promise<O[]>;
+ batchedForEachInterval(batchSize: number, handler: BatchHandler<T>, interval: number): Promise<void>;
+ batchedMapInterval<O>(batchSize: number, handler: BatchConverter<T, O>, interval: number): Promise<O[]>;
lastElement(): T;
}
Array.prototype.batch = extensions.Batch;
-Array.prototype.executeInBatches = extensions.ExecuteInBatches;
-Array.prototype.convertInBatches = extensions.ConvertInBatches;
-Array.prototype.executeInBatchesAsync = extensions.ExecuteInBatchesAsync;
-Array.prototype.convertInBatchesAsync = extensions.ConvertInBatchesAsync;
-Array.prototype.executeInBatchesAtInterval = extensions.ExecuteInBatchesAtInterval;
-Array.prototype.convertInBatchesAtInterval = extensions.ConvertInBatchesAtInterval;
+Array.prototype.batchedForEach = extensions.ExecuteInBatches;
+Array.prototype.batchedMap = extensions.ConvertInBatches;
+Array.prototype.batchedForEachAsync = extensions.ExecuteInBatchesAsync;
+Array.prototype.batchedMapAsync = extensions.ConvertInBatchesAsync;
+Array.prototype.batchedForEachInterval = extensions.ExecuteInBatchesAtInterval;
+Array.prototype.batchedMapInterval = extensions.ConvertInBatchesAtInterval;
Array.prototype.lastElement = function <T>() {
if (!this.length) {
diff --git a/src/client/util/Import & Export/DirectoryImportBox.tsx b/src/client/util/Import & Export/DirectoryImportBox.tsx
index 44075ecdd..d371766dd 100644
--- a/src/client/util/Import & Export/DirectoryImportBox.tsx
+++ b/src/client/util/Import & Export/DirectoryImportBox.tsx
@@ -103,7 +103,7 @@ export default class DirectoryImportBox extends React.Component<FieldViewProps>
runInAction(() => this.phase = `Internal: uploading ${this.quota - this.completed} files to Dash...`);
- const uploads = await validated.convertInBatchesAsync<FileResponse>(15, async (batch: File[]) => {
+ const uploads = await validated.batchedMapAsync<FileResponse>(15, async (batch: File[]) => {
const formData = new FormData();
const parameters = { method: 'POST', body: formData };
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 4d4f69b92..59fc11359 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -1,7 +1,7 @@
import { action, computed } from "mobx";
import * as rp from 'request-promise';
import CursorField from "../../../new_fields/CursorField";
-import { Doc, DocListCast } from "../../../new_fields/Doc";
+import { Doc, DocListCast, HeightSym } from "../../../new_fields/Doc";
import { Id } from "../../../new_fields/FieldSymbols";
import { List } from "../../../new_fields/List";
import { listSpec } from "../../../new_fields/Schema";
@@ -23,6 +23,7 @@ import { CollectionVideoView } from "./CollectionVideoView";
import { CollectionView } from "./CollectionView";
import React = require("react");
import { GooglePhotos } from "../../apis/google_docs/GooglePhotosClientUtils";
+import { CollectionDockingView } from "./CollectionDockingView";
export interface CollectionViewProps extends FieldViewProps {
addDocument: (document: Doc, allowDuplicates?: boolean) => boolean;
@@ -212,11 +213,14 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
if ((matches = /(https:\/\/)?docs\.google\.com\/document\/d\/([^\\]+)\/edit/g.exec(text)) !== null) {
let newBox = Docs.Create.TextDocument({ ...options, width: 400, height: 200, title: "Awaiting title from Google Docs..." });
let proto = newBox.proto!;
- proto.autoHeight = true;
- proto[GoogleRef] = matches[2];
+ const documentId = matches[2];
+ proto[GoogleRef] = documentId;
proto.data = "Please select this document and then click on its pull button to load its contents from from Google Docs...";
proto.backgroundColor = "#eeeeff";
this.props.addDocument(newBox);
+ // const parent = Docs.Create.StackingDocument([newBox], { title: `Google Doc Import (${documentId})` });
+ // CollectionDockingView.Instance.AddRightSplit(parent, undefined);
+ // proto.height = parent[HeightSym]();
return;
}
if ((matches = /(https:\/\/)?photos\.google\.com\/(u\/3\/)?album\/([^\\]+)/g.exec(text)) !== null) {
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index b4ca6d797..9c7e8d22f 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -523,38 +523,38 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
let y = this.Document.panY || 0;
let docs = this.childDocs || [];
let [dx, dy] = this.getTransform().transformDirection(e.clientX - this._lastX, e.clientY - this._lastY);
- if (!this.isAnnotationOverlay) {
- PDFMenu.Instance.fadeOut(true);
- let minx = docs.length ? NumCast(docs[0].x) : 0;
- let maxx = docs.length ? NumCast(docs[0].width) + minx : minx;
- let miny = docs.length ? NumCast(docs[0].y) : 0;
- let maxy = docs.length ? NumCast(docs[0].height) + miny : miny;
- let ranges = docs.filter(doc => doc).reduce((range, doc) => {
- let x = NumCast(doc.x);
- let xe = x + NumCast(doc.width);
- let y = NumCast(doc.y);
- let ye = y + NumCast(doc.height);
- return [[range[0][0] > x ? x : range[0][0], range[0][1] < xe ? xe : range[0][1]],
- [range[1][0] > y ? y : range[1][0], range[1][1] < ye ? ye : range[1][1]]];
- }, [[minx, maxx], [miny, maxy]]);
- let ink = Cast(this.fieldExtensionDoc.ink, InkField);
- if (ink && ink.inkData) {
- ink.inkData.forEach((value: StrokeData, key: string) => {
- let bounds = InkingCanvas.StrokeRect(value);
- ranges[0] = [Math.min(ranges[0][0], bounds.left), Math.max(ranges[0][1], bounds.right)];
- ranges[1] = [Math.min(ranges[1][0], bounds.top), Math.max(ranges[1][1], bounds.bottom)];
- });
- }
-
- let panelDim = this.props.ScreenToLocalTransform().transformDirection(this._pwidth / this.zoomScaling(),
- this._pheight / this.zoomScaling());
- let panelwidth = panelDim[0];
- let panelheight = panelDim[1];
- if (ranges[0][0] - dx > (this.panX() + panelwidth / 2)) x = ranges[0][1] + panelwidth / 2;
- if (ranges[0][1] - dx < (this.panX() - panelwidth / 2)) x = ranges[0][0] - panelwidth / 2;
- if (ranges[1][0] - dy > (this.panY() + panelheight / 2)) y = ranges[1][1] + panelheight / 2;
- if (ranges[1][1] - dy < (this.panY() - panelheight / 2)) y = ranges[1][0] - panelheight / 2;
- }
+ // if (!this.isAnnotationOverlay) {
+ // PDFMenu.Instance.fadeOut(true);
+ // let minx = docs.length ? NumCast(docs[0].x) : 0;
+ // let maxx = docs.length ? NumCast(docs[0].width) + minx : minx;
+ // let miny = docs.length ? NumCast(docs[0].y) : 0;
+ // let maxy = docs.length ? NumCast(docs[0].height) + miny : miny;
+ // let ranges = docs.filter(doc => doc).reduce((range, doc) => {
+ // let x = NumCast(doc.x);
+ // let xe = x + NumCast(doc.width);
+ // let y = NumCast(doc.y);
+ // let ye = y + NumCast(doc.height);
+ // return [[range[0][0] > x ? x : range[0][0], range[0][1] < xe ? xe : range[0][1]],
+ // [range[1][0] > y ? y : range[1][0], range[1][1] < ye ? ye : range[1][1]]];
+ // }, [[minx, maxx], [miny, maxy]]);
+ // let ink = Cast(this.fieldExtensionDoc.ink, InkField);
+ // if (ink && ink.inkData) {
+ // ink.inkData.forEach((value: StrokeData, key: string) => {
+ // let bounds = InkingCanvas.StrokeRect(value);
+ // ranges[0] = [Math.min(ranges[0][0], bounds.left), Math.max(ranges[0][1], bounds.right)];
+ // ranges[1] = [Math.min(ranges[1][0], bounds.top), Math.max(ranges[1][1], bounds.bottom)];
+ // });
+ // }
+
+ // let panelDim = this.props.ScreenToLocalTransform().transformDirection(this._pwidth / this.zoomScaling(),
+ // this._pheight / this.zoomScaling());
+ // let panelwidth = panelDim[0];
+ // let panelheight = panelDim[1];
+ // if (ranges[0][0] - dx > (this.panX() + panelwidth / 2)) x = ranges[0][1] + panelwidth / 2;
+ // if (ranges[0][1] - dx < (this.panX() - panelwidth / 2)) x = ranges[0][0] - panelwidth / 2;
+ // if (ranges[1][0] - dy > (this.panY() + panelheight / 2)) y = ranges[1][1] + panelheight / 2;
+ // if (ranges[1][1] - dy < (this.panY() - panelheight / 2)) y = ranges[1][0] - panelheight / 2;
+ // }
this.setPan(x - dx, y - dy);
this._lastX = e.pageX;
this._lastY = e.pageY;
diff --git a/src/new_fields/RichTextUtils.ts b/src/new_fields/RichTextUtils.ts
index ab5e677c8..5b1da2669 100644
--- a/src/new_fields/RichTextUtils.ts
+++ b/src/new_fields/RichTextUtils.ts
@@ -278,7 +278,7 @@ export namespace RichTextUtils {
} else {
docid = backingDocId;
}
- return schema.node("image", { src, width, docid });
+ return schema.node("image", { src, width, docid, float: null });
};
const textNode = (schema: any, run: docs_v1.Schema$TextRun) => {
@@ -331,6 +331,7 @@ export namespace RichTextUtils {
["strong", "bold"],
["em", "italic"],
["pFontColor", "foregroundColor"],
+ ["pFontSize", "fontSize"],
["timesNewRoman", "weightedFontFamily"],
["georgia", "weightedFontFamily"],
["comicSans", "weightedFontFamily"],
@@ -382,21 +383,24 @@ export namespace RichTextUtils {
const delimiter = "/doc/";
const alreadyShared = "?sharing=true";
if (new RegExp(window.location.origin + delimiter).test(url) && !url.endsWith(alreadyShared)) {
+ alert("Reassigning alias!");
const linkDoc = await DocServer.GetRefField(url.split(delimiter)[1]);
if (linkDoc instanceof Doc) {
const target = (await Cast(linkDoc.anchor2, Doc))!;
const exported = Doc.MakeAlias(target);
DocumentView.makeCustomViewClicked(exported);
- target && (url = Utils.shareUrl(exported[Id]));
+ const documentId = exported[Id];
+ target && (url = Utils.shareUrl(documentId));
linkDoc.anchor2 = exported;
}
}
+ alert(`url: ${url}`);
value = { url };
textStyle.foregroundColor = fromRgb.blue;
textStyle.bold = true;
break;
case "fontSize":
- value = attrs.fontSize;
+ value = { magnitude: attrs.fontSize, unit: "PT" };
break;
case "foregroundColor":
value = fromHex(attrs.color);
diff --git a/src/server/apis/google/GooglePhotosUploadUtils.ts b/src/server/apis/google/GooglePhotosUploadUtils.ts
index 3ab9ba90f..734d77fd7 100644
--- a/src/server/apis/google/GooglePhotosUploadUtils.ts
+++ b/src/server/apis/google/GooglePhotosUploadUtils.ts
@@ -80,7 +80,7 @@ export namespace GooglePhotosUploadUtils {
});
})).newMediaItemResults;
};
- const newMediaItemResults = await newMediaItems.convertInBatchesAtInterval(50, createFromUploadTokens, 0.1);
+ const newMediaItemResults = await newMediaItems.batchedMapInterval(50, createFromUploadTokens, 0.1);
return { newMediaItemResults };
};
@@ -122,12 +122,20 @@ export namespace DownloadUtils {
isLocal: boolean;
stream: any;
normalizedUrl: string;
- contentSize: number;
- contentType: string;
+ contentSize?: number;
+ contentType?: string;
}
- export const InspectImage = async (url: string) => {
+ export const InspectImage = async (url: string): Promise<InspectionResults> => {
const { isLocal, stream, normalized: normalizedUrl } = classify(url);
+ const results = {
+ isLocal,
+ stream,
+ normalizedUrl
+ };
+ if (isLocal) {
+ return results;
+ }
const metadata = (await new Promise<any>((resolve, reject) => {
request.head(url, async (error, res) => {
if (error) {
@@ -139,9 +147,7 @@ export namespace DownloadUtils {
return {
contentSize: parseInt(metadata[size]),
contentType: metadata[type],
- isLocal,
- stream,
- normalizedUrl
+ ...results
};
};
diff --git a/src/server/apis/google/existing_uploads.json b/src/server/apis/google/existing_uploads.json
index 05c20c33b..4d723868e 100644
--- a/src/server/apis/google/existing_uploads.json
+++ b/src/server/apis/google/existing_uploads.json
@@ -1 +1 @@
-{"23625":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_l.png"],"fileNames":{"clean":"upload_7e2d5fef-860a-49a8-b9ec-b91f28073180.png","_o":"upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_o.png","_s":"upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_s.png","_m":"upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_m.png","_l":"upload_7e2d5fef-860a-49a8-b9ec-b91f28073180_l.png"},"contentSize":23625,"contentType":"image/jpeg"}} \ No newline at end of file
+{"23394":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_l.png"],"fileNames":{"clean":"upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2.png","_o":"upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_o.png","_s":"upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_s.png","_m":"upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_m.png","_l":"upload_e6e6239c-a436-4f08-bea5-de29ad4e72f2_l.png"},"contentSize":23394,"contentType":"image/jpeg"},"23406":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2b310488-a12b-4ecf-8adf-38943282381a_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2b310488-a12b-4ecf-8adf-38943282381a_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2b310488-a12b-4ecf-8adf-38943282381a_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2b310488-a12b-4ecf-8adf-38943282381a_l.png"],"fileNames":{"clean":"upload_2b310488-a12b-4ecf-8adf-38943282381a.png","_o":"upload_2b310488-a12b-4ecf-8adf-38943282381a_o.png","_s":"upload_2b310488-a12b-4ecf-8adf-38943282381a_s.png","_m":"upload_2b310488-a12b-4ecf-8adf-38943282381a_m.png","_l":"upload_2b310488-a12b-4ecf-8adf-38943282381a_l.png"},"contentSize":23406,"contentType":"image/jpeg"},"23408":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_l.png"],"fileNames":{"clean":"upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78.png","_o":"upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_o.png","_s":"upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_s.png","_m":"upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_m.png","_l":"upload_a35aef02-3dac-434f-a2d5-932ee3fc6b78_l.png"},"contentSize":23408,"contentType":"image/jpeg"},"23413":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_l.png"],"fileNames":{"clean":"upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c.png","_o":"upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_o.png","_s":"upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_s.png","_m":"upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_m.png","_l":"upload_8babdd04-c4af-4ebf-9e48-bcf5cb51ab6c_l.png"},"contentSize":23413,"contentType":"image/jpeg"},"23415":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2e51d02c-a113-4eec-8030-badb54d0f719_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2e51d02c-a113-4eec-8030-badb54d0f719_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2e51d02c-a113-4eec-8030-badb54d0f719_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_2e51d02c-a113-4eec-8030-badb54d0f719_l.png"],"fileNames":{"clean":"upload_2e51d02c-a113-4eec-8030-badb54d0f719.png","_o":"upload_2e51d02c-a113-4eec-8030-badb54d0f719_o.png","_s":"upload_2e51d02c-a113-4eec-8030-badb54d0f719_s.png","_m":"upload_2e51d02c-a113-4eec-8030-badb54d0f719_m.png","_l":"upload_2e51d02c-a113-4eec-8030-badb54d0f719_l.png"},"contentSize":23415,"contentType":"image/jpeg"},"23466":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_l.png"],"fileNames":{"clean":"upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f.png","_o":"upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_o.png","_s":"upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_s.png","_m":"upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_m.png","_l":"upload_ec4c15ea-9858-4886-bc15-03a5073b8f4f_l.png"},"contentSize":23466,"contentType":"image/jpeg"},"23625":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_l.png"],"fileNames":{"clean":"upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1.png","_o":"upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_o.png","_s":"upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_s.png","_m":"upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_m.png","_l":"upload_e1488792-46cb-4ff5-bb26-f62ea2ef91d1_l.png"},"contentSize":23625,"contentType":"image/jpeg"},"45184":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_l.png"],"fileNames":{"clean":"upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402.png","_o":"upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_o.png","_s":"upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_s.png","_m":"upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_m.png","_l":"upload_c0de990f-e3b5-4830-ab5d-17cfb4ddc402_l.png"},"contentSize":45184,"contentType":"image/jpeg"},"45211":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_l.png"],"fileNames":{"clean":"upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8.png","_o":"upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_o.png","_s":"upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_s.png","_m":"upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_m.png","_l":"upload_43ae4f14-b987-4a1a-9430-cc90bb24a9c8_l.png"},"contentSize":45211,"contentType":"image/jpeg"},"45228":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_608688a6-53bc-4d1f-adfc-3aac153066fb_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_608688a6-53bc-4d1f-adfc-3aac153066fb_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_608688a6-53bc-4d1f-adfc-3aac153066fb_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_608688a6-53bc-4d1f-adfc-3aac153066fb_l.png"],"fileNames":{"clean":"upload_608688a6-53bc-4d1f-adfc-3aac153066fb.png","_o":"upload_608688a6-53bc-4d1f-adfc-3aac153066fb_o.png","_s":"upload_608688a6-53bc-4d1f-adfc-3aac153066fb_s.png","_m":"upload_608688a6-53bc-4d1f-adfc-3aac153066fb_m.png","_l":"upload_608688a6-53bc-4d1f-adfc-3aac153066fb_l.png"},"contentSize":45228,"contentType":"image/jpeg"},"45247":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_1de378be-f389-41d7-a6bf-d680b2eee551_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_1de378be-f389-41d7-a6bf-d680b2eee551_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_1de378be-f389-41d7-a6bf-d680b2eee551_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_1de378be-f389-41d7-a6bf-d680b2eee551_l.png"],"fileNames":{"clean":"upload_1de378be-f389-41d7-a6bf-d680b2eee551.png","_o":"upload_1de378be-f389-41d7-a6bf-d680b2eee551_o.png","_s":"upload_1de378be-f389-41d7-a6bf-d680b2eee551_s.png","_m":"upload_1de378be-f389-41d7-a6bf-d680b2eee551_m.png","_l":"upload_1de378be-f389-41d7-a6bf-d680b2eee551_l.png"},"contentSize":45247,"contentType":"image/jpeg"},"45263":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_984f220d-1409-418d-998b-44667879fde2_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_984f220d-1409-418d-998b-44667879fde2_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_984f220d-1409-418d-998b-44667879fde2_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_984f220d-1409-418d-998b-44667879fde2_l.png"],"fileNames":{"clean":"upload_984f220d-1409-418d-998b-44667879fde2.png","_o":"upload_984f220d-1409-418d-998b-44667879fde2_o.png","_s":"upload_984f220d-1409-418d-998b-44667879fde2_s.png","_m":"upload_984f220d-1409-418d-998b-44667879fde2_m.png","_l":"upload_984f220d-1409-418d-998b-44667879fde2_l.png"},"contentSize":45263,"contentType":"image/jpeg"},"45273":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_l.png"],"fileNames":{"clean":"upload_86280e72-0c1e-40cf-a6c3-79291a7ec384.png","_o":"upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_o.png","_s":"upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_s.png","_m":"upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_m.png","_l":"upload_86280e72-0c1e-40cf-a6c3-79291a7ec384_l.png"},"contentSize":45273,"contentType":"image/jpeg"},"45492":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a3070781-0b4d-43f7-80b8-5be8138d0930_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a3070781-0b4d-43f7-80b8-5be8138d0930_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a3070781-0b4d-43f7-80b8-5be8138d0930_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_a3070781-0b4d-43f7-80b8-5be8138d0930_l.png"],"fileNames":{"clean":"upload_a3070781-0b4d-43f7-80b8-5be8138d0930.png","_o":"upload_a3070781-0b4d-43f7-80b8-5be8138d0930_o.png","_s":"upload_a3070781-0b4d-43f7-80b8-5be8138d0930_s.png","_m":"upload_a3070781-0b4d-43f7-80b8-5be8138d0930_m.png","_l":"upload_a3070781-0b4d-43f7-80b8-5be8138d0930_l.png"},"contentSize":45492,"contentType":"image/jpeg"},"45510":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_892f666b-ac98-4feb-9017-39448434b732_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_892f666b-ac98-4feb-9017-39448434b732_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_892f666b-ac98-4feb-9017-39448434b732_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_892f666b-ac98-4feb-9017-39448434b732_l.png"],"fileNames":{"clean":"upload_892f666b-ac98-4feb-9017-39448434b732.png","_o":"upload_892f666b-ac98-4feb-9017-39448434b732_o.png","_s":"upload_892f666b-ac98-4feb-9017-39448434b732_s.png","_m":"upload_892f666b-ac98-4feb-9017-39448434b732_m.png","_l":"upload_892f666b-ac98-4feb-9017-39448434b732_l.png"},"contentSize":45510,"contentType":"image/jpeg"},"45585":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_l.png"],"fileNames":{"clean":"upload_f684c94c-7d37-47ed-91cb-bb458f9cff15.png","_o":"upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_o.png","_s":"upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_s.png","_m":"upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_m.png","_l":"upload_f684c94c-7d37-47ed-91cb-bb458f9cff15_l.png"},"contentSize":45585,"contentType":"image/jpeg"},"74829":{"mediaPaths":["C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_o.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_s.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_m.png","C:\\Users\\avd\\Desktop\\Sam\\Dash-Web\\src\\server\\public\\files\\upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_l.png"],"fileNames":{"clean":"upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5.png","_o":"upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_o.png","_s":"upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_s.png","_m":"upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_m.png","_l":"upload_cc43cdb6-b877-4b30-a702-b7f591a8bca5_l.png"},"contentSize":74829,"contentType":"image/jpeg"}} \ No newline at end of file
diff --git a/src/server/credentials/google_docs_token.json b/src/server/credentials/google_docs_token.json
index c10b0797f..5998ccfd8 100644
--- a/src/server/credentials/google_docs_token.json
+++ b/src/server/credentials/google_docs_token.json
@@ -1 +1 @@
-{"access_token":"ya29.ImCFB_ghOybVB6A4HvIIwIlyGyZw6wOymdwJyWJJECIpCmFTHNEzOAfP98KFzm5OUV2zZNS5Wx1iUT1xYWW35PY7NoZc7PWwjzmOaGkMzDm7_fxpsgjT0StdvEwTJprFIv0","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":1568590984976} \ No newline at end of file
+{"access_token":"ya29.GlyFByFfWe7VNNjHImJwA58yoh2cAKDJUPhBKn5IDVUY9oPlXbpyhdJMjfGSRhDZpgEWM0QoSqONu9gBVWDV9aXsf7p8r9TDXK7jBfWs1Qnox4zPf54kSfCHsmV6iw","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":1568646012183} \ No newline at end of file
diff --git a/src/server/index.ts b/src/server/index.ts
index 07ce4b6f0..9da6a8b38 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -836,12 +836,12 @@ export interface NewMediaItem {
}
Array.prototype.batch = extensions.Batch;
-Array.prototype.executeInBatches = extensions.ExecuteInBatches;
-Array.prototype.convertInBatches = extensions.ConvertInBatches;
-Array.prototype.executeInBatchesAsync = extensions.ExecuteInBatchesAsync;
-Array.prototype.convertInBatchesAsync = extensions.ConvertInBatchesAsync;
-Array.prototype.executeInBatchesAtInterval = extensions.ExecuteInBatchesAtInterval;
-Array.prototype.convertInBatchesAtInterval = extensions.ConvertInBatchesAtInterval;
+Array.prototype.batchedForEach = extensions.ExecuteInBatches;
+Array.prototype.batchedMap = extensions.ConvertInBatches;
+Array.prototype.batchedForEachAsync = extensions.ExecuteInBatchesAsync;
+Array.prototype.batchedMapAsync = extensions.ConvertInBatchesAsync;
+Array.prototype.batchedForEachInterval = extensions.ExecuteInBatchesAtInterval;
+Array.prototype.batchedMapInterval = extensions.ConvertInBatchesAtInterval;
app.post(RouteStore.googlePhotosMediaUpload, async (req, res) => {
const mediaInput: GooglePhotosUploadUtils.MediaInput[] = req.body.media;
@@ -865,7 +865,7 @@ app.post(RouteStore.googlePhotosMediaUpload, async (req, res) => {
return newMediaItems;
};
- const newMediaItems = await mediaInput.convertInBatchesAtInterval(25, dispatchUpload, 0.1);
+ const newMediaItems = await mediaInput.batchedMapInterval(25, dispatchUpload, 0.1);
if (failed) {
return _error(res, tokenError);
@@ -900,10 +900,10 @@ app.post(RouteStore.googlePhotosMediaDownload, async (req, res) => {
let existing = content.length ? JSON.parse(content) : {};
for (let item of contents.mediaItems) {
const { contentSize, ...attributes } = await UploadUtils.InspectImage(item.baseUrl);
- const found: UploadUtils.UploadInformation = existing[contentSize];
+ const found: UploadUtils.UploadInformation = existing[contentSize!];
if (!found) {
const upload = await UploadUtils.UploadImage({ contentSize, ...attributes }, item.filename, prefix).catch(error => _error(res, downloadError, error));
- upload && completed.push(existing[contentSize] = upload);
+ upload && completed.push(existing[contentSize!] = upload);
} else {
completed.push(found);
}