mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-14 08:09:58 +03:00
Explicitly declare file extensions for stickers and log event fetching progress
This commit is contained in:
parent
593f14beae
commit
4af8ec4d40
4 changed files with 9 additions and 7 deletions
|
@ -148,7 +148,7 @@ export default abstract class Exporter {
|
||||||
}
|
}
|
||||||
events.push(mxEv);
|
events.push(mxEv);
|
||||||
}
|
}
|
||||||
|
console.log("Fetched " + events.length + " events so far.");
|
||||||
prevToken = res.end;
|
prevToken = res.end;
|
||||||
}
|
}
|
||||||
// Reverse the events so that we preserve the order
|
// Reverse the events so that we preserve the order
|
||||||
|
@ -216,7 +216,8 @@ export default abstract class Exporter {
|
||||||
fileDirectory = event.getType() === "m.sticker" ? "stickers" : "files";
|
fileDirectory = event.getType() === "m.sticker" ? "stickers" : "files";
|
||||||
}
|
}
|
||||||
const fileDate = formatFullDateNoDay(new Date(event.getTs()));
|
const fileDate = formatFullDateNoDay(new Date(event.getTs()));
|
||||||
const [fileName, fileExt] = this.splitFileName(event.getContent().body);
|
let [fileName, fileExt] = this.splitFileName(event.getContent().body);
|
||||||
|
if (event.getType() === "m.sticker") fileExt = ".png";
|
||||||
return fileDirectory + "/" + fileName + '-' + fileDate + fileExt;
|
return fileDirectory + "/" + fileName + '-' + fileDate + fileExt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ export default class HTMLExporter extends Exporter {
|
||||||
const res = await this.getRequiredEvents();
|
const res = await this.getRequiredEvents();
|
||||||
const fetchEnd = performance.now();
|
const fetchEnd = performance.now();
|
||||||
|
|
||||||
console.log(`Fetched ${res.length} events in ${(fetchEnd - fetchStart)/1000} s`);
|
console.log(`Fetched ${res.length} events in ${(fetchEnd - fetchStart)/1000}s`);
|
||||||
console.info("Creating HTML...");
|
console.info("Creating HTML...");
|
||||||
|
|
||||||
const html = await this.createHTML(res);
|
const html = await this.createHTML(res);
|
||||||
|
|
|
@ -77,8 +77,8 @@ ${json}
|
||||||
const res = await this.getRequiredEvents();
|
const res = await this.getRequiredEvents();
|
||||||
const fetchEnd = performance.now();
|
const fetchEnd = performance.now();
|
||||||
|
|
||||||
console.log(`Fetched ${res.length} events in ${(fetchEnd - fetchStart)/1000} s`);
|
console.log(`Fetched ${res.length} events in ${(fetchEnd - fetchStart)/1000}s`);
|
||||||
console.info("Creating Output...");
|
console.info("Creating output...");
|
||||||
|
|
||||||
const text = await this.createOutput(res);
|
const text = await this.createOutput(res);
|
||||||
|
|
||||||
|
@ -91,7 +91,8 @@ ${json}
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportEnd = performance.now();
|
const exportEnd = performance.now();
|
||||||
console.info(`Export Successful! Exported ${res.length} events in ${(exportEnd - fetchStart)/1000} seconds`);
|
console.info(`Export successful!`)
|
||||||
|
console.log(`Exported ${res.length} events in ${(exportEnd - fetchStart)/1000} seconds`);
|
||||||
window.removeEventListener("beforeunload", this.onBeforeUnload);
|
window.removeEventListener("beforeunload", this.onBeforeUnload);
|
||||||
window.removeEventListener("onunload", this.abortExport);
|
window.removeEventListener("onunload", this.abortExport);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ export default class PlainTextExporter extends Exporter {
|
||||||
const res = await this.getRequiredEvents();
|
const res = await this.getRequiredEvents();
|
||||||
const fetchEnd = performance.now();
|
const fetchEnd = performance.now();
|
||||||
|
|
||||||
console.log(`Fetched ${res.length} events in ${(fetchEnd - fetchStart)/1000} s`);
|
console.log(`Fetched ${res.length} events in ${(fetchEnd - fetchStart)/1000}s`);
|
||||||
console.info("Creating Output...");
|
console.info("Creating Output...");
|
||||||
|
|
||||||
const text = await this.createOutput(res);
|
const text = await this.createOutput(res);
|
||||||
|
|
Loading…
Reference in a new issue