Add misskey update page

This commit is contained in:
syuilo 2021-01-23 16:52:45 +09:00
parent a2bef1fa52
commit 82207598f0
4 changed files with 101 additions and 0 deletions

View File

@ -692,6 +692,10 @@ deleteConfirm: "削除しますか?"
invalidValue: "有効な値ではありません。" invalidValue: "有効な値ではありません。"
registry: "レジストリ" registry: "レジストリ"
closeAccount: "アカウントを閉鎖する" closeAccount: "アカウントを閉鎖する"
currentVersion: "現在のバージョン"
latestVersion: "最新のバージョン"
youAreRunningUpToDateClient: "お使いのクライアントは最新です。"
newVersionOfClientAvailable: "新しいバージョンのクライアントが利用可能です。"
_registry: _registry:
scope: "スコープ" scope: "スコープ"

View File

@ -106,6 +106,7 @@ export default defineComponent({
case 'plugins': return defineAsyncComponent(() => import('./plugins.vue')); case 'plugins': return defineAsyncComponent(() => import('./plugins.vue'));
case 'import-export': return defineAsyncComponent(() => import('./import-export.vue')); case 'import-export': return defineAsyncComponent(() => import('./import-export.vue'));
case 'account-info': return defineAsyncComponent(() => import('./account-info.vue')); case 'account-info': return defineAsyncComponent(() => import('./account-info.vue'));
case 'update': return defineAsyncComponent(() => import('./update.vue'));
case 'registry': return defineAsyncComponent(() => import('./registry.vue')); case 'registry': return defineAsyncComponent(() => import('./registry.vue'));
case 'experimental-features': return defineAsyncComponent(() => import('./experimental-features.vue')); case 'experimental-features': return defineAsyncComponent(() => import('./experimental-features.vue'));
} }

View File

@ -1,5 +1,7 @@
<template> <template>
<FormBase> <FormBase>
<FormLink to="/settings/update">Misskey Update</FormLink>
<FormSwitch :value="$i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote"> <FormSwitch :value="$i.injectFeaturedNote" @update:value="onChangeInjectFeaturedNote">
{{ $ts.showFeaturedNotesInTimeline }} {{ $ts.showFeaturedNotesInTimeline }}
</FormSwitch> </FormSwitch>

View File

@ -0,0 +1,94 @@
<template>
<FormBase>
<template v-if="meta">
<MkInfo v-if="version === meta.version">{{ $ts.youAreRunningUpToDateClient }}</MkInfo>
<MkInfo v-else warn>{{ $ts.newVersionOfClientAvailable }}</MkInfo>
</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';
import FormSwitch from '@/components/form/switch.vue';
import FormSelect from '@/components/form/select.vue';
import FormLink from '@/components/form/link.vue';
import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import FormButton from '@/components/form/button.vue';
import FormKeyValueView from '@/components/form/key-value-view.vue';
import MkInfo from '@/components/ui/info.vue';
import * as os from '@/os';
import { version, instanceName } from '@/config';
export default defineComponent({
components: {
FormBase,
FormSelect,
FormSwitch,
FormButton,
FormLink,
FormGroup,
FormKeyValueView,
MkInfo,
},
emits: ['info'],
data() {
return {
INFO: {
title: 'Misskey Update',
icon: faSyncAlt
},
version,
instanceName,
releases: null,
meta: null
}
},
mounted() {
this.$emit('info', this.INFO);
os.api('meta', {
detail: false
}).then(meta => {
this.meta = meta;
localStorage.setItem('v', meta.version);
});
fetch('https://api.github.com/repos/syuilo/misskey/releases', {
method: 'GET',
})
.then(res => res.json())
.then(res => {
this.releases = res;
});
},
methods: {
}
});
</script>