Automatically upload export to master server

Upload the created export data zip file to a new /api/upload-export
endpoint on the master server which unpacks it into the appropriate
directory on the master.
This commit is contained in:
Hornwitser committed 2020-05-26 15:31:42 +02:00
1 parent f3d4cfdcf5
commit 36cf14074e
5 files changed
+62 -4

No files matched your search

+2 -2
View File
@@ -306,6 +306,7 @@ async function exportLocale(server, modVersions, modOrder, languageCode) {
*
* @param {module:lib/factorio.FactorioServer} server -
* The server to export the data from.
* @returns {JSZip} zip file with exported data.
* @memberof module:lib/factorio
*/
async function exportData(server) {
@@ -347,8 +348,7 @@ async function exportData(server) {
zip.file("export/item-spritesheet.png", await iconSheet.getBufferAsync(Jimp.MIME_PNG));
zip.file("export/item-metadata.json", JSON.stringify([...itemData.entries()]));
zip.file("export/locale.json", JSON.stringify([...locale.entries()]));
let content = await zip.generateAsync({ type: "nodebuffer" });
await fs.outputFile("temp/export.zip", content);
return zip;
}