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

@@ -94,6 +94,7 @@ namespace VRCX
public void DownloadFile(string url, int size, string AppVersion)
{
DownloadProgress = 0;
DownloadSize = size;
DownloadCanceled = false;
DownloadTempLocation = Path.Combine(Program.AppDataDirectory, "tempDownload.exe");

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();

View File

@@ -2194,18 +2194,18 @@ html
//- dialog: update VRCX
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="VRCXUpdateDialog" :visible.sync="VRCXUpdateDialog.visible" title="VRCX Updater" width="400px")
div(v-loading="checkingForVRCXUpdate" style="margin-top:15px")
template(v-if="VRCXUpdateDialog.updatePending")
span Update ready for install, restart VRCX to apply.
template(v-else)
el-select(v-model="branch" @change="loadBranchVersions" style="display:inline-block;width:150px;margin-right:15px")
el-option(v-once v-for="branch in branches" :key="branch.name" :label="branch.name" :value="branch.name")
el-select(v-model="VRCXUpdateDialog.release" style="display:inline-block;width:150px")
el-option(v-for="item in VRCXUpdateDialog.releases" :key="item.name" :label="item.tag_name" :value="item.name")
template(v-if="!VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release === appVersion")
div(v-if="VRCXUpdateDialog.updatePending" style="margin-bottom:15px")
span(v-text="pendingVRCXUpdate")
br
span Ready for install, restart VRCX to apply.
el-select(v-model="branch" @change="loadBranchVersions" style="display:inline-block;width:150px;margin-right:15px")
el-option(v-once v-for="branch in branches" :key="branch.name" :label="branch.name" :value="branch.name")
el-select(v-model="VRCXUpdateDialog.release" style="display:inline-block;width:150px")
el-option(v-for="item in VRCXUpdateDialog.releases" :key="item.name" :label="item.tag_name" :value="item.name")
div(v-if="!VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release === appVersion" style="margin-top:15px")
span VRCX is up to date.
template(#footer)
el-button(v-if="!VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release !== appVersion" type="primary" size="small" @click="installVRCXUpdate") Download
el-button(v-if="(VRCXUpdateDialog.updatePending && VRCXUpdateDialog.release !== pendingVRCXUpdate) || VRCXUpdateDialog.release !== appVersion" type="primary" size="small" @click="installVRCXUpdate") Download
el-button(v-if="VRCXUpdateDialog.updatePending" type="primary" size="small" @click="restartVRCX") Install
//- dialog: launch