0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-10 05:25:07 +00:00
VueTube/NUXT/pages/mods/updates.vue

100 lines
2.8 KiB
Vue
Raw Normal View History

2022-03-07 14:36:23 +00:00
<template>
2022-08-06 13:42:35 +00:00
<div style="padding: 2em;">
<v-icon x-large color="primary" style="padding-bottom: 0.25em;">mdi-cellphone-arrow-down</v-icon>
<div v-if="status == 'checking'">
<h1>{{ lang.checking }}</h1>
<div>{{ lang.installed }}: {{ installedVersion }}</div>
<center>
<v-progress-circular indeterminate color="primary" size="75" style="padding-top: 10em;" />
</center>
</div>
<div v-if="status == 'latest'">
<h1>{{ lang.noupdate }}</h1>
<p>{{ lang.noupdatemessage }}</p>
<div class="bottom">
<v-btn rounded color="primary" @click="$router.go(-1)">{{ lang.okay }}</v-btn>
</div>
</div>
2022-03-07 14:36:23 +00:00
2022-08-06 13:42:35 +00:00
<div v-if="status == 'available'">
<h1>{{ lang.available }}</h1>
<div>{{ lang.installed }}: {{ installedVersion }}</div>
<div>{{ lang.latest }}: {{ latestVersion.tag_name }}</div>
<div style="margin-top: 3em; color: #999;"><b>Changelog</b></div>
<p style="white-space: pre-line; color: #999;">{{ latestVersion.body.trim() }}</p>
<p></p>
2022-08-06 13:42:35 +00:00
<div class="bottom">
<v-btn rounded @click="$router.go(-1)">{{ lang.later }}</v-btn>
2022-08-06 14:00:49 +00:00
<v-btn rounded color="primary" @click="update()">{{ lang.update }}</v-btn>
2022-08-06 13:42:35 +00:00
</div>
</div>
2022-03-07 14:36:23 +00:00
</div>
</template>
<style scoped>
2022-08-06 13:42:35 +00:00
.bottom {
position: absolute;
bottom: 0;
right: 0;
padding: 2em;
2022-03-11 13:31:01 +00:00
}
2022-03-07 14:36:23 +00:00
</style>
<script>
2022-08-06 14:00:49 +00:00
import { Device } from "@capacitor/device";
2022-03-07 14:36:23 +00:00
export default {
2022-08-06 13:42:35 +00:00
layout: "empty",
2022-03-07 14:36:23 +00:00
data() {
return {
2022-03-21 23:47:11 +00:00
installedVersion: process.env.appVersion,
2022-08-06 13:42:35 +00:00
latestVersion: "",
lang: {},
2022-08-06 13:42:35 +00:00
status: "checking"
2022-03-21 23:47:11 +00:00
};
2022-03-07 14:36:23 +00:00
},
async mounted() {
2022-08-06 13:42:35 +00:00
//--- Setup Lang Pack ---//
this.lang = this.$lang("mods").updates;
2022-03-11 16:39:52 +00:00
2022-08-06 13:42:35 +00:00
//--- Get Latest Version ---//
const releases = await this.$vuetube.releases;
this.latestVersion = releases[0];
//--- Wait like 2 seconds because if people don't see loading, they think it didn't refresh properly ---//
2022-08-07 05:18:10 +00:00
if (!this.$route.query.nowait) await require("~/plugins/utils").delay(2000);
2022-08-06 13:42:35 +00:00
//--- Kick Off Update Notice ---//
if (this.latestVersion.tag_name != this.installedVersion) {
this.status = "available";
} else {
this.status = "latest";
}
2022-08-06 14:00:49 +00:00
},
methods: {
async update() {
const device = await Device.getInfo();
const platform = device.platform;
let downloads = new Array();
for (const i in this.latestVersion.assets) {
const asset = this.latestVersion.assets[i];
downloads.push(asset.browser_download_url);
}
console.log(downloads)
if (platform == "ios") {
window.open(downloads.filter(m => m.includes('.ipa'))[0], '_blank');
} else {
window.open(downloads.filter(m => m.includes('.apk'))[0], '_blank');
}
}
2022-08-06 13:42:35 +00:00
}
2022-03-21 23:47:11 +00:00
};
2022-03-07 14:36:23 +00:00
</script>