File tree 3 files changed +23
-4
lines changed
electron_modules/networking
3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 10
10
11
11
module . exports = {
12
12
'cdn' : {
13
- 'root' : 'https://cdn.vircadia .com' ,
13
+ 'root' : 'https://api.github .com/repos/vircadia/vircadia/releases ' ,
14
14
'eventsFilename' : 'vircadiaEvents.json' ,
15
15
'metadataFilename' : 'vircadiaMeta.json'
16
16
} ,
Original file line number Diff line number Diff line change @@ -441,8 +441,27 @@ async function checkRunningApps() {
441
441
442
442
async function getDownloadURL ( ) {
443
443
var metaJSON = await download . cdn . meta ( ) ;
444
- if ( metaJSON ) {
445
- return metaJSON . latest . url ;
444
+
445
+ /*
446
+ GitHub provides releases in the following format:
447
+ metaJSON -> A list of all releases.
448
+ metaJSON[0] -> Latest release.
449
+ metaJSON[0].assets -> A list of downloadable assets (installers, etc) for the latest release.
450
+ metaJSON[0].assets[0].browser_download_url -> The download link for the first asset in the list.
451
+
452
+ Since the assets list could contain any number of files in any order, we need to search through the list until we find the windows installer.
453
+ The windows installer will be demarcated by its content type: 'application/x-msdownload'.
454
+ */
455
+
456
+ let latest_url = false ;
457
+ metaJSON [ 0 ] . assets . forEach ( ( asset ) => {
458
+ if ( asset . content_type === 'application/x-msdownload' ) {
459
+ latest_url = asset . browser_download_url ;
460
+ }
461
+ } ) ;
462
+
463
+ if ( metaJSON && latest_url ) {
464
+ return latest_url ;
446
465
} else {
447
466
return false ;
448
467
}
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ var electronDlItemMeta = null;
17
17
var electronDlItemEvents = null ;
18
18
19
19
async function getCDNMetaJSON ( ) {
20
- var metaURL = DEFAULT_CDN_URL + '/dist/launcher/' + DEFAULT_CDN_METADATA_FILENAME ;
20
+ var metaURL = DEFAULT_CDN_URL ;
21
21
22
22
await electronDlMeta . download ( win , metaURL , {
23
23
directory : storagePath . main ,
You can’t perform that action at this time.
0 commit comments