misskey/packages/client/src/pages/settings/update.vue

96 lines
2.5 KiB
Vue
Raw Normal View History

2021-01-23 08:52:45 +01:00
<template>
<FormBase>
<template v-if="meta">
2021-04-13 18:41:49 +02:00
<FormInfo v-if="version === meta.version">{{ $ts.youAreRunningUpToDateClient }}</FormInfo>
<FormInfo v-else warn>{{ $ts.newVersionOfClientAvailable }}</FormInfo>
2021-01-23 08:52:45 +01:00
</template>
<FormGroup>
<template #label>{{ instanceName }}</template>
<FormKeyValueView>
<template #key>{{ $ts.currentVersion }}</template>
<template #value>{{ version }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>{{ $ts.latestVersion }}</template>
2021-11-19 11:36:12 +01:00
<template v-if="meta" #value>{{ meta.version }}</template>
<template v-else #value><MkEllipsis/></template>
2021-01-23 08:52:45 +01:00
</FormKeyValueView>
</FormGroup>
<FormGroup>
<template #label>Misskey</template>
<FormKeyValueView>
<template #key>{{ $ts.latestVersion }}</template>
2021-11-19 11:36:12 +01:00
<template v-if="releases" #value>{{ releases[0].tag_name }}</template>
<template v-else #value><MkEllipsis/></template>
2021-01-23 08:52:45 +01:00
</FormKeyValueView>
2021-11-19 11:36:12 +01:00
<template v-if="releases" #caption><MkTime :time="releases[0].published_at" mode="detail"/></template>
2021-01-23 08:52:45 +01:00
</FormGroup>
</FormBase>
</template>
<script lang="ts">
import { defineAsyncComponent, defineComponent } from 'vue';
2021-11-11 18:02:25 +01:00
import FormSwitch from '@/components/form/switch.vue';
import FormSelect from '@/components/form/select.vue';
import FormLink from '@/components/debobigego/link.vue';
import FormBase from '@/components/debobigego/base.vue';
import FormGroup from '@/components/debobigego/group.vue';
import FormButton from '@/components/debobigego/button.vue';
import FormKeyValueView from '@/components/debobigego/key-value-view.vue';
import FormInfo from '@/components/debobigego/info.vue';
import * as os from '@/os';
import { version, instanceName } from '@/config';
import * as symbols from '@/symbols';
2021-01-23 08:52:45 +01:00
export default defineComponent({
components: {
FormBase,
FormSelect,
FormSwitch,
FormButton,
FormLink,
FormGroup,
FormKeyValueView,
2021-04-13 18:41:49 +02:00
FormInfo,
2021-01-23 08:52:45 +01:00
},
emits: ['info'],
data() {
return {
2021-04-10 05:54:12 +02:00
[symbols.PAGE_INFO]: {
2021-01-23 08:52:45 +01:00
title: 'Misskey Update',
2021-09-29 17:50:45 +02:00
icon: 'fas fa-sync-alt',
bg: 'var(--bg)',
2021-01-23 08:52:45 +01:00
},
version,
instanceName,
releases: null,
meta: null
}
},
mounted() {
2021-04-10 05:54:12 +02:00
this.$emit('info', this[symbols.PAGE_INFO]);
2021-01-23 08:52:45 +01:00
os.api('meta', {
detail: false
}).then(meta => {
this.meta = meta;
localStorage.setItem('v', meta.version);
});
2021-03-24 04:23:05 +01:00
fetch('https://api.github.com/repos/misskey-dev/misskey/releases', {
2021-01-23 08:52:45 +01:00
method: 'GET',
})
.then(res => res.json())
.then(res => {
this.releases = res;
});
},
methods: {
}
});
</script>