diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/endpoints/i/update.ts | 8 | ||||
| -rw-r--r-- | src/api/models/user.ts | 1 | ||||
| -rw-r--r-- | src/web/app/common/views/components/poll.vue | 12 | ||||
| -rw-r--r-- | src/web/app/config.ts | 2 | ||||
| -rw-r--r-- | src/web/app/desktop/script.ts | 1 | ||||
| -rw-r--r-- | src/web/app/desktop/style.styl | 1 | ||||
| -rw-r--r-- | src/web/app/desktop/views/components/settings.profile.vue | 9 | ||||
| -rw-r--r-- | src/web/app/desktop/views/components/settings.vue | 28 | ||||
| -rw-r--r-- | src/web/app/init.ts | 2 | ||||
| -rw-r--r-- | src/web/docs/api/entities/user.yaml | 6 | ||||
| -rw-r--r-- | src/web/element.scss | 12 |
11 files changed, 69 insertions, 13 deletions
diff --git a/src/api/endpoints/i/update.ts b/src/api/endpoints/i/update.ts index 43c5245044..fc12665ad6 100644 --- a/src/api/endpoints/i/update.ts +++ b/src/api/endpoints/i/update.ts @@ -46,13 +46,19 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re if (bannerIdErr) return rej('invalid banner_id param'); if (bannerId) user.banner_id = bannerId; + // Get 'is_bot' parameter + const [isBot, isBotErr] = $(params.is_bot).optional.boolean().$; + if (isBotErr) return rej('invalid is_bot param'); + if (isBot) user.is_bot = isBot; + await User.update(user._id, { $set: { name: user.name, description: user.description, avatar_id: user.avatar_id, banner_id: user.banner_id, - profile: user.profile + profile: user.profile, + is_bot: user.is_bot } }); diff --git a/src/api/models/user.ts b/src/api/models/user.ts index e92f244dd0..278b949db5 100644 --- a/src/api/models/user.ts +++ b/src/api/models/user.ts @@ -75,6 +75,7 @@ export type IUser = { last_used_at: Date; latest_post: IPost; pinned_post_id: mongo.ObjectID; + is_bot: boolean; is_pro: boolean; is_suspended: boolean; keywords: string[]; diff --git a/src/web/app/common/views/components/poll.vue b/src/web/app/common/views/components/poll.vue index 7ed5bc6b1e..556d8ebf6c 100644 --- a/src/web/app/common/views/components/poll.vue +++ b/src/web/app/common/views/components/poll.vue @@ -5,14 +5,14 @@ <div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div> <span> <template v-if="choice.is_voted">%fa:check%</template> - {{ choice.text }} + <span>{{ choice.text }}</span> <span class="votes" v-if="showResult">({{ '%i18n:common.tags.mk-poll.vote-count%'.replace('{}', choice.votes) }})</span> </span> </li> </ul> <p v-if="total > 0"> <span>{{ '%i18n:common.tags.mk-poll.total-users%'.replace('{}', total) }}</span> - ・ + <span>・</span> <a v-if="!isVoted" @click="toggleShowResult">{{ showResult ? '%i18n:common.tags.mk-poll.vote%' : '%i18n:common.tags.mk-poll.show-result%' }}</a> <span v-if="isVoted">%i18n:common.tags.mk-poll.voted%</span> </p> @@ -98,8 +98,12 @@ export default Vue.extend({ background $theme-color transition width 1s ease - > .votes - margin-left 4px + > span + > [data-fa] + margin-right 4px + + > .votes + margin-left 4px > p a diff --git a/src/web/app/config.ts b/src/web/app/config.ts index 2461b22158..b51279192c 100644 --- a/src/web/app/config.ts +++ b/src/web/app/config.ts @@ -12,6 +12,7 @@ declare const _SW_PUBLICKEY_: string; declare const _THEME_COLOR_: string; declare const _COPYRIGHT_: string; declare const _VERSION_: string; +declare const _LICENSE_: string; export const host = _HOST_; export const url = _URL_; @@ -27,3 +28,4 @@ export const swPublickey = _SW_PUBLICKEY_; export const themeColor = _THEME_COLOR_; export const copyright = _COPYRIGHT_; export const version = _VERSION_; +export const license = _LICENSE_; diff --git a/src/web/app/desktop/script.ts b/src/web/app/desktop/script.ts index f0412805ef..78549741b0 100644 --- a/src/web/app/desktop/script.ts +++ b/src/web/app/desktop/script.ts @@ -4,6 +4,7 @@ // Style import './style.styl'; +import '../../element.scss'; import init from '../init'; import fuckAdBlock from '../common/scripts/fuck-ad-block'; diff --git a/src/web/app/desktop/style.styl b/src/web/app/desktop/style.styl index 4d295035f7..49f71fbde7 100644 --- a/src/web/app/desktop/style.styl +++ b/src/web/app/desktop/style.styl @@ -1,6 +1,5 @@ @import "../app" @import "../reset" -@import "../../../../node_modules/cropperjs/dist/cropper.css" @import "./ui" diff --git a/src/web/app/desktop/views/components/settings.profile.vue b/src/web/app/desktop/views/components/settings.profile.vue index 97a382d798..218da67e81 100644 --- a/src/web/app/desktop/views/components/settings.profile.vue +++ b/src/web/app/desktop/views/components/settings.profile.vue @@ -22,6 +22,10 @@ <input v-model="birthday" type="date" class="ui"/> </label> <button class="ui primary" @click="save">%i18n:desktop.tags.mk-profile-setting.save%</button> + <section> + <h2>その他</h2> + <el-switch v-model="os.i.is_bot" @change="onChangeIsBot" active-text="このアカウントはbotです"/> + </section> </div> </template> @@ -56,6 +60,11 @@ export default Vue.extend({ }).then(() => { (this as any).apis.notify('プロフィールを更新しました'); }); + }, + onChangeIsBot() { + (this as any).api('i/update', { + is_bot: (this as any).os.i.is_bot + }); } } }); diff --git a/src/web/app/desktop/views/components/settings.vue b/src/web/app/desktop/views/components/settings.vue index c210997c38..b65623e33a 100644 --- a/src/web/app/desktop/views/components/settings.vue +++ b/src/web/app/desktop/views/components/settings.vue @@ -23,10 +23,7 @@ <div> <button class="ui button" @click="customizeHome">ホームをカスタマイズ</button> </div> - <label> - <input type="checkbox" v-model="showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl"> - <span>タイムライン上部に投稿フォームを表示する</span> - </label> + <el-switch v-model="showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" active-text="タイムライン上部に投稿フォームを表示する"/> </section> <section class="drive" v-show="page == 'drive'"> @@ -71,7 +68,8 @@ <section class="other" v-show="page == 'other'"> <h1>%i18n:desktop.tags.mk-settings.license%</h1> - %license% + <div v-html="license"></div> + <a :href="licenseUrl" target="_blank">サードパーティ</a> </section> </div> </div> @@ -84,6 +82,7 @@ import XMute from './settings.mute.vue'; import XPassword from './settings.password.vue'; import X2fa from './settings.2fa.vue'; import XApi from './settings.api.vue'; +import { docsUrl, license, lang } from '../../../config'; export default Vue.extend({ components: { @@ -96,10 +95,15 @@ export default Vue.extend({ data() { return { page: 'profile', - + license, showPostFormOnTopOfTl: false }; }, + computed: { + licenseUrl(): string { + return `${docsUrl}/${lang}/license`; + } + }, created() { this.showPostFormOnTopOfTl = (this as any).os.i.client_settings.showPostFormOnTopOfTl; }, @@ -162,13 +166,23 @@ export default Vue.extend({ color #4a535a > h1 - display block margin 0 0 1em 0 padding 0 0 8px 0 font-size 1em color #555 border-bottom solid 1px #eee + &, >>> * + > 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 + > .web > div border-bottom solid 1px #eee diff --git a/src/web/app/init.ts b/src/web/app/init.ts index f9855fd5c9..dc3057935f 100644 --- a/src/web/app/init.ts +++ b/src/web/app/init.ts @@ -5,9 +5,11 @@ import Vue from 'vue'; import VueRouter from 'vue-router'; import VModal from 'vue-js-modal'; +import Element from 'element-ui'; Vue.use(VueRouter); Vue.use(VModal); +Vue.use(Element); // Register global directives require('./common/views/directives'); diff --git a/src/web/docs/api/entities/user.yaml b/src/web/docs/api/entities/user.yaml index e62ad84db8..528b9b0e13 100644 --- a/src/web/docs/api/entities/user.yaml +++ b/src/web/docs/api/entities/user.yaml @@ -111,6 +111,12 @@ props: desc: ja: "ドライブの容量(bytes)" en: "The capacity of drive of this user (bytes)" + - name: "is_bot" + type: "boolean" + optional: true + desc: + ja: "botか否か(自己申告であることに留意)" + en: "Whether is bot or not" - name: "twitter" type: "object" optional: true diff --git a/src/web/element.scss b/src/web/element.scss new file mode 100644 index 0000000000..917198e024 --- /dev/null +++ b/src/web/element.scss @@ -0,0 +1,12 @@ +/* Element variable definitons */ +/* SEE: http://element.eleme.io/#/en-US/component/custom-theme */ + +@import '../const.json'; + +/* theme color */ +$--color-primary: $themeColor; + +/* icon font path, required */ +$--font-path: '~element-ui/lib/theme-chalk/fonts'; + +@import "~element-ui/packages/theme-chalk/src/index"; |