Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25e4cebc0f | ||
|
|
5d0ded2a69 | ||
|
|
bd207b5012 | ||
|
|
38b9ed3f27 | ||
|
|
e2202b084b | ||
|
|
45b6a6bc54 | ||
|
|
d87e3a0ee3 |
18
cli/suspend.js
Normal file
18
cli/suspend.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const mongo = require('mongodb');
|
||||||
|
const User = require('../built/models/user').default;
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
|
||||||
|
const userId = new mongo.ObjectID(args[0]);
|
||||||
|
|
||||||
|
console.log(`Suspending ${userId}...`);
|
||||||
|
|
||||||
|
User.update({ _id: userId }, {
|
||||||
|
$set: {
|
||||||
|
isSuspended: true
|
||||||
|
}
|
||||||
|
}).then(() => {
|
||||||
|
console.log(`Suspended ${userId}`);
|
||||||
|
}, e => {
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
@@ -406,6 +406,7 @@ desktop/views/pages/user/user.friends.vue:
|
|||||||
no-users: "No users"
|
no-users: "No users"
|
||||||
|
|
||||||
desktop/views/pages/user/user.header.vue:
|
desktop/views/pages/user/user.header.vue:
|
||||||
|
is-suspended: "This account has been suspended."
|
||||||
is-remote: "This user is a remote user, so the information is not accurate. "
|
is-remote: "This user is a remote user, so the information is not accurate. "
|
||||||
view-remote: "See accurate information"
|
view-remote: "See accurate information"
|
||||||
|
|
||||||
@@ -594,6 +595,7 @@ mobile/views/pages/user.vue:
|
|||||||
overview: "Overview"
|
overview: "Overview"
|
||||||
timeline: "Timeline"
|
timeline: "Timeline"
|
||||||
media: "Media"
|
media: "Media"
|
||||||
|
is-suspended: "This account has been suspended."
|
||||||
is-remote: "This user is a remote user, so the information is not accurate. "
|
is-remote: "This user is a remote user, so the information is not accurate. "
|
||||||
view-remote: "See accurate information"
|
view-remote: "See accurate information"
|
||||||
|
|
||||||
|
|||||||
@@ -406,6 +406,7 @@ desktop/views/pages/user/user.friends.vue:
|
|||||||
no-users: "Pas d'utilisateurs"
|
no-users: "Pas d'utilisateurs"
|
||||||
|
|
||||||
desktop/views/pages/user/user.header.vue:
|
desktop/views/pages/user/user.header.vue:
|
||||||
|
is-suspended: "This account has been suspended."
|
||||||
is-remote: "Cet utilisateur n'est pas un utilisateur de Misskey. Certaines informations peuvent être erronées "
|
is-remote: "Cet utilisateur n'est pas un utilisateur de Misskey. Certaines informations peuvent être erronées "
|
||||||
view-remote: "Voir les informations détaillées"
|
view-remote: "Voir les informations détaillées"
|
||||||
|
|
||||||
@@ -594,6 +595,7 @@ mobile/views/pages/user.vue:
|
|||||||
overview: "Aperçu"
|
overview: "Aperçu"
|
||||||
timeline: "Fil d'actualité"
|
timeline: "Fil d'actualité"
|
||||||
media: "Media"
|
media: "Media"
|
||||||
|
is-suspended: "This account has been suspended."
|
||||||
is-remote: "Cet utilisateur n'est pas un utilisateur de Misskey. Certaines informations peuvent être erronées "
|
is-remote: "Cet utilisateur n'est pas un utilisateur de Misskey. Certaines informations peuvent être erronées "
|
||||||
view-remote: "Voir les informations détaillées"
|
view-remote: "Voir les informations détaillées"
|
||||||
|
|
||||||
|
|||||||
@@ -406,7 +406,8 @@ desktop/views/pages/user/user.friends.vue:
|
|||||||
no-users: "よく話すユーザーはいません"
|
no-users: "よく話すユーザーはいません"
|
||||||
|
|
||||||
desktop/views/pages/user/user.header.vue:
|
desktop/views/pages/user/user.header.vue:
|
||||||
is-remote: "このユーザーはリモートユーザーのため情報が正確ではありません。"
|
is-suspended: "このユーザーは凍結されています。"
|
||||||
|
is-remote: "このユーザーはリモートユーザーです。"
|
||||||
view-remote: "正確な情報を見る"
|
view-remote: "正確な情報を見る"
|
||||||
|
|
||||||
desktop/views/pages/user/user.home.vue:
|
desktop/views/pages/user/user.home.vue:
|
||||||
@@ -594,7 +595,8 @@ mobile/views/pages/user.vue:
|
|||||||
overview: "概要"
|
overview: "概要"
|
||||||
timeline: "タイムライン"
|
timeline: "タイムライン"
|
||||||
media: "メディア"
|
media: "メディア"
|
||||||
is-remote: "このユーザーはリモートユーザーのため情報が正確ではありません。"
|
is-suspended: "このユーザーは凍結されています。"
|
||||||
|
is-remote: "このユーザーはリモートユーザーです。"
|
||||||
view-remote: "正確な情報を見る"
|
view-remote: "正確な情報を見る"
|
||||||
|
|
||||||
mobile/views/pages/user/home.vue:
|
mobile/views/pages/user/home.vue:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "0.0.5023",
|
"version": "0.0.5030",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A miniblog-based SNS",
|
"description": "A miniblog-based SNS",
|
||||||
@@ -56,6 +56,7 @@
|
|||||||
"@types/koa-bodyparser": "4.2.0",
|
"@types/koa-bodyparser": "4.2.0",
|
||||||
"@types/koa-compress": "^2.0.8",
|
"@types/koa-compress": "^2.0.8",
|
||||||
"@types/koa-favicon": "2.0.19",
|
"@types/koa-favicon": "2.0.19",
|
||||||
|
"@types/koa-logger": "^3.1.0",
|
||||||
"@types/koa-mount": "3.0.1",
|
"@types/koa-mount": "3.0.1",
|
||||||
"@types/koa-multer": "1.0.0",
|
"@types/koa-multer": "1.0.0",
|
||||||
"@types/koa-router": "7.0.27",
|
"@types/koa-router": "7.0.27",
|
||||||
@@ -141,6 +142,7 @@
|
|||||||
"koa-compress": "3.0.0",
|
"koa-compress": "3.0.0",
|
||||||
"koa-favicon": "2.0.1",
|
"koa-favicon": "2.0.1",
|
||||||
"koa-json-body": "^5.3.0",
|
"koa-json-body": "^5.3.0",
|
||||||
|
"koa-logger": "^3.2.0",
|
||||||
"koa-mount": "3.0.0",
|
"koa-mount": "3.0.0",
|
||||||
"koa-multer": "1.0.2",
|
"koa-multer": "1.0.2",
|
||||||
"koa-router": "7.4.0",
|
"koa-router": "7.4.0",
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ export default Vue.extend({
|
|||||||
color #b2b8bb
|
color #b2b8bb
|
||||||
|
|
||||||
> .body
|
> .body
|
||||||
|
max-height 128px
|
||||||
|
overflow hidden
|
||||||
|
|
||||||
> .text
|
> .text
|
||||||
cursor default
|
cursor default
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="header" :data-is-dark-background="user.bannerUrl != null">
|
<div class="header" :data-is-dark-background="user.bannerUrl != null">
|
||||||
|
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
||||||
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
||||||
<div class="banner-container" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=2048)` : ''">
|
<div class="banner-container" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=2048)` : ''">
|
||||||
<div class="banner" ref="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=2048)` : ''" @click="onBannerClick"></div>
|
<div class="banner" ref="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=2048)` : ''" @click="onBannerClick"></div>
|
||||||
@@ -73,8 +74,15 @@ export default Vue.extend({
|
|||||||
background #f7f7f7
|
background #f7f7f7
|
||||||
box-shadow 0 1px 1px rgba(0, 0, 0, 0.075)
|
box-shadow 0 1px 1px rgba(0, 0, 0, 0.075)
|
||||||
|
|
||||||
|
> .is-suspended
|
||||||
> .is-remote
|
> .is-remote
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
&.is-suspended
|
||||||
|
color #570808
|
||||||
|
background #ffdbdb
|
||||||
|
|
||||||
|
&.is-remote
|
||||||
color #573c08
|
color #573c08
|
||||||
background #fff0db
|
background #fff0db
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,8 @@ export default Vue.extend({
|
|||||||
color #b2b8bb
|
color #b2b8bb
|
||||||
|
|
||||||
> .body
|
> .body
|
||||||
|
max-height 128px
|
||||||
|
overflow hidden
|
||||||
|
|
||||||
> .text
|
> .text
|
||||||
cursor default
|
cursor default
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<mk-ui>
|
<mk-ui>
|
||||||
<span slot="header" v-if="!fetching">%fa:user% {{ user | userName }}</span>
|
<span slot="header" v-if="!fetching">%fa:user% {{ user | userName }}</span>
|
||||||
<main v-if="!fetching">
|
<main v-if="!fetching">
|
||||||
|
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
||||||
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
||||||
<header>
|
<header>
|
||||||
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=1024)` : ''"></div>
|
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=1024)` : ''"></div>
|
||||||
@@ -110,8 +111,15 @@ export default Vue.extend({
|
|||||||
@import '~const.styl'
|
@import '~const.styl'
|
||||||
|
|
||||||
main
|
main
|
||||||
|
> .is-suspended
|
||||||
> .is-remote
|
> .is-remote
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
&.is-suspended
|
||||||
|
color #570808
|
||||||
|
background #ffdbdb
|
||||||
|
|
||||||
|
&.is-remote
|
||||||
color #573c08
|
color #573c08
|
||||||
background #fff0db
|
background #fff0db
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,11 @@ const log = debug('misskey:activitypub');
|
|||||||
* Imageを作成します。
|
* Imageを作成します。
|
||||||
*/
|
*/
|
||||||
export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile> {
|
export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile> {
|
||||||
|
// 投稿者が凍結されていたらスキップ
|
||||||
|
if (actor.isSuspended) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const image = await new Resolver().resolve(value);
|
const image = await new Resolver().resolve(value);
|
||||||
|
|
||||||
if (image.url == null) {
|
if (image.url == null) {
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
|||||||
// 投稿者をフェッチ
|
// 投稿者をフェッチ
|
||||||
const actor = await resolvePerson(note.attributedTo) as IRemoteUser;
|
const actor = await resolvePerson(note.attributedTo) as IRemoteUser;
|
||||||
|
|
||||||
|
// 投稿者が凍結されていたらスキップ
|
||||||
|
if (actor.isSuspended) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
//#region Visibility
|
//#region Visibility
|
||||||
let visibility = 'public';
|
let visibility = 'public';
|
||||||
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) visibility = 'unlisted';
|
if (!note.to.includes('https://www.w3.org/ns/activitystreams#Public')) visibility = 'unlisted';
|
||||||
|
|||||||
@@ -80,7 +80,9 @@ export async function createPerson(value: any, resolver?: Resolver): Promise<IUs
|
|||||||
const summaryDOM = JSDOM.fragment(person.summary);
|
const summaryDOM = JSDOM.fragment(person.summary);
|
||||||
|
|
||||||
// Create user
|
// Create user
|
||||||
const user = await User.insert({
|
let user: IRemoteUser;
|
||||||
|
try {
|
||||||
|
user = await User.insert({
|
||||||
avatarId: null,
|
avatarId: null,
|
||||||
bannerId: null,
|
bannerId: null,
|
||||||
createdAt: Date.parse(person.published) || null,
|
createdAt: Date.parse(person.published) || null,
|
||||||
@@ -101,6 +103,15 @@ export async function createPerson(value: any, resolver?: Resolver): Promise<IUs
|
|||||||
uri: person.id,
|
uri: person.id,
|
||||||
url: person.url
|
url: person.url
|
||||||
}) as IRemoteUser;
|
}) as IRemoteUser;
|
||||||
|
} catch (e) {
|
||||||
|
// duplicate key error
|
||||||
|
if (e.code === 11000) {
|
||||||
|
throw new Error('already registered');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
//#region アイコンとヘッダー画像をフェッチ
|
//#region アイコンとヘッダー画像をフェッチ
|
||||||
const [avatarId, bannerId] = (await Promise.all([
|
const [avatarId, bannerId] = (await Promise.all([
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import * as Koa from 'koa';
|
|||||||
import * as Router from 'koa-router';
|
import * as Router from 'koa-router';
|
||||||
import * as mount from 'koa-mount';
|
import * as mount from 'koa-mount';
|
||||||
import * as compress from 'koa-compress';
|
import * as compress from 'koa-compress';
|
||||||
|
import * as logger from 'koa-logger';
|
||||||
|
|
||||||
import activityPub from './activitypub';
|
import activityPub from './activitypub';
|
||||||
import webFinger from './webfinger';
|
import webFinger from './webfinger';
|
||||||
@@ -19,6 +20,12 @@ import config from '../config';
|
|||||||
const app = new Koa();
|
const app = new Koa();
|
||||||
app.proxy = true;
|
app.proxy = true;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV != 'production') {
|
||||||
|
// Logger
|
||||||
|
app.use(logger());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compress response
|
||||||
app.use(compress({
|
app.use(compress({
|
||||||
flush: zlib.constants.Z_SYNC_FLUSH
|
flush: zlib.constants.Z_SYNC_FLUSH
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user