refactor: Use path alias
This commit is contained in:
		@@ -1,8 +1,8 @@
 | 
			
		||||
import { Antenna } from '../models/entities/antenna';
 | 
			
		||||
import { Note } from '../models/entities/note';
 | 
			
		||||
import { AntennaNotes, Mutings, Notes } from '../models';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { isMutedUserRelated } from '../misc/is-muted-user-related';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { isMutedUserRelated } from '@/misc/is-muted-user-related';
 | 
			
		||||
import { publishAntennaStream, publishMainStream } from './stream';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import renderReject from '../../remote/activitypub/renderer/reject';
 | 
			
		||||
import { User } from '../../models/entities/user';
 | 
			
		||||
import { Blockings, Users, FollowRequests, Followings } from '../../models';
 | 
			
		||||
import { perUserFollowingChart } from '../chart';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
 | 
			
		||||
export default async function(blocker: User, blockee: User) {
 | 
			
		||||
	await Promise.all([
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Users } from '../../../../models';
 | 
			
		||||
import { name, schema } from '../schemas/active-users';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { DriveFiles } from '../../../../models';
 | 
			
		||||
import { Not, IsNull } from 'typeorm';
 | 
			
		||||
import { DriveFile } from '../../../../models/entities/drive-file';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Instances } from '../../../../models';
 | 
			
		||||
import { name, schema } from '../schemas/federation';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Users } from '../../../../models';
 | 
			
		||||
import { name, schema } from '../schemas/hashtag';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { DriveFiles, Followings, Users, Notes } from '../../../../models';
 | 
			
		||||
import { DriveFile } from '../../../../models/entities/drive-file';
 | 
			
		||||
import { name, schema } from '../schemas/instance';
 | 
			
		||||
import { Note } from '../../../../models/entities/note';
 | 
			
		||||
import { toPuny } from '../../../../misc/convert-host';
 | 
			
		||||
import { toPuny } from '@/misc/convert-host';
 | 
			
		||||
 | 
			
		||||
type InstanceLog = SchemaType<typeof schema>;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { name, schema } from '../schemas/network';
 | 
			
		||||
 | 
			
		||||
type NetworkLog = SchemaType<typeof schema>;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
import { Not, IsNull } from 'typeorm';
 | 
			
		||||
import { Note } from '../../../../models/entities/note';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { DriveFiles } from '../../../../models';
 | 
			
		||||
import { DriveFile } from '../../../../models/entities/drive-file';
 | 
			
		||||
import { name, schema } from '../schemas/per-user-drive';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Followings, Users } from '../../../../models';
 | 
			
		||||
import { Not, IsNull } from 'typeorm';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Notes } from '../../../../models';
 | 
			
		||||
import { Note } from '../../../../models/entities/note';
 | 
			
		||||
import { name, schema } from '../schemas/per-user-notes';
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { DeepPartial } from '../../core';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
import { Note } from '../../../../models/entities/note';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Users } from '../../../../models';
 | 
			
		||||
import { name, schema } from '../schemas/per-user-reactions';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { name, schema } from '../schemas/test-grouped';
 | 
			
		||||
 | 
			
		||||
type TestGroupedLog = SchemaType<typeof schema>;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { name, schema } from '../schemas/test-unique';
 | 
			
		||||
 | 
			
		||||
type TestUniqueLog = SchemaType<typeof schema>;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { name, schema } from '../schemas/test';
 | 
			
		||||
 | 
			
		||||
type TestLog = SchemaType<typeof schema>;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Chart, { Obj, DeepPartial } from '../../core';
 | 
			
		||||
import { SchemaType } from '../../../../misc/schema';
 | 
			
		||||
import { SchemaType } from '@/misc/schema';
 | 
			
		||||
import { Users } from '../../../../models';
 | 
			
		||||
import { Not, IsNull } from 'typeorm';
 | 
			
		||||
import { User } from '../../../../models/entities/user';
 | 
			
		||||
 
 | 
			
		||||
@@ -7,10 +7,10 @@
 | 
			
		||||
import * as nestedProperty from 'nested-property';
 | 
			
		||||
import autobind from 'autobind-decorator';
 | 
			
		||||
import Logger from '../logger';
 | 
			
		||||
import { Schema } from '../../misc/schema';
 | 
			
		||||
import { Schema } from '@/misc/schema';
 | 
			
		||||
import { EntitySchema, getRepository, Repository, LessThan, Between } from 'typeorm';
 | 
			
		||||
import { dateUTC, isTimeSame, isTimeBefore, subtractTime, addTime } from '../../prelude/time';
 | 
			
		||||
import { getChartInsertLock } from '../../misc/app-lock';
 | 
			
		||||
import { getChartInsertLock } from '@/misc/app-lock';
 | 
			
		||||
 | 
			
		||||
const logger = new Logger('chart', 'white', process.env.NODE_ENV !== 'test');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ import PerUserReactionsChart from './charts/classes/per-user-reactions';
 | 
			
		||||
import HashtagChart from './charts/classes/hashtag';
 | 
			
		||||
import PerUserFollowingChart from './charts/classes/per-user-following';
 | 
			
		||||
import PerUserDriveChart from './charts/classes/per-user-drive';
 | 
			
		||||
import { beforeShutdown } from '../../misc/before-shutdown';
 | 
			
		||||
import { beforeShutdown } from '@/misc/before-shutdown';
 | 
			
		||||
 | 
			
		||||
export const federationChart = new FederationChart();
 | 
			
		||||
export const notesChart = new NotesChart();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { publishMainStream } from './stream';
 | 
			
		||||
import pushSw from './push-notification';
 | 
			
		||||
import { Notifications, Mutings, UserProfiles } from '../models';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
import { Notification } from '../models/entities/notification';
 | 
			
		||||
import { sendEmailNotification } from './send-email-notification';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
import * as 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 { genRsaKeyPair } from '@/misc/gen-key-pair';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
import { UserProfile } from '../models/entities/user-profile';
 | 
			
		||||
import { getConnection } from 'typeorm';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { UserKeypair } from '../models/entities/user-keypair';
 | 
			
		||||
import { UsedUsername } from '../models/entities/used-username';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,19 +4,19 @@ import { v4 as uuid } from 'uuid';
 | 
			
		||||
 | 
			
		||||
import { publishMainStream, publishDriveStream } from '../stream';
 | 
			
		||||
import { deleteFile } from './delete-file';
 | 
			
		||||
import { fetchMeta } from '../../misc/fetch-meta';
 | 
			
		||||
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 { contentDisposition } from '@/misc/content-disposition';
 | 
			
		||||
import { getFileInfo } from '@/misc/get-file-info';
 | 
			
		||||
import { DriveFiles, DriveFolders, Users, Instances, UserProfiles } from '../../models';
 | 
			
		||||
import { InternalStorage } from './internal-storage';
 | 
			
		||||
import { DriveFile } from '../../models/entities/drive-file';
 | 
			
		||||
import { IRemoteUser, User } from '../../models/entities/user';
 | 
			
		||||
import { driveChart, perUserDriveChart, instanceChart } from '../chart';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { isDuplicateKeyValueError } from '../../misc/is-duplicate-key-value-error';
 | 
			
		||||
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';
 | 
			
		||||
 
 | 
			
		||||
@@ -3,14 +3,14 @@ import { InternalStorage } from './internal-storage';
 | 
			
		||||
import { DriveFiles, Instances, Notes, Users } from '../../models';
 | 
			
		||||
import { driveChart, perUserDriveChart, instanceChart } from '../chart';
 | 
			
		||||
import { createDeleteObjectStorageFileJob } from '../../queue';
 | 
			
		||||
import { fetchMeta } from '../../misc/fetch-meta';
 | 
			
		||||
import { fetchMeta } from '@/misc/fetch-meta';
 | 
			
		||||
import { getS3 } from './s3';
 | 
			
		||||
import { v4 as uuid } from 'uuid';
 | 
			
		||||
import { Note } from '../../models/entities/note';
 | 
			
		||||
import { renderActivity } from '../../remote/activitypub/renderer';
 | 
			
		||||
import renderDelete from '../../remote/activitypub/renderer/delete';
 | 
			
		||||
import renderTombstone from '../../remote/activitypub/renderer/tombstone';
 | 
			
		||||
import config from '../../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { deliverToFollowers } from '../../remote/activitypub/deliver-manager';
 | 
			
		||||
import { Brackets } from 'typeorm';
 | 
			
		||||
import { deliverToRelays } from '../relay';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import * as fs from 'fs';
 | 
			
		||||
import * as Path from 'path';
 | 
			
		||||
import config from '../../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
 | 
			
		||||
export class InternalStorage {
 | 
			
		||||
	private static readonly path = Path.resolve(__dirname, '../../../files');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import * as S3 from 'aws-sdk/clients/s3';
 | 
			
		||||
import { Meta } from '../../models/entities/meta';
 | 
			
		||||
import { getAgentByUrl } from '../../misc/fetch';
 | 
			
		||||
import { getAgentByUrl } from '@/misc/fetch';
 | 
			
		||||
 | 
			
		||||
export function getS3(meta: Meta) {
 | 
			
		||||
	const u = meta.objectStorageEndpoint != null
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
import create 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 { 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';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
import { DOMWindow, JSDOM } from 'jsdom';
 | 
			
		||||
import fetch from 'node-fetch';
 | 
			
		||||
import { getJson, getHtml, getAgentByUrl } from '../misc/fetch';
 | 
			
		||||
import { getJson, getHtml, getAgentByUrl } from '@/misc/fetch';
 | 
			
		||||
import { Instance } from '../models/entities/instance';
 | 
			
		||||
import { Instances } from '../models';
 | 
			
		||||
import { getFetchInstanceMetadataLock } from '../misc/app-lock';
 | 
			
		||||
import { getFetchInstanceMetadataLock } from '@/misc/app-lock';
 | 
			
		||||
import Logger from './logger';
 | 
			
		||||
import { URL } from 'url';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,13 +7,13 @@ import { deliver } from '../../queue';
 | 
			
		||||
import createFollowRequest from './requests/create';
 | 
			
		||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
 | 
			
		||||
import Logger from '../logger';
 | 
			
		||||
import { IdentifiableError } from '../../misc/identifiable-error';
 | 
			
		||||
import { IdentifiableError } from '@/misc/identifiable-error';
 | 
			
		||||
import { User } from '../../models/entities/user';
 | 
			
		||||
import { Followings, Users, FollowRequests, Blockings, Instances, UserProfiles } from '../../models';
 | 
			
		||||
import { instanceChart, perUserFollowingChart } from '../chart';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { createNotification } from '../create-notification';
 | 
			
		||||
import { isDuplicateKeyValueError } from '../../misc/is-duplicate-key-value-error';
 | 
			
		||||
import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
 | 
			
		||||
 | 
			
		||||
const logger = new Logger('following/create');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ import { publishMainStream } from '../../stream';
 | 
			
		||||
import { insertFollowingDoc } from '../create';
 | 
			
		||||
import { User, ILocalUser } from '../../../models/entities/user';
 | 
			
		||||
import { FollowRequests, Users } from '../../../models';
 | 
			
		||||
import { IdentifiableError } from '../../../misc/identifiable-error';
 | 
			
		||||
import { IdentifiableError } from '@/misc/identifiable-error';
 | 
			
		||||
 | 
			
		||||
export default async function(followee: User, follower: User) {
 | 
			
		||||
	const request = await FollowRequests.findOne({
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ import renderFollow from '../../../remote/activitypub/renderer/follow';
 | 
			
		||||
import renderUndo from '../../../remote/activitypub/renderer/undo';
 | 
			
		||||
import { deliver } from '../../../queue';
 | 
			
		||||
import { publishMainStream } from '../../stream';
 | 
			
		||||
import { IdentifiableError } from '../../../misc/identifiable-error';
 | 
			
		||||
import { IdentifiableError } from '@/misc/identifiable-error';
 | 
			
		||||
import { User, ILocalUser } from '../../../models/entities/user';
 | 
			
		||||
import { Users, FollowRequests } from '../../../models';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import renderFollow from '../../../remote/activitypub/renderer/follow';
 | 
			
		||||
import { deliver } from '../../../queue';
 | 
			
		||||
import { User } from '../../../models/entities/user';
 | 
			
		||||
import { Blockings, FollowRequests, Users } from '../../../models';
 | 
			
		||||
import { genId } from '../../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { createNotification } from '../../create-notification';
 | 
			
		||||
 | 
			
		||||
export default async function(follower: User, followee: User, requestId?: string) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,13 @@
 | 
			
		||||
import config from '../../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import renderAdd from '../../remote/activitypub/renderer/add';
 | 
			
		||||
import renderRemove from '../../remote/activitypub/renderer/remove';
 | 
			
		||||
import { renderActivity } from '../../remote/activitypub/renderer';
 | 
			
		||||
import { IdentifiableError } from '../../misc/identifiable-error';
 | 
			
		||||
import { IdentifiableError } from '@/misc/identifiable-error';
 | 
			
		||||
import { User } from '../../models/entities/user';
 | 
			
		||||
import { Note } from '../../models/entities/note';
 | 
			
		||||
import { Notes, UserNotePinings, Users } from '../../models';
 | 
			
		||||
import { UserNotePining } from '../../models/entities/user-note-pining';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { deliverToFollowers } from '../../remote/activitypub/deliver-manager';
 | 
			
		||||
import { deliverToRelays } from '../relay';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { ILocalUser } from '../models/entities/user';
 | 
			
		||||
import { ModerationLogs } from '../models';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
 | 
			
		||||
export async function insertModerationLog(moderator: ILocalUser, 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';
 | 
			
		||||
import { Cache } from '../misc/cache';
 | 
			
		||||
import { Cache } from '@/misc/cache';
 | 
			
		||||
 | 
			
		||||
const ACTOR_USERNAME = 'instance.actor' as const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,8 +5,8 @@ import * as dateformat from 'dateformat';
 | 
			
		||||
import { program } from '../argv';
 | 
			
		||||
import { getRepository } from 'typeorm';
 | 
			
		||||
import { Log } from '../models/entities/log';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
 | 
			
		||||
const SyslogPro = require('syslog-pro');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ 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';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { MessagingMessage } from '../../models/entities/messaging-message';
 | 
			
		||||
import { publishMessagingStream, publishMessagingIndexStream, publishMainStream, publishGroupMessagingStream } from '../stream';
 | 
			
		||||
import pushNotification from '../push-notification';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import config from '../../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { MessagingMessages, Users } from '../../models';
 | 
			
		||||
import { MessagingMessage } from '../../models/entities/messaging-message';
 | 
			
		||||
import { publishGroupMessagingStream, publishMessagingStream } from '../stream';
 | 
			
		||||
 
 | 
			
		||||
@@ -7,33 +7,33 @@ import renderAnnounce from '../../remote/activitypub/renderer/announce';
 | 
			
		||||
import { renderActivity } from '../../remote/activitypub/renderer';
 | 
			
		||||
import { parse } from '../../mfm/parse';
 | 
			
		||||
import { resolveUser } from '../../remote/resolve-user';
 | 
			
		||||
import config from '../../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { updateHashtags } from '../update-hashtag';
 | 
			
		||||
import { concat } from '../../prelude/array';
 | 
			
		||||
import insertNoteUnread from './unread';
 | 
			
		||||
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
 | 
			
		||||
import extractMentions from '../../misc/extract-mentions';
 | 
			
		||||
import extractEmojis from '../../misc/extract-emojis';
 | 
			
		||||
import extractHashtags from '../../misc/extract-hashtags';
 | 
			
		||||
import extractMentions from '@/misc/extract-mentions';
 | 
			
		||||
import extractEmojis from '@/misc/extract-emojis';
 | 
			
		||||
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 } from '../../models';
 | 
			
		||||
import { DriveFile } from '../../models/entities/drive-file';
 | 
			
		||||
import { App } from '../../models/entities/app';
 | 
			
		||||
import { Not, getConnection, In } from 'typeorm';
 | 
			
		||||
import { User, ILocalUser, IRemoteUser } from '../../models/entities/user';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { notesChart, perUserNotesChart, activeUsersChart, instanceChart } from '../chart';
 | 
			
		||||
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 { 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 { 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 { normalizeForSearch } from '@/misc/normalize-for-search';
 | 
			
		||||
import { getAntennas } from '@/misc/antenna-cache';
 | 
			
		||||
 | 
			
		||||
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,14 +4,14 @@ import renderAnnounce from '../../remote/activitypub/renderer/announce';
 | 
			
		||||
import renderUndo from '../../remote/activitypub/renderer/undo';
 | 
			
		||||
import { renderActivity } from '../../remote/activitypub/renderer';
 | 
			
		||||
import renderTombstone from '../../remote/activitypub/renderer/tombstone';
 | 
			
		||||
import config from '../../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
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';
 | 
			
		||||
import { notesChart, perUserNotesChart, instanceChart } from '../chart';
 | 
			
		||||
import { deliverToFollowers, deliverToUser } from '../../remote/activitypub/deliver-manager';
 | 
			
		||||
import { countSameRenotes } from '../../misc/count-same-renotes';
 | 
			
		||||
import { countSameRenotes } from '@/misc/count-same-renotes';
 | 
			
		||||
import { deliverToRelays } from '../relay';
 | 
			
		||||
import { Brackets, In } from 'typeorm';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ import { User } from '../../../models/entities/user';
 | 
			
		||||
import { Note } from '../../../models/entities/note';
 | 
			
		||||
import { PollVotes, NoteWatchings, Polls } from '../../../models';
 | 
			
		||||
import { Not } from 'typeorm';
 | 
			
		||||
import { genId } from '../../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { createNotification } from '../../create-notification';
 | 
			
		||||
 | 
			
		||||
export default async function(user: User, note: Note, choice: number) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,16 +2,16 @@ import { publishNoteStream } from '../../stream';
 | 
			
		||||
import { renderLike } from '../../../remote/activitypub/renderer/like';
 | 
			
		||||
import DeliverManager from '../../../remote/activitypub/deliver-manager';
 | 
			
		||||
import { renderActivity } from '../../../remote/activitypub/renderer';
 | 
			
		||||
import { toDbReaction, decodeReaction } from '../../../misc/reaction-lib';
 | 
			
		||||
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 } from '../../../models';
 | 
			
		||||
import { Not } from 'typeorm';
 | 
			
		||||
import { perUserReactionsChart } from '../../chart';
 | 
			
		||||
import { genId } from '../../../misc/gen-id';
 | 
			
		||||
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 { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
 | 
			
		||||
import { NoteReaction } from '../../../models/entities/note-reaction';
 | 
			
		||||
 | 
			
		||||
export default async (user: User, note: Note, reaction?: string) => {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,11 +3,11 @@ import { renderLike } from '../../../remote/activitypub/renderer/like';
 | 
			
		||||
import renderUndo from '../../../remote/activitypub/renderer/undo';
 | 
			
		||||
import { renderActivity } from '../../../remote/activitypub/renderer';
 | 
			
		||||
import DeliverManager from '../../../remote/activitypub/deliver-manager';
 | 
			
		||||
import { IdentifiableError } from '../../../misc/identifiable-error';
 | 
			
		||||
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';
 | 
			
		||||
import { decodeReaction } from '../../../misc/reaction-lib';
 | 
			
		||||
import { decodeReaction } from '@/misc/reaction-lib';
 | 
			
		||||
 | 
			
		||||
export default async (user: User, note: Note) => {
 | 
			
		||||
	// if already unreacted
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,8 @@ import { User } from '../../models/entities/user';
 | 
			
		||||
import { NoteUnreads, AntennaNotes, Users, Followings, ChannelFollowings } from '../../models';
 | 
			
		||||
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 { checkHitAntenna } from '@/misc/check-hit-antenna';
 | 
			
		||||
import { getAntennas } from '@/misc/antenna-cache';
 | 
			
		||||
import { PackedNote } from '../../models/repositories/note';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import { Note } from '../../models/entities/note';
 | 
			
		||||
import { publishMainStream } from '../stream';
 | 
			
		||||
import { User } from '../../models/entities/user';
 | 
			
		||||
import { Mutings, NoteUnreads } from '../../models';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
 | 
			
		||||
export default async function(userId: User['id'], note: Note, params: {
 | 
			
		||||
	// NOTE: isSpecifiedがtrueならisMentionedは必ずfalse
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { User } from '../../models/entities/user';
 | 
			
		||||
import { Note } from '../../models/entities/note';
 | 
			
		||||
import { NoteWatchings } from '../../models';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { NoteWatching } from '../../models/entities/note-watching';
 | 
			
		||||
 | 
			
		||||
export default async (me: User['id'], note: Note) => {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import * as push from 'web-push';
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { SwSubscriptions } from '../models';
 | 
			
		||||
import { fetchMeta } from '../misc/fetch-meta';
 | 
			
		||||
import { fetchMeta } from '@/misc/fetch-meta';
 | 
			
		||||
import { PackedNotification } from '../models/repositories/notification';
 | 
			
		||||
import { PackedMessagingMessage } from '../models/repositories/messaging-message';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
import { Instance } from '../models/entities/instance';
 | 
			
		||||
import { Instances } from '../models';
 | 
			
		||||
import { federationChart } from './chart';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { toPuny } from '../misc/convert-host';
 | 
			
		||||
import { Cache } from '../misc/cache';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { toPuny } from '@/misc/convert-host';
 | 
			
		||||
import { Cache } from '@/misc/cache';
 | 
			
		||||
 | 
			
		||||
const cache = new Cache<Instance>(1000 * 60 * 60);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ import renderUndo from '../remote/activitypub/renderer/undo';
 | 
			
		||||
import { deliver } from '../queue';
 | 
			
		||||
import { ILocalUser } from '../models/entities/user';
 | 
			
		||||
import { Users, Relays } from '../models';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
 | 
			
		||||
const ACTOR_USERNAME = 'relay.actor' as const;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import { UserProfiles } from '../models';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
import { sendEmail } from './send-email';
 | 
			
		||||
import * as locales from '../../locales/';
 | 
			
		||||
import { I18n } from '../misc/i18n';
 | 
			
		||||
import { I18n } from '@/misc/i18n';
 | 
			
		||||
 | 
			
		||||
// TODO: locale ファイルをクライアント用とサーバー用で分けたい
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import * as nodemailer from 'nodemailer';
 | 
			
		||||
import { fetchMeta } from '../misc/fetch-meta';
 | 
			
		||||
import { fetchMeta } from '@/misc/fetch-meta';
 | 
			
		||||
import Logger from './logger';
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
 | 
			
		||||
export const logger = new Logger('email');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import { Note } from '../models/entities/note';
 | 
			
		||||
import { UserList } from '../models/entities/user-list';
 | 
			
		||||
import { ReversiGame } from '../models/entities/games/reversi/game';
 | 
			
		||||
import { UserGroup } from '../models/entities/user-group';
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { Antenna } from '../models/entities/antenna';
 | 
			
		||||
import { Channel } from '../models/entities/channel';
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import renderDelete from '../remote/activitypub/renderer/delete';
 | 
			
		||||
import { renderActivity } from '../remote/activitypub/renderer';
 | 
			
		||||
import { deliver } from '../queue';
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
import { Users, Followings } from '../models';
 | 
			
		||||
import { Not, IsNull } from 'typeorm';
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ import renderDelete from '../remote/activitypub/renderer/delete';
 | 
			
		||||
import renderUndo from '../remote/activitypub/renderer/undo';
 | 
			
		||||
import { renderActivity } from '../remote/activitypub/renderer';
 | 
			
		||||
import { deliver } from '../queue';
 | 
			
		||||
import config from '../config';
 | 
			
		||||
import config from '@/config';
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
import { Users, Followings } from '../models';
 | 
			
		||||
import { Not, IsNull } from 'typeorm';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,9 @@
 | 
			
		||||
import { User } from '../models/entities/user';
 | 
			
		||||
import { Hashtags, Users } from '../models';
 | 
			
		||||
import { hashtagChart } from './chart';
 | 
			
		||||
import { genId } from '../misc/gen-id';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { Hashtag } from '../models/entities/hashtag';
 | 
			
		||||
import { normalizeForSearch } from '../misc/normalize-for-search';
 | 
			
		||||
import { normalizeForSearch } from '@/misc/normalize-for-search';
 | 
			
		||||
 | 
			
		||||
export async function updateHashtags(user: User, tags: string[]) {
 | 
			
		||||
	for (const tag of tags) {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,8 @@ import { User } from '../../models/entities/user';
 | 
			
		||||
import { UserList } from '../../models/entities/user-list';
 | 
			
		||||
import { UserListJoinings, Users } from '../../models';
 | 
			
		||||
import { UserListJoining } from '../../models/entities/user-list-joining';
 | 
			
		||||
import { genId } from '../../misc/gen-id';
 | 
			
		||||
import { fetchProxyAccount } from '../../misc/fetch-proxy-account';
 | 
			
		||||
import { genId } from '@/misc/gen-id';
 | 
			
		||||
import { fetchProxyAccount } from '@/misc/fetch-proxy-account';
 | 
			
		||||
import createFollowing from '../following/create';
 | 
			
		||||
 | 
			
		||||
export async function pushUserToUserList(target: User, list: UserList) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user