1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-18 16:48:30 +09:00
cherrypick/src/web/app/desktop/views/components/settings.vue

318 lines
9.5 KiB
Vue
Raw Normal View History

2018-02-12 22:18:13 +09:00
<template>
<div class="mk-settings">
<div class="nav">
<p :class="{ active: page == 'profile' }" @mousedown="page = 'profile'">%fa:user .fw%%i18n:desktop.tags.mk-settings.profile%</p>
<p :class="{ active: page == 'web' }" @mousedown="page = 'web'">%fa:desktop .fw%Web</p>
<p :class="{ active: page == 'notification' }" @mousedown="page = 'notification'">%fa:R bell .fw%通知</p>
<p :class="{ active: page == 'drive' }" @mousedown="page = 'drive'">%fa:cloud .fw%%i18n:desktop.tags.mk-settings.drive%</p>
<p :class="{ active: page == 'mute' }" @mousedown="page = 'mute'">%fa:ban .fw%%i18n:desktop.tags.mk-settings.mute%</p>
<p :class="{ active: page == 'apps' }" @mousedown="page = 'apps'">%fa:puzzle-piece .fw%アプリ</p>
<p :class="{ active: page == 'twitter' }" @mousedown="page = 'twitter'">%fa:B twitter .fw%Twitter</p>
<p :class="{ active: page == 'security' }" @mousedown="page = 'security'">%fa:unlock-alt .fw%%i18n:desktop.tags.mk-settings.security%</p>
<p :class="{ active: page == 'api' }" @mousedown="page = 'api'">%fa:key .fw%API</p>
<p :class="{ active: page == 'other' }" @mousedown="page = 'other'">%fa:cogs .fw%%i18n:desktop.tags.mk-settings.other%</p>
</div>
<div class="pages">
<section class="profile" v-show="page == 'profile'">
<h1>%i18n:desktop.tags.mk-settings.profile%</h1>
2018-02-20 23:22:19 +09:00
<x-profile/>
2018-02-12 22:18:13 +09:00
</section>
<section class="web" v-show="page == 'web'">
<h1>デザイン</h1>
2018-03-02 18:46:08 +09:00
<div class="div">
2018-02-23 02:06:35 +09:00
<button class="ui button" @click="customizeHome">ホームをカスタマイズ</button>
</div>
2018-03-03 09:49:47 +09:00
<mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
</section>
2018-03-04 09:39:25 +09:00
<section class="web" v-show="page == 'web'">
<h1>モバイル</h1>
2018-03-04 14:10:14 +09:00
<mk-switch v-model="os.i.client_settings.disableViaMobile" @change="onChangeDisableViaMobile" text="「モバイルからの投稿」フラグを付けない"/>
2018-03-04 09:39:25 +09:00
</section>
2018-03-03 09:49:47 +09:00
<section class="web" v-show="page == 'web'">
<h1>言語</h1>
<el-select v-model="lang" placeholder="言語を選択">
<el-option-group label="推奨">
<el-option label="自動" value=""/>
</el-option-group>
<el-option-group label="言語を指定">
<el-option label="ja-JP" value="ja"/>
<el-option label="en-US" value="en"/>
</el-option-group>
</el-select>
2018-03-03 11:13:28 +09:00
<div class="none ui info">
2018-03-03 14:25:36 +09:00
<p>%fa:info-circle%変更はページの再度読み込み後に反映されます</p>
2018-03-03 11:13:28 +09:00
</div>
2018-03-02 18:46:08 +09:00
</section>
<section class="web" v-show="page == 'web'">
<h1>キャッシュ</h1>
<button class="ui button" @click="clean">クリーンアップ</button>
2018-03-03 11:13:28 +09:00
<div class="none ui info warn">
<p>%fa:exclamation-triangle%クリーンアップを行うとブラウザに記憶されたアカウント情報のキャッシュ書きかけの投稿返信メッセージおよびその他のデータ(設定情報含む)が削除されますクリーンアップを行った後はページを再度読み込みする必要があります</p>
2018-03-02 18:46:08 +09:00
</div>
2018-02-12 22:18:13 +09:00
</section>
<section class="drive" v-show="page == 'drive'">
<h1>%i18n:desktop.tags.mk-settings.drive%</h1>
<mk-drive-setting/>
</section>
<section class="mute" v-show="page == 'mute'">
<h1>%i18n:desktop.tags.mk-settings.mute%</h1>
2018-02-22 01:25:57 +09:00
<x-mute/>
2018-02-12 22:18:13 +09:00
</section>
<section class="apps" v-show="page == 'apps'">
<h1>アプリケーション</h1>
<mk-authorized-apps/>
</section>
<section class="twitter" v-show="page == 'twitter'">
<h1>Twitter</h1>
<mk-twitter-setting/>
</section>
<section class="password" v-show="page == 'security'">
<h1>%i18n:desktop.tags.mk-settings.password%</h1>
2018-02-22 01:25:57 +09:00
<x-password/>
2018-02-12 22:18:13 +09:00
</section>
<section class="2fa" v-show="page == 'security'">
<h1>%i18n:desktop.tags.mk-settings.2fa%</h1>
2018-02-22 01:25:57 +09:00
<x-2fa/>
2018-02-12 22:18:13 +09:00
</section>
<section class="signin" v-show="page == 'security'">
<h1>サインイン履歴</h1>
<mk-signin-history/>
</section>
<section class="api" v-show="page == 'api'">
<h1>API</h1>
2018-02-22 21:15:24 +09:00
<x-api/>
2018-02-12 22:18:13 +09:00
</section>
2018-03-03 09:49:47 +09:00
<section class="other" v-show="page == 'other'">
<h1>Misskeyについて</h1>
<p v-if="meta">このサーバーの運営者: <i><a :href="meta.maintainer.url" target="_blank">{{ meta.maintainer.name }}</a></i></p>
</section>
2018-03-02 18:46:08 +09:00
<section class="other" v-show="page == 'other'">
<h1>Misskey Update</h1>
<p>
<span>バージョン: <i>{{ version }}</i></span>
<template v-if="latestVersion !== undefined">
<br>
<span>最新のバージョン: <i>{{ latestVersion ? latestVersion : version }}</i></span>
</template>
</p>
2018-03-04 14:10:14 +09:00
<button class="ui button block" @click="checkForUpdate" :disabled="checkingForUpdate">
2018-03-02 18:46:08 +09:00
<template v-if="checkingForUpdate">アップデートを確認中<mk-ellipsis/></template>
<template v-else>アップデートを確認</template>
</button>
2018-03-04 14:10:14 +09:00
<details>
<summary>詳細設定</summary>
<mk-switch v-model="preventUpdate" text="アップデートを延期する(非推奨)">
<span>この設定をオンにしてもアップデートが反映される場合がありますこの設定はこのデバイスのみ有効です</span>
</mk-switch>
</details>
2018-03-02 18:46:08 +09:00
</section>
<section class="other" v-show="page == 'other'">
<h1>高度な設定</h1>
<mk-switch v-model="debug" text="デバッグモードを有効にする">
<span>この設定はアカウントに保存されません</span>
</mk-switch>
2018-03-03 07:32:18 +09:00
<mk-switch v-model="enableExperimental" text="実験的機能を有効にする">
<span>この設定はアカウントに保存されません実験的機能を有効にするとMisskeyの動作が不安定になる可能性があります</span>
</mk-switch>
2018-03-02 18:46:08 +09:00
</section>
2018-02-12 22:18:13 +09:00
<section class="other" v-show="page == 'other'">
<h1>%i18n:desktop.tags.mk-settings.license%</h1>
2018-03-02 06:26:31 +09:00
<div v-html="license"></div>
<a :href="licenseUrl" target="_blank">サードパーティ</a>
2018-02-12 22:18:13 +09:00
</section>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
2018-02-20 23:22:19 +09:00
import XProfile from './settings.profile.vue';
2018-02-22 01:25:57 +09:00
import XMute from './settings.mute.vue';
import XPassword from './settings.password.vue';
import X2fa from './settings.2fa.vue';
2018-02-22 21:15:24 +09:00
import XApi from './settings.api.vue';
2018-03-02 18:46:08 +09:00
import { docsUrl, license, lang, version } from '../../../config';
import checkForUpdate from '../../../common/scripts/check-for-update';
2018-02-19 16:58:37 +09:00
2018-02-12 22:18:13 +09:00
export default Vue.extend({
2018-02-19 16:58:37 +09:00
components: {
2018-02-22 01:25:57 +09:00
XProfile,
XMute,
XPassword,
2018-02-22 21:15:24 +09:00
X2fa,
XApi
2018-02-19 16:58:37 +09:00
},
2018-02-12 22:18:13 +09:00
data() {
return {
2018-02-23 02:06:35 +09:00
page: 'profile',
2018-03-03 07:32:18 +09:00
meta: null,
2018-03-02 06:26:31 +09:00
license,
2018-03-02 18:46:08 +09:00
version,
latestVersion: undefined,
checkingForUpdate: false,
2018-03-03 09:49:47 +09:00
lang: localStorage.getItem('lang') || '',
2018-03-04 14:10:14 +09:00
preventUpdate: localStorage.getItem('preventUpdate') == 'true',
2018-03-03 07:32:18 +09:00
debug: localStorage.getItem('debug') == 'true',
enableExperimental: localStorage.getItem('enableExperimental') == 'true'
2018-02-12 22:18:13 +09:00
};
2018-02-23 02:06:35 +09:00
},
2018-03-02 18:46:08 +09:00
watch: {
2018-03-03 09:49:47 +09:00
lang() {
localStorage.setItem('lang', this.lang);
},
2018-03-04 14:10:14 +09:00
preventUpdate() {
localStorage.setItem('preventUpdate', this.preventUpdate ? 'true' : 'false');
},
2018-03-02 18:46:08 +09:00
debug() {
localStorage.setItem('debug', this.debug ? 'true' : 'false');
2018-03-03 07:32:18 +09:00
},
enableExperimental() {
localStorage.setItem('enableExperimental', this.enableExperimental ? 'true' : 'false');
2018-03-02 18:46:08 +09:00
}
},
2018-03-02 06:26:31 +09:00
computed: {
licenseUrl(): string {
return `${docsUrl}/${lang}/license`;
}
},
2018-02-23 02:06:35 +09:00
created() {
2018-03-03 09:49:47 +09:00
(this as any).os.getMeta().then(meta => {
this.meta = meta;
});
2018-02-23 02:06:35 +09:00
},
methods: {
customizeHome() {
this.$router.push('/i/customize-home');
this.$emit('done');
},
2018-03-03 09:49:47 +09:00
onChangeShowPostFormOnTopOfTl(v) {
2018-02-23 02:06:35 +09:00
(this as any).api('i/update_client_setting', {
name: 'showPostFormOnTopOfTl',
2018-03-03 09:49:47 +09:00
value: v
2018-02-23 02:06:35 +09:00
});
2018-03-02 18:46:08 +09:00
},
2018-03-04 09:39:25 +09:00
onChangeDisableViaMobile(v) {
(this as any).api('i/update_client_setting', {
name: 'disableViaMobile',
value: v
});
},
2018-03-02 18:46:08 +09:00
checkForUpdate() {
this.checkingForUpdate = true;
checkForUpdate((this as any).os, true, true).then(newer => {
this.checkingForUpdate = false;
this.latestVersion = newer;
if (newer == null) {
(this as any).apis.dialog({
title: '利用可能な更新はありません',
text: 'お使いのMisskeyは最新です。'
});
} else {
(this as any).apis.dialog({
title: '新しいバージョンが利用可能です',
text: 'ページを再度読み込みすると更新が適用されます。'
});
}
});
},
clean() {
localStorage.clear();
(this as any).apis.dialog({
title: 'キャッシュを削除しました',
text: 'ページを再度読み込みしてください。'
});
2018-02-23 02:06:35 +09:00
}
2018-02-12 22:18:13 +09:00
}
});
</script>
<style lang="stylus" scoped>
2018-03-03 13:47:55 +09:00
@import '~const.styl'
2018-02-12 22:18:13 +09:00
.mk-settings
display flex
width 100%
height 100%
> .nav
flex 0 0 200px
width 100%
height 100%
padding 16px 0 0 0
overflow auto
border-right solid 1px #ddd
> p
display block
padding 10px 16px
margin 0
color #666
cursor pointer
user-select none
transition margin-left 0.2s ease
> [data-fa]
margin-right 4px
&:hover
color #555
&.active
margin-left 8px
color $theme-color !important
> .pages
width 100%
height 100%
flex auto
overflow auto
> section
margin 32px
color #4a535a
> h1
margin 0 0 1em 0
padding 0 0 8px 0
font-size 1em
color #555
border-bottom solid 1px #eee
2018-03-02 06:26:31 +09:00
&, >>> *
2018-03-04 14:10:14 +09:00
.ui.button.block
margin 16px 0
2018-03-02 06:26:31 +09:00
> section
margin 32px 0
> h2
margin 0 0 1em 0
padding 0 0 8px 0
font-size 1em
color #555
border-bottom solid 1px #eee
2018-02-23 02:06:35 +09:00
> .web
2018-03-02 18:46:08 +09:00
> .div
2018-02-23 02:06:35 +09:00
border-bottom solid 1px #eee
padding 0 0 16px 0
margin 0 0 16px 0
2018-02-12 22:18:13 +09:00
</style>