refactor: Use ESM (#8358)
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { Antenna } from '@/models/entities/antenna';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { AntennaNotes, Mutings, Notes } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related';
|
||||
import { publishAntennaStream, publishMainStream } from '@/services/stream';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Antenna } from '@/models/entities/antenna.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { AntennaNotes, Mutings, Notes } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related.js';
|
||||
import { publishAntennaStream, publishMainStream } from '@/services/stream.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
|
||||
export async function addNoteToAntenna(antenna: Antenna, note: Note, noteUser: { id: User['id']; }) {
|
||||
// 通知しない設定になっているか、自分自身の投稿なら既読にする
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import renderBlock from '@/remote/activitypub/renderer/block';
|
||||
import { deliver } from '@/queue/index';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '@/models/index';
|
||||
import { perUserFollowingChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import renderBlock from '@/remote/activitypub/renderer/block.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Blockings, Users, FollowRequests, Followings, UserListJoinings, UserLists } from '@/models/index.js';
|
||||
import { perUserFollowingChart } from '@/services/chart/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
||||
export default async function(blocker: User, blockee: User) {
|
||||
await Promise.all([
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderBlock from '@/remote/activitypub/renderer/block';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { deliver } from '@/queue/index';
|
||||
import Logger from '../logger';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Blockings, Users } from '@/models/index';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderBlock from '@/remote/activitypub/renderer/block.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import Logger from '../logger.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Blockings, Users } from '@/models/index.js';
|
||||
|
||||
const logger = new Logger('blocking/delete');
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Users } from '@/models/index';
|
||||
import { name, schema } from './entities/active-users';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { name, schema } from './entities/active-users.js';
|
||||
|
||||
const week = 1000 * 60 * 60 * 24 * 7;
|
||||
const month = 1000 * 60 * 60 * 24 * 30;
|
||||
@ -17,17 +16,14 @@ export default class ActiveUsersChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async read(user: { id: User['id'], host: null, createdAt: User['createdAt'] }): Promise<void> {
|
||||
await this.commit({
|
||||
'read': [user.id],
|
||||
@ -40,7 +36,6 @@ export default class ActiveUsersChart extends Chart<typeof schema> {
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async write(user: { id: User['id'], host: null, createdAt: User['createdAt'] }): Promise<void> {
|
||||
await this.commit({
|
||||
'write': [user.id],
|
||||
|
@ -1,6 +1,5 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { name, schema } from './entities/ap-request';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { name, schema } from './entities/ap-request.js';
|
||||
|
||||
/**
|
||||
* Chart about ActivityPub requests
|
||||
@ -11,31 +10,26 @@ export default class ApRequestChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async deliverSucc(): Promise<void> {
|
||||
await this.commit({
|
||||
'deliverSucceeded': 1,
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async deliverFail(): Promise<void> {
|
||||
await this.commit({
|
||||
'deliverFailed': 1,
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async inbox(): Promise<void> {
|
||||
await this.commit({
|
||||
'inboxReceived': 1,
|
||||
|
@ -1,9 +1,8 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { DriveFiles } from '@/models/index';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { Not, IsNull } from 'typeorm';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { name, schema } from './entities/drive';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { name, schema } from './entities/drive.js';
|
||||
|
||||
/**
|
||||
* ドライブに関するチャート
|
||||
@ -14,17 +13,14 @@ export default class DriveChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(file: DriveFile, isAdditional: boolean): Promise<void> {
|
||||
const fileSizeKb = file.size / 1000;
|
||||
await this.commit(file.userHost === null ? {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'activeUsers';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'apRequest';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'drive';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'federation';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'hashtag';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'instance';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'notes';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'perUserDrive';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'perUserFollowing';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'perUserNotes';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'perUserReaction';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'testGrouped';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'testIntersection';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'testUnique';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'test';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import Chart from '../../core';
|
||||
import Chart from '../../core.js';
|
||||
|
||||
export const name = 'users';
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { Followings } from '@/models/index';
|
||||
import { name, schema } from './entities/federation';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { Followings } from '@/models/index.js';
|
||||
import { name, schema } from './entities/federation.js';
|
||||
|
||||
/**
|
||||
* フェデレーションに関するチャート
|
||||
@ -12,13 +11,11 @@ export default class FederationChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
const pubsubSubQuery = Followings.createQueryBuilder('f')
|
||||
.select('f.followerHost')
|
||||
@ -51,7 +48,6 @@ export default class FederationChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async deliverd(host: string, succeeded: boolean): Promise<void> {
|
||||
await this.commit(succeeded ? {
|
||||
'deliveredInstances': [host],
|
||||
@ -60,7 +56,6 @@ export default class FederationChart extends Chart<typeof schema> {
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async inbox(host: string): Promise<void> {
|
||||
await this.commit({
|
||||
'inboxInstances': [host],
|
||||
|
@ -1,8 +1,7 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Users } from '@/models/index';
|
||||
import { name, schema } from './entities/hashtag';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { name, schema } from './entities/hashtag.js';
|
||||
|
||||
/**
|
||||
* ハッシュタグに関するチャート
|
||||
@ -13,17 +12,14 @@ export default class HashtagChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(hashtag: string, user: { id: User['id'], host: User['host'] }): Promise<void> {
|
||||
await this.commit({
|
||||
'local.users': Users.isLocalUser(user) ? [user.id] : [],
|
||||
|
@ -1,10 +1,9 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { DriveFiles, Followings, Users, Notes } from '@/models/index';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { toPuny } from '@/misc/convert-host';
|
||||
import { name, schema } from './entities/instance';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { DriveFiles, Followings, Users, Notes } from '@/models/index.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { toPuny } from '@/misc/convert-host.js';
|
||||
import { name, schema } from './entities/instance.js';
|
||||
|
||||
/**
|
||||
* インスタンスごとのチャート
|
||||
@ -15,7 +14,6 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
const [
|
||||
notesCount,
|
||||
@ -42,19 +40,16 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async requestReceived(host: string): Promise<void> {
|
||||
await this.commit({
|
||||
'requests.received': 1,
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async requestSent(host: string, isSucceeded: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
'requests.succeeded': isSucceeded ? 1 : 0,
|
||||
@ -62,7 +57,6 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async newUser(host: string): Promise<void> {
|
||||
await this.commit({
|
||||
'users.total': 1,
|
||||
@ -70,7 +64,6 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async updateNote(host: string, note: Note, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
'notes.total': isAdditional ? 1 : -1,
|
||||
@ -83,7 +76,6 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async updateFollowing(host: string, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
'following.total': isAdditional ? 1 : -1,
|
||||
@ -92,7 +84,6 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async updateFollowers(host: string, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
'followers.total': isAdditional ? 1 : -1,
|
||||
@ -101,7 +92,6 @@ export default class InstanceChart extends Chart<typeof schema> {
|
||||
}, toPuny(host));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async updateDrive(file: DriveFile, isAdditional: boolean): Promise<void> {
|
||||
const fileSizeKb = file.size / 1000;
|
||||
await this.commit({
|
||||
|
@ -1,9 +1,8 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { Notes } from '@/models/index';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { Notes } from '@/models/index.js';
|
||||
import { Not, IsNull } from 'typeorm';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { name, schema } from './entities/notes';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { name, schema } from './entities/notes.js';
|
||||
|
||||
/**
|
||||
* ノートに関するチャート
|
||||
@ -14,7 +13,6 @@ export default class NotesChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
const [localCount, remoteCount] = await Promise.all([
|
||||
Notes.count({ userHost: null }),
|
||||
@ -27,12 +25,10 @@ export default class NotesChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(note: Note, isAdditional: boolean): Promise<void> {
|
||||
const prefix = note.userHost === null ? 'local' : 'remote';
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { DriveFiles } from '@/models/index';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { name, schema } from './entities/per-user-drive';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { name, schema } from './entities/per-user-drive.js';
|
||||
|
||||
/**
|
||||
* ユーザーごとのドライブに関するチャート
|
||||
@ -13,7 +12,6 @@ export default class PerUserDriveChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
const [count, size] = await Promise.all([
|
||||
DriveFiles.count({ userId: group }),
|
||||
@ -26,12 +24,10 @@ export default class PerUserDriveChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(file: DriveFile, isAdditional: boolean): Promise<void> {
|
||||
const fileSizeKb = file.size / 1000;
|
||||
await this.commit({
|
||||
|
@ -1,9 +1,8 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { Followings, Users } from '@/models/index';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { Followings, Users } from '@/models/index.js';
|
||||
import { Not, IsNull } from 'typeorm';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { name, schema } from './entities/per-user-following';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { name, schema } from './entities/per-user-following.js';
|
||||
|
||||
/**
|
||||
* ユーザーごとのフォローに関するチャート
|
||||
@ -14,7 +13,6 @@ export default class PerUserFollowingChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
const [
|
||||
localFollowingsCount,
|
||||
@ -36,12 +34,10 @@ export default class PerUserFollowingChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(follower: { id: User['id']; host: User['host']; }, followee: { id: User['id']; host: User['host']; }, isFollow: boolean): Promise<void> {
|
||||
const prefixFollower = Users.isLocalUser(follower) ? 'local' : 'remote';
|
||||
const prefixFollowee = Users.isLocalUser(followee) ? 'local' : 'remote';
|
||||
|
@ -1,9 +1,8 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Notes } from '@/models/index';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { name, schema } from './entities/per-user-notes';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Notes } from '@/models/index.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { name, schema } from './entities/per-user-notes.js';
|
||||
|
||||
/**
|
||||
* ユーザーごとのノートに関するチャート
|
||||
@ -14,7 +13,6 @@ export default class PerUserNotesChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
const [count] = await Promise.all([
|
||||
Notes.count({ userId: group }),
|
||||
@ -25,12 +23,10 @@ export default class PerUserNotesChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(user: { id: User['id'] }, note: Note, isAdditional: boolean): Promise<void> {
|
||||
await this.commit({
|
||||
'total': isAdditional ? 1 : -1,
|
||||
|
@ -1,9 +1,8 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { Users } from '@/models/index';
|
||||
import { name, schema } from './entities/per-user-reactions';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { name, schema } from './entities/per-user-reactions.js';
|
||||
|
||||
/**
|
||||
* ユーザーごとのリアクションに関するチャート
|
||||
@ -14,17 +13,14 @@ export default class PerUserReactionsChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(user: { id: User['id'], host: User['host'] }, note: Note): Promise<void> {
|
||||
const prefix = Users.isLocalUser(user) ? 'local' : 'remote';
|
||||
this.commit({
|
||||
|
@ -1,6 +1,5 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { name, schema } from './entities/test-grouped';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { name, schema } from './entities/test-grouped.js';
|
||||
|
||||
/**
|
||||
* For testing
|
||||
@ -13,19 +12,16 @@ export default class TestGroupedChart extends Chart<typeof schema> {
|
||||
super(name, schema, true);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(group: string): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {
|
||||
'foo.total': this.total[group],
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async increment(group: string): Promise<void> {
|
||||
if (this.total[group] == null) this.total[group] = 0;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { name, schema } from './entities/test-intersection';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { name, schema } from './entities/test-intersection.js';
|
||||
|
||||
/**
|
||||
* For testing
|
||||
@ -11,24 +10,20 @@ export default class TestIntersectionChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async addA(key: string): Promise<void> {
|
||||
await this.commit({
|
||||
a: [key],
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async addB(key: string): Promise<void> {
|
||||
await this.commit({
|
||||
b: [key],
|
||||
|
@ -1,6 +1,5 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { name, schema } from './entities/test-unique';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { name, schema } from './entities/test-unique.js';
|
||||
|
||||
/**
|
||||
* For testing
|
||||
@ -11,17 +10,14 @@ export default class TestUniqueChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async uniqueIncrement(key: string): Promise<void> {
|
||||
await this.commit({
|
||||
foo: [key],
|
||||
|
@ -1,6 +1,5 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { name, schema } from './entities/test';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { name, schema } from './entities/test.js';
|
||||
|
||||
/**
|
||||
* For testing
|
||||
@ -13,19 +12,16 @@ export default class TestChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {
|
||||
'foo.total': this.total,
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async increment(): Promise<void> {
|
||||
this.total++;
|
||||
|
||||
@ -35,7 +31,6 @@ export default class TestChart extends Chart<typeof schema> {
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async decrement(): Promise<void> {
|
||||
this.total--;
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Chart, { KVs } from '../core';
|
||||
import { Users } from '@/models/index';
|
||||
import Chart, { KVs } from '../core.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { Not, IsNull } from 'typeorm';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { name, schema } from './entities/users';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { name, schema } from './entities/users.js';
|
||||
|
||||
/**
|
||||
* ユーザー数に関するチャート
|
||||
@ -14,7 +13,6 @@ export default class UsersChart extends Chart<typeof schema> {
|
||||
super(name, schema);
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMajor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
const [localCount, remoteCount] = await Promise.all([
|
||||
Users.count({ host: null }),
|
||||
@ -27,12 +25,10 @@ export default class UsersChart extends Chart<typeof schema> {
|
||||
};
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected async tickMinor(): Promise<Partial<KVs<typeof schema>>> {
|
||||
return {};
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async update(user: { id: User['id'], host: User['host'] }, isAdditional: boolean): Promise<void> {
|
||||
const prefix = Users.isLocalUser(user) ? 'local' : 'remote';
|
||||
|
||||
|
@ -5,11 +5,10 @@
|
||||
*/
|
||||
|
||||
import * as nestedProperty from 'nested-property';
|
||||
import autobind from 'autobind-decorator';
|
||||
import Logger from '../logger';
|
||||
import Logger from '../logger.js';
|
||||
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
|
||||
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '@/prelude/time';
|
||||
import { getChartInsertLock } from '@/misc/app-lock';
|
||||
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '@/prelude/time.js';
|
||||
import { getChartInsertLock } from '@/misc/app-lock.js';
|
||||
|
||||
const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test');
|
||||
|
||||
@ -142,7 +141,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
*/
|
||||
protected abstract tickMinor(group: string | null): Promise<Partial<KVs<T>>>;
|
||||
|
||||
@autobind
|
||||
private static convertSchemaToColumnDefinitions(schema: Schema): Record<string, { type: string; array?: boolean; default?: any; }> {
|
||||
const columns = {} as Record<string, { type: string; array?: boolean; default?: any; }>;
|
||||
for (const [k, v] of Object.entries(schema)) {
|
||||
@ -168,12 +166,10 @@ export default abstract class Chart<T extends Schema> {
|
||||
return columns;
|
||||
}
|
||||
|
||||
@autobind
|
||||
private static dateToTimestamp(x: Date): number {
|
||||
return Math.floor(x.getTime() / 1000);
|
||||
}
|
||||
|
||||
@autobind
|
||||
private static parseDate(date: Date): [number, number, number, number, number, number, number] {
|
||||
const y = date.getUTCFullYear();
|
||||
const m = date.getUTCMonth();
|
||||
@ -186,12 +182,10 @@ export default abstract class Chart<T extends Schema> {
|
||||
return [y, m, d, h, _m, _s, _ms];
|
||||
}
|
||||
|
||||
@autobind
|
||||
private static getCurrentDate() {
|
||||
return Chart.parseDate(new Date());
|
||||
}
|
||||
|
||||
@autobind
|
||||
public static schemaToEntity(name: string, schema: Schema, grouped = false): {
|
||||
hour: EntitySchema,
|
||||
day: EntitySchema,
|
||||
@ -251,7 +245,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
this.repositoryForDay = getRepository<{ id: number; group?: string | null; date: number; }>(day);
|
||||
}
|
||||
|
||||
@autobind
|
||||
private convertRawRecord(x: RawRecord<T>): KVs<T> {
|
||||
const kvs = {} as Record<string, number>;
|
||||
for (const k of Object.keys(x).filter((k) => k.startsWith(columnPrefix)) as (keyof Columns<T>)[]) {
|
||||
@ -260,7 +253,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
return kvs as KVs<T>;
|
||||
}
|
||||
|
||||
@autobind
|
||||
private getNewLog(latest: KVs<T> | null): KVs<T> {
|
||||
const log = {} as Record<keyof T, number>;
|
||||
for (const [k, v] of Object.entries(this.schema) as ([keyof typeof this['schema'], this['schema'][string]])[]) {
|
||||
@ -273,7 +265,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
return log as KVs<T>;
|
||||
}
|
||||
|
||||
@autobind
|
||||
private getLatestLog(group: string | null, span: 'hour' | 'day'): Promise<RawRecord<T> | null> {
|
||||
const repository =
|
||||
span === 'hour' ? this.repositoryForHour :
|
||||
@ -292,7 +283,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
/**
|
||||
* 現在(=今のHour or Day)のログをデータベースから探して、あればそれを返し、なければ作成して返します。
|
||||
*/
|
||||
@autobind
|
||||
private async claimCurrentLog(group: string | null, span: 'hour' | 'day'): Promise<RawRecord<T>> {
|
||||
const [y, m, d, h] = Chart.getCurrentDate();
|
||||
|
||||
@ -376,7 +366,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
protected commit(diff: Commit<T>, group: string | null = null): void {
|
||||
for (const [k, v] of Object.entries(diff)) {
|
||||
if (v == null || v === 0 || (Array.isArray(v) && v.length === 0)) delete diff[k];
|
||||
@ -386,7 +375,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
});
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async save(): Promise<void> {
|
||||
if (this.buffer.length === 0) {
|
||||
logger.info(`${this.name}: Write skipped`);
|
||||
@ -505,7 +493,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
update(logHour, logDay))));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async tick(major: boolean, group: string | null = null): Promise<void> {
|
||||
const data = major ? await this.tickMajor(group) : await this.tickMinor(group);
|
||||
|
||||
@ -541,12 +528,10 @@ export default abstract class Chart<T extends Schema> {
|
||||
update(logHour, logDay));
|
||||
}
|
||||
|
||||
@autobind
|
||||
public resync(group: string | null = null): Promise<void> {
|
||||
return this.tick(true, group);
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async clean(): Promise<void> {
|
||||
const current = dateUTC(Chart.getCurrentDate());
|
||||
|
||||
@ -582,7 +567,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
]);
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async getChartRaw(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise<ChartResult<T>> {
|
||||
const [y, m, d, h, _m, _s, _ms] = cursor ? Chart.parseDate(subtractTime(addTime(cursor, 1, span), 1)) : Chart.getCurrentDate();
|
||||
const [y2, m2, d2, h2] = cursor ? Chart.parseDate(addTime(cursor, 1, span)) : [] as never;
|
||||
@ -685,7 +669,6 @@ export default abstract class Chart<T extends Schema> {
|
||||
return res;
|
||||
}
|
||||
|
||||
@autobind
|
||||
public async getChart(span: 'hour' | 'day', amount: number, cursor: Date | null, group: string | null = null): Promise<Unflatten<ChartResult<T>>> {
|
||||
const result = await this.getChartRaw(span, amount, cursor, group);
|
||||
const object = {};
|
||||
|
@ -1,15 +1,15 @@
|
||||
import { entity as FederationChart } from './charts/entities/federation';
|
||||
import { entity as NotesChart } from './charts/entities/notes';
|
||||
import { entity as UsersChart } from './charts/entities/users';
|
||||
import { entity as ActiveUsersChart } from './charts/entities/active-users';
|
||||
import { entity as InstanceChart } from './charts/entities/instance';
|
||||
import { entity as PerUserNotesChart } from './charts/entities/per-user-notes';
|
||||
import { entity as DriveChart } from './charts/entities/drive';
|
||||
import { entity as PerUserReactionsChart } from './charts/entities/per-user-reactions';
|
||||
import { entity as HashtagChart } from './charts/entities/hashtag';
|
||||
import { entity as PerUserFollowingChart } from './charts/entities/per-user-following';
|
||||
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive';
|
||||
import { entity as ApRequestChart } from './charts/entities/ap-request';
|
||||
import { entity as FederationChart } from './charts/entities/federation.js';
|
||||
import { entity as NotesChart } from './charts/entities/notes.js';
|
||||
import { entity as UsersChart } from './charts/entities/users.js';
|
||||
import { entity as ActiveUsersChart } from './charts/entities/active-users.js';
|
||||
import { entity as InstanceChart } from './charts/entities/instance.js';
|
||||
import { entity as PerUserNotesChart } from './charts/entities/per-user-notes.js';
|
||||
import { entity as DriveChart } from './charts/entities/drive.js';
|
||||
import { entity as PerUserReactionsChart } from './charts/entities/per-user-reactions.js';
|
||||
import { entity as HashtagChart } from './charts/entities/hashtag.js';
|
||||
import { entity as PerUserFollowingChart } from './charts/entities/per-user-following.js';
|
||||
import { entity as PerUserDriveChart } from './charts/entities/per-user-drive.js';
|
||||
import { entity as ApRequestChart } from './charts/entities/ap-request.js';
|
||||
|
||||
export const entities = [
|
||||
FederationChart.hour, FederationChart.day,
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { beforeShutdown } from '@/misc/before-shutdown';
|
||||
import { beforeShutdown } from '@/misc/before-shutdown.js';
|
||||
|
||||
import FederationChart from './charts/federation';
|
||||
import NotesChart from './charts/notes';
|
||||
import UsersChart from './charts/users';
|
||||
import ActiveUsersChart from './charts/active-users';
|
||||
import InstanceChart from './charts/instance';
|
||||
import PerUserNotesChart from './charts/per-user-notes';
|
||||
import DriveChart from './charts/drive';
|
||||
import PerUserReactionsChart from './charts/per-user-reactions';
|
||||
import HashtagChart from './charts/hashtag';
|
||||
import PerUserFollowingChart from './charts/per-user-following';
|
||||
import PerUserDriveChart from './charts/per-user-drive';
|
||||
import ApRequestChart from './charts/ap-request';
|
||||
import FederationChart from './charts/federation.js';
|
||||
import NotesChart from './charts/notes.js';
|
||||
import UsersChart from './charts/users.js';
|
||||
import ActiveUsersChart from './charts/active-users.js';
|
||||
import InstanceChart from './charts/instance.js';
|
||||
import PerUserNotesChart from './charts/per-user-notes.js';
|
||||
import DriveChart from './charts/drive.js';
|
||||
import PerUserReactionsChart from './charts/per-user-reactions.js';
|
||||
import HashtagChart from './charts/hashtag.js';
|
||||
import PerUserFollowingChart from './charts/per-user-following.js';
|
||||
import PerUserDriveChart from './charts/per-user-drive.js';
|
||||
import ApRequestChart from './charts/ap-request.js';
|
||||
|
||||
export const federationChart = new FederationChart();
|
||||
export const notesChart = new NotesChart();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import pushSw from './push-notification';
|
||||
import { Notifications, Mutings, UserProfiles, Users } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Notification } from '@/models/entities/notification';
|
||||
import { sendEmailNotification } from './send-email-notification';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import pushSw from './push-notification.js';
|
||||
import { Notifications, Mutings, UserProfiles, Users } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Notification } from '@/models/entities/notification.js';
|
||||
import { sendEmailNotification } from './send-email-notification.js';
|
||||
|
||||
export async function createNotification(
|
||||
notifieeId: User['id'],
|
||||
|
@ -1,13 +1,13 @@
|
||||
import * as bcrypt from 'bcryptjs';
|
||||
import bcrypt from 'bcryptjs';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import generateNativeUserToken from '../server/api/common/generate-native-user-token';
|
||||
import { genRsaKeyPair } from '@/misc/gen-key-pair';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { UserProfile } from '@/models/entities/user-profile';
|
||||
import generateNativeUserToken from '../server/api/common/generate-native-user-token.js';
|
||||
import { genRsaKeyPair } from '@/misc/gen-key-pair.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { UserProfile } from '@/models/entities/user-profile.js';
|
||||
import { getConnection, ObjectLiteral } from 'typeorm';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { UserKeypair } from '@/models/entities/user-keypair';
|
||||
import { UsedUsername } from '@/models/entities/used-username';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
||||
import { UsedUsername } from '@/models/entities/used-username.js';
|
||||
|
||||
export async function createSystemUser(username: string) {
|
||||
const password = uuid();
|
||||
|
@ -1,26 +1,26 @@
|
||||
import * as fs from 'fs';
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import { publishMainStream, publishDriveStream } from '@/services/stream';
|
||||
import { deleteFile } from './delete-file';
|
||||
import { fetchMeta } from '@/misc/fetch-meta';
|
||||
import { GenerateVideoThumbnail } from './generate-video-thumbnail';
|
||||
import { driveLogger } from './logger';
|
||||
import { IImage, convertSharpToJpeg, convertSharpToWebp, convertSharpToPng, convertSharpToPngOrJpeg } from './image-processor';
|
||||
import { contentDisposition } from '@/misc/content-disposition';
|
||||
import { getFileInfo } from '@/misc/get-file-info';
|
||||
import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '@/models/index';
|
||||
import { InternalStorage } from './internal-storage';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { IRemoteUser, User } from '@/models/entities/user';
|
||||
import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||
import * as S3 from 'aws-sdk/clients/s3';
|
||||
import { getS3 } from './s3';
|
||||
import * as sharp from 'sharp';
|
||||
import { FILE_TYPE_BROWSERSAFE } from '@/const';
|
||||
import { publishMainStream, publishDriveStream } from '@/services/stream.js';
|
||||
import { deleteFile } from './delete-file.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import { GenerateVideoThumbnail } from './generate-video-thumbnail.js';
|
||||
import { driveLogger } from './logger.js';
|
||||
import { IImage, convertSharpToJpeg, convertSharpToWebp, convertSharpToPng, convertSharpToPngOrJpeg } from './image-processor.js';
|
||||
import { contentDisposition } from '@/misc/content-disposition.js';
|
||||
import { getFileInfo } from '@/misc/get-file-info.js';
|
||||
import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '@/models/index.js';
|
||||
import { InternalStorage } from './internal-storage.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { IRemoteUser, User } from '@/models/entities/user.js';
|
||||
import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import * as S3 from 'aws-sdk/clients/s3.js';
|
||||
import { getS3 } from './s3.js';
|
||||
import sharp from 'sharp';
|
||||
import { FILE_TYPE_BROWSERSAFE } from '@/const.js';
|
||||
|
||||
const logger = driveLogger.createSubLogger('register', 'yellow');
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { InternalStorage } from './internal-storage';
|
||||
import { DriveFiles, Instances } from '@/models/index';
|
||||
import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index';
|
||||
import { createDeleteObjectStorageFileJob } from '@/queue/index';
|
||||
import { fetchMeta } from '@/misc/fetch-meta';
|
||||
import { getS3 } from './s3';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { InternalStorage } from './internal-storage.js';
|
||||
import { DriveFiles, Instances } from '@/models/index.js';
|
||||
import { driveChart, perUserDriveChart, instanceChart } from '@/services/chart/index.js';
|
||||
import { createDeleteObjectStorageFileJob } from '@/queue/index.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import { getS3 } from './s3.js';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
export async function deleteFile(file: DriveFile, isExpired = false) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as fs from 'node:fs';
|
||||
import * as tmp from 'tmp';
|
||||
import { IImage, convertToJpeg } from './image-processor';
|
||||
import { IImage, convertToJpeg } from './image-processor.js';
|
||||
import * as FFmpeg from 'fluent-ffmpeg';
|
||||
|
||||
export async function GenerateVideoThumbnail(path: string): Promise<IImage> {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as sharp from 'sharp';
|
||||
import sharp from 'sharp';
|
||||
|
||||
export type IImage = {
|
||||
data: Buffer;
|
||||
|
@ -1,11 +1,10 @@
|
||||
import * as fs from 'fs';
|
||||
import * as Path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import config from '@/config/index';
|
||||
import * as fs from 'node:fs';
|
||||
import * as Path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
//const _filename = fileURLToPath(import.meta.url);
|
||||
const _filename = __filename;
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
||||
export class InternalStorage {
|
||||
|
@ -1,3 +1,3 @@
|
||||
import Logger from '../logger';
|
||||
import Logger from '../logger.js';
|
||||
|
||||
export const driveLogger = new Logger('drive', 'blue');
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { URL } from 'url';
|
||||
import * as S3 from 'aws-sdk/clients/s3';
|
||||
import { Meta } from '@/models/entities/meta';
|
||||
import { getAgentByUrl } from '@/misc/fetch';
|
||||
import { URL } from 'node:url';
|
||||
import * as S3 from 'aws-sdk/clients/s3.js';
|
||||
import { Meta } from '@/models/entities/meta.js';
|
||||
import { getAgentByUrl } from '@/misc/fetch.js';
|
||||
|
||||
export function getS3(meta: Meta) {
|
||||
const u = meta.objectStorageEndpoint != null
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { URL } from 'url';
|
||||
import { addFile } from './add-file';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { driveLogger } from './logger';
|
||||
import { createTemp } from '@/misc/create-temp';
|
||||
import { downloadUrl } from '@/misc/download-url';
|
||||
import { DriveFolder } from '@/models/entities/drive-folder';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { DriveFiles } from '@/models/index';
|
||||
import { URL } from 'node:url';
|
||||
import { addFile } from './add-file.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { driveLogger } from './logger.js';
|
||||
import { createTemp } from '@/misc/create-temp.js';
|
||||
import { downloadUrl } from '@/misc/download-url.js';
|
||||
import { DriveFolder } from '@/models/entities/drive-folder.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { DriveFiles } from '@/models/index.js';
|
||||
|
||||
const logger = driveLogger.createSubLogger('downloader');
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { DOMWindow, JSDOM } from 'jsdom';
|
||||
import fetch from 'node-fetch';
|
||||
import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch';
|
||||
import { Instance } from '@/models/entities/instance';
|
||||
import { Instances } from '@/models/index';
|
||||
import { getFetchInstanceMetadataLock } from '@/misc/app-lock';
|
||||
import Logger from './logger';
|
||||
import { URL } from 'url';
|
||||
import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch.js';
|
||||
import { Instance } from '@/models/entities/instance.js';
|
||||
import { Instances } from '@/models/index.js';
|
||||
import { getFetchInstanceMetadataLock } from '@/misc/app-lock.js';
|
||||
import Logger from './logger.js';
|
||||
import { URL } from 'node:url';
|
||||
|
||||
const logger = new Logger('metadata', 'cyan');
|
||||
|
||||
|
@ -1,20 +1,20 @@
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import renderAccept from '@/remote/activitypub/renderer/accept';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject';
|
||||
import { deliver } from '@/queue/index';
|
||||
import createFollowRequest from './requests/create';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import Logger from '../logger';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '@/models/index';
|
||||
import { instanceChart, perUserFollowingChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createNotification } from '../create-notification';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||
import { Packed } from '@/misc/schema';
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import renderAccept from '@/remote/activitypub/renderer/accept.js';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import createFollowRequest from './requests/create.js';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||
import Logger from '../logger.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '@/models/index.js';
|
||||
import { instanceChart, perUserFollowingChart } from '@/services/chart/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { createNotification } from '../create-notification.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
const logger = new Logger('following/create');
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject';
|
||||
import { deliver } from '@/queue/index';
|
||||
import Logger from '../logger';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Followings, Users, Instances } from '@/models/index';
|
||||
import { instanceChart, perUserFollowingChart } from '@/services/chart/index';
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import Logger from '../logger.js';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Followings, Users, Instances } from '@/models/index.js';
|
||||
import { instanceChart, perUserFollowingChart } from '@/services/chart/index.js';
|
||||
|
||||
const logger = new Logger('following/delete');
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject';
|
||||
import { deliver } from '@/queue/index';
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user';
|
||||
import { Users, FollowRequests, Followings } from '@/models/index';
|
||||
import { decrementFollowing } from './delete';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import renderReject from '@/remote/activitypub/renderer/reject.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import { publishMainStream, publishUserEvent } from '@/services/stream.js';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Users, FollowRequests, Followings } from '@/models/index.js';
|
||||
import { decrementFollowing } from './delete.js';
|
||||
|
||||
type Local = ILocalUser | { id: User['id']; host: User['host']; uri: User['host'] };
|
||||
type Remote = IRemoteUser;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import accept from './accept';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { FollowRequests, Users } from '@/models/index';
|
||||
import accept from './accept.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { FollowRequests, Users } from '@/models/index.js';
|
||||
|
||||
/**
|
||||
* 指定したユーザー宛てのフォローリクエストをすべて承認
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import renderAccept from '@/remote/activitypub/renderer/accept';
|
||||
import { deliver } from '@/queue/index';
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import { insertFollowingDoc } from '../create';
|
||||
import { User, ILocalUser } from '@/models/entities/user';
|
||||
import { FollowRequests, Users } from '@/models/index';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import renderAccept from '@/remote/activitypub/renderer/accept.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { insertFollowingDoc } from '../create.js';
|
||||
import { User, ILocalUser } from '@/models/entities/user.js';
|
||||
import { FollowRequests, Users } from '@/models/index.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
||||
export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: User) {
|
||||
const request = await FollowRequests.findOne({
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { deliver } from '@/queue/index';
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { User, ILocalUser } from '@/models/entities/user';
|
||||
import { Users, FollowRequests } from '@/models/index';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { User, ILocalUser } from '@/models/entities/user.js';
|
||||
import { Users, FollowRequests } from '@/models/index.js';
|
||||
|
||||
export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox'] }, follower: { id: User['id']; host: User['host']; uri: User['host'] }) {
|
||||
if (Users.isRemoteUser(followee)) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow';
|
||||
import { deliver } from '@/queue/index';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Blockings, FollowRequests, Users } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createNotification } from '../../create-notification';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Blockings, FollowRequests, Users } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { createNotification } from '../../create-notification.js';
|
||||
|
||||
export default async function(follower: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, requestId?: string) {
|
||||
if (follower.id === followee.id) return;
|
||||
|
@ -1,15 +1,15 @@
|
||||
import config from '@/config/index';
|
||||
import renderAdd from '@/remote/activitypub/renderer/add';
|
||||
import renderRemove from '@/remote/activitypub/renderer/remove';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { Notes, UserNotePinings, Users } from '@/models/index';
|
||||
import { UserNotePining } from '@/models/entities/user-note-pining';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager';
|
||||
import { deliverToRelays } from '../relay';
|
||||
import config from '@/config/index.js';
|
||||
import renderAdd from '@/remote/activitypub/renderer/add.js';
|
||||
import renderRemove from '@/remote/activitypub/renderer/remove.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { Notes, UserNotePinings, Users } from '@/models/index.js';
|
||||
import { UserNotePining } from '@/models/entities/user-note-pining.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js';
|
||||
import { deliverToRelays } from '../relay.js';
|
||||
|
||||
/**
|
||||
* 指定した投稿をピン留めします
|
||||
|
@ -1,10 +1,10 @@
|
||||
import renderUpdate from '@/remote/activitypub/renderer/update';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { Users } from '@/models/index';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { renderPerson } from '@/remote/activitypub/renderer/person';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager';
|
||||
import { deliverToRelays } from '../relay';
|
||||
import renderUpdate from '@/remote/activitypub/renderer/update.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { renderPerson } from '@/remote/activitypub/renderer/person.js';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js';
|
||||
import { deliverToRelays } from '../relay.js';
|
||||
|
||||
export async function publishToFollowers(userId: User['id']) {
|
||||
const user = await Users.findOne(userId);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { ModerationLogs } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { ModerationLogs } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
|
||||
export async function insertModerationLog(moderator: { id: User['id'] }, type: string, info?: Record<string, any>) {
|
||||
await ModerationLogs.insert({
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { createSystemUser } from './create-system-user';
|
||||
import { ILocalUser } from '@/models/entities/user';
|
||||
import { Users } from '@/models/index';
|
||||
import { Cache } from '@/misc/cache';
|
||||
import { createSystemUser } from './create-system-user.js';
|
||||
import { ILocalUser } from '@/models/entities/user.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { Cache } from '@/misc/cache.js';
|
||||
|
||||
const ACTOR_USERNAME = 'instance.actor' as const;
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import * as cluster from 'cluster';
|
||||
import * as chalk from 'chalk';
|
||||
import cluster from 'node:cluster';
|
||||
import chalk from 'chalk';
|
||||
import { default as convertColor } from 'color-convert';
|
||||
import { format as dateFormat } from 'date-fns';
|
||||
import { envOption } from '../env';
|
||||
import config from '@/config/index';
|
||||
import { envOption } from '../env.js';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
import * as SyslogPro from 'syslog-pro';
|
||||
|
||||
@ -66,7 +67,7 @@ export default class Logger {
|
||||
level === 'debug' ? chalk.gray('VERB') :
|
||||
level === 'info' ? chalk.blue('INFO') :
|
||||
null;
|
||||
const domains = [this.domain].concat(subDomains).map(d => d.color ? chalk.keyword(d.color)(d.name) : chalk.white(d.name));
|
||||
const domains = [this.domain].concat(subDomains).map(d => d.color ? chalk.rgb(...convertColor.keyword.rgb(d.color))(d.name) : chalk.white(d.name));
|
||||
const m =
|
||||
level === 'error' ? chalk.red(message) :
|
||||
level === 'warning' ? chalk.yellow(message) :
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { User } from '@/models/entities/user';
|
||||
import { UserGroup } from '@/models/entities/user-group';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { MessagingMessages, UserGroupJoinings, Mutings, Users } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message';
|
||||
import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '@/services/stream';
|
||||
import pushNotification from '../push-notification';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { UserGroup } from '@/models/entities/user-group.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { MessagingMessages, UserGroupJoinings, Mutings, Users } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message.js';
|
||||
import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '@/services/stream.js';
|
||||
import pushNotification from '../push-notification.js';
|
||||
import { Not } from 'typeorm';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import renderNote from '@/remote/activitypub/renderer/note';
|
||||
import renderCreate from '@/remote/activitypub/renderer/create';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { deliver } from '@/queue/index';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import renderNote from '@/remote/activitypub/renderer/note.js';
|
||||
import renderCreate from '@/remote/activitypub/renderer/create.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
|
||||
export async function createMessage(user: { id: User['id']; host: User['host']; }, recipientUser: User | undefined, recipientGroup: UserGroup | undefined, text: string | null | undefined, file: DriveFile | null, uri?: string) {
|
||||
const message = {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import config from '@/config/index';
|
||||
import { MessagingMessages, Users } from '@/models/index';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message';
|
||||
import { publishGroupMessagingStream, publishMessagingStream } from '@/services/stream';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete';
|
||||
import renderTombstone from '@/remote/activitypub/renderer/tombstone';
|
||||
import { deliver } from '@/queue/index';
|
||||
import config from '@/config/index.js';
|
||||
import { MessagingMessages, Users } from '@/models/index.js';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message.js';
|
||||
import { publishGroupMessagingStream, publishMessagingStream } from '@/services/stream.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
||||
import renderTombstone from '@/remote/activitypub/renderer/tombstone.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
|
||||
export async function deleteMessage(message: MessagingMessage) {
|
||||
await MessagingMessages.delete(message.id);
|
||||
|
@ -1,39 +1,39 @@
|
||||
import * as mfm from 'mfm-js';
|
||||
import es from '../../db/elasticsearch';
|
||||
import { publishMainStream, publishNotesStream } from '@/services/stream';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager';
|
||||
import renderNote from '@/remote/activitypub/renderer/note';
|
||||
import renderCreate from '@/remote/activitypub/renderer/create';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { resolveUser } from '@/remote/resolve-user';
|
||||
import config from '@/config/index';
|
||||
import { updateHashtags } from '../update-hashtag';
|
||||
import { concat } from '@/prelude/array';
|
||||
import { insertNoteUnread } from '@/services/note/unread';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import { extractMentions } from '@/misc/extract-mentions';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm';
|
||||
import { extractHashtags } from '@/misc/extract-hashtags';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note';
|
||||
import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings, NoteThreadMutings } from '@/models/index';
|
||||
import { DriveFile } from '@/models/entities/drive-file';
|
||||
import { App } from '@/models/entities/app';
|
||||
import es from '../../db/elasticsearch.js';
|
||||
import { publishMainStream, publishNotesStream } from '@/services/stream.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import renderNote from '@/remote/activitypub/renderer/note.js';
|
||||
import renderCreate from '@/remote/activitypub/renderer/create.js';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { resolveUser } from '@/remote/resolve-user.js';
|
||||
import config from '@/config/index.js';
|
||||
import { updateHashtags } from '../update-hashtag.js';
|
||||
import { concat } from '@/prelude/array.js';
|
||||
import { insertNoteUnread } from '@/services/note/unread.js';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||
import { extractMentions } from '@/misc/extract-mentions.js';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js';
|
||||
import { Mutings, Users, NoteWatchings, Notes, Instances, UserProfiles, Antennas, Followings, MutedNotes, Channels, ChannelFollowings, Blockings, NoteThreadMutings } from '@/models/index.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { App } from '@/models/entities/app.js';
|
||||
import { Not, getConnection, In } from 'typeorm';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '@/services/chart/index';
|
||||
import { Poll, IPoll } from '@/models/entities/poll';
|
||||
import { createNotification } from '../create-notification';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna';
|
||||
import { checkWordMute } from '@/misc/check-word-mute';
|
||||
import { addNoteToAntenna } from '../add-note-to-antenna';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes';
|
||||
import { deliverToRelays } from '../relay';
|
||||
import { Channel } from '@/models/entities/channel';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search';
|
||||
import { getAntennas } from '@/misc/antenna-cache';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '@/services/chart/index.js';
|
||||
import { Poll, IPoll } from '@/models/entities/poll.js';
|
||||
import { createNotification } from '../create-notification.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna.js';
|
||||
import { checkWordMute } from '@/misc/check-word-mute.js';
|
||||
import { addNoteToAntenna } from '../add-note-to-antenna.js';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes.js';
|
||||
import { deliverToRelays } from '../relay.js';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||
|
||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
import { publishNoteStream } from '@/services/stream';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderTombstone from '@/remote/activitypub/renderer/tombstone';
|
||||
import config from '@/config/index';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note';
|
||||
import { Notes, Users, Instances } from '@/models/index';
|
||||
import { notesChart, perUserNotesChart, instanceChart } from '@/services/chart/index';
|
||||
import { deliverToFollowers, deliverToUser } from '@/remote/activitypub/deliver-manager';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes';
|
||||
import { deliverToRelays } from '../relay';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
||||
import renderAnnounce from '@/remote/activitypub/renderer/announce.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderTombstone from '@/remote/activitypub/renderer/tombstone.js';
|
||||
import config from '@/config/index.js';
|
||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc.js';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Note, IMentionedRemoteUsers } from '@/models/entities/note.js';
|
||||
import { Notes, Users, Instances } from '@/models/index.js';
|
||||
import { notesChart, perUserNotesChart, instanceChart } from '@/services/chart/index.js';
|
||||
import { deliverToFollowers, deliverToUser } from '@/remote/activitypub/deliver-manager.js';
|
||||
import { countSameRenotes } from '@/misc/count-same-renotes.js';
|
||||
import { deliverToRelays } from '../relay.js';
|
||||
import { Brackets, In } from 'typeorm';
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,10 @@
|
||||
import renderUpdate from '@/remote/activitypub/renderer/update';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import renderNote from '@/remote/activitypub/renderer/note';
|
||||
import { Users, Notes } from '@/models/index';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager';
|
||||
import { deliverToRelays } from '../../relay';
|
||||
import renderUpdate from '@/remote/activitypub/renderer/update.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderNote from '@/remote/activitypub/renderer/note.js';
|
||||
import { Users, Notes } from '@/models/index.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { deliverToFollowers } from '@/remote/activitypub/deliver-manager.js';
|
||||
import { deliverToRelays } from '../../relay.js';
|
||||
|
||||
export async function deliverQuestionUpdate(noteId: Note['id']) {
|
||||
const note = await Notes.findOne(noteId);
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { publishNoteStream } from '@/services/stream';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { PollVotes, NoteWatchings, Polls, Blockings } from '@/models/index';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { PollVotes, NoteWatchings, Polls, Blockings } from '@/models/index.js';
|
||||
import { Not } from 'typeorm';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createNotification } from '../../create-notification';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { createNotification } from '../../create-notification.js';
|
||||
|
||||
export default async function(user: User, note: Note, choice: number) {
|
||||
const poll = await Polls.findOne(note.id);
|
||||
|
@ -1,19 +1,19 @@
|
||||
import { publishNoteStream } from '@/services/stream';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { toDbReaction, decodeReaction } from '@/misc/reaction-lib';
|
||||
import { User, IRemoteUser } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '@/models/index';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { toDbReaction, decodeReaction } from '@/misc/reaction-lib.js';
|
||||
import { User, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteReactions, Users, NoteWatchings, Notes, Emojis, Blockings } from '@/models/index.js';
|
||||
import { Not } from 'typeorm';
|
||||
import { perUserReactionsChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createNotification } from '../../create-notification';
|
||||
import deleteReaction from './delete';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { perUserReactionsChart } from '@/services/chart/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { createNotification } from '../../create-notification.js';
|
||||
import deleteReaction from './delete.js';
|
||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error.js';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
||||
export default async (user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) => {
|
||||
// Check blocking
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { publishNoteStream } from '@/services/stream';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error';
|
||||
import { User, IRemoteUser } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteReactions, Users, Notes } from '@/models/index';
|
||||
import { decodeReaction } from '@/misc/reaction-lib';
|
||||
import { publishNoteStream } from '@/services/stream.js';
|
||||
import { renderLike } from '@/remote/activitypub/renderer/like.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { User, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteReactions, Users, Notes } from '@/models/index.js';
|
||||
import { decodeReaction } from '@/misc/reaction-lib.js';
|
||||
|
||||
export default async (user: { id: User['id']; host: User['host']; }, note: Note) => {
|
||||
// if already unreacted
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '@/models/index';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '@/models/index.js';
|
||||
import { Not, IsNull, In } from 'typeorm';
|
||||
import { Channel } from '@/models/entities/channel';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna';
|
||||
import { getAntennas } from '@/misc/antenna-cache';
|
||||
import { readNotificationByQuery } from '@/server/api/common/read-notification';
|
||||
import { Packed } from '@/misc/schema';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
import { checkHitAntenna } from '@/misc/check-hit-antenna.js';
|
||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||
import { readNotificationByQuery } from '@/server/api/common/read-notification.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
/**
|
||||
* Mark notes as read
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { publishMainStream } from '@/services/stream';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Mutings, NoteThreadMutings, NoteUnreads } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Mutings, NoteThreadMutings, NoteUnreads } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
|
||||
export async function insertNoteUnread(userId: User['id'], note: Note, params: {
|
||||
// NOTE: isSpecifiedがtrueならisMentionedは必ずfalse
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { User } from '@/models/entities/user';
|
||||
import { NoteWatchings } from '@/models/index';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { NoteWatchings } from '@/models/index.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
|
||||
export default async (me: User['id'], note: Note) => {
|
||||
await NoteWatchings.delete({
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteWatchings } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { NoteWatching } from '@/models/entities/note-watching';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteWatchings } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { NoteWatching } from '@/models/entities/note-watching.js';
|
||||
|
||||
export default async (me: User['id'], note: Note) => {
|
||||
// 自分の投稿はwatchできない
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as push from 'web-push';
|
||||
import config from '@/config/index';
|
||||
import { SwSubscriptions } from '@/models/index';
|
||||
import { fetchMeta } from '@/misc/fetch-meta';
|
||||
import { Packed } from '@/misc/schema';
|
||||
import { getNoteSummary } from '@/misc/get-note-summary';
|
||||
import config from '@/config/index.js';
|
||||
import { SwSubscriptions } from '@/models/index.js';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
import { getNoteSummary } from '@/misc/get-note-summary.js';
|
||||
|
||||
type notificationType = 'notification' | 'unreadMessagingMessage';
|
||||
type notificationBody = Packed<'Notification'> | Packed<'MessagingMessage'>;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Instance } from '@/models/entities/instance';
|
||||
import { Instances } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { toPuny } from '@/misc/convert-host';
|
||||
import { Cache } from '@/misc/cache';
|
||||
import { Instance } from '@/models/entities/instance.js';
|
||||
import { Instances } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { toPuny } from '@/misc/convert-host.js';
|
||||
import { Cache } from '@/misc/cache.js';
|
||||
|
||||
const cache = new Cache<Instance>(1000 * 60 * 60);
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { createSystemUser } from './create-system-user';
|
||||
import { renderFollowRelay } from '@/remote/activitypub/renderer/follow-relay';
|
||||
import { renderActivity, attachLdSignature } from '@/remote/activitypub/renderer/index';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { deliver } from '@/queue/index';
|
||||
import { ILocalUser, User } from '@/models/entities/user';
|
||||
import { Users, Relays } from '@/models/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { createSystemUser } from './create-system-user.js';
|
||||
import { renderFollowRelay } from '@/remote/activitypub/renderer/follow-relay.js';
|
||||
import { renderActivity, attachLdSignature } from '@/remote/activitypub/renderer/index.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import { ILocalUser, User } from '@/models/entities/user.js';
|
||||
import { Users, Relays } from '@/models/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
|
||||
const ACTOR_USERNAME = 'relay.actor' as const;
|
||||
|
||||
|
@ -1,28 +1,33 @@
|
||||
import { UserProfiles } from '@/models/index';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { sendEmail } from './send-email';
|
||||
import { I18n } from '@/misc/i18n';
|
||||
import * as Acct from 'misskey-js/built/acct';
|
||||
const locales = require('../../../../locales/index.js');
|
||||
import { UserProfiles } from '@/models/index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { sendEmail } from './send-email.js';
|
||||
import { I18n } from '@/misc/i18n.js';
|
||||
import * as Acct from '@/misc/acct.js';
|
||||
// TODO
|
||||
//const locales = await import('../../../../locales/index.js');
|
||||
|
||||
// TODO: locale ファイルをクライアント用とサーバー用で分けたい
|
||||
|
||||
async function follow(userId: User['id'], follower: User) {
|
||||
/*
|
||||
const userProfile = await UserProfiles.findOneOrFail({ userId: userId });
|
||||
if (!userProfile.email || !userProfile.emailNotificationTypes.includes('follow')) return;
|
||||
const locale = locales[userProfile.lang || 'ja-JP'];
|
||||
const i18n = new I18n(locale);
|
||||
// TODO: render user information html
|
||||
sendEmail(userProfile.email, i18n.t('_email._follow.title'), `${follower.name} (@${Acct.toString(follower)})`, `${follower.name} (@${Acct.toString(follower)})`);
|
||||
*/
|
||||
}
|
||||
|
||||
async function receiveFollowRequest(userId: User['id'], follower: User) {
|
||||
/*
|
||||
const userProfile = await UserProfiles.findOneOrFail({ userId: userId });
|
||||
if (!userProfile.email || !userProfile.emailNotificationTypes.includes('receiveFollowRequest')) return;
|
||||
const locale = locales[userProfile.lang || 'ja-JP'];
|
||||
const i18n = new I18n(locale);
|
||||
// TODO: render user information html
|
||||
sendEmail(userProfile.email, i18n.t('_email._receiveFollowRequest.title'), `${follower.name} (@${Acct.toString(follower)})`, `${follower.name} (@${Acct.toString(follower)})`);
|
||||
*/
|
||||
}
|
||||
|
||||
export const sendEmailNotification = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as nodemailer from 'nodemailer';
|
||||
import { fetchMeta } from '@/misc/fetch-meta';
|
||||
import Logger from './logger';
|
||||
import config from '@/config/index';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import Logger from './logger.js';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
export const logger = new Logger('email');
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { redisClient } from '../db/redis';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { UserList } from '@/models/entities/user-list';
|
||||
import { UserGroup } from '@/models/entities/user-group';
|
||||
import config from '@/config/index';
|
||||
import { Antenna } from '@/models/entities/antenna';
|
||||
import { Channel } from '@/models/entities/channel';
|
||||
import { redisClient } from '../db/redis.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { UserList } from '@/models/entities/user-list.js';
|
||||
import { UserGroup } from '@/models/entities/user-group.js';
|
||||
import config from '@/config/index.js';
|
||||
import { Antenna } from '@/models/entities/antenna.js';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
import {
|
||||
StreamChannels,
|
||||
AdminStreamTypes,
|
||||
@ -21,8 +21,8 @@ import {
|
||||
NoteStreamTypes,
|
||||
UserListStreamTypes,
|
||||
UserStreamTypes,
|
||||
} from '@/server/api/stream/types';
|
||||
import { Packed } from '@/misc/schema';
|
||||
} from '@/server/api/stream/types.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
|
||||
class Publisher {
|
||||
private publish = (channel: StreamChannels, type: string | null, value?: any): void => {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { deliver } from '@/queue/index';
|
||||
import config from '@/config/index';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Users, Followings } from '@/models/index';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import config from '@/config/index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Users, Followings } from '@/models/index.js';
|
||||
import { Not, IsNull } from 'typeorm';
|
||||
|
||||
export async function doPostSuspend(user: { id: User['id']; host: User['host'] }) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index';
|
||||
import { deliver } from '@/queue/index';
|
||||
import config from '@/config/index';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Users, Followings } from '@/models/index';
|
||||
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
||||
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import config from '@/config/index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Users, Followings } from '@/models/index.js';
|
||||
import { Not, IsNull } from 'typeorm';
|
||||
|
||||
export async function doPostUnsuspend(user: User) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { User } from '@/models/entities/user';
|
||||
import { Hashtags, Users } from '@/models/index';
|
||||
import { hashtagChart } from '@/services/chart/index';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { Hashtag } from '@/models/entities/hashtag';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { Hashtags, Users } from '@/models/index.js';
|
||||
import { hashtagChart } from '@/services/chart/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { Hashtag } from '@/models/entities/hashtag.js';
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
|
||||
export async function updateHashtags(user: { id: User['id']; host: User['host']; }, tags: string[]) {
|
||||
for (const tag of tags) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { publishUserListStream } from '@/services/stream';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { UserList } from '@/models/entities/user-list';
|
||||
import { UserListJoinings, Users } from '@/models/index';
|
||||
import { UserListJoining } from '@/models/entities/user-list-joining';
|
||||
import { genId } from '@/misc/gen-id';
|
||||
import { fetchProxyAccount } from '@/misc/fetch-proxy-account';
|
||||
import createFollowing from '../following/create';
|
||||
import { publishUserListStream } from '@/services/stream.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { UserList } from '@/models/entities/user-list.js';
|
||||
import { UserListJoinings, Users } from '@/models/index.js';
|
||||
import { UserListJoining } from '@/models/entities/user-list-joining.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import { fetchProxyAccount } from '@/misc/fetch-proxy-account.js';
|
||||
import createFollowing from '../following/create.js';
|
||||
|
||||
export async function pushUserToUserList(target: User, list: UserList) {
|
||||
await UserListJoinings.insert({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import validateEmail from 'deep-email-validator';
|
||||
import { UserProfiles } from '@/models';
|
||||
import { UserProfiles } from '@/models/index.js';
|
||||
|
||||
export async function validateEmailForAccount(emailAddress: string): Promise<{
|
||||
available: boolean;
|
||||
|
Reference in New Issue
Block a user