|
@@ -40,7 +40,6 @@ export type OnDownloadProgress = (event: {
|
|
|
|
|
|
export interface DownloadClient {
|
|
export interface DownloadClient {
|
|
updateTokens: (token: string, passwordToken?: string) => void;
|
|
updateTokens: (token: string, passwordToken?: string) => void;
|
|
- updateTimeout: (timeout: number) => void;
|
|
|
|
downloadThumbnail: (
|
|
downloadThumbnail: (
|
|
file: EnteFile,
|
|
file: EnteFile,
|
|
timeout?: number,
|
|
timeout?: number,
|
|
@@ -77,13 +76,12 @@ class DownloadManagerImpl {
|
|
async init(
|
|
async init(
|
|
app: APPS,
|
|
app: APPS,
|
|
tokens?: { token: string; passwordToken?: string } | { token: string },
|
|
tokens?: { token: string; passwordToken?: string } | { token: string },
|
|
- timeout?: number,
|
|
|
|
) {
|
|
) {
|
|
if (this.ready) {
|
|
if (this.ready) {
|
|
log.info("DownloadManager already initialized");
|
|
log.info("DownloadManager already initialized");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.downloadClient = createDownloadClient(app, tokens, timeout);
|
|
|
|
|
|
+ this.downloadClient = createDownloadClient(app, tokens);
|
|
try {
|
|
try {
|
|
this.thumbnailCache = await openCache("thumbs");
|
|
this.thumbnailCache = await openCache("thumbs");
|
|
} catch (e) {
|
|
} catch (e) {
|
|
@@ -127,10 +125,6 @@ class DownloadManagerImpl {
|
|
this.cryptoWorker = cryptoWorker;
|
|
this.cryptoWorker = cryptoWorker;
|
|
}
|
|
}
|
|
|
|
|
|
- updateTimeout(timeout: number) {
|
|
|
|
- this.downloadClient.updateTimeout(timeout);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
setProgressUpdater(progressUpdater: (value: Map<number, number>) => void) {
|
|
setProgressUpdater(progressUpdater: (value: Map<number, number>) => void) {
|
|
this.progressUpdater = progressUpdater;
|
|
this.progressUpdater = progressUpdater;
|
|
}
|
|
}
|
|
@@ -525,11 +519,8 @@ export default DownloadManager;
|
|
function createDownloadClient(
|
|
function createDownloadClient(
|
|
app: APPS,
|
|
app: APPS,
|
|
tokens?: { token: string; passwordToken?: string } | { token: string },
|
|
tokens?: { token: string; passwordToken?: string } | { token: string },
|
|
- timeout?: number,
|
|
|
|
): DownloadClient {
|
|
): DownloadClient {
|
|
- if (!timeout) {
|
|
|
|
- timeout = 300000; // 5 minute
|
|
|
|
- }
|
|
|
|
|
|
+ const timeout = 300000; // 5 minute
|
|
if (app === APPS.ALBUMS) {
|
|
if (app === APPS.ALBUMS) {
|
|
if (!tokens) {
|
|
if (!tokens) {
|
|
tokens = { token: undefined, passwordToken: undefined };
|
|
tokens = { token: undefined, passwordToken: undefined };
|