2022-03-07 14:36:23 +00:00
|
|
|
<template>
|
2022-08-20 21:23:31 +00:00
|
|
|
<div style="padding: 2em">
|
|
|
|
<v-icon x-large color="primary" style="padding-bottom: 0.25em">
|
|
|
|
mdi-cellphone-arrow-down
|
|
|
|
</v-icon>
|
|
|
|
|
2022-08-06 13:42:35 +00:00
|
|
|
<div v-if="status == 'checking'">
|
|
|
|
<h1>{{ lang.checking }}</h1>
|
2022-08-20 21:23:31 +00:00
|
|
|
<div>
|
2022-08-20 22:15:46 +00:00
|
|
|
{{ lang.installed }}:
|
|
|
|
{{ installedVersion.substring(0, 7) || "Unknown" }}
|
|
|
|
<!-- (release) -->
|
|
|
|
({{ latestVersion.tag_name }})
|
2022-08-20 21:23:31 +00:00
|
|
|
</div>
|
2022-08-06 13:42:35 +00:00
|
|
|
<center>
|
2022-08-20 21:23:31 +00:00
|
|
|
<v-progress-circular
|
|
|
|
indeterminate
|
|
|
|
style="padding-top: 10em"
|
|
|
|
color="primary"
|
|
|
|
size="75"
|
|
|
|
/>
|
2022-08-06 13:42:35 +00:00
|
|
|
</center>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="status == 'latest'">
|
|
|
|
<h1>{{ lang.noupdate }}</h1>
|
|
|
|
<p>{{ lang.noupdatemessage }}</p>
|
|
|
|
<div class="bottom">
|
2022-08-07 17:26:20 +00:00
|
|
|
<v-btn rounded @click="getLatest">{{ lang.refresh }}</v-btn>
|
2022-08-20 22:25:28 +00:00
|
|
|
<v-btn
|
|
|
|
rounded
|
|
|
|
depressed
|
|
|
|
color="primary"
|
|
|
|
class="background--text"
|
|
|
|
@click="$router.go(-1)"
|
|
|
|
>
|
2022-08-20 21:23:31 +00:00
|
|
|
{{ lang.okay }}
|
|
|
|
</v-btn>
|
2022-08-06 13:42:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-03-07 14:36:23 +00:00
|
|
|
|
2022-08-06 13:42:35 +00:00
|
|
|
<div v-if="status == 'available'">
|
2022-08-07 17:26:20 +00:00
|
|
|
<h1 v-if="!downloading">{{ lang.available }}</h1>
|
|
|
|
<h1 v-if="downloading">{{ lang.updating }}</h1>
|
2022-08-20 21:23:31 +00:00
|
|
|
<div>
|
2022-08-20 22:15:46 +00:00
|
|
|
{{ lang.installed }}:
|
|
|
|
{{ installedVersion.substring(0, 7) || "Unknown" }}
|
|
|
|
<!-- (release) -->
|
|
|
|
({{ latestVersion.tag_name }})
|
2022-08-20 21:23:31 +00:00
|
|
|
</div>
|
2022-08-06 13:42:35 +00:00
|
|
|
<div>{{ lang.latest }}: {{ latestVersion.tag_name }}</div>
|
2022-08-07 17:26:20 +00:00
|
|
|
|
2022-08-20 21:23:31 +00:00
|
|
|
<div style="margin-top: 1em; color: #999">
|
|
|
|
<div>
|
|
|
|
{{ lang.published }}:
|
|
|
|
{{ new Date(update.created_at).toLocaleString() }}
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
{{ lang.size }}:
|
|
|
|
{{ require("~/plugins/utils").humanFileSize(update.size) }}
|
|
|
|
</div>
|
2022-08-07 17:26:20 +00:00
|
|
|
<div>{{ lang.users }}: {{ update.download_count }}</div>
|
|
|
|
</div>
|
|
|
|
|
2022-08-20 21:23:31 +00:00
|
|
|
<div style="margin-top: 1em; color: #999"><b>Changelog</b></div>
|
|
|
|
<p style="white-space: pre-line; color: #999">
|
|
|
|
{{ latestVersion.body.trim() }}
|
|
|
|
</p>
|
2022-08-07 17:26:20 +00:00
|
|
|
|
2022-08-20 21:23:31 +00:00
|
|
|
<v-progress-linear
|
|
|
|
v-if="downloading"
|
|
|
|
style="position: absolute; top: 0; width: 100%; left: 0"
|
|
|
|
color="primary"
|
|
|
|
indeterminate
|
|
|
|
/>
|
2022-08-07 19:04:46 +00:00
|
|
|
|
2022-08-20 21:23:31 +00:00
|
|
|
<div v-if="!downloading" class="bottom">
|
|
|
|
<v-btn
|
|
|
|
rounded
|
2022-08-20 22:15:46 +00:00
|
|
|
depressed
|
|
|
|
:class="
|
|
|
|
$vuetify.theme.dark ? 'background lighten-1' : 'background darken-1'
|
|
|
|
"
|
|
|
|
@click="$router.go(-1)"
|
|
|
|
>
|
|
|
|
{{ lang.later }}
|
|
|
|
</v-btn>
|
|
|
|
<v-btn
|
|
|
|
rounded
|
|
|
|
depressed
|
2022-08-20 22:25:28 +00:00
|
|
|
class="background--text ml-2"
|
2022-08-20 21:23:31 +00:00
|
|
|
color="primary"
|
|
|
|
@click="install()"
|
|
|
|
>
|
|
|
|
{{ lang.update }}
|
|
|
|
</v-btn>
|
2022-08-06 13:42:35 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-03-07 14:36:23 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<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: "",
|
2022-06-22 05:24:06 +00:00
|
|
|
lang: {},
|
2022-08-07 17:26:20 +00:00
|
|
|
status: "checking",
|
|
|
|
update: {},
|
|
|
|
downloading: false,
|
2022-03-21 23:47:11 +00:00
|
|
|
};
|
2022-03-07 14:36:23 +00:00
|
|
|
},
|
2022-04-11 01:00:42 +00:00
|
|
|
async mounted() {
|
2022-08-06 13:42:35 +00:00
|
|
|
//--- Setup Lang Pack ---//
|
2022-06-15 19:29:52 +00:00
|
|
|
this.lang = this.$lang("mods").updates;
|
2022-03-11 16:39:52 +00:00
|
|
|
|
2022-08-07 17:26:20 +00:00
|
|
|
this.getLatest();
|
2022-08-06 14:00:49 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-08-07 17:26:20 +00:00
|
|
|
async getUpdate() {
|
2022-08-06 14:00:49 +00:00
|
|
|
const device = await Device.getInfo();
|
|
|
|
const platform = device.platform;
|
|
|
|
|
2022-08-07 17:26:20 +00:00
|
|
|
//--- Put all strings into 1 array ---//
|
2022-08-06 14:00:49 +00:00
|
|
|
let downloads = new Array();
|
|
|
|
for (const i in this.latestVersion.assets) {
|
|
|
|
const asset = this.latestVersion.assets[i];
|
|
|
|
downloads.push(asset.browser_download_url);
|
|
|
|
}
|
|
|
|
|
2022-08-07 17:26:20 +00:00
|
|
|
//--- Pick String For Platform From Above Array ---//
|
2022-08-06 14:00:49 +00:00
|
|
|
if (platform == "ios") {
|
2022-08-20 21:23:31 +00:00
|
|
|
this.update = downloads.filter((m) => m.includes(".ipa"))[0];
|
2022-08-06 14:00:49 +00:00
|
|
|
} else {
|
2022-08-20 21:23:31 +00:00
|
|
|
this.update = downloads.filter((m) => m.includes(".apk"))[0];
|
2022-08-06 14:00:49 +00:00
|
|
|
}
|
|
|
|
|
2022-08-07 17:26:20 +00:00
|
|
|
//--- Set Update As Full Data ---//
|
|
|
|
for (const i in this.latestVersion.assets) {
|
|
|
|
const asset = this.latestVersion.assets[i];
|
|
|
|
if (asset.browser_download_url == this.update) {
|
2022-08-20 21:23:31 +00:00
|
|
|
return (this.update = asset);
|
2022-08-07 17:26:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async getLatest() {
|
2022-08-20 21:23:31 +00:00
|
|
|
//--- Get Latest Version ---//
|
2022-08-07 17:26:20 +00:00
|
|
|
this.status = "checking";
|
|
|
|
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-20 21:23:31 +00:00
|
|
|
if (!this.$route.query.nowait)
|
|
|
|
await require("~/plugins/utils").delay(2000);
|
2022-08-07 17:26:20 +00:00
|
|
|
|
|
|
|
//--- Get Proper File ---//
|
|
|
|
this.getUpdate();
|
|
|
|
|
|
|
|
//--- Kick Off Update Notice ---//
|
|
|
|
if (this.latestVersion.tag_name != this.installedVersion) {
|
|
|
|
this.status = "available";
|
|
|
|
} else {
|
|
|
|
this.status = "latest";
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
async install() {
|
2022-08-07 19:04:46 +00:00
|
|
|
this.downloading = true;
|
2022-08-20 21:23:31 +00:00
|
|
|
await this.$update(this.update.browser_download_url).catch(() => {
|
|
|
|
this.downloading = false;
|
|
|
|
});
|
2022-08-07 19:04:46 +00:00
|
|
|
//window.open(this.update.browser_download_url, '_blank');
|
2022-08-20 21:23:31 +00:00
|
|
|
},
|
|
|
|
},
|
2022-03-21 23:47:11 +00:00
|
|
|
};
|
2022-03-07 14:36:23 +00:00
|
|
|
</script>
|
2022-08-20 21:23:31 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.bottom {
|
|
|
|
position: absolute;
|
|
|
|
padding: 2em;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
}
|
|
|
|
</style>
|