From 2f0c3b3c44e14ac7089ea1400f2acf5676fd37bb Mon Sep 17 00:00:00 2001 From: Pierce Date: Sun, 13 Jan 2019 20:31:17 -0500 Subject: [PATCH] Get package from url --- components/handler.js | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/handler.js b/components/handler.js index 5d3b5fa..abcdf78 100644 --- a/components/handler.js +++ b/components/handler.js @@ -3,6 +3,7 @@ const shelljs = require('shelljs'); const path = require('path'); const request = require('request'); const zip = require('adm-zip'); +const event = require('./events'); function downloadAsync (url, directory, name) { @@ -220,8 +221,13 @@ module.exports.makePackage = async function(versions, os) { }; module.exports.extractPackage = function(root, clientPackage) { - return new Promise(resolve => { + return new Promise(async resolve => { + if(clientPackage.startsWith('http')) { + await downloadAsync(clientPackage, root, "clientPackage.zip") + clientPackage = path.join(root, "clientPackage.zip") + } new zip(clientPackage).extractAllTo(root, true); + event.emit('package-extract', true); resolve(); }); }; \ No newline at end of file diff --git a/package.json b/package.json index a6e840b..b3a449e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-launcher-core", - "version": "1.1.0", + "version": "1.2.0", "description": "Module that downloads Minecraft assets and runs Minecraft.", "main": "index.js", "dependencies": {