Compare commits
24 Commits
11.0.0-bet
...
11.0.0-bet
Author | SHA1 | Date | |
---|---|---|---|
5d52e9ce6b | |||
3c29027ca3 | |||
2ff3069d23 | |||
4198246351 | |||
2b6389b4dc | |||
d7df75ae6c | |||
11c30eccb3 | |||
ab8c6515b8 | |||
d4ad36fa41 | |||
4d688be3df | |||
d2b75f3501 | |||
46b78cb4ff | |||
5d6e0d0f37 | |||
e19d0a37bb | |||
dea3e2132e | |||
91c1ceefbd | |||
5c50989970 | |||
2a7e3b9c51 | |||
ab302df0ae | |||
21e5809993 | |||
c58afc67e8 | |||
8e344f2deb | |||
c28f4ffb3f | |||
2a40240310 |
16
CHANGELOG.md
16
CHANGELOG.md
@ -8,11 +8,27 @@ If you encounter any problems with updating, please try the following:
|
||||
11.0.0
|
||||
----------
|
||||
* データベースがMongoDBからPostgreSQLに変更されました
|
||||
* アカウントを完全に削除できるように
|
||||
* ミュート/ブロック時にそのユーザーの投稿のウォッチをすべて解除するように
|
||||
* フォロー申請数が実際より1すくなくなる問題を修正
|
||||
* リストからアカウント削除したユーザーを削除できない問題を修正
|
||||
* リストTLでフォローしていないユーザーの非公開投稿が流れる問題を修正
|
||||
* リストTLでダイレクト投稿が流れない問題を修正
|
||||
* ミュートしているユーザーの投稿がタイムラインに流れてくることがある問題を修正
|
||||
|
||||
### APIの破壊的変更
|
||||
* v10時点で deprecated だったパラメータなどを削除
|
||||
* ユーザーリストの title が name に
|
||||
|
||||
10.100.0
|
||||
----------
|
||||
* ユーザーリストでフォローボタンを表示するように
|
||||
* ドライブのファイルのサムネイルを修正
|
||||
* 投稿ウィジットでローカルのみの公開範囲で投稿できない問題を修正
|
||||
* TLを遡った時に抜けがある時がある問題を修正
|
||||
* ユーザータイムラインが投稿日時順ではなくなっているのを修正
|
||||
* 10.99.0 でチャートのレンダリングがおかしい問題を修正
|
||||
|
||||
10.99.0
|
||||
----------
|
||||
* manifest.json にインスタンス名を反映させるように
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "11.0.0-beta.1",
|
||||
"version": "11.0.0-beta.3",
|
||||
"codename": "daybreak",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -8,7 +8,7 @@
|
||||
<div class="is-remote" v-if="user.host != null">
|
||||
<details>
|
||||
<summary><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}</summary>
|
||||
<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
</details>
|
||||
</div>
|
||||
<header :style="bannerStyle">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<fa icon="exclamation-triangle"/> {{ $t('@.user-suspended') }}
|
||||
</div>
|
||||
<div class="is-remote" v-if="user.host != null" :class="{ shadow: $store.state.device.useShadow, round: $store.state.device.roundedCorners }">
|
||||
<fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
<fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a>
|
||||
</div>
|
||||
<div class="main">
|
||||
<x-header class="header" :user="user"/>
|
||||
|
@ -5,7 +5,7 @@
|
||||
</template>
|
||||
<div class="wwtwuxyh" v-if="!fetching">
|
||||
<div class="is-suspended" v-if="user.isSuspended"><p><fa icon="exclamation-triangle"/> {{ $t('@.user-suspended') }}</p></div>
|
||||
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url || user.uri" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
|
||||
<div class="is-remote" v-if="user.host != null"><p><fa icon="exclamation-triangle"/> {{ $t('@.is-remote-user') }}<a :href="user.url" target="_blank">{{ $t('@.view-on-remote') }}</a></p></div>
|
||||
<header>
|
||||
<div class="banner" :style="style"></div>
|
||||
<div class="body">
|
||||
|
@ -16,7 +16,6 @@ import { InternalStorage } from './services/drive/internal-storage';
|
||||
import { createTemp } from './misc/create-temp';
|
||||
import { Note } from './models/entities/note';
|
||||
import { Following } from './models/entities/following';
|
||||
import { genId } from './misc/gen-id';
|
||||
import { Poll } from './models/entities/poll';
|
||||
import { PollVote } from './models/entities/poll-vote';
|
||||
import { NoteFavorite } from './models/entities/note-favorite';
|
||||
@ -36,6 +35,9 @@ const uri = `mongodb://${u && p ? `${u}:${p}@` : ''}${(config as any).mongodb.ho
|
||||
const db = monk(uri);
|
||||
let mdb: mongo.Db;
|
||||
|
||||
const test = false;
|
||||
const limit = 500;
|
||||
|
||||
const nativeDbConn = async (): Promise<mongo.Db> => {
|
||||
if (mdb) return mdb;
|
||||
|
||||
@ -92,14 +94,14 @@ async function main() {
|
||||
usernameLower: user.username.toLowerCase(),
|
||||
host: toPuny(user.host),
|
||||
token: generateUserToken(),
|
||||
isAdmin: user.isAdmin,
|
||||
isAdmin: user.isAdmin || false,
|
||||
name: user.name,
|
||||
followersCount: user.followersCount,
|
||||
followingCount: user.followingCount,
|
||||
notesCount: user.notesCount,
|
||||
isBot: user.isBot,
|
||||
isCat: user.isCat,
|
||||
isVerified: user.isVerified,
|
||||
followersCount: user.followersCount || 0,
|
||||
followingCount: user.followingCount || 0,
|
||||
notesCount: user.notesCount || 0,
|
||||
isBot: user.isBot || false,
|
||||
isCat: user.isCat || false,
|
||||
isVerified: user.isVerified || false,
|
||||
inbox: user.inbox,
|
||||
sharedInbox: user.sharedInbox,
|
||||
uri: user.uri,
|
||||
@ -133,7 +135,7 @@ async function main() {
|
||||
async function migrateFollowing(following: any) {
|
||||
await Followings.save({
|
||||
id: following._id.toHexString(),
|
||||
createdAt: following.createdAt || new Date(),
|
||||
createdAt: new Date(),
|
||||
followerId: following.followerId.toHexString(),
|
||||
followeeId: following.followeeId.toHexString(),
|
||||
|
||||
@ -160,6 +162,7 @@ async function main() {
|
||||
const user = await _User.findOne({
|
||||
_id: file.metadata.userId
|
||||
});
|
||||
if (user == null) return;
|
||||
if (file.metadata.storage && file.metadata.storage.key) { // when object storage
|
||||
await DriveFiles.save({
|
||||
id: file._id.toHexString(),
|
||||
@ -169,7 +172,7 @@ async function main() {
|
||||
md5: file.md5,
|
||||
name: file.filename,
|
||||
type: file.contentType,
|
||||
properties: file.metadata.properties,
|
||||
properties: file.metadata.properties || {},
|
||||
size: file.length,
|
||||
url: file.metadata.url,
|
||||
uri: file.metadata.uri,
|
||||
@ -255,7 +258,6 @@ async function main() {
|
||||
|
||||
if (note.poll) {
|
||||
await Polls.save({
|
||||
id: genId(),
|
||||
noteId: note._id.toHexString(),
|
||||
choices: note.poll.choices.map((x: any) => x.text),
|
||||
expiresAt: note.poll.expiresAt,
|
||||
@ -301,13 +303,13 @@ async function main() {
|
||||
const u = await _User.findOne({
|
||||
_id: new mongo.ObjectId(user.id)
|
||||
});
|
||||
const avatar = await DriveFiles.findOne(u.avatarId.toHexString());
|
||||
const banner = await DriveFiles.findOne(u.bannerId.toHexString());
|
||||
const avatar = u.avatarId ? await DriveFiles.findOne(u.avatarId.toHexString()) : null;
|
||||
const banner = u.bannerId ? await DriveFiles.findOne(u.bannerId.toHexString()) : null;
|
||||
await Users.update(user.id, {
|
||||
avatarId: avatar.id,
|
||||
bannerId: banner.id,
|
||||
avatarUrl: avatar.url,
|
||||
bannerUrl: banner.url
|
||||
avatarId: avatar ? avatar.id : null,
|
||||
bannerId: banner ? banner.id : null,
|
||||
avatarUrl: avatar ? avatar.url : null,
|
||||
bannerUrl: banner ? banner.url : null
|
||||
});
|
||||
}
|
||||
|
||||
@ -323,9 +325,14 @@ async function main() {
|
||||
});
|
||||
}
|
||||
|
||||
const allUsersCount = await _User.count();
|
||||
let allUsersCount = await _User.count({
|
||||
deletedAt: { $exists: false }
|
||||
});
|
||||
if (test && allUsersCount > limit) allUsersCount = limit;
|
||||
for (let i = 0; i < allUsersCount; i++) {
|
||||
const user = await _User.findOne({}, {
|
||||
const user = await _User.findOne({
|
||||
deletedAt: { $exists: false }
|
||||
}, {
|
||||
skip: i
|
||||
});
|
||||
try {
|
||||
@ -337,7 +344,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allFollowingsCount = await _Following.count();
|
||||
let allFollowingsCount = await _Following.count();
|
||||
if (test && allFollowingsCount > limit) allFollowingsCount = limit;
|
||||
for (let i = 0; i < allFollowingsCount; i++) {
|
||||
const following = await _Following.findOne({}, {
|
||||
skip: i
|
||||
@ -351,7 +359,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allDriveFoldersCount = await _DriveFolder.count();
|
||||
let allDriveFoldersCount = await _DriveFolder.count();
|
||||
if (test && allDriveFoldersCount > limit) allDriveFoldersCount = limit;
|
||||
for (let i = 0; i < allDriveFoldersCount; i++) {
|
||||
const folder = await _DriveFolder.findOne({}, {
|
||||
skip: i
|
||||
@ -365,9 +374,16 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allDriveFilesCount = await _DriveFile.count();
|
||||
let allDriveFilesCount = await _DriveFile.count({
|
||||
'metadata._user.host': null,
|
||||
'metadata.deletedAt': { $exists: false }
|
||||
});
|
||||
if (test && allDriveFilesCount > limit) allDriveFilesCount = limit;
|
||||
for (let i = 0; i < allDriveFilesCount; i++) {
|
||||
const file = await _DriveFile.findOne({}, {
|
||||
const file = await _DriveFile.findOne({
|
||||
'metadata._user.host': null,
|
||||
'metadata.deletedAt': { $exists: false }
|
||||
}, {
|
||||
skip: i
|
||||
});
|
||||
try {
|
||||
@ -379,12 +395,15 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allNotesCount = await _Note.count({
|
||||
'_user.host': null
|
||||
let allNotesCount = await _Note.count({
|
||||
'_user.host': null,
|
||||
'metadata.deletedAt': { $exists: false }
|
||||
});
|
||||
if (test && allNotesCount > limit) allNotesCount = limit;
|
||||
for (let i = 0; i < allNotesCount; i++) {
|
||||
const note = await _Note.findOne({
|
||||
'_user.host': null
|
||||
'_user.host': null,
|
||||
'metadata.deletedAt': { $exists: false }
|
||||
}, {
|
||||
skip: i
|
||||
});
|
||||
@ -397,7 +416,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allPollVotesCount = await _PollVote.count();
|
||||
let allPollVotesCount = await _PollVote.count();
|
||||
if (test && allPollVotesCount > limit) allPollVotesCount = limit;
|
||||
for (let i = 0; i < allPollVotesCount; i++) {
|
||||
const vote = await _PollVote.findOne({}, {
|
||||
skip: i
|
||||
@ -411,7 +431,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allNoteFavoritesCount = await _Favorite.count();
|
||||
let allNoteFavoritesCount = await _Favorite.count();
|
||||
if (test && allNoteFavoritesCount > limit) allNoteFavoritesCount = limit;
|
||||
for (let i = 0; i < allNoteFavoritesCount; i++) {
|
||||
const favorite = await _Favorite.findOne({}, {
|
||||
skip: i
|
||||
@ -425,7 +446,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allNoteReactionsCount = await _NoteReaction.count();
|
||||
let allNoteReactionsCount = await _NoteReaction.count();
|
||||
if (test && allNoteReactionsCount > limit) allNoteReactionsCount = limit;
|
||||
for (let i = 0; i < allNoteReactionsCount; i++) {
|
||||
const reaction = await _NoteReaction.findOne({}, {
|
||||
skip: i
|
||||
@ -439,7 +461,8 @@ async function main() {
|
||||
}
|
||||
}
|
||||
|
||||
const allActualUsersCount = await Users.count();
|
||||
let allActualUsersCount = await Users.count();
|
||||
if (test && allActualUsersCount > limit) allActualUsersCount = limit;
|
||||
for (let i = 0; i < allActualUsersCount; i++) {
|
||||
const [user] = await Users.find({
|
||||
take: 1,
|
||||
|
@ -53,7 +53,7 @@ export class App {
|
||||
public permission: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: 'The callbackUrl of the App.'
|
||||
})
|
||||
public callbackUrl: string | null;
|
||||
|
@ -25,12 +25,12 @@ export class Emoji {
|
||||
public host: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256,
|
||||
length: 512,
|
||||
})
|
||||
public url: string;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true
|
||||
length: 512, nullable: true
|
||||
})
|
||||
public uri: string | null;
|
||||
|
||||
|
@ -53,13 +53,13 @@ export class FollowRequest {
|
||||
public followerHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followerInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followerSharedInbox: string | null;
|
||||
@ -71,13 +71,13 @@ export class FollowRequest {
|
||||
public followeeHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followeeInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followeeSharedInbox: string | null;
|
||||
|
@ -48,13 +48,13 @@ export class Following {
|
||||
public followerHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followerInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followerSharedInbox: string | null;
|
||||
@ -66,13 +66,13 @@ export class Following {
|
||||
public followeeHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followeeInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public followeeSharedInbox: string | null;
|
||||
|
@ -78,27 +78,27 @@ export class Meta {
|
||||
public blockedHosts: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256,
|
||||
length: 512,
|
||||
nullable: true,
|
||||
default: '/assets/ai.png'
|
||||
})
|
||||
public mascotImageUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256,
|
||||
length: 512,
|
||||
nullable: true
|
||||
})
|
||||
public bannerUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256,
|
||||
length: 512,
|
||||
nullable: true,
|
||||
default: 'https://ai.misskey.xyz/aiart/yubitun.png'
|
||||
})
|
||||
public errorImageUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256,
|
||||
length: 512,
|
||||
nullable: true
|
||||
})
|
||||
public iconUrl: string | null;
|
||||
|
@ -15,13 +15,6 @@ export class Note {
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
nullable: true,
|
||||
comment: 'The updated date of the Note.'
|
||||
})
|
||||
public updatedAt: Date | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
@ -126,7 +119,7 @@ export class Note {
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URI of a note. it will be null when the note is local.'
|
||||
})
|
||||
public uri: string | null;
|
||||
@ -195,12 +188,6 @@ export class Note {
|
||||
})
|
||||
public userHost: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: '[Denormalized]'
|
||||
})
|
||||
public userInbox: string | null;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
@ -227,6 +214,14 @@ export class Note {
|
||||
})
|
||||
public renoteUserHost: string | null;
|
||||
//#endregion
|
||||
|
||||
constructor(data: Partial<Note>) {
|
||||
if (data == null) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
(this as any)[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type IMentionedRemoteUsers = {
|
||||
|
@ -6,10 +6,6 @@ import { User } from './user';
|
||||
@Entity()
|
||||
export class Poll {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
||||
@Index({ unique: true })
|
||||
@Column(id())
|
||||
public noteId: Note['id'];
|
||||
|
||||
@OneToOne(type => Note, {
|
||||
@ -57,6 +53,14 @@ export class Poll {
|
||||
})
|
||||
public userHost: string | null;
|
||||
//#endregion
|
||||
|
||||
constructor(data: Partial<Poll>) {
|
||||
if (data == null) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
(this as any)[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type IPoll = {
|
||||
|
@ -21,7 +21,7 @@ export class SwSubscription {
|
||||
public user: User | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256,
|
||||
length: 512,
|
||||
})
|
||||
public endpoint: string;
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
|
||||
import { PrimaryColumn, Entity, JoinColumn, Column, OneToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
|
||||
@Entity()
|
||||
export class UserKeypair {
|
||||
@Index({ unique: true })
|
||||
@PrimaryColumn(id())
|
||||
public userId: User['id'];
|
||||
|
||||
@ -23,4 +22,12 @@ export class UserKeypair {
|
||||
length: 4096,
|
||||
})
|
||||
public privateKey: string;
|
||||
|
||||
constructor(data: Partial<UserKeypair>) {
|
||||
if (data == null) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
(this as any)[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import { User } from './user';
|
||||
|
||||
@Entity()
|
||||
export class UserProfile {
|
||||
@Index({ unique: true })
|
||||
@PrimaryColumn(id())
|
||||
public userId: User['id'];
|
||||
|
||||
@ -40,6 +39,12 @@ export class UserProfile {
|
||||
value: string;
|
||||
}[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512, nullable: true,
|
||||
comment: 'Remote URL of the user.'
|
||||
})
|
||||
public url: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128, nullable: true,
|
||||
comment: 'The email address of the User.'
|
||||
@ -193,4 +198,12 @@ export class UserProfile {
|
||||
})
|
||||
public userHost: string | null;
|
||||
//#endregion
|
||||
|
||||
constructor(data: Partial<UserProfile>) {
|
||||
if (data == null) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
(this as any)[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import { id } from '../id';
|
||||
|
||||
@Entity()
|
||||
export class UserPublickey {
|
||||
@Index({ unique: true })
|
||||
@PrimaryColumn(id())
|
||||
public userId: User['id'];
|
||||
|
||||
@ -24,4 +23,12 @@ export class UserPublickey {
|
||||
length: 4096,
|
||||
})
|
||||
public keyPem: string;
|
||||
|
||||
constructor(data: Partial<UserPublickey>) {
|
||||
if (data == null) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
(this as any)[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,12 +96,12 @@ export class User {
|
||||
public tags: string[];
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
})
|
||||
public avatarUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
})
|
||||
public bannerUrl: string | null;
|
||||
|
||||
@ -175,26 +175,26 @@ export class User {
|
||||
public host: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
comment: 'The inbox of the User. It will be null if the origin of the user is local.'
|
||||
length: 512, nullable: true,
|
||||
comment: 'The inbox URL of the User. It will be null if the origin of the user is local.'
|
||||
})
|
||||
public inbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
comment: 'The sharedInbox of the User. It will be null if the origin of the user is local.'
|
||||
length: 512, nullable: true,
|
||||
comment: 'The sharedInbox URL of the User. It will be null if the origin of the user is local.'
|
||||
})
|
||||
public sharedInbox: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
comment: 'The featured of the User. It will be null if the origin of the user is local.'
|
||||
length: 512, nullable: true,
|
||||
comment: 'The featured URL of the User. It will be null if the origin of the user is local.'
|
||||
})
|
||||
public featured: string | null;
|
||||
|
||||
@Index()
|
||||
@Column('varchar', {
|
||||
length: 256, nullable: true,
|
||||
length: 512, nullable: true,
|
||||
comment: 'The URI of the User. It will be null if the origin of the user is local.'
|
||||
})
|
||||
public uri: string | null;
|
||||
@ -205,6 +205,14 @@ export class User {
|
||||
comment: 'The native access token of the User. It will be null if the origin of the user is local.'
|
||||
})
|
||||
public token: string | null;
|
||||
|
||||
constructor(data: Partial<User>) {
|
||||
if (data == null) return;
|
||||
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
(this as any)[k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export interface ILocalUser extends User {
|
||||
|
@ -87,7 +87,6 @@ export class UserRepository extends Repository<User> {
|
||||
name: user.name,
|
||||
username: user.username,
|
||||
host: user.host,
|
||||
uri: user.uri,
|
||||
avatarUrl: user.avatarUrl,
|
||||
bannerUrl: user.bannerUrl,
|
||||
avatarColor: user.avatarColor,
|
||||
@ -95,6 +94,7 @@ export class UserRepository extends Repository<User> {
|
||||
isAdmin: user.isAdmin,
|
||||
isBot: user.isBot,
|
||||
isCat: user.isCat,
|
||||
isVerified: user.isVerified,
|
||||
|
||||
// カスタム絵文字添付
|
||||
emojis: user.emojis.length > 0 ? Emojis.find({
|
||||
@ -117,6 +117,9 @@ export class UserRepository extends Repository<User> {
|
||||
} : {}),
|
||||
|
||||
...(opts.detail ? {
|
||||
url: profile.url,
|
||||
createdAt: user.createdAt,
|
||||
updatedAt: user.updatedAt,
|
||||
description: profile.description,
|
||||
location: profile.location,
|
||||
birthday: profile.birthday,
|
||||
|
@ -13,6 +13,7 @@ import { instanceChart } from '../../services/chart';
|
||||
import { UserPublickey } from '../../models/entities/user-publickey';
|
||||
import fetchMeta from '../../misc/fetch-meta';
|
||||
import { toPuny } from '../../misc/convert-host';
|
||||
import { validActor } from '../../remote/activitypub/type';
|
||||
|
||||
const logger = new Logger('inbox');
|
||||
|
||||
@ -93,7 +94,7 @@ export default async (job: Bull.Job): Promise<void> => {
|
||||
|
||||
// Update Person activityの場合は、ここで署名検証/更新処理まで実施して終了
|
||||
if (activity.type === 'Update') {
|
||||
if (activity.object && activity.object.type === 'Person') {
|
||||
if (activity.object && validActor.includes(activity.object.type)) {
|
||||
if (user == null) {
|
||||
logger.warn('Update activity received, but user not registed.');
|
||||
} else if (!httpSignature.verifySignature(signature, key.keyPem)) {
|
||||
|
@ -24,6 +24,8 @@ import { UserPublickey } from '../../../models/entities/user-publickey';
|
||||
import { isDuplicateKeyValueError } from '../../../misc/is-duplicate-key-value-error';
|
||||
import { toPuny } from '../../../misc/convert-host';
|
||||
import { UserProfile } from '../../../models/entities/user-profile';
|
||||
import { validActor } from '../../../remote/activitypub/type';
|
||||
import { getConnection } from 'typeorm';
|
||||
const logger = apLogger;
|
||||
|
||||
/**
|
||||
@ -38,7 +40,7 @@ function validatePerson(x: any, uri: string) {
|
||||
return new Error('invalid person: object is null');
|
||||
}
|
||||
|
||||
if (x.type != 'Person' && x.type != 'Service') {
|
||||
if (!validActor.includes(x.type)) {
|
||||
return new Error(`invalid person: object is not a person or service '${x.type}'`);
|
||||
}
|
||||
|
||||
@ -135,27 +137,42 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
||||
// Create user
|
||||
let user: IRemoteUser;
|
||||
try {
|
||||
user = await Users.save({
|
||||
id: genId(),
|
||||
avatarId: null,
|
||||
bannerId: null,
|
||||
createdAt: Date.parse(person.published) || new Date(),
|
||||
lastFetchedAt: new Date(),
|
||||
name: person.name,
|
||||
isLocked: person.manuallyApprovesFollowers,
|
||||
username: person.preferredUsername,
|
||||
usernameLower: person.preferredUsername.toLowerCase(),
|
||||
host,
|
||||
inbox: person.inbox,
|
||||
sharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
||||
featured: person.featured,
|
||||
endpoints: person.endpoints,
|
||||
uri: person.id,
|
||||
url: person.url,
|
||||
tags,
|
||||
isBot,
|
||||
isCat: (person as any).isCat === true
|
||||
} as Partial<User>) as IRemoteUser;
|
||||
// Start transaction
|
||||
await getConnection().transaction(async transactionalEntityManager => {
|
||||
user = await transactionalEntityManager.save(new User({
|
||||
id: genId(),
|
||||
avatarId: null,
|
||||
bannerId: null,
|
||||
createdAt: new Date(person.published) || new Date(),
|
||||
lastFetchedAt: new Date(),
|
||||
name: person.name,
|
||||
isLocked: person.manuallyApprovesFollowers,
|
||||
username: person.preferredUsername,
|
||||
usernameLower: person.preferredUsername.toLowerCase(),
|
||||
host,
|
||||
inbox: person.inbox,
|
||||
sharedInbox: person.sharedInbox || (person.endpoints ? person.endpoints.sharedInbox : undefined),
|
||||
featured: person.featured,
|
||||
uri: person.id,
|
||||
tags,
|
||||
isBot,
|
||||
isCat: (person as any).isCat === true
|
||||
})) as IRemoteUser;
|
||||
|
||||
await transactionalEntityManager.save(new UserProfile({
|
||||
userId: user.id,
|
||||
description: fromHtml(person.summary),
|
||||
url: person.url,
|
||||
fields,
|
||||
userHost: host
|
||||
}));
|
||||
|
||||
await transactionalEntityManager.save(new UserPublickey({
|
||||
userId: user.id,
|
||||
keyId: person.publicKey.id,
|
||||
keyPem: person.publicKey.publicKeyPem
|
||||
}));
|
||||
});
|
||||
} catch (e) {
|
||||
// duplicate key error
|
||||
if (isDuplicateKeyValueError(e)) {
|
||||
@ -166,18 +183,6 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
||||
throw e;
|
||||
}
|
||||
|
||||
await UserProfiles.save({
|
||||
userId: user.id,
|
||||
description: fromHtml(person.summary),
|
||||
fields,
|
||||
} as Partial<UserProfile>);
|
||||
|
||||
await UserPublickeys.save({
|
||||
userId: user.id,
|
||||
keyId: person.publicKey.id,
|
||||
keyPem: person.publicKey.publicKeyPem
|
||||
} as UserPublickey);
|
||||
|
||||
// Register host
|
||||
registerOrFetchInstanceDoc(host).then(i => {
|
||||
Instances.increment({ id: i.id }, 'usersCount', 1);
|
||||
|
@ -68,11 +68,7 @@ export async function updateQuestion(value: any) {
|
||||
}
|
||||
}
|
||||
|
||||
await Notes.update(note.id, {
|
||||
updatedAt: new Date(),
|
||||
});
|
||||
|
||||
await Polls.update(poll.id, {
|
||||
await Polls.update({ noteId: note.id }, {
|
||||
votes: poll.votes
|
||||
});
|
||||
|
||||
|
@ -65,6 +65,8 @@ interface IQuestionChoice {
|
||||
_misskey_votes?: number;
|
||||
}
|
||||
|
||||
export const validActor = ['Person', 'Service'];
|
||||
|
||||
export interface IPerson extends IObject {
|
||||
type: 'Person';
|
||||
name: string;
|
||||
|
@ -80,7 +80,11 @@ export default async (endpoint: string, user: User, app: App, data: any, file?:
|
||||
apiLogger.error(`Internal error occurred in ${ep.name}`, {
|
||||
ep: ep.name,
|
||||
ps: data,
|
||||
e: e
|
||||
e: {
|
||||
message: e.message,
|
||||
code: e.name,
|
||||
stack: e.stack
|
||||
}
|
||||
});
|
||||
throw new ApiError(null, {
|
||||
e: {
|
||||
|
@ -10,6 +10,7 @@ import { Users, Notes } from '../../../../models';
|
||||
import { Note } from '../../../../models/entities/note';
|
||||
import { User } from '../../../../models/entities/user';
|
||||
import fetchMeta from '../../../../misc/fetch-meta';
|
||||
import { validActor } from '../../../../remote/activitypub/type';
|
||||
|
||||
export const meta = {
|
||||
tags: ['federation'],
|
||||
@ -110,7 +111,7 @@ async function fetchAny(uri: string) {
|
||||
}
|
||||
|
||||
// それでもみつからなければ新規であるため登録
|
||||
if (object.type === 'Person') {
|
||||
if (validActor.includes(object.type)) {
|
||||
const user = await createPerson(object.id);
|
||||
return {
|
||||
type: 'User',
|
||||
|
@ -123,7 +123,7 @@ export default define(meta, async (ps, user) => {
|
||||
|
||||
// Increment votes count
|
||||
const index = ps.choice + 1; // In SQL, array index is 1 based
|
||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE id = '${poll.id}'`);
|
||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE noteId = '${poll.noteId}'`);
|
||||
|
||||
publishNoteStream(note.id, 'pollVoted', {
|
||||
choice: ps.choice,
|
||||
|
@ -5,13 +5,14 @@ import generateUserToken from '../common/generate-native-user-token';
|
||||
import config from '../../../config';
|
||||
import fetchMeta from '../../../misc/fetch-meta';
|
||||
import * as recaptcha from 'recaptcha-promise';
|
||||
import { Users, RegistrationTickets, UserProfiles, UserKeypairs } from '../../../models';
|
||||
import { Users, RegistrationTickets } from '../../../models';
|
||||
import { genId } from '../../../misc/gen-id';
|
||||
import { usersChart } from '../../../services/chart';
|
||||
import { User } from '../../../models/entities/user';
|
||||
import { UserKeypair } from '../../../models/entities/user-keypair';
|
||||
import { toPuny } from '../../../misc/convert-host';
|
||||
import { UserProfile } from '../../../models/entities/user-profile';
|
||||
import { getConnection } from 'typeorm';
|
||||
|
||||
export default async (ctx: Koa.BaseContext) => {
|
||||
const body = ctx.request.body as any;
|
||||
@ -99,28 +100,33 @@ export default async (ctx: Koa.BaseContext) => {
|
||||
e ? j(e) : s([publicKey, privateKey])
|
||||
));
|
||||
|
||||
const account = await Users.save({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
username: username,
|
||||
usernameLower: username.toLowerCase(),
|
||||
host: toPuny(host),
|
||||
token: secret,
|
||||
isAdmin: config.autoAdmin && usersCount === 0,
|
||||
} as User);
|
||||
let account: User;
|
||||
|
||||
await UserKeypairs.save({
|
||||
publicKey: keyPair[0],
|
||||
privateKey: keyPair[1],
|
||||
userId: account.id
|
||||
} as UserKeypair);
|
||||
// Start transaction
|
||||
await getConnection().transaction(async transactionalEntityManager => {
|
||||
account = await transactionalEntityManager.save(new User({
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
username: username,
|
||||
usernameLower: username.toLowerCase(),
|
||||
host: toPuny(host),
|
||||
token: secret,
|
||||
isAdmin: config.autoAdmin && usersCount === 0,
|
||||
}));
|
||||
|
||||
await UserProfiles.save({
|
||||
userId: account.id,
|
||||
autoAcceptFollowed: true,
|
||||
autoWatch: false,
|
||||
password: hash,
|
||||
} as Partial<UserProfile>);
|
||||
await transactionalEntityManager.save(new UserKeypair({
|
||||
publicKey: keyPair[0],
|
||||
privateKey: keyPair[1],
|
||||
userId: account.id
|
||||
}));
|
||||
|
||||
await transactionalEntityManager.save(new UserProfile({
|
||||
userId: account.id,
|
||||
autoAcceptFollowed: true,
|
||||
autoWatch: false,
|
||||
password: hash,
|
||||
}));
|
||||
});
|
||||
|
||||
usersChart.update(account, true);
|
||||
|
||||
|
@ -16,7 +16,7 @@ import fetchMeta from '../../misc/fetch-meta';
|
||||
import * as pkg from '../../../package.json';
|
||||
import { genOpenapiSpec } from '../api/openapi/gen-spec';
|
||||
import config from '../../config';
|
||||
import { Users, Notes, Emojis } from '../../models';
|
||||
import { Users, Notes, Emojis, UserProfiles } from '../../models';
|
||||
import parseAcct from '../../misc/acct/parse';
|
||||
import getNoteSummary from '../../misc/get-note-summary';
|
||||
|
||||
@ -149,11 +149,14 @@ router.get('/@:user', async (ctx, next) => {
|
||||
usernameLower: username.toLowerCase(),
|
||||
host
|
||||
});
|
||||
const profile = await UserProfiles.findOne({
|
||||
userId: user.id
|
||||
});
|
||||
|
||||
if (user != null) {
|
||||
const meta = await fetchMeta();
|
||||
await ctx.render('user', {
|
||||
user,
|
||||
user, profile,
|
||||
instanceName: meta.name || 'Misskey'
|
||||
});
|
||||
ctx.set('Cache-Control', 'public, max-age=180');
|
||||
|
@ -9,12 +9,12 @@ block title
|
||||
= `${title} | ${instanceName}`
|
||||
|
||||
block desc
|
||||
meta(name='description' content= user.description)
|
||||
meta(name='description' content= profile.description)
|
||||
|
||||
block og
|
||||
meta(property='og:type' content='blog')
|
||||
meta(property='og:title' content= title)
|
||||
meta(property='og:description' content= user.description)
|
||||
meta(property='og:description' content= profile.description)
|
||||
meta(property='og:url' content= url)
|
||||
meta(property='og:image' content= img)
|
||||
|
||||
@ -24,12 +24,12 @@ block meta
|
||||
|
||||
meta(name='twitter:card' content='summary')
|
||||
|
||||
if user.twitter
|
||||
meta(name='twitter:creator' content=`@${user.twitter.screenName}`)
|
||||
if profile.twitter
|
||||
meta(name='twitter:creator' content=`@${profile.twitter.screenName}`)
|
||||
|
||||
if !user.host
|
||||
link(rel='alternate' href=`${config.url}/users/${user._id}` type='application/activity+json')
|
||||
link(rel='alternate' href=`${config.url}/users/${user.id}` type='application/activity+json')
|
||||
if user.uri
|
||||
link(rel='alternate' href=user.uri type='application/activity+json')
|
||||
if user.url
|
||||
link(rel='alternate' href=user.url type='text/html')
|
||||
if profile.url
|
||||
link(rel='alternate' href=profile.url type='text/html')
|
||||
|
@ -17,10 +17,10 @@ import extractMentions from '../../misc/extract-mentions';
|
||||
import extractEmojis from '../../misc/extract-emojis';
|
||||
import extractHashtags from '../../misc/extract-hashtags';
|
||||
import { Note } from '../../models/entities/note';
|
||||
import { Mutings, Users, NoteWatchings, Followings, Notes, Instances, Polls, UserProfiles } from '../../models';
|
||||
import { Mutings, Users, NoteWatchings, Followings, Notes, Instances, UserProfiles } from '../../models';
|
||||
import { DriveFile } from '../../models/entities/drive-file';
|
||||
import { App } from '../../models/entities/app';
|
||||
import { Not } from 'typeorm';
|
||||
import { Not, getConnection } from 'typeorm';
|
||||
import { User, ILocalUser, IRemoteUser } from '../../models/entities/user';
|
||||
import { genId } from '../../misc/gen-id';
|
||||
import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '../chart';
|
||||
@ -329,12 +329,16 @@ async function publish(user: User, note: Note, reply: Note, renote: Note, noteAc
|
||||
if (Users.isLocalUser(user)) {
|
||||
// 投稿がリプライかつ投稿者がローカルユーザーかつリプライ先の投稿の投稿者がリモートユーザーなら配送
|
||||
if (reply && reply.userHost !== null) {
|
||||
deliver(user, noteActivity, reply.userInbox);
|
||||
Users.findOne(reply.userId).then(u => {
|
||||
deliver(user, noteActivity, u.inbox);
|
||||
});
|
||||
}
|
||||
|
||||
// 投稿がRenoteかつ投稿者がローカルユーザーかつRenote元の投稿の投稿者がリモートユーザーなら配送
|
||||
if (renote && renote.userHost !== null) {
|
||||
deliver(user, noteActivity, renote.userInbox);
|
||||
Users.findOne(renote.userId).then(u => {
|
||||
deliver(user, noteActivity, u.inbox);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,7 +349,7 @@ async function publish(user: User, note: Note, reply: Note, renote: Note, noteAc
|
||||
}
|
||||
|
||||
async function insertNote(user: User, data: Option, tags: string[], emojis: string[], mentionedUsers: User[]) {
|
||||
const insert: Partial<Note> = {
|
||||
const insert = new Note({
|
||||
id: genId(data.createdAt),
|
||||
createdAt: data.createdAt,
|
||||
fileIds: data.files ? data.files.map(file => file.id) : [],
|
||||
@ -377,8 +381,7 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri
|
||||
renoteUserId: data.renote ? data.renote.userId : null,
|
||||
renoteUserHost: data.renote ? data.renote.userHost : null,
|
||||
userHost: user.host,
|
||||
userInbox: user.inbox,
|
||||
};
|
||||
});
|
||||
|
||||
if (data.uri != null) insert.uri = data.uri;
|
||||
|
||||
@ -394,20 +397,27 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri
|
||||
|
||||
// 投稿を作成
|
||||
try {
|
||||
const note = await Notes.save(insert);
|
||||
let note: Note;
|
||||
if (insert.hasPoll) {
|
||||
// Start transaction
|
||||
await getConnection().transaction(async transactionalEntityManager => {
|
||||
note = await transactionalEntityManager.save(insert);
|
||||
|
||||
if (note.hasPoll) {
|
||||
await Polls.save({
|
||||
id: genId(),
|
||||
noteId: note.id,
|
||||
choices: data.poll.choices,
|
||||
expiresAt: data.poll.expiresAt,
|
||||
multiple: data.poll.multiple,
|
||||
votes: new Array(data.poll.choices.length).fill(0),
|
||||
noteVisibility: note.visibility,
|
||||
userId: user.id,
|
||||
userHost: user.host
|
||||
} as Poll);
|
||||
const poll = new Poll({
|
||||
noteId: note.id,
|
||||
choices: data.poll.choices,
|
||||
expiresAt: data.poll.expiresAt,
|
||||
multiple: data.poll.multiple,
|
||||
votes: new Array(data.poll.choices.length).fill(0),
|
||||
noteVisibility: note.visibility,
|
||||
userId: user.id,
|
||||
userHost: user.host
|
||||
});
|
||||
|
||||
await transactionalEntityManager.save(poll);
|
||||
});
|
||||
} else {
|
||||
note = await Notes.save(insert);
|
||||
}
|
||||
|
||||
return note;
|
||||
|
@ -1,6 +1,3 @@
|
||||
import { updateQuestion } from '../../../remote/activitypub/models/question';
|
||||
import ms = require('ms');
|
||||
import Logger from '../../logger';
|
||||
import renderUpdate from '../../../remote/activitypub/renderer/update';
|
||||
import { renderActivity } from '../../../remote/activitypub/renderer';
|
||||
import { deliver } from '../../../queue';
|
||||
@ -8,21 +5,6 @@ import renderNote from '../../../remote/activitypub/renderer/note';
|
||||
import { Users, Notes, Followings } from '../../../models';
|
||||
import { Note } from '../../../models/entities/note';
|
||||
|
||||
const logger = new Logger('pollsUpdate');
|
||||
|
||||
export async function triggerUpdate(note: Note) {
|
||||
if (!note.updatedAt || Date.now() - new Date(note.updatedAt).getTime() > ms('1min')) {
|
||||
logger.info(`Updating ${note.id}`);
|
||||
|
||||
try {
|
||||
const updated = await updateQuestion(note.uri);
|
||||
logger.info(`Updated ${note.id} ${updated ? 'changed' : 'nochange'}`);
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function deliverQuestionUpdate(noteId: Note['id']) {
|
||||
const note = await Notes.findOne(noteId);
|
||||
|
||||
|
@ -40,7 +40,7 @@ export default (user: User, note: Note, choice: number) => new Promise(async (re
|
||||
|
||||
// Increment votes count
|
||||
const index = choice + 1; // In SQL, array index is 1 based
|
||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE id = '${poll.id}'`);
|
||||
await Polls.query(`UPDATE poll SET votes[${index}] = votes[${index}] + 1 WHERE noteId = '${poll.noteId}'`);
|
||||
|
||||
publishNoteStream(note.id, 'pollVoted', {
|
||||
choice: choice,
|
||||
|
@ -90,7 +90,9 @@ export default async (user: User, note: Note, reaction: string) => {
|
||||
// リアクターがローカルユーザーかつリアクション対象がリモートユーザーの投稿なら配送
|
||||
if (Users.isLocalUser(user) && note.userHost !== null) {
|
||||
const content = renderActivity(renderLike(user, note, reaction));
|
||||
deliver(user, content, note.userInbox);
|
||||
Users.findOne(note.userId).then(u => {
|
||||
deliver(user, content, u.inbox);
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
};
|
||||
|
@ -41,7 +41,9 @@ export default async (user: User, note: Note) => {
|
||||
// リアクターがローカルユーザーかつリアクション対象がリモートユーザーの投稿なら配送
|
||||
if (Users.isLocalUser(user) && (note.userHost !== null)) {
|
||||
const content = renderActivity(renderUndo(renderLike(user, note, exist.reaction), user));
|
||||
deliver(user, content, note.userInbox);
|
||||
Users.findOne(note.userId).then(u => {
|
||||
deliver(user, content, u.inbox);
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
};
|
||||
|
Reference in New Issue
Block a user