1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-03 17:28:28 +09:00
This commit is contained in:
syuilo 2019-01-16 14:54:14 +09:00
parent eb45eeb1ae
commit 13cee2b4f5
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
9 changed files with 30 additions and 7 deletions

View File

@ -1163,6 +1163,7 @@ admin/views/instance.vue:
max-note-text-length: "投稿の最大文字数"
disable-registration: "ユーザー登録の受付を停止する"
disable-local-timeline: "ローカルタイムラインを無効にする"
disable-global-timeline: "グローバルタイムラインを無効にする"
invite: "招待"
save: "保存"
saved: "保存しました"

View File

@ -22,6 +22,7 @@
<section>
<ui-switch v-model="disableRegistration">{{ $t('disable-registration') }}</ui-switch>
<ui-switch v-model="disableLocalTimeline">{{ $t('disable-local-timeline') }}</ui-switch>
<ui-switch v-model="disableGlobalTimeline">{{ $t('disable-global-timeline') }}</ui-switch>
</section>
<section class="fit-bottom">
<header><fa icon="cloud"/> {{ $t('drive-config') }}</header>
@ -150,6 +151,7 @@ export default Vue.extend({
maintainerEmail: null,
disableRegistration: false,
disableLocalTimeline: false,
disableGlobalTimeline: false,
mascotImageUrl: null,
bannerUrl: null,
errorImageUrl: null,
@ -198,6 +200,7 @@ export default Vue.extend({
this.maintainerEmail = meta.maintainer.email;
this.disableRegistration = meta.disableRegistration;
this.disableLocalTimeline = meta.disableLocalTimeline;
this.disableGlobalTimeline = meta.disableGlobalTimeline;
this.mascotImageUrl = meta.mascotImageUrl;
this.bannerUrl = meta.bannerUrl;
this.errorImageUrl = meta.errorImageUrl;
@ -256,6 +259,7 @@ export default Vue.extend({
maintainerEmail: this.maintainerEmail,
disableRegistration: this.disableRegistration,
disableLocalTimeline: this.disableLocalTimeline,
disableGlobalTimeline: this.disableGlobalTimeline,
mascotImageUrl: this.mascotImageUrl,
bannerUrl: this.bannerUrl,
errorImageUrl: this.errorImageUrl,

View File

@ -4,7 +4,7 @@
<span :data-active="src == 'home'" @click="src = 'home'"><fa icon="home"/> {{ $t('home') }}</span>
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline"><fa :icon="['far', 'comments']"/> {{ $t('local') }}</span>
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('hybrid') }}</span>
<span :data-active="src == 'global'" @click="src = 'global'"><fa icon="globe"/> {{ $t('global') }}</span>
<span :data-active="src == 'global'" @click="src = 'global'" v-if="enableGlobalTimeline"><fa icon="globe"/> {{ $t('global') }}</span>
<span :data-active="src == 'tag'" @click="src = 'tag'" v-if="tagTl"><fa icon="hashtag"/> {{ tagTl.title }}</span>
<span :data-active="src == 'list'" @click="src = 'list'" v-if="list"><fa icon="list"/> {{ list.title }}</span>
<div class="buttons">
@ -43,7 +43,8 @@ export default Vue.extend({
src: 'home',
list: null,
tagTl: null,
enableLocalTimeline: false
enableLocalTimeline: false,
enableGlobalTimeline: false,
};
},
@ -66,6 +67,7 @@ export default Vue.extend({
created() {
this.$root.getMeta().then(meta => {
this.enableLocalTimeline = !meta.disableLocalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin;
this.enableGlobalTimeline = !meta.disableGlobalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin;
});
if (this.$store.state.device.tl) {

View File

@ -31,7 +31,7 @@
<span :data-active="src == 'home'" @click="src = 'home'"><fa icon="home"/> {{ $t('home') }}</span>
<span :data-active="src == 'local'" @click="src = 'local'" v-if="enableLocalTimeline"><fa :icon="['far', 'comments']"/> {{ $t('local') }}</span>
<span :data-active="src == 'hybrid'" @click="src = 'hybrid'" v-if="enableLocalTimeline"><fa icon="share-alt"/> {{ $t('hybrid') }}</span>
<span :data-active="src == 'global'" @click="src = 'global'"><fa icon="globe"/> {{ $t('global') }}</span>
<span :data-active="src == 'global'" @click="src = 'global'" v-if="enableGlobalTimeline"><fa icon="globe"/> {{ $t('global') }}</span>
<div class="hr"></div>
<span :data-active="src == 'mentions'" @click="src = 'mentions'"><fa icon="at"/> {{ $t('mentions') }}<i class="badge" v-if="$store.state.i.hasUnreadMentions"><fa icon="circle"/></i></span>
<span :data-active="src == 'messages'" @click="src = 'messages'"><fa :icon="['far', 'envelope']"/> {{ $t('messages') }}<i class="badge" v-if="$store.state.i.hasUnreadSpecifiedNotes"><fa icon="circle"/></i></span>
@ -79,7 +79,8 @@ export default Vue.extend({
lists: null,
tagTl: null,
showNav: false,
enableLocalTimeline: false
enableLocalTimeline: false,
enableGlobalTimeline: false,
};
},
@ -113,6 +114,7 @@ export default Vue.extend({
created() {
this.$root.getMeta().then(meta => {
this.enableLocalTimeline = !meta.disableLocalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin;
this.enableGlobalTimeline = !meta.disableGlobalTimeline || this.$store.state.i.isModerator || this.$store.state.i.isAdmin;
});
if (this.$store.state.device.tl) {

View File

@ -184,6 +184,7 @@ export type IMeta = {
disableRegistration?: boolean;
disableLocalTimeline?: boolean;
disableGlobalTimeline?: boolean;
hidedTags?: string[];
mascotImageUrl?: string;
bannerUrl?: string;

View File

@ -32,6 +32,13 @@ export const meta = {
}
},
disableGlobalTimeline: {
validator: $.bool.optional.nullable,
desc: {
'ja-JP': 'グローバルタイムラインを無効にするか否か'
}
},
hidedTags: {
validator: $.arr($.str).optional.nullable,
desc: {
@ -331,6 +338,10 @@ export default define(meta, (ps) => new Promise(async (res, rej) => {
set.disableLocalTimeline = ps.disableLocalTimeline;
}
if (typeof ps.disableGlobalTimeline === 'boolean') {
set.disableGlobalTimeline = ps.disableGlobalTimeline;
}
if (Array.isArray(ps.hidedTags)) {
set.hidedTags = ps.hidedTags;
}

View File

@ -59,6 +59,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
broadcasts: instance.broadcasts || [],
disableRegistration: instance.disableRegistration,
disableLocalTimeline: instance.disableLocalTimeline,
disableGlobalTimeline: instance.disableGlobalTimeline,
driveCapacityPerLocalUserMb: instance.localDriveCapacityMb,
driveCapacityPerRemoteUserMb: instance.remoteDriveCapacityMb,
cacheRemoteFiles: instance.cacheRemoteFiles,
@ -81,6 +82,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
response.features = {
registration: !instance.disableRegistration,
localTimeLine: !instance.disableLocalTimeline,
globalTimeLine: !instance.disableGlobalTimeline,
elasticsearch: config.elasticsearch ? true : false,
recaptcha: instance.enableRecaptcha,
objectStorage: config.drive && config.drive.storage === 'minio',

View File

@ -53,9 +53,9 @@ export const meta = {
export default define(meta, (ps, user) => new Promise(async (res, rej) => {
const meta = await fetchMeta();
if (meta.disableLocalTimeline) {
if (meta.disableGlobalTimeline) {
if (user == null || (!user.isAdmin && !user.isModerator)) {
return rej('local timeline disabled');
return rej('global timeline disabled');
}
}

View File

@ -15,7 +15,7 @@ export default class extends Channel {
@autobind
public async init(params: any) {
const meta = await fetchMeta();
if (meta.disableLocalTimeline) {
if (meta.disableGlobalTimeline) {
if (this.user == null || (!this.user.isAdmin && !this.user.isModerator)) return;
}