Skip to content

Commit

Permalink
minor change to downloading to work with https servers
Browse files Browse the repository at this point in the history
  • Loading branch information
Kensaa committed Dec 23, 2023
1 parent 2ffe02a commit fe22f70
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions launcher/electron/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs'
import * as path from 'path'
import * as http from 'http'
import * as https from 'https'
import { createHash } from 'crypto'
import fetch from 'electron-fetch'

Expand All @@ -19,13 +19,15 @@ export function download(address: string, filepath: string) {
fs.writeFileSync(filepath, '')
}
const file = fs.createWriteStream(filepath)
http.get(address, res => {
res.pipe(file)
file.on('finish', () => {
file.close()
resolve()
https
.get(address, res => {
res.pipe(file)
file.on('finish', () => {
file.close()
resolve()
})
})
}).on('error', err => reject(err))
.on('error', err => reject(err))
})
}

Expand Down
2 changes: 1 addition & 1 deletion launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A Minecraft launcher with auto-update feature to facilitate playing modded minecraft",
"author": "Kensa",
"private": true,
"version": "2.4.3",
"version": "2.4.4",
"main": "dist-electron/electron.js",
"scripts": {
"dev": "vite",
Expand Down

0 comments on commit fe22f70

Please sign in to comment.