paricafe/src/client/pages/settings/update.vue

96 lines
2.5 KiB
Vue
Raw Normal View History

2021-01-23 01:52:45 -06:00
<template>
<FormBase>
<template v-if="meta">
2021-04-13 11:41:49 -05:00
<FormInfo v-if="version === meta.version">{{ $ts.youAreRunningUpToDateClient }}</FormInfo>
<FormInfo v-else warn>{{ $ts.newVersionOfClientAvailable }}</FormInfo>
2021-01-23 01:52:45 -06:00
</template>
<FormGroup>
<template #label>{{ instanceName }}</template>
<FormKeyValueView>
<template #key>{{ $ts.currentVersion }}</template>
<template #value>{{ version }}</template>
</FormKeyValueView>
<FormKeyValueView>
<template #key>{{ $ts.latestVersion }}</template>
<template #value v-if="meta">{{ meta.version }}</template>
<template #value v-else><MkEllipsis/></template>
</FormKeyValueView>
</FormGroup>
<FormGroup>
<template #label>Misskey</template>
<FormKeyValueView>
<template #key>{{ $ts.latestVersion }}</template>
<template #value v-if="releases">{{ releases[0].tag_name }}</template>
<template #value v-else><MkEllipsis/></template>
</FormKeyValueView>
<template #caption v-if="releases"><MkTime :time="releases[0].published_at" mode="detail"/></template>
</FormGroup>
</FormBase>
</template>
<script lang="ts">
import { defineAsyncComponent, defineComponent } from 'vue';
import { faInfoCircle, faSyncAlt } from '@fortawesome/free-solid-svg-icons';
2021-03-23 03:30:14 -05:00
import FormSwitch from '@client/components/form/switch.vue';
import FormSelect from '@client/components/form/select.vue';
import FormLink from '@client/components/form/link.vue';
import FormBase from '@client/components/form/base.vue';
import FormGroup from '@client/components/form/group.vue';
import FormButton from '@client/components/form/button.vue';
import FormKeyValueView from '@client/components/form/key-value-view.vue';
2021-04-13 11:41:49 -05:00
import FormInfo from '@client/components/form/info.vue';
2021-03-23 03:30:14 -05:00
import * as os from '@client/os';
import { version, instanceName } from '@client/config';
2021-04-09 22:54:12 -05:00
import * as symbols from '@client/symbols';
2021-01-23 01:52:45 -06:00
export default defineComponent({
components: {
FormBase,
FormSelect,
FormSwitch,
FormButton,
FormLink,
FormGroup,
FormKeyValueView,
2021-04-13 11:41:49 -05:00
FormInfo,
2021-01-23 01:52:45 -06:00
},
emits: ['info'],
data() {
return {
2021-04-09 22:54:12 -05:00
[symbols.PAGE_INFO]: {
2021-01-23 01:52:45 -06:00
title: 'Misskey Update',
icon: faSyncAlt
},
version,
instanceName,
releases: null,
meta: null
}
},
mounted() {
2021-04-09 22:54:12 -05:00
this.$emit('info', this[symbols.PAGE_INFO]);
2021-01-23 01:52:45 -06:00
os.api('meta', {
detail: false
}).then(meta => {
this.meta = meta;
localStorage.setItem('v', meta.version);
});
2021-03-23 22:23:05 -05:00
fetch('https://api.github.com/repos/misskey-dev/misskey/releases', {
2021-01-23 01:52:45 -06:00
method: 'GET',
})
.then(res => res.json())
.then(res => {
this.releases = res;
});
},
methods: {
}
});
</script>