Auto updater changes

This commit is contained in:
Natsumi
2022-07-02 06:44:59 +12:00
parent 80b2c4548f
commit 9dcce5e707
3 changed files with 45 additions and 23 deletions

View File

@@ -11784,9 +11784,6 @@ speechSynthesis.getVoices();
}
if (!configRepository.getString('VRCX_branch')) {
$app.data.branch = 'Stable';
if (appVersion.substring(0, 24) === 'VRCX.PyPyDance.Companion') {
$app.data.branch = 'Beta';
}
configRepository.setString('VRCX_branch', $app.data.branch);
}
if (configRepository.getString('VRCX_lastVRCXVersion')) {
@@ -18093,11 +18090,14 @@ speechSynthesis.getVoices();
this.downloadFileComplete('Failed');
return;
case -16:
if (this.downloadCurrent.autoInstall) {
this.restartVRCX();
} else {
this.downloadDialog.visible = false;
this.showVRCXUpdateDialog();
if (this.downloadCurrent.ref.id === 'VRCXUpdate') {
if (this.downloadCurrent.autoInstall) {
this.restartVRCX();
} else {
this.downloadDialog.visible = false;
this.pendingVRCXUpdate = this.downloadCurrent.ref.name;
this.showVRCXUpdateDialog();
}
}
this.downloadFileComplete('Success');
return;
@@ -18556,11 +18556,13 @@ speechSynthesis.getVoices();
$app.data.VRCXUpdateDialog = {
visible: false,
updatePending: false,
updatePendingIsLatest: false,
release: '',
releases: []
};
$app.data.checkingForVRCXUpdate = false;
$app.data.pendingVRCXUpdate = '';
$app.data.branches = {
Stable: {
@@ -18568,8 +18570,8 @@ speechSynthesis.getVoices();
urlReleases: 'https://vrcx.pypy.moe/releases/pypy-vrc.json',
urlLatest: 'https://vrcx.pypy.moe/releases/latest/pypy-vrc.json'
},
Beta: {
name: 'Beta',
Nightly: {
name: 'Nightly',
urlReleases: 'https://vrcx.pypy.moe/releases/natsumi-sama.json',
urlLatest: 'https://vrcx.pypy.moe/releases/latest/natsumi-sama.json'
}
@@ -18579,6 +18581,7 @@ speechSynthesis.getVoices();
this.$nextTick(() => adjustDialogZ(this.$refs.VRCXUpdateDialog.$el));
var D = this.VRCXUpdateDialog;
D.visible = true;
D.updatePendingIsLatest = false;
D.updatePending = await AppApi.CheckForUpdateExe();
this.loadBranchVersions();
};
@@ -18668,6 +18671,13 @@ speechSynthesis.getVoices();
return;
}
for (var release of json) {
if (
release.target_commitish === 'PyPyDanceCompanion' ||
release.prerelease
) {
// skip old branch name and prerelease builds
continue;
}
for (var asset of release.assets) {
if (
asset.content_type === 'application/x-msdownload' &&
@@ -18679,6 +18689,11 @@ speechSynthesis.getVoices();
}
D.releases = releases;
D.release = json[0].name;
this.VRCXUpdateDialog.updatePendingIsLatest = false;
if (D.release === this.pendingVRCXUpdate) {
// update already downloaded and latest version
this.VRCXUpdateDialog.updatePendingIsLatest = true;
}
if (configRepository.getString('VRCX_branch') !== this.branch) {
configRepository.setString('VRCX_branch', this.branch);
}
@@ -18689,8 +18704,10 @@ speechSynthesis.getVoices();
};
$app.methods.checkForVRCXUpdate = async function () {
if (await AppApi.CheckForUpdateExe()) {
return;
if (this.branch === 'Beta') {
// move Beta users to stable
this.branch = 'Stable';
configRepository.setString('VRCX_branch', this.branch);
}
var url = this.branches[this.branch].urlLatest;
this.checkingForVRCXUpdate = true;
@@ -18711,7 +18728,12 @@ speechSynthesis.getVoices();
json.published_at,
'YYYY-MM-DD HH24:MI:SS'
)})`;
if (json.name > this.appVersion) {
var name = json.name;
this.VRCXUpdateDialog.updatePendingIsLatest = false;
if (name === this.pendingVRCXUpdate) {
// update already downloaded
this.VRCXUpdateDialog.updatePendingIsLatest = true;
} else if (name > this.appVersion) {
for (var asset of json.assets) {
if (
asset.content_type === 'application/x-msdownload' &&
@@ -18726,7 +18748,6 @@ speechSynthesis.getVoices();
return;
}
this.notifyMenu('settings');
var name = json.name;
var type = 'Auto';
if (this.autoUpdateVRCX === 'Notify') {
this.showVRCXUpdateDialog();