nanka iroiro

This commit is contained in:
syuilo 2018-03-02 06:26:31 +09:00
parent 8c897660df
commit 423f73777c
13 changed files with 92 additions and 14 deletions

View file

@ -97,6 +97,7 @@
"deepcopy": "0.6.3", "deepcopy": "0.6.3",
"diskusage": "0.2.4", "diskusage": "0.2.4",
"elasticsearch": "14.1.0", "elasticsearch": "14.1.0",
"element-ui": "^2.2.0",
"emojilib": "^2.2.12", "emojilib": "^2.2.12",
"escape-regexp": "0.0.1", "escape-regexp": "0.0.1",
"eslint": "4.18.0", "eslint": "4.18.0",
@ -104,6 +105,7 @@
"eventemitter3": "3.0.1", "eventemitter3": "3.0.1",
"exif-js": "2.3.0", "exif-js": "2.3.0",
"express": "4.16.2", "express": "4.16.2",
"file-loader": "^1.1.10",
"file-type": "7.6.0", "file-type": "7.6.0",
"fuckadblock": "3.2.1", "fuckadblock": "3.2.1",
"gm": "1.23.1", "gm": "1.23.1",
@ -137,6 +139,8 @@
"morgan": "1.9.0", "morgan": "1.9.0",
"ms": "2.1.1", "ms": "2.1.1",
"multer": "1.3.0", "multer": "1.3.0",
"node-sass": "^4.7.2",
"node-sass-json-importer": "^3.1.3",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"os-utils": "0.0.14", "os-utils": "0.0.14",
"progress-bar-webpack-plugin": "^1.11.0", "progress-bar-webpack-plugin": "^1.11.0",
@ -152,6 +156,7 @@
"rimraf": "2.6.2", "rimraf": "2.6.2",
"rndstr": "1.0.0", "rndstr": "1.0.0",
"s-age": "1.1.2", "s-age": "1.1.2",
"sass-loader": "^6.0.6",
"seedrandom": "2.4.3", "seedrandom": "2.4.3",
"serve-favicon": "2.4.5", "serve-favicon": "2.4.5",
"speakeasy": "2.0.0", "speakeasy": "2.0.0",
@ -181,7 +186,7 @@
"vue-template-compiler": "2.5.13", "vue-template-compiler": "2.5.13",
"vuedraggable": "2.16.0", "vuedraggable": "2.16.0",
"web-push": "3.3.0", "web-push": "3.3.0",
"webpack": "^3.11.0", "webpack": "3.11.0",
"webpack-cli": "^2.0.8", "webpack-cli": "^2.0.8",
"webpack-replace-loader": "1.3.0", "webpack-replace-loader": "1.3.0",
"websocket": "1.0.25", "websocket": "1.0.25",

View file

@ -46,13 +46,19 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
if (bannerIdErr) return rej('invalid banner_id param'); if (bannerIdErr) return rej('invalid banner_id param');
if (bannerId) user.banner_id = bannerId; 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, { await User.update(user._id, {
$set: { $set: {
name: user.name, name: user.name,
description: user.description, description: user.description,
avatar_id: user.avatar_id, avatar_id: user.avatar_id,
banner_id: user.banner_id, banner_id: user.banner_id,
profile: user.profile profile: user.profile,
is_bot: user.is_bot
} }
}); });

View file

@ -75,6 +75,7 @@ export type IUser = {
last_used_at: Date; last_used_at: Date;
latest_post: IPost; latest_post: IPost;
pinned_post_id: mongo.ObjectID; pinned_post_id: mongo.ObjectID;
is_bot: boolean;
is_pro: boolean; is_pro: boolean;
is_suspended: boolean; is_suspended: boolean;
keywords: string[]; keywords: string[];

View file

@ -5,14 +5,14 @@
<div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div> <div class="backdrop" :style="{ 'width': (showResult ? (choice.votes / total * 100) : 0) + '%' }"></div>
<span> <span>
<template v-if="choice.is_voted">%fa:check%</template> <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 class="votes" v-if="showResult">({{ '%i18n:common.tags.mk-poll.vote-count%'.replace('{}', choice.votes) }})</span>
</span> </span>
</li> </li>
</ul> </ul>
<p v-if="total > 0"> <p v-if="total > 0">
<span>{{ '%i18n:common.tags.mk-poll.total-users%'.replace('{}', total) }}</span> <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> <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> <span v-if="isVoted">%i18n:common.tags.mk-poll.voted%</span>
</p> </p>
@ -98,6 +98,10 @@ export default Vue.extend({
background $theme-color background $theme-color
transition width 1s ease transition width 1s ease
> span
> [data-fa]
margin-right 4px
> .votes > .votes
margin-left 4px margin-left 4px

View file

@ -12,6 +12,7 @@ declare const _SW_PUBLICKEY_: string;
declare const _THEME_COLOR_: string; declare const _THEME_COLOR_: string;
declare const _COPYRIGHT_: string; declare const _COPYRIGHT_: string;
declare const _VERSION_: string; declare const _VERSION_: string;
declare const _LICENSE_: string;
export const host = _HOST_; export const host = _HOST_;
export const url = _URL_; export const url = _URL_;
@ -27,3 +28,4 @@ export const swPublickey = _SW_PUBLICKEY_;
export const themeColor = _THEME_COLOR_; export const themeColor = _THEME_COLOR_;
export const copyright = _COPYRIGHT_; export const copyright = _COPYRIGHT_;
export const version = _VERSION_; export const version = _VERSION_;
export const license = _LICENSE_;

View file

@ -4,6 +4,7 @@
// Style // Style
import './style.styl'; import './style.styl';
import '../../element.scss';
import init from '../init'; import init from '../init';
import fuckAdBlock from '../common/scripts/fuck-ad-block'; import fuckAdBlock from '../common/scripts/fuck-ad-block';

View file

@ -1,6 +1,5 @@
@import "../app" @import "../app"
@import "../reset" @import "../reset"
@import "../../../../node_modules/cropperjs/dist/cropper.css"
@import "./ui" @import "./ui"

View file

@ -22,6 +22,10 @@
<input v-model="birthday" type="date" class="ui"/> <input v-model="birthday" type="date" class="ui"/>
</label> </label>
<button class="ui primary" @click="save">%i18n:desktop.tags.mk-profile-setting.save%</button> <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> </div>
</template> </template>
@ -56,6 +60,11 @@ export default Vue.extend({
}).then(() => { }).then(() => {
(this as any).apis.notify('プロフィールを更新しました'); (this as any).apis.notify('プロフィールを更新しました');
}); });
},
onChangeIsBot() {
(this as any).api('i/update', {
is_bot: (this as any).os.i.is_bot
});
} }
} }
}); });

View file

@ -23,10 +23,7 @@
<div> <div>
<button class="ui button" @click="customizeHome">ホームをカスタマイズ</button> <button class="ui button" @click="customizeHome">ホームをカスタマイズ</button>
</div> </div>
<label> <el-switch v-model="showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" active-text="タイムライン上部に投稿フォームを表示する"/>
<input type="checkbox" v-model="showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl">
<span>タイムライン上部に投稿フォームを表示する</span>
</label>
</section> </section>
<section class="drive" v-show="page == 'drive'"> <section class="drive" v-show="page == 'drive'">
@ -71,7 +68,8 @@
<section class="other" v-show="page == 'other'"> <section class="other" v-show="page == 'other'">
<h1>%i18n:desktop.tags.mk-settings.license%</h1> <h1>%i18n:desktop.tags.mk-settings.license%</h1>
%license% <div v-html="license"></div>
<a :href="licenseUrl" target="_blank">サードパーティ</a>
</section> </section>
</div> </div>
</div> </div>
@ -84,6 +82,7 @@ import XMute from './settings.mute.vue';
import XPassword from './settings.password.vue'; import XPassword from './settings.password.vue';
import X2fa from './settings.2fa.vue'; import X2fa from './settings.2fa.vue';
import XApi from './settings.api.vue'; import XApi from './settings.api.vue';
import { docsUrl, license, lang } from '../../../config';
export default Vue.extend({ export default Vue.extend({
components: { components: {
@ -96,10 +95,15 @@ export default Vue.extend({
data() { data() {
return { return {
page: 'profile', page: 'profile',
license,
showPostFormOnTopOfTl: false showPostFormOnTopOfTl: false
}; };
}, },
computed: {
licenseUrl(): string {
return `${docsUrl}/${lang}/license`;
}
},
created() { created() {
this.showPostFormOnTopOfTl = (this as any).os.i.client_settings.showPostFormOnTopOfTl; this.showPostFormOnTopOfTl = (this as any).os.i.client_settings.showPostFormOnTopOfTl;
}, },
@ -162,7 +166,17 @@ export default Vue.extend({
color #4a535a color #4a535a
> h1 > 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 margin 0 0 1em 0
padding 0 0 8px 0 padding 0 0 8px 0
font-size 1em font-size 1em

View file

@ -5,9 +5,11 @@
import Vue from 'vue'; import Vue from 'vue';
import VueRouter from 'vue-router'; import VueRouter from 'vue-router';
import VModal from 'vue-js-modal'; import VModal from 'vue-js-modal';
import Element from 'element-ui';
Vue.use(VueRouter); Vue.use(VueRouter);
Vue.use(VModal); Vue.use(VModal);
Vue.use(Element);
// Register global directives // Register global directives
require('./common/views/directives'); require('./common/views/directives');

View file

@ -111,6 +111,12 @@ props:
desc: desc:
ja: "ドライブの容量(bytes)" ja: "ドライブの容量(bytes)"
en: "The capacity of drive of this user (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" - name: "twitter"
type: "object" type: "object"
optional: true optional: true

12
src/web/element.scss Normal file
View file

@ -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";

View file

@ -3,6 +3,7 @@
*/ */
import * as fs from 'fs'; import * as fs from 'fs';
import jsonImporter from 'node-sass-json-importer';
const minify = require('html-minifier').minify; const minify = require('html-minifier').minify;
import I18nReplacer from '../src/common/build/i18n'; import I18nReplacer from '../src/common/build/i18n';
import { pattern as faPattern, replacement as faReplacement } from '../src/common/build/fa'; import { pattern as faPattern, replacement as faReplacement } from '../src/common/build/fa';
@ -111,12 +112,28 @@ module.exports = Object.keys(langs).map(lang => {
{ loader: 'css-loader' }, { loader: 'css-loader' },
{ loader: 'stylus-loader' } { loader: 'stylus-loader' }
] ]
}, {
test: /\.scss$/,
exclude: /node_modules/,
use: [{
loader: 'style-loader'
}, {
loader: 'css-loader'
}, {
loader: 'sass-loader',
options: {
importer: jsonImporter,
}
}]
}, { }, {
test: /\.css$/, test: /\.css$/,
use: [ use: [
{ loader: 'style-loader' }, { loader: 'style-loader' },
{ loader: 'css-loader' } { loader: 'css-loader' }
] ]
}, {
test: /\.(eot|woff|woff2|svg|ttf)([\?]?.*)$/,
loader: 'file-loader'
}, { }, {
test: /\.ts$/, test: /\.ts$/,
exclude: /node_modules/, exclude: /node_modules/,