Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
cb0673b1ec | |||
cd018db945 | |||
50fe67b99b | |||
1dba82aae5 | |||
17c6d64750 | |||
b4c04efa23 | |||
152dd74abf | |||
0985f7f609 | |||
56d571c0f0 | |||
dc9a19b9c7 | |||
88a2c7715a | |||
2fa8cb1b73 | |||
5f8a66fdb9 | |||
57320a94f9 | |||
89f045d624 | |||
1a77dea7ed | |||
d063d59a91 | |||
90429b787c | |||
7a2ef04ec3 | |||
76a9ea8d3d | |||
0a05a2d060 | |||
a7e2ee3b0c | |||
40efa90dd5 | |||
4ca0a22bfc | |||
20a943b193 | |||
552df8737d |
@ -1034,6 +1034,7 @@ admin/views/index.vue:
|
||||
dashboard: "ダッシュボード"
|
||||
instance: "インスタンス"
|
||||
emoji: "カスタム絵文字"
|
||||
moderators: "モデレーター"
|
||||
users: "ユーザー"
|
||||
update: "更新"
|
||||
announcements: "お知らせ"
|
||||
@ -1133,6 +1134,12 @@ admin/views/users.vue:
|
||||
unverify: "公式アカウントを解除する"
|
||||
unverified: "公式アカウントを解除しました"
|
||||
|
||||
admin/views/moderators.vue:
|
||||
add-moderator:
|
||||
title: "モデレーターの登録"
|
||||
add: "登録"
|
||||
added: "モデレーターを登録しました"
|
||||
|
||||
admin/views/emoji.vue:
|
||||
add-emoji:
|
||||
title: "絵文字の登録"
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "10.49.4",
|
||||
"clientVersion": "2.0.11774",
|
||||
"version": "10.51.0",
|
||||
"clientVersion": "2.0.11800",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
@ -176,6 +176,7 @@
|
||||
"pug": "2.0.3",
|
||||
"punycode": "2.1.1",
|
||||
"qrcode": "1.3.2",
|
||||
"randomcolor": "0.5.3",
|
||||
"ratelimiter": "3.2.0",
|
||||
"recaptcha-promise": "0.1.3",
|
||||
"reconnecting-websocket": "4.1.10",
|
||||
@ -218,6 +219,7 @@
|
||||
"vue-i18n": "8.3.1",
|
||||
"vue-js-modal": "1.3.26",
|
||||
"vue-loader": "15.4.2",
|
||||
"vue-marquee-text-component": "1.1.0",
|
||||
"vue-router": "3.0.1",
|
||||
"vue-style-loader": "4.1.2",
|
||||
"vue-svg-inline-loader": "1.2.1",
|
||||
|
@ -41,7 +41,7 @@ export default Vue.extend({
|
||||
|
||||
methods: {
|
||||
add() {
|
||||
this.announcements.push({
|
||||
this.announcements.unshift({
|
||||
title: '',
|
||||
text: ''
|
||||
});
|
||||
|
@ -20,6 +20,7 @@
|
||||
<ul>
|
||||
<li @click="nav('dashboard')" :class="{ active: page == 'dashboard' }"><fa icon="home" fixed-width/>{{ $t('dashboard') }}</li>
|
||||
<li @click="nav('instance')" :class="{ active: page == 'instance' }"><fa icon="cog" fixed-width/>{{ $t('instance') }}</li>
|
||||
<li @click="nav('moderators')" :class="{ active: page == 'moderators' }"><fa :icon="faHeadset" fixed-width/>{{ $t('moderators') }}</li>
|
||||
<li @click="nav('users')" :class="{ active: page == 'users' }"><fa icon="users" fixed-width/>{{ $t('users') }}</li>
|
||||
<li @click="nav('emoji')" :class="{ active: page == 'emoji' }"><fa :icon="faGrin" fixed-width/>{{ $t('emoji') }}</li>
|
||||
<li @click="nav('announcements')" :class="{ active: page == 'announcements' }"><fa icon="broadcast-tower" fixed-width/>{{ $t('announcements') }}</li>
|
||||
@ -36,14 +37,20 @@
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
||||
<div v-if="page == 'dashboard'"><x-dashboard/></div>
|
||||
<div v-if="page == 'instance'"><x-instance/></div>
|
||||
<div v-if="page == 'users'"><x-users/></div>
|
||||
<div v-if="page == 'emoji'"><x-emoji/></div>
|
||||
<div v-if="page == 'announcements'"><x-announcements/></div>
|
||||
<div v-if="page == 'hashtags'"><x-hashtags/></div>
|
||||
<div v-if="page == 'drive'"></div>
|
||||
<div v-if="page == 'update'"></div>
|
||||
<marquee-text v-if="instances.length > 0" class="instances" :repeat="10" :duration="10">
|
||||
<span v-for="instance in instances" class="instance"><b :style="{ background: instance.bg }">{{ instance.host }}</b>{{ instance.notesCount | number }}</span>
|
||||
</marquee-text>
|
||||
<div class="page">
|
||||
<div v-if="page == 'dashboard'"><x-dashboard/></div>
|
||||
<div v-if="page == 'instance'"><x-instance/></div>
|
||||
<div v-if="page == 'moderators'"><x-moderators/></div>
|
||||
<div v-if="page == 'users'"><x-users/></div>
|
||||
<div v-if="page == 'emoji'"><x-emoji/></div>
|
||||
<div v-if="page == 'announcements'"><x-announcements/></div>
|
||||
<div v-if="page == 'hashtags'"><x-hashtags/></div>
|
||||
<div v-if="page == 'drive'"></div>
|
||||
<div v-if="page == 'update'"></div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</template>
|
||||
@ -54,12 +61,15 @@ import i18n from '../../i18n';
|
||||
import { version } from '../../config';
|
||||
import XDashboard from "./dashboard.vue";
|
||||
import XInstance from "./instance.vue";
|
||||
import XModerators from "./moderators.vue";
|
||||
import XEmoji from "./emoji.vue";
|
||||
import XAnnouncements from "./announcements.vue";
|
||||
import XHashtags from "./hashtags.vue";
|
||||
import XUsers from "./users.vue";
|
||||
import { faArrowLeft } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faHeadset, faArrowLeft } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faGrin } from '@fortawesome/free-regular-svg-icons';
|
||||
import MarqueeText from 'vue-marquee-text-component';
|
||||
import randomColor from 'randomcolor';
|
||||
|
||||
// Detect the user agent
|
||||
const ua = navigator.userAgent.toLowerCase();
|
||||
@ -70,10 +80,12 @@ export default Vue.extend({
|
||||
components: {
|
||||
XDashboard,
|
||||
XInstance,
|
||||
XModerators,
|
||||
XEmoji,
|
||||
XAnnouncements,
|
||||
XHashtags,
|
||||
XUsers
|
||||
XUsers,
|
||||
MarqueeText
|
||||
},
|
||||
provide: {
|
||||
isMobile
|
||||
@ -84,10 +96,23 @@ export default Vue.extend({
|
||||
version,
|
||||
isMobile,
|
||||
navOpend: !isMobile,
|
||||
instances: [],
|
||||
faGrin,
|
||||
faArrowLeft
|
||||
faArrowLeft,
|
||||
faHeadset
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$root.api('instances').then(instances => {
|
||||
instances.forEach(i => {
|
||||
i.bg = randomColor({
|
||||
seed: i.host,
|
||||
luminosity: 'dark'
|
||||
});
|
||||
});
|
||||
this.instances = instances;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
nav(page: string) {
|
||||
this.page = page;
|
||||
@ -96,7 +121,7 @@ export default Vue.extend({
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus">
|
||||
<style lang="stylus" scoped>
|
||||
.mk-admin
|
||||
$headerHeight = 48px
|
||||
|
||||
@ -257,7 +282,23 @@ export default Vue.extend({
|
||||
> main
|
||||
width 100%
|
||||
padding 0 0 0 250px
|
||||
max-width 1300px
|
||||
|
||||
> .instances
|
||||
padding 8px
|
||||
background rgba(0, 0, 0, 0.7)
|
||||
color #fff
|
||||
font-size 14px
|
||||
|
||||
>>> .instance
|
||||
margin 0 10px
|
||||
|
||||
> b
|
||||
padding 0px 6px
|
||||
margin-right 4px
|
||||
border-radius 4px
|
||||
|
||||
> .page
|
||||
max-width 1300px
|
||||
|
||||
&.isMobile
|
||||
> main
|
||||
|
61
src/client/app/admin/views/moderators.vue
Normal file
61
src/client/app/admin/views/moderators.vue
Normal file
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div class="jnhmugbb">
|
||||
<ui-card>
|
||||
<div slot="title"><fa icon="plus"/> {{ $t('add-moderator.title') }}</div>
|
||||
<section class="fit-top">
|
||||
<ui-input v-model="username" type="text">
|
||||
<span slot="prefix">@</span>
|
||||
</ui-input>
|
||||
<ui-button @click="add" :disabled="adding">{{ $t('add-moderator.add') }}</ui-button>
|
||||
</section>
|
||||
</ui-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../i18n';
|
||||
import parseAcct from "../../../../misc/acct/parse";
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('admin/views/moderators.vue'),
|
||||
|
||||
data() {
|
||||
return {
|
||||
username: '',
|
||||
adding: false
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
async add() {
|
||||
this.adding = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await this.$root.api('users/show', parseAcct(this.username));
|
||||
await this.$root.api('admin/moderators/add', { userId: user.id });
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('add-moderator.added')
|
||||
});
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e.toString()
|
||||
});
|
||||
});
|
||||
|
||||
this.adding = false;
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.jnhmugbb
|
||||
@media (min-width 500px)
|
||||
padding 16px
|
||||
|
||||
</style>
|
@ -49,6 +49,7 @@ import parseAcct from "../../../../misc/acct/parse";
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('admin/views/users.vue'),
|
||||
|
||||
data() {
|
||||
return {
|
||||
verifyUsername: null,
|
||||
@ -67,13 +68,19 @@ export default Vue.extend({
|
||||
this.verifying = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.verifyUsername));
|
||||
await this.$root.os.api('admin/verify-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('verified') });
|
||||
const user = await this.$root.api('users/show', parseAcct(this.verifyUsername));
|
||||
await this.$root.api('admin/verify-user', { userId: user.id });
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('verified')
|
||||
});
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e.toString()
|
||||
});
|
||||
});
|
||||
|
||||
this.verifying = false;
|
||||
@ -83,13 +90,19 @@ export default Vue.extend({
|
||||
this.unverifying = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.unverifyUsername));
|
||||
await this.$root.os.api('admin/unverify-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('unverified') });
|
||||
const user = await this.$root.api('users/show', parseAcct(this.unverifyUsername));
|
||||
await this.$root.api('admin/unverify-user', { userId: user.id });
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('unverified')
|
||||
});
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e.toString()
|
||||
});
|
||||
});
|
||||
|
||||
this.unverifying = false;
|
||||
@ -99,13 +112,19 @@ export default Vue.extend({
|
||||
this.suspending = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.suspendUsername));
|
||||
await this.$root.os.api('admin/suspend-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('suspended') });
|
||||
const user = await this.$root.api('users/show', parseAcct(this.suspendUsername));
|
||||
await this.$root.api('admin/suspend-user', { userId: user.id });
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('suspended')
|
||||
});
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e.toString()
|
||||
});
|
||||
});
|
||||
|
||||
this.suspending = false;
|
||||
@ -115,13 +134,19 @@ export default Vue.extend({
|
||||
this.unsuspending = true;
|
||||
|
||||
const process = async () => {
|
||||
const user = await this.$root.os.api('users/show', parseAcct(this.unsuspendUsername));
|
||||
await this.$root.os.api('admin/unsuspend-user', { userId: user.id });
|
||||
//this.$root.os.apis.dialog({ text: this.$t('unsuspended') });
|
||||
const user = await this.$root.api('users/show', parseAcct(this.unsuspendUsername));
|
||||
await this.$root.api('admin/unsuspend-user', { userId: user.id });
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
text: this.$t('unsuspended')
|
||||
});
|
||||
};
|
||||
|
||||
await process().catch(e => {
|
||||
//this.$root.os.apis.dialog({ text: `Failed: ${e}` });
|
||||
this.$root.alert({
|
||||
type: 'error',
|
||||
text: e.toString()
|
||||
});
|
||||
});
|
||||
|
||||
this.unsuspending = false;
|
||||
|
@ -43,6 +43,9 @@
|
||||
if (`${url.pathname}/`.startsWith('/admin/')) app = 'admin';
|
||||
//#endregion
|
||||
|
||||
// Script version
|
||||
const ver = localStorage.getItem('v') || VERSION;
|
||||
|
||||
//#region Detect the user language
|
||||
let lang = null;
|
||||
|
||||
@ -67,7 +70,7 @@
|
||||
|
||||
let locale = localStorage.getItem('locale');
|
||||
if (locale == null) {
|
||||
const locale = await fetch(`/assets/locales/${lang}.json`)
|
||||
const locale = await fetch(`/assets/locales/${lang}.json?ver=${ver}`)
|
||||
.then(response => response.json());
|
||||
|
||||
localStorage.setItem('locale', JSON.stringify(locale));
|
||||
@ -98,9 +101,6 @@
|
||||
app = isMobile ? 'mobile' : 'desktop';
|
||||
}
|
||||
|
||||
// Script version
|
||||
const ver = localStorage.getItem('v') || VERSION;
|
||||
|
||||
// Get salt query
|
||||
const salt = localStorage.getItem('salt')
|
||||
? `?salt=${localStorage.getItem('salt')}`
|
||||
|
@ -141,11 +141,10 @@ export default (opts: Opts = {}) => ({
|
||||
this.$root.api('notes/favorites/create', {
|
||||
noteId: this.appearNote.id
|
||||
}).then(() => {
|
||||
// TODO
|
||||
/*this.$root.alert({
|
||||
pointer: false,
|
||||
autoClose: true
|
||||
});*/
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="felqjxyj" :class="{ pointer }">
|
||||
<div class="felqjxyj" :class="{ splash }">
|
||||
<div class="bg" ref="bg" @click="onBgClick"></div>
|
||||
<div class="main" ref="main">
|
||||
<div class="icon" :class="type"><fa :icon="icon"/></div>
|
||||
<header v-if="title" v-html="title"></header>
|
||||
<div class="body" v-if="text" v-html="text"></div>
|
||||
<ui-horizon-group no-grow class="buttons">
|
||||
<ui-button @click="ok" primary>OK</ui-button>
|
||||
<ui-horizon-group no-grow class="buttons" v-if="!splash">
|
||||
<ui-button @click="ok" primary autofocus>OK</ui-button>
|
||||
<ui-button @click="cancel" v-if="showCancelButton">Cancel</ui-button>
|
||||
</ui-horizon-group>
|
||||
</div>
|
||||
@ -31,15 +31,15 @@ export default Vue.extend({
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
required: true
|
||||
required: false
|
||||
},
|
||||
showCancelButton: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
pointer: {
|
||||
splash: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
@ -72,6 +72,12 @@ export default Vue.extend({
|
||||
duration: 300,
|
||||
easing: [0, 0.5, 0.5, 1]
|
||||
});
|
||||
|
||||
if (this.splash) {
|
||||
setTimeout(() => {
|
||||
this.close();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -101,7 +107,7 @@ export default Vue.extend({
|
||||
opacity: 0,
|
||||
scale: 0.8,
|
||||
duration: 300,
|
||||
easing: [ 0.5, -0.5, 1, 0.5 ],
|
||||
easing: [0, 0.5, 0.5, 1],
|
||||
complete: () => this.destroyDom()
|
||||
});
|
||||
},
|
||||
@ -125,8 +131,13 @@ export default Vue.extend({
|
||||
width 100%
|
||||
height 100%
|
||||
|
||||
&:not(.pointer)
|
||||
pointer-events none
|
||||
&.splash
|
||||
&, *
|
||||
pointer-events none !important
|
||||
|
||||
> .main
|
||||
min-width 0
|
||||
width initial
|
||||
|
||||
> .bg
|
||||
display block
|
||||
@ -143,7 +154,7 @@ export default Vue.extend({
|
||||
display block
|
||||
position fixed
|
||||
margin auto
|
||||
padding 32px 42px
|
||||
padding 32px
|
||||
min-width 320px
|
||||
max-width 480px
|
||||
width calc(100% - 32px)
|
||||
@ -169,9 +180,10 @@ export default Vue.extend({
|
||||
display block
|
||||
margin 0 auto
|
||||
|
||||
> .header
|
||||
margin 16px 0
|
||||
> header
|
||||
margin 16px 0 8px 0
|
||||
font-weight bold
|
||||
font-size 20px
|
||||
|
||||
& + .body
|
||||
margin-top 8px
|
||||
@ -179,4 +191,7 @@ export default Vue.extend({
|
||||
> .body
|
||||
margin 16px 0
|
||||
|
||||
> .buttons
|
||||
margin-top 16px
|
||||
|
||||
</style>
|
||||
|
@ -20,7 +20,7 @@
|
||||
<footer>
|
||||
<transition name="fade">
|
||||
<div class="new-message" v-show="showIndicator">
|
||||
<button @click="onIndicatorClick"><i><fa icon="arrow-circle-down"/></i>{{ $t('new-message') }}</button>
|
||||
<button @click="onIndicatorClick"><i><fa :icon="faArrowCircleDown"/></i>{{ $t('new-message') }}</button>
|
||||
</div>
|
||||
</transition>
|
||||
<x-form :user="user" ref="form"/>
|
||||
@ -34,6 +34,7 @@ import i18n from '../../../i18n';
|
||||
import XMessage from './messaging-room.message.vue';
|
||||
import XForm from './messaging-room.form.vue';
|
||||
import { url } from '../../../config';
|
||||
import { faArrowCircleDown } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n('common/views/components/messaging-room.vue'),
|
||||
@ -52,7 +53,8 @@ export default Vue.extend({
|
||||
existMoreMessages: false,
|
||||
connection: null,
|
||||
showIndicator: false,
|
||||
timer: null
|
||||
timer: null,
|
||||
faArrowCircleDown
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -55,7 +55,7 @@ export default Vue.extend({
|
||||
}
|
||||
] : []
|
||||
], [
|
||||
this.note.userId == this.$store.state.i.id || this.$store.state.i.isAdmin ? [{
|
||||
this.note.userId == this.$store.state.i.id || this.$store.state.i.isAdmin || this.$store.state.i.isModerator ? [{
|
||||
icon: ['far', 'trash-alt'],
|
||||
text: this.$t('delete'),
|
||||
action: this.del
|
||||
@ -78,8 +78,10 @@ export default Vue.extend({
|
||||
this.$root.api('i/pin', {
|
||||
noteId: this.note.id
|
||||
}).then(() => {
|
||||
// TODO
|
||||
//this.$root.new(Ok);
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
this.destroyDom();
|
||||
});
|
||||
},
|
||||
@ -93,11 +95,18 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
del() {
|
||||
if (!window.confirm(this.$t('delete-confirm'))) return;
|
||||
this.$root.api('notes/delete', {
|
||||
noteId: this.note.id
|
||||
}).then(() => {
|
||||
this.destroyDom();
|
||||
this.$root.alert({
|
||||
type: 'warning',
|
||||
text: this.$t('delete-confirm'),
|
||||
showCancelButton: true
|
||||
}).then(res => {
|
||||
if (!res) return;
|
||||
|
||||
this.$root.api('notes/delete', {
|
||||
noteId: this.note.id
|
||||
}).then(() => {
|
||||
this.destroyDom();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@ -105,8 +114,10 @@ export default Vue.extend({
|
||||
this.$root.api('notes/favorites/create', {
|
||||
noteId: this.note.id
|
||||
}).then(() => {
|
||||
// TODO
|
||||
//this.$root.new(Ok);
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
this.destroyDom();
|
||||
});
|
||||
},
|
||||
@ -115,8 +126,10 @@ export default Vue.extend({
|
||||
this.$root.api('notes/favorites/delete', {
|
||||
noteId: this.note.id
|
||||
}).then(() => {
|
||||
// TODO
|
||||
//this.$root.new(Ok);
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
this.destroyDom();
|
||||
});
|
||||
},
|
||||
|
@ -223,6 +223,5 @@ export default Vue.extend({
|
||||
width 72px
|
||||
height 72px
|
||||
margin auto
|
||||
box-shadow 0 0 16px rgba(0, 0, 0, 0.5)
|
||||
|
||||
</style>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="nicnklzforebnpfgasiypmpdaaglujqm">
|
||||
<label>
|
||||
<span>{{ $t('light-theme') }}</span>
|
||||
<span><fa :icon="faSun"/> {{ $t('light-theme') }}</span>
|
||||
<ui-select v-model="light" :placeholder="$t('light-theme')">
|
||||
<optgroup :label="$t('light-themes')">
|
||||
<option v-for="x in lightThemes" :value="x.id" :key="x.id">{{ x.name }}</option>
|
||||
@ -13,7 +13,7 @@
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<span>{{ $t('dark-theme') }}</span>
|
||||
<span><fa :icon="faMoon"/> {{ $t('dark-theme') }}</span>
|
||||
<ui-select v-model="dark" :placeholder="$t('dark-theme')">
|
||||
<optgroup :label="$t('dark-themes')">
|
||||
<option v-for="x in darkThemes" :value="x.id" :key="x.id">{{ x.name }}</option>
|
||||
@ -104,6 +104,7 @@ import { Chrome } from 'vue-color';
|
||||
import * as uuid from 'uuid';
|
||||
import * as tinycolor from 'tinycolor2';
|
||||
import * as JSON5 from 'json5';
|
||||
import { faMoon, faSun } from '@fortawesome/free-regular-svg-icons';
|
||||
|
||||
// 後方互換性のため
|
||||
function convertOldThemedefinition(t) {
|
||||
@ -135,7 +136,8 @@ export default Vue.extend({
|
||||
myThemeDesc: '',
|
||||
myThemePrimary: lightTheme.vars.primary,
|
||||
myThemeSecondary: lightTheme.vars.secondary,
|
||||
myThemeText: lightTheme.vars.text
|
||||
myThemeText: lightTheme.vars.text,
|
||||
faMoon, faSun
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -38,12 +38,24 @@ export default Vue.extend({
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
autofocus: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
styl: 'fill'
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
if (this.autofocus) {
|
||||
this.$nextTick(() => {
|
||||
this.$el.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -58,7 +58,7 @@
|
||||
<i><fa icon="angle-right"/></i>
|
||||
</p>
|
||||
</li>
|
||||
<li v-if="$store.state.i.isAdmin">
|
||||
<li v-if="$store.state.i.isAdmin || $store.state.i.isModerator">
|
||||
<a href="/admin">
|
||||
<i><fa icon="terminal"/></i>
|
||||
<span>{{ $t('admin') }}</span>
|
||||
|
@ -307,8 +307,10 @@ export default Vue.extend({
|
||||
listId: list.id,
|
||||
userId: this.user.id
|
||||
});
|
||||
// TODO
|
||||
//this.$root.new(Ok);
|
||||
this.$root.alert({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
});
|
||||
}
|
||||
}];
|
||||
|
@ -73,13 +73,20 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
block() {
|
||||
if (!window.confirm(this.$t('block-confirm'))) return;
|
||||
this.$root.api('blocking/create', {
|
||||
userId: this.user.id
|
||||
}).then(() => {
|
||||
this.user.isBlocking = true;
|
||||
}, () => {
|
||||
alert('error');
|
||||
this.$root.alert({
|
||||
type: 'warning',
|
||||
text: this.$t('block-confirm'),
|
||||
showCancelButton: true
|
||||
}).then(res => {
|
||||
if (!res) return;
|
||||
|
||||
this.$root.api('blocking/create', {
|
||||
userId: this.user.id
|
||||
}).then(() => {
|
||||
this.user.isBlocking = true;
|
||||
}, () => {
|
||||
alert('error');
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -114,6 +114,10 @@ import {
|
||||
faBroadcastTower,
|
||||
faChartLine,
|
||||
faEllipsisV,
|
||||
faStickyNote,
|
||||
faUserPlus,
|
||||
faExternalLinkSquareAlt,
|
||||
faSync,
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
import {
|
||||
@ -231,6 +235,10 @@ library.add(
|
||||
faBroadcastTower,
|
||||
faChartLine,
|
||||
faEllipsisV,
|
||||
faStickyNote,
|
||||
faUserPlus,
|
||||
faExternalLinkSquareAlt,
|
||||
faSync,
|
||||
|
||||
farBell,
|
||||
farEnvelope,
|
||||
|
@ -30,7 +30,7 @@
|
||||
<ul>
|
||||
<li><a @click="search"><i><fa icon="search"/></i>{{ $t('search') }}<i><fa icon="angle-right"/></i></a></li>
|
||||
<li><router-link to="/i/settings" :data-active="$route.name == 'settings'"><i><fa icon="cog"/></i>{{ $t('settings') }}<i><fa icon="angle-right"/></i></router-link></li>
|
||||
<li v-if="$store.getters.isSignedIn && $store.state.i.isAdmin"><a href="/admin"><i><fa icon="terminal"/></i><span>{{ $t('admin') }}</span><i><fa icon="angle-right"/></i></a></li>
|
||||
<li v-if="$store.getters.isSignedIn && ($store.state.i.isAdmin || $store.state.i.isModerator)"><a href="/admin"><i><fa icon="terminal"/></i><span>{{ $t('admin') }}</span><i><fa icon="angle-right"/></i></a></li>
|
||||
<li @click="dark"><p><template v-if="$store.state.device.darkmode"><i><fa icon="moon"/></i></template><template v-else><i><fa :icon="['far', 'moon']"/></i></template><span>{{ $t('darkmode') }}</span></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -23,10 +23,15 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
fn() {
|
||||
const ok = window.confirm(this.$t('read-all'));
|
||||
if (!ok) return;
|
||||
this.$root.alert({
|
||||
type: 'warning',
|
||||
text: this.$t('read-all'),
|
||||
showCancelButton: true
|
||||
}).then(res => {
|
||||
if (!res) return;
|
||||
|
||||
this.$root.api('notifications/mark_all_as_read');
|
||||
this.$root.api('notifications/mark_all_as_read');
|
||||
});
|
||||
},
|
||||
onFetched() {
|
||||
Progress.done();
|
||||
|
@ -99,6 +99,7 @@ export interface ILocalUser extends IUserBase {
|
||||
lastUsedAt: Date;
|
||||
isCat: boolean;
|
||||
isAdmin?: boolean;
|
||||
isModerator?: boolean;
|
||||
isVerified?: boolean;
|
||||
twoFactorSecret: string;
|
||||
twoFactorEnabled: boolean;
|
||||
@ -125,6 +126,7 @@ export interface IRemoteUser extends IUserBase {
|
||||
};
|
||||
updatedAt: Date;
|
||||
isAdmin: false;
|
||||
isModerator: false;
|
||||
}
|
||||
|
||||
export type IUser = ILocalUser | IRemoteUser;
|
||||
|
@ -29,6 +29,10 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
|
||||
return rej('YOU_ARE_NOT_ADMIN');
|
||||
}
|
||||
|
||||
if (ep.meta.requireModerator && !user.isAdmin && !user.isModerator) {
|
||||
return rej('YOU_ARE_NOT_MODERATOR');
|
||||
}
|
||||
|
||||
if (app && ep.meta.kind && !app.permission.some(p => p === ep.meta.kind)) {
|
||||
return rej('PERMISSION_DENIED');
|
||||
}
|
||||
|
@ -30,6 +30,11 @@ export interface IEndpointMeta {
|
||||
*/
|
||||
requireAdmin?: boolean;
|
||||
|
||||
/**
|
||||
* 管理者またはモデレーターのみ使えるエンドポイントか否か
|
||||
*/
|
||||
requireModerator?: boolean;
|
||||
|
||||
/**
|
||||
* エンドポイントのリミテーションに関するやつ
|
||||
* 省略した場合はリミテーションは無いものとして解釈されます。
|
||||
|
@ -8,7 +8,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
name: {
|
||||
|
@ -8,7 +8,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
host: {
|
||||
|
@ -9,7 +9,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
id: {
|
||||
|
@ -9,7 +9,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
id: {
|
||||
|
@ -8,7 +8,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {}
|
||||
};
|
||||
|
45
src/server/api/endpoints/admin/moderators/add.ts
Normal file
45
src/server/api/endpoints/admin/moderators/add.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import $ from 'cafy';
|
||||
import ID, { transform } from '../../../../../misc/cafy-id';
|
||||
import define from '../../../define';
|
||||
import User from '../../../../../models/user';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
'ja-JP': '指定したユーザーをモデレーターにします。',
|
||||
'en-US': 'Mark a user as moderator.'
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
|
||||
params: {
|
||||
userId: {
|
||||
validator: $.type(ID),
|
||||
transform: transform,
|
||||
desc: {
|
||||
'ja-JP': '対象のユーザーID',
|
||||
'en-US': 'The user ID'
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const user = await User.findOne({
|
||||
_id: ps.userId
|
||||
});
|
||||
|
||||
if (user == null) {
|
||||
return rej('user not found');
|
||||
}
|
||||
|
||||
await User.update({
|
||||
_id: user._id
|
||||
}, {
|
||||
$set: {
|
||||
isModerator: true
|
||||
}
|
||||
});
|
||||
|
||||
res();
|
||||
}));
|
45
src/server/api/endpoints/admin/moderators/remove.ts
Normal file
45
src/server/api/endpoints/admin/moderators/remove.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import $ from 'cafy';
|
||||
import ID, { transform } from '../../../../../misc/cafy-id';
|
||||
import define from '../../../define';
|
||||
import User from '../../../../../models/user';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
'ja-JP': '指定したユーザーをモデレーター解除します。',
|
||||
'en-US': 'Unmark a user as moderator.'
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
|
||||
params: {
|
||||
userId: {
|
||||
validator: $.type(ID),
|
||||
transform: transform,
|
||||
desc: {
|
||||
'ja-JP': '対象のユーザーID',
|
||||
'en-US': 'The user ID'
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
||||
const user = await User.findOne({
|
||||
_id: ps.userId
|
||||
});
|
||||
|
||||
if (user == null) {
|
||||
return rej('user not found');
|
||||
}
|
||||
|
||||
await User.update({
|
||||
_id: user._id
|
||||
}, {
|
||||
$set: {
|
||||
isModerator: false
|
||||
}
|
||||
});
|
||||
|
||||
res();
|
||||
}));
|
@ -10,7 +10,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
userId: {
|
||||
|
@ -10,7 +10,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
userId: {
|
||||
|
@ -10,7 +10,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
userId: {
|
||||
|
@ -8,7 +8,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
broadcasts: {
|
||||
|
@ -10,7 +10,7 @@ export const meta = {
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
requireModerator: true,
|
||||
|
||||
params: {
|
||||
userId: {
|
||||
|
51
src/server/api/endpoints/instances.ts
Normal file
51
src/server/api/endpoints/instances.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import $ from 'cafy';
|
||||
import define from '../define';
|
||||
import Instance from '../../../models/instance';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: false,
|
||||
|
||||
params: {
|
||||
limit: {
|
||||
validator: $.num.optional.range(1, 100),
|
||||
default: 30
|
||||
},
|
||||
|
||||
offset: {
|
||||
validator: $.num.optional.min(0),
|
||||
default: 0
|
||||
},
|
||||
|
||||
sort: {
|
||||
validator: $.str.optional.or('+notes|-notes'),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||
let _sort;
|
||||
if (ps.sort) {
|
||||
if (ps.sort == '+notes') {
|
||||
_sort = {
|
||||
notesCount: -1
|
||||
};
|
||||
} else if (ps.sort == '-notes') {
|
||||
_sort = {
|
||||
notesCount: 1
|
||||
};
|
||||
}
|
||||
} else {
|
||||
_sort = {
|
||||
_id: -1
|
||||
};
|
||||
}
|
||||
|
||||
const instances = await Instance
|
||||
.find({}, {
|
||||
limit: ps.limit,
|
||||
sort: _sort,
|
||||
skip: ps.offset
|
||||
});
|
||||
|
||||
res(instances);
|
||||
}));
|
@ -84,7 +84,7 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||
};
|
||||
}
|
||||
|
||||
if (me && me.isAdmin) {
|
||||
if (me && (me.isAdmin || me.isModerator)) {
|
||||
response.hidedTags = instance.hidedTags;
|
||||
response.recaptchaSecretKey = instance.recaptchaSecretKey;
|
||||
response.proxyAccount = instance.proxyAccount;
|
||||
|
@ -38,7 +38,7 @@ export default define(meta, (ps, user) => new Promise(async (res, rej) => {
|
||||
return rej('note not found');
|
||||
}
|
||||
|
||||
if (!user.isAdmin && !note.userId.equals(user._id)) {
|
||||
if (!user.isAdmin && !user.isModerator && !note.userId.equals(user._id)) {
|
||||
return rej('access denied');
|
||||
}
|
||||
|
||||
|
@ -180,6 +180,8 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
|
||||
query.createdAt = {
|
||||
$lt: new Date(ps.untilDate)
|
||||
};
|
||||
} else {
|
||||
sort._id = -1;
|
||||
}
|
||||
|
||||
if (!ps.includeReplies) {
|
||||
|
Reference in New Issue
Block a user