mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-25 06:49:51 +01:00
improved mods downloading support + added logging system
This commit is contained in:
parent
91f5d1c91a
commit
9ab2afacdd
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ node_modules/
|
|||||||
game
|
game
|
||||||
out/
|
out/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
launcher.json
|
146
package-lock.json
generated
146
package-lock.json
generated
@ -768,8 +768,7 @@
|
|||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.19.8",
|
"version": "12.19.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.19.8.tgz",
|
||||||
"integrity": "sha512-D4k2kNi0URNBxIRCb1khTnkWNHv8KSL1owPmS/K5e5t8B2GzMReY7AsJIY1BnP5KdlgC4rj9jk2IkDMasIE7xg==",
|
"integrity": "sha512-D4k2kNi0URNBxIRCb1khTnkWNHv8KSL1owPmS/K5e5t8B2GzMReY7AsJIY1BnP5KdlgC4rj9jk2IkDMasIE7xg=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"@types/responselike": {
|
"@types/responselike": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -784,7 +783,6 @@
|
|||||||
"version": "2.9.1",
|
"version": "2.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz",
|
||||||
"integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==",
|
"integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==",
|
||||||
"dev": true,
|
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
@ -927,6 +925,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
|
||||||
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
|
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
|
||||||
},
|
},
|
||||||
|
"axios": {
|
||||||
|
"version": "0.21.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
|
||||||
|
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
|
||||||
|
"requires": {
|
||||||
|
"follow-redirects": "^1.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"balanced-match": {
|
"balanced-match": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||||
@ -989,8 +995,7 @@
|
|||||||
"buffer-crc32": {
|
"buffer-crc32": {
|
||||||
"version": "0.2.13",
|
"version": "0.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||||
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=",
|
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"buffer-fill": {
|
"buffer-fill": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -1298,7 +1303,6 @@
|
|||||||
"version": "4.3.1",
|
"version": "4.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
|
||||||
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"ms": "2.1.2"
|
"ms": "2.1.2"
|
||||||
}
|
}
|
||||||
@ -1404,6 +1408,33 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz",
|
||||||
"integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==",
|
"integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"version": "2.6.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
|
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-zip": {
|
||||||
|
"version": "1.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
|
||||||
|
"integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"concat-stream": "^1.6.2",
|
||||||
|
"debug": "^2.6.9",
|
||||||
|
"mkdirp": "^0.5.4",
|
||||||
|
"yauzl": "^2.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1412,6 +1443,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz",
|
||||||
"integrity": "sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA=="
|
"integrity": "sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA=="
|
||||||
},
|
},
|
||||||
|
"electron-log": {
|
||||||
|
"version": "4.3.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/electron-log/-/electron-log-4.3.4.tgz",
|
||||||
|
"integrity": "sha512-Cd6xZ9if2J4NG+PNoi3cARAYoanbM4ddpod0faaL5LIhmwuSdxP9XH95C9SgTpHMqklbg8u3CFh1yqiaqo2Bng=="
|
||||||
|
},
|
||||||
"electron-notarize": {
|
"electron-notarize": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.0.0.tgz",
|
||||||
@ -1840,7 +1876,6 @@
|
|||||||
"version": "1.4.4",
|
"version": "1.4.4",
|
||||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
}
|
}
|
||||||
@ -1972,31 +2007,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extract-zip": {
|
"extract-zip": {
|
||||||
"version": "1.7.0",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||||
"integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==",
|
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"concat-stream": "^1.6.2",
|
"@types/yauzl": "^2.9.1",
|
||||||
"debug": "^2.6.9",
|
"debug": "^4.1.1",
|
||||||
"mkdirp": "^0.5.4",
|
"get-stream": "^5.1.0",
|
||||||
"yauzl": "^2.10.0"
|
"yauzl": "^2.10.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": {
|
"get-stream": {
|
||||||
"version": "2.6.9",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"ms": "2.0.0"
|
"pump": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"ms": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
|
||||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
|
||||||
"dev": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2019,7 +2046,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||||
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
|
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"pend": "~1.2.0"
|
"pend": "~1.2.0"
|
||||||
}
|
}
|
||||||
@ -2126,6 +2152,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"follow-redirects": {
|
||||||
|
"version": "1.13.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz",
|
||||||
|
"integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA=="
|
||||||
|
},
|
||||||
"forever-agent": {
|
"forever-agent": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||||
@ -2454,6 +2485,27 @@
|
|||||||
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
|
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"hasha": {
|
||||||
|
"version": "5.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz",
|
||||||
|
"integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==",
|
||||||
|
"requires": {
|
||||||
|
"is-stream": "^2.0.0",
|
||||||
|
"type-fest": "^0.8.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"is-stream": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw=="
|
||||||
|
},
|
||||||
|
"type-fest": {
|
||||||
|
"version": "0.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz",
|
||||||
|
"integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"homedir-polyfill": {
|
"homedir-polyfill": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
|
||||||
@ -2997,16 +3049,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mime-db": {
|
"mime-db": {
|
||||||
"version": "1.44.0",
|
"version": "1.47.0",
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.47.0.tgz",
|
||||||
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
|
"integrity": "sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw=="
|
||||||
},
|
},
|
||||||
"mime-types": {
|
"mime-types": {
|
||||||
"version": "2.1.27",
|
"version": "2.1.30",
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.30.tgz",
|
||||||
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
|
"integrity": "sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"mime-db": "1.44.0"
|
"mime-db": "1.47.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mimic-fn": {
|
"mimic-fn": {
|
||||||
@ -3086,8 +3138,7 @@
|
|||||||
"ms": {
|
"ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"mute-stream": {
|
"mute-stream": {
|
||||||
"version": "0.0.8",
|
"version": "0.0.8",
|
||||||
@ -3399,7 +3450,6 @@
|
|||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
@ -3591,8 +3641,7 @@
|
|||||||
"pend": {
|
"pend": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=",
|
"integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"performance-now": {
|
"performance-now": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
@ -3755,7 +3804,6 @@
|
|||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
|
||||||
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"end-of-stream": "^1.1.0",
|
"end-of-stream": "^1.1.0",
|
||||||
"once": "^1.3.1"
|
"once": "^1.3.1"
|
||||||
@ -4044,6 +4092,14 @@
|
|||||||
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"sha1-file": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/sha1-file/-/sha1-file-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-ejHwMRlsshtZF/UVYfuzq0B4jSUFPxBgbBUnYr1sS4K7i9j5Ix6bz2ZxxDIXB6tqZCVv08Gjp1McFkoGIsa7Jw==",
|
||||||
|
"requires": {
|
||||||
|
"hasha": "^5.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"shebang-command": {
|
"shebang-command": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||||
@ -4517,9 +4573,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uri-js": {
|
"uri-js": {
|
||||||
"version": "4.4.0",
|
"version": "4.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
|
||||||
"integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
|
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"punycode": "^2.1.0"
|
"punycode": "^2.1.0"
|
||||||
}
|
}
|
||||||
@ -4645,8 +4701,7 @@
|
|||||||
"wrappy": {
|
"wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"xmlbuilder": {
|
"xmlbuilder": {
|
||||||
"version": "9.0.7",
|
"version": "9.0.7",
|
||||||
@ -4794,7 +4849,6 @@
|
|||||||
"version": "2.10.0",
|
"version": "2.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||||
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
|
"integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"buffer-crc32": "~0.2.3",
|
"buffer-crc32": "~0.2.3",
|
||||||
"fd-slicer": "~1.1.0"
|
"fd-slicer": "~1.1.0"
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"repository": "AltarikMC/Launcher",
|
"repository": "AltarikMC/Launcher",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron-forge start",
|
"start": "electron-forge start",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "electron .",
|
||||||
"package": "electron-forge package",
|
"package": "electron-forge package",
|
||||||
"make": "electron-forge make"
|
"make": "electron-forge make"
|
||||||
},
|
},
|
||||||
@ -21,9 +21,13 @@
|
|||||||
"electron": "^12.0.2"
|
"electron": "^12.0.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios": "^0.21.1",
|
||||||
"electron-is-dev": "^2.0.0",
|
"electron-is-dev": "^2.0.0",
|
||||||
|
"electron-log": "^4.3.4",
|
||||||
"electron-squirrel-startup": "^1.0.0",
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
"minecraft-launcher-core": "^3.16.2"
|
"extract-zip": "^2.0.1",
|
||||||
|
"minecraft-launcher-core": "^3.16.2",
|
||||||
|
"sha1-file": "^2.0.0"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"forge": "./config.forge.js"
|
"forge": "./config.forge.js"
|
||||||
|
@ -28,6 +28,7 @@ body{
|
|||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
width: 322px;
|
width: 322px;
|
||||||
height: 398px;
|
height: 398px;
|
||||||
|
padding: 20px 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#media {
|
#media {
|
||||||
@ -172,3 +173,20 @@ h3 {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected h3 {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar h2,
|
||||||
|
#sidebar-content h3 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar h2 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar-content {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
@ -11,14 +11,18 @@ const maxMem = document.querySelector('#maxMem')
|
|||||||
const outputMinMem = document.querySelector('#outputMinMem')
|
const outputMinMem = document.querySelector('#outputMinMem')
|
||||||
const outputMaxMem = document.querySelector('#outputMaxMem')
|
const outputMaxMem = document.querySelector('#outputMaxMem')
|
||||||
const totalMem = os.totalmem() / (1.049 * Math.pow(10, 6))
|
const totalMem = os.totalmem() / (1.049 * Math.pow(10, 6))
|
||||||
|
const sidebar = document.querySelector("#sidebar-content")
|
||||||
|
|
||||||
document.body.onload = (e) => {
|
let selectedChapter = -1;
|
||||||
|
|
||||||
|
document.body.onload = () => {
|
||||||
minMem.max = totalMem
|
minMem.max = totalMem
|
||||||
maxMem.max = totalMem
|
maxMem.max = totalMem
|
||||||
minMem.value = localStorage.getItem("minMem") != null ? localStorage.getItem("minMem") : 1024
|
minMem.value = localStorage.getItem("minMem") != null ? localStorage.getItem("minMem") : 1024
|
||||||
outputMinMem.innerHTML = minMem.value
|
outputMinMem.innerHTML = minMem.value
|
||||||
maxMem.value = localStorage.getItem("maxMem") != null ? localStorage.getItem("maxMem") : 2048
|
maxMem.value = localStorage.getItem("maxMem") != null ? localStorage.getItem("maxMem") : 2048
|
||||||
outputMaxMem.innerHTML = maxMem.value
|
outputMaxMem.innerHTML = maxMem.value
|
||||||
|
demandModsInformations()
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.on("nick", (event, args) => {
|
ipcRenderer.on("nick", (event, args) => {
|
||||||
@ -33,7 +37,8 @@ launchBtn.addEventListener("click", e => {
|
|||||||
if(Number(minMem.value) <= Number(maxMem.value)){
|
if(Number(minMem.value) <= Number(maxMem.value)){
|
||||||
ipcRenderer.send('launch', {
|
ipcRenderer.send('launch', {
|
||||||
minMem: minMem.value + "M",
|
minMem: minMem.value + "M",
|
||||||
maxMem: maxMem.value + "M"
|
maxMem: maxMem.value + "M",
|
||||||
|
chapter: selectedChapter
|
||||||
})
|
})
|
||||||
launchBtn.disabled = true
|
launchBtn.disabled = true
|
||||||
localStorage.setItem("minMem", minMem.value)
|
localStorage.setItem("minMem", minMem.value)
|
||||||
@ -82,6 +87,32 @@ ipcRenderer.on('launch', (e, args) => {
|
|||||||
loadingMessage.classList.add('hidden')
|
loadingMessage.classList.add('hidden')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcRenderer.on("modsInformations", (e, args) => {
|
||||||
|
if(args === null) {
|
||||||
|
sidebar.innerHTML = "<p>Une erreur est survenue lors de la récupération des informations, vérifiez votre connexion internet puis cliquez sur réessayez</p>"
|
||||||
|
+ "<button onclick=\"demandModsInformations()\">Réessayer</button>"
|
||||||
|
} else {
|
||||||
|
let element = ""
|
||||||
|
for(const i in args) {
|
||||||
|
element += `<div data-chapter="${i}" onclick="changeSelectedChapter(this)"><h3>${args[i].title}</h3><p>${args[i].description}</p></div>`
|
||||||
|
}
|
||||||
|
sidebar.innerHTML = element
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function demandModsInformations() {
|
||||||
|
ipcRenderer.send('demandModsInformations')
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeSelectedChapter(element) {
|
||||||
|
selectedChapter = Number(element.dataset.chapter)
|
||||||
|
document.querySelectorAll("#sidebar-content > div").forEach((v, key) => {
|
||||||
|
v.classList.remove("selected")
|
||||||
|
})
|
||||||
|
element.classList.add("selected")
|
||||||
|
launchBtn.classList.remove('hidden')
|
||||||
|
}
|
||||||
|
|
||||||
disconnectBtn.addEventListener('click', e => {
|
disconnectBtn.addEventListener('click', e => {
|
||||||
ipcRenderer.send('disconnect')
|
ipcRenderer.send('disconnect')
|
||||||
})
|
})
|
||||||
|
@ -32,7 +32,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
|
<h2>Chapitres</h2>
|
||||||
|
<div id="sidebar-content">
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="media">
|
<div id="media">
|
||||||
<div id="options">
|
<div id="options">
|
||||||
@ -51,7 +54,7 @@
|
|||||||
<div id="account">
|
<div id="account">
|
||||||
<div id="nick"></div><!-- <img src=""> Head du joueur -->
|
<div id="nick"></div><!-- <img src=""> Head du joueur -->
|
||||||
</div>
|
</div>
|
||||||
<button id="launch-btn">
|
<button id="launch-btn" class="hidden">
|
||||||
<div id="launch-text">JOUER</div>
|
<div id="launch-text">JOUER</div>
|
||||||
<div id="loading-message" class="hidden">Téléchargement de Minecraft en cours...</div>
|
<div id="loading-message" class="hidden">Téléchargement de Minecraft en cours...</div>
|
||||||
<div id="fullprogressbar" class="hidden"><div id="progressbar"></div></div>
|
<div id="fullprogressbar" class="hidden"><div id="progressbar"></div></div>
|
||||||
|
@ -1,26 +1,32 @@
|
|||||||
const { app, BrowserWindow, Menu, ipcMain, Notification, autoUpdater, dialog } = require('electron')
|
const { app, BrowserWindow, Menu, ipcMain, Notification, autoUpdater, dialog } = require('electron')
|
||||||
|
const logger = require('electron-log')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
if (require('electron-squirrel-startup')) {
|
if (require('electron-squirrel-startup')) {
|
||||||
require("./install.js").handleSquirrelEvent(app)
|
require("./install.js").handleSquirrelEvent(app)
|
||||||
app.quit()
|
app.quit()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// don't work
|
require('./updater.js').configUpdater(app, autoUpdater, dialog, logger)
|
||||||
require('./updater.js').configUpdater(app, autoUpdater, dialog)
|
|
||||||
|
|
||||||
|
const axios = require('axios').default
|
||||||
|
const sha1File = require('sha1-file')
|
||||||
|
const fs = require('fs')
|
||||||
|
const constants = require("constants")
|
||||||
|
const zip = require('extract-zip')
|
||||||
|
|
||||||
const { Client, Authenticator } = require('minecraft-launcher-core')
|
const { Client, Authenticator } = require('minecraft-launcher-core')
|
||||||
const appdata = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share")
|
const appdata = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Preferences' : process.env.HOME + "/.local/share")
|
||||||
|
|
||||||
const launcher = new Client();
|
const launcher = new Client()
|
||||||
const iconPath = join(__dirname, "icon.ico");
|
const iconPath = join(__dirname, "icon.ico")
|
||||||
let win = null
|
let win = null
|
||||||
let auth = null
|
let auth = null
|
||||||
|
|
||||||
let Minecraftpath = join(appdata, ".altarik")
|
let Minecraftpath = join(appdata, ".altarik")
|
||||||
let clientPackage = "https://www.dropbox.com/s/ww6a052nzzgojdm/modpack.zip?dl=1"
|
// let clientPackage = "https://www.dropbox.com/s/ww6a052nzzgojdm/modpack.zip?dl=1"
|
||||||
let version = "1.16.4"
|
let version = "1.16.4"
|
||||||
let versionFolder = "fabric-loader-0.10.8-1.16.4"
|
let versionFolder = "fabric-loader-0.10.8-1.16.4"
|
||||||
|
let modsList = undefined
|
||||||
|
|
||||||
function createWindow () {
|
function createWindow () {
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
@ -84,17 +90,13 @@ ipcMain.on("login", (event, args) => {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.warn(err)
|
logger.warn(err)
|
||||||
showNotification("Erreur de connexion")
|
showNotification("Erreur de connexion")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function showNotification(title, body="") {
|
function showNotification(title, body="") {
|
||||||
const notification = {
|
new Notification({ title: title, body: body }).show()
|
||||||
title: title,
|
|
||||||
body: body
|
|
||||||
}
|
|
||||||
new Notification(notification).show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on("notification", (event, args) => {
|
ipcMain.on("notification", (event, args) => {
|
||||||
@ -102,34 +104,183 @@ ipcMain.on("notification", (event, args) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on("launch", (event, args) => {
|
ipcMain.on("launch", (event, args) => {
|
||||||
let opts = {
|
extractMods(Number(args.chapter), event).then(() => {
|
||||||
clientPackage: clientPackage,
|
launcher.launch({
|
||||||
authorization: auth,
|
// clientPackage: clientPackage,
|
||||||
root: Minecraftpath,
|
authorization: auth,
|
||||||
version: {
|
root: Minecraftpath,
|
||||||
number: version,
|
version: {
|
||||||
type: "release",
|
number: version,
|
||||||
custom: versionFolder
|
type: "release",
|
||||||
},
|
custom: versionFolder
|
||||||
memory: {
|
},
|
||||||
max: args.maxMem,
|
memory: {
|
||||||
min: args.minMem
|
max: args.maxMem,
|
||||||
}
|
min: args.minMem
|
||||||
}
|
}
|
||||||
launcher.launch(opts)
|
})
|
||||||
// launcher.on('debug', (e) => console.log("debug", e));
|
// launcher.on('debug', (e) => console.log("debug", e));
|
||||||
// launcher.on('data', (e) => console.log("data", e));
|
// launcher.on('data', (e) => console.log("data", e));
|
||||||
launcher.on('progress', (e) => event.sender.send("progress", e))
|
launcher.on('progress', (e) => {
|
||||||
launcher.on('arguments', (e) => event.sender.send("launch", e))
|
event.sender.send("progress", e)
|
||||||
launcher.on('close', (e) => {
|
logger.info(`progress ${e.type} :${e.task} / ${e.total}`)
|
||||||
event.sender.send("close", e)
|
})
|
||||||
if(e !== 0){
|
launcher.on('arguments', (e) => {
|
||||||
showNotification("Une erreur est survenue", "Minecraft ne s'est pas fermé correctement")
|
event.sender.send("launch", e)
|
||||||
}
|
logger.info("launching the game")
|
||||||
})
|
logger.info(e)
|
||||||
|
})
|
||||||
|
launcher.on('close', (e) => {
|
||||||
|
event.sender.send("close", e)
|
||||||
|
if(e !== 0){
|
||||||
|
logger.warn("Minecraft didn't close properly")
|
||||||
|
logger.warn(e)
|
||||||
|
showNotification("Une erreur est survenue", "Minecraft ne s'est pas fermé correctement")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch((err) => {
|
||||||
|
showNotification("Impossible de lancer le jeu")
|
||||||
|
logger.error('Unable to launch the game')
|
||||||
|
logger.error(err)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on("disconnect", (e) => {
|
ipcMain.on("disconnect", (e) => {
|
||||||
win.loadFile('src/client/login.html')
|
win.loadFile('src/client/login.html')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
ipcMain.on("demandModsInformations", (e) => {
|
||||||
|
getModsInformations(e)
|
||||||
|
})
|
||||||
|
|
||||||
|
function getModsInformations(event) {
|
||||||
|
axios.get("https://altarik.fr/launcher.json").then(o => {
|
||||||
|
if(o.status === 200 && o.headers["content-type"] === "application/json") {
|
||||||
|
folder = join(process.env.LOCALAPPDATA, "altarik-launcher", "data")
|
||||||
|
if(!fs.existsSync(folder))
|
||||||
|
fs.mkdirSync(folder)
|
||||||
|
fs.writeFileSync(join(folder, "launcher.json"), JSON.stringify(o.data))
|
||||||
|
event.sender.send('modsInformations', extractModsInformations(o.data))
|
||||||
|
} else {
|
||||||
|
event.sender.send('modsInformations', extractModsFromFileSystem())
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
logger.error("Unable to connect to server")
|
||||||
|
logger.error(err)
|
||||||
|
event.sender.send('informations', extractModsFromFileSystem())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractModsFromFileSystem() {
|
||||||
|
content = fs.readFileSync(join(process.env.LOCALAPPDATA, "altarik-launcher/data/launcher.json"))
|
||||||
|
if(content !== null) {
|
||||||
|
showNotification("Impossible de récupérer certaines informations en ligne", "utilisation des dernières données récupérées")
|
||||||
|
return extractModsInformations(JSON.parse(o.data))
|
||||||
|
} else {
|
||||||
|
showNotification("Impossible de récupérer certaines informations en ligne", "Veuillez réessayez en cliquant sur le bouton")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractModsInformations(json) {
|
||||||
|
modsList = json.chapters
|
||||||
|
return modsList
|
||||||
|
}
|
||||||
|
|
||||||
|
async function extractMods(chapterId, event) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
modsFolder = join(Minecraftpath, "mods")
|
||||||
|
shaderFolder = join(Minecraftpath, "shaderpacks")
|
||||||
|
if(fs.existsSync(modsFolder))
|
||||||
|
fs.rmSync(modsFolder, { recursive: true })
|
||||||
|
if(fs.existsSync(shaderFolder))
|
||||||
|
fs.rmSync(shaderFolder, { recursive: true })
|
||||||
|
for(const i in modsList) {
|
||||||
|
if(Number(i) === chapterId) {
|
||||||
|
const chapter = modsList[i]
|
||||||
|
let j
|
||||||
|
for(j in chapter.modspack.mods) {
|
||||||
|
event.sender.send("progress", {type: "mods", task: i, total: chapter.modspack.mods.length })
|
||||||
|
modpackFolder = join(Minecraftpath, "modpack", chapter.title)
|
||||||
|
if(!fs.existsSync(modpackFolder))
|
||||||
|
fs.mkdirSync(modpackFolder, { recursive: true })
|
||||||
|
const path = join(modpackFolder, `modpack${j}.zip`)
|
||||||
|
try {
|
||||||
|
fs.accessSync(path, constants.W_OK)
|
||||||
|
sha1 = await sha1File(path)
|
||||||
|
if(sha1 === chapter.modspack.sha1sum) {
|
||||||
|
await unzipMods(path)
|
||||||
|
} else {
|
||||||
|
await downloadAndExtractMods(chapter.modspack.mods[j], path).catch(err => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
try {
|
||||||
|
await downloadAndExtractMods(chapter.modspack.mods[j], path)
|
||||||
|
} catch(e) {
|
||||||
|
reject({ err, e })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
event.sender.send("progress", {type: "mods", task: Number(j)+1, total: chapter.modspack.mods.length })
|
||||||
|
resolve()
|
||||||
|
return
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reject("didn't found the correct chapter" + chapter)
|
||||||
|
return
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadMods(link, path) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.get(link, {
|
||||||
|
responseType: "stream"
|
||||||
|
}).then(res => {
|
||||||
|
if(res.status === 200) {
|
||||||
|
res.data.pipe(fs.createWriteStream(path));
|
||||||
|
res.data.on("end", () => {
|
||||||
|
logger.log("download completed");
|
||||||
|
resolve("download completed")
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
reject(res.status)
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function unzipMods(path) {
|
||||||
|
return new Promise(async (resolve, reject) => {
|
||||||
|
zip(path, { dir: Minecraftpath }).then(() => {
|
||||||
|
resolve()
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadAndExtractMods(link, path) {
|
||||||
|
return new Promise(async(resolve, reject) => {
|
||||||
|
downloadMods(link, path).then(() => {
|
||||||
|
unzipMods(path).then(() => {
|
||||||
|
resolve()
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ const isDev = require('electron-is-dev')
|
|||||||
const { Notification } = require('electron')
|
const { Notification } = require('electron')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const pkg = require('../../package.json')
|
const pkg = require('../../package.json')
|
||||||
const { format } = require('util')
|
|
||||||
const server = 'https://update.electronjs.org'
|
const server = 'https://update.electronjs.org'
|
||||||
|
|
||||||
function initUpdater(autoUpdater) {
|
function initUpdater(autoUpdater) {
|
||||||
@ -12,9 +11,13 @@ function initUpdater(autoUpdater) {
|
|||||||
}, 10 * 60 * 1000) // 10 minutes
|
}, 10 * 60 * 1000) // 10 minutes
|
||||||
}
|
}
|
||||||
|
|
||||||
function configUpdater(app, autoUpdater, dialog) {
|
function configUpdater(app, autoUpdater, dialog, logger) {
|
||||||
if(isDev)
|
if(isDev) {
|
||||||
|
logger.info(`developpement version ${app.getVersion()}`)
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
logger.info(`production version ${app.getVersion()}`)
|
||||||
|
|
||||||
const feed = `${server}/${pkg.repository}/${process.platform}-${process.arch}/${app.getVersion()}`
|
const feed = `${server}/${pkg.repository}/${process.platform}-${process.arch}/${app.getVersion()}`
|
||||||
autoUpdater.setFeedURL(feed)
|
autoUpdater.setFeedURL(feed)
|
||||||
app.isReady ? initUpdater(autoUpdater) : app.on("ready", () => initUpdater(autoUpdater))
|
app.isReady ? initUpdater(autoUpdater) : app.on("ready", () => initUpdater(autoUpdater))
|
||||||
@ -31,38 +34,26 @@ function configUpdater(app, autoUpdater, dialog) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
||||||
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
if (returnValue.response === 0) {
|
||||||
|
logger.info("Quit applicaiton to install update")
|
||||||
|
autoUpdater.quitAndInstall()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
autoUpdater.on('error', message => {
|
autoUpdater.on('error', message => {
|
||||||
console.error('There was a problem updating the application')
|
logger.error('There was a problem updating the application')
|
||||||
console.error(message)
|
logger.error(message)
|
||||||
/*
|
|
||||||
showNotification(feed)
|
|
||||||
const dialogOpts = {
|
|
||||||
type: 'info',
|
|
||||||
buttons: ['Fermer'],
|
|
||||||
title: 'Erreur lors de la tentative de mise à jour du launcher',
|
|
||||||
message: "Une erreur est survenue lros de la tentative de mise à jour du launcher",
|
|
||||||
detail: message
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.showMessageBox(dialogOpts) */
|
|
||||||
})
|
})
|
||||||
|
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', () => {
|
||||||
showNotification("Altarik launcher", "downloading update")
|
showNotification("Altarik launcher", "downloading update")
|
||||||
autoUpdater.down
|
logger.info("update available, downloading...")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNotification(title, body="") {
|
function showNotification(title, body="") {
|
||||||
const content = {
|
new Notification({ title: title, body: body }).show()
|
||||||
title: title,
|
|
||||||
body: body
|
|
||||||
}
|
|
||||||
new Notification(content).show()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
Reference in New Issue
Block a user