moving to private repo
This commit is contained in:
+4
-3
@@ -248,10 +248,11 @@ function setupApp() {
|
||||
const adb = new ADB();
|
||||
|
||||
ipcMain.on('download-url', async (event, { url, token, directory, filename }) => {
|
||||
await download(url, path.join(directory, filename), stats => {
|
||||
download(url, path.join(directory, filename), stats => {
|
||||
return event.sender.send('download-progress', { stats, token });
|
||||
}).catch(e => console.log(e));
|
||||
event.sender.send('download-url', { token });
|
||||
})
|
||||
.then(() => event.sender.send('download-url', { token }))
|
||||
.catch(e => event.sender.send('download-url-fail', { e, token }));
|
||||
});
|
||||
ipcMain.on('extract-file', async (event, { token, directory, filename }) => {
|
||||
extract(
|
||||
|
||||
@@ -21,7 +21,9 @@ module.exports = function(url, path, progress) {
|
||||
callback(null, response);
|
||||
}
|
||||
});
|
||||
|
||||
request.on('error', function(err) {
|
||||
callback(err);
|
||||
});
|
||||
request.setTimeout(TIMEOUT, function() {
|
||||
request.abort();
|
||||
callback(new Error(`request timeout after ${TIMEOUT / 1000.0}s`));
|
||||
@@ -31,7 +33,7 @@ module.exports = function(url, path, progress) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
get(uri.href, (err, res) => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
return reject(err);
|
||||
}
|
||||
const len = parseInt(res.headers['content-length'], 10);
|
||||
let downloaded = 0;
|
||||
|
||||
@@ -59,6 +59,7 @@ export class AppWindow {
|
||||
show: !showAfterSetup,
|
||||
frame: false,
|
||||
webPreferences: {
|
||||
webviewTag: true,
|
||||
nodeIntegration: true,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user