Skip to content

Commit 00e43cb

Browse files
committed
Fix Vircadia client download URL
Changed the download URL for the latest Vircadia client release from `https://cdn.vircadia.com` to `https://api.github.com/repos/vircadia/vircadia/releases`.
1 parent 8c60a6d commit 00e43cb

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

pantheon.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
module.exports = {
1212
'cdn': {
13-
'root': 'https://cdn.vircadia.com',
13+
'root': 'https://api.github.com/repos/vircadia/vircadia/releases',
1414
'eventsFilename': 'vircadiaEvents.json',
1515
'metadataFilename': 'vircadiaMeta.json'
1616
},

src/background.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,27 @@ async function checkRunningApps() {
441441

442442
async function getDownloadURL() {
443443
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;
446465
} else {
447466
return false;
448467
}

src/electron_modules/networking/download.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var electronDlItemMeta = null;
1717
var electronDlItemEvents = null;
1818

1919
async function getCDNMetaJSON() {
20-
var metaURL = DEFAULT_CDN_URL + '/dist/launcher/' + DEFAULT_CDN_METADATA_FILENAME;
20+
var metaURL = DEFAULT_CDN_URL;
2121

2222
await electronDlMeta.download(win, metaURL, {
2323
directory: storagePath.main,

0 commit comments

Comments
 (0)