mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-27 01:03:08 +00:00
This commit is contained in:
parent
71b4a73798
commit
d7c94de07e
8 changed files with 46 additions and 7 deletions
|
@ -31,6 +31,10 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||||
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
|
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).$;
|
||||||
if (textErr) return rej('invalid text');
|
if (textErr) return rej('invalid text');
|
||||||
|
|
||||||
|
// Get 'via_mobile' parameter
|
||||||
|
const [viaMobile = false, viaMobileErr] = $(params.via_mobile).optional.boolean().$;
|
||||||
|
if (viaMobileErr) return rej('invalid via_mobile');
|
||||||
|
|
||||||
// Get 'tags' parameter
|
// Get 'tags' parameter
|
||||||
const [tags = [], tagsErr] = $(params.tags).optional.array('string').unique().eachQ(t => t.range(1, 32)).$;
|
const [tags = [], tagsErr] = $(params.tags).optional.array('string').unique().eachQ(t => t.range(1, 32)).$;
|
||||||
if (tagsErr) return rej('invalid tags');
|
if (tagsErr) return rej('invalid tags');
|
||||||
|
@ -239,6 +243,7 @@ module.exports = (params, user: IUser, app) => new Promise(async (res, rej) => {
|
||||||
tags: tags,
|
tags: tags,
|
||||||
user_id: user._id,
|
user_id: user._id,
|
||||||
app_id: app ? app._id : null,
|
app_id: app ? app._id : null,
|
||||||
|
via_mobile: viaMobile,
|
||||||
|
|
||||||
// 以下非正規化データ
|
// 以下非正規化データ
|
||||||
_reply: reply ? { user_id: reply.user_id } : undefined,
|
_reply: reply ? { user_id: reply.user_id } : undefined,
|
||||||
|
|
|
@ -31,6 +31,7 @@ export type IPost = {
|
||||||
app_id: mongo.ObjectID;
|
app_id: mongo.ObjectID;
|
||||||
category: string;
|
category: string;
|
||||||
is_category_verified: boolean;
|
is_category_verified: boolean;
|
||||||
|
via_mobile: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"copyright": "Copyright (c) 2014-2018 syuilo",
|
"copyright": "Copyright (c) 2014-2018 syuilo",
|
||||||
"themeColor": "#ff4e45",
|
"themeColor": "#5cbb2d",
|
||||||
"themeColorForeground": "#fff"
|
"themeColorForeground": "#fff"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<span class="username">@{{ p.user.username }}</span>
|
<span class="username">@{{ p.user.username }}</span>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
|
<span class="app" v-if="p.app">via <b>{{ p.app.name }}</b></span>
|
||||||
|
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
||||||
<router-link class="created-at" :to="url">
|
<router-link class="created-at" :to="url">
|
||||||
<mk-time :time="p.created_at"/>
|
<mk-time :time="p.created_at"/>
|
||||||
</router-link>
|
</router-link>
|
||||||
|
@ -399,6 +400,10 @@ export default Vue.extend({
|
||||||
margin-left auto
|
margin-left auto
|
||||||
font-size 0.9em
|
font-size 0.9em
|
||||||
|
|
||||||
|
> .mobile
|
||||||
|
margin-right 8px
|
||||||
|
color #ccc
|
||||||
|
|
||||||
> .app
|
> .app
|
||||||
margin-right 8px
|
margin-right 8px
|
||||||
padding-right 8px
|
padding-right 8px
|
||||||
|
|
|
@ -26,6 +26,11 @@
|
||||||
<mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
|
<mk-switch v-model="os.i.client_settings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="web" v-show="page == 'web'">
|
||||||
|
<h1>モバイル</h1>
|
||||||
|
<mk-switch v-model="os.i.client_settings.disableViaMobile" @change="onChangeDisableViaMobile" text="モバイルからの投稿とフラグを付けない"/>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="web" v-show="page == 'web'">
|
<section class="web" v-show="page == 'web'">
|
||||||
<h1>言語</h1>
|
<h1>言語</h1>
|
||||||
<el-select v-model="lang" placeholder="言語を選択">
|
<el-select v-model="lang" placeholder="言語を選択">
|
||||||
|
@ -192,6 +197,12 @@ export default Vue.extend({
|
||||||
value: v
|
value: v
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onChangeDisableViaMobile(v) {
|
||||||
|
(this as any).api('i/update_client_setting', {
|
||||||
|
name: 'disableViaMobile',
|
||||||
|
value: v
|
||||||
|
});
|
||||||
|
},
|
||||||
checkForUpdate() {
|
checkForUpdate() {
|
||||||
this.checkingForUpdate = true;
|
this.checkingForUpdate = true;
|
||||||
checkForUpdate((this as any).os, true, true).then(newer => {
|
checkForUpdate((this as any).os, true, true).then(newer => {
|
||||||
|
|
|
@ -91,11 +91,13 @@ export default Vue.extend({
|
||||||
},
|
},
|
||||||
post() {
|
post() {
|
||||||
this.posting = true;
|
this.posting = true;
|
||||||
|
const viaMobile = (this as any).os.i.client_settings.disableViaMobile !== true;
|
||||||
(this as any).api('posts/create', {
|
(this as any).api('posts/create', {
|
||||||
text: this.text == '' ? undefined : this.text,
|
text: this.text == '' ? undefined : this.text,
|
||||||
media_ids: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
media_ids: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
||||||
reply_id: this.reply ? this.reply.id : undefined,
|
reply_id: this.reply ? this.reply.id : undefined,
|
||||||
poll: this.poll ? (this.$refs.poll as any).get() : undefined
|
poll: this.poll ? (this.$refs.poll as any).get() : undefined,
|
||||||
|
via_mobile: viaMobile
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
this.$emit('post');
|
this.$emit('post');
|
||||||
this.$destroy();
|
this.$destroy();
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
<router-link class="name" :to="`/${p.user.username}`">{{ p.user.name }}</router-link>
|
<router-link class="name" :to="`/${p.user.username}`">{{ p.user.name }}</router-link>
|
||||||
<span class="is-bot" v-if="p.user.is_bot">bot</span>
|
<span class="is-bot" v-if="p.user.is_bot">bot</span>
|
||||||
<span class="username">@{{ p.user.username }}</span>
|
<span class="username">@{{ p.user.username }}</span>
|
||||||
<router-link class="created-at" :to="url">
|
<div class="info">
|
||||||
<mk-time :time="p.created_at"/>
|
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
||||||
</router-link>
|
<router-link class="created-at" :to="url">
|
||||||
|
<mk-time :time="p.created_at"/>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="text" ref="text">
|
<div class="text" ref="text">
|
||||||
|
@ -336,10 +339,16 @@ export default Vue.extend({
|
||||||
margin 0 0.5em 0 0
|
margin 0 0.5em 0 0
|
||||||
color #ccc
|
color #ccc
|
||||||
|
|
||||||
> .created-at
|
> .info
|
||||||
margin-left auto
|
margin-left auto
|
||||||
font-size 0.9em
|
font-size 0.9em
|
||||||
color #c0c0c0
|
|
||||||
|
> .mobile
|
||||||
|
margin-right 6px
|
||||||
|
color #c0c0c0
|
||||||
|
|
||||||
|
> .created-at
|
||||||
|
color #c0c0c0
|
||||||
|
|
||||||
> .body
|
> .body
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,12 @@ props:
|
||||||
desc:
|
desc:
|
||||||
ja: "投稿日時"
|
ja: "投稿日時"
|
||||||
en: "The posted date of this post"
|
en: "The posted date of this post"
|
||||||
|
- name: "via_mobile"
|
||||||
|
type: "boolean"
|
||||||
|
optional: true
|
||||||
|
desc:
|
||||||
|
ja: "モバイル端末から投稿したか否か(自己申告であることに留意)"
|
||||||
|
en: "Whether this post sent via a mobile device"
|
||||||
- name: "text"
|
- name: "text"
|
||||||
type: "string"
|
type: "string"
|
||||||
optional: true
|
optional: true
|
||||||
|
|
Loading…
Reference in a new issue