1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-30 23:01:48 +09:00

chore: fix import position

This commit is contained in:
syuilo 2022-12-04 17:05:32 +09:00
parent bbb49457f9
commit 9ce13d487b
16 changed files with 29 additions and 16 deletions

View File

@ -6,13 +6,13 @@ import * as nsfw from 'nsfwjs';
import si from 'systeminformation';
import type { Config } from '@/config.js';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const REQUIRED_CPU_FLAGS = ['avx2', 'fma'];
let isSupportedCpu: undefined | boolean = undefined;
import { bindThis } from '@/decorators.js';
@Injectable()
export class AiService {

View File

@ -3,12 +3,12 @@ import { Inject, Injectable } from '@nestjs/common';
import redisLock from 'redis-lock';
import Redis from 'ioredis';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';
/**
* Retry delay (ms) for lock acquisition
*/
const retryDelay = 100;
import { bindThis } from '@/decorators.js';
@Injectable()
export class AppLockService {

View File

@ -12,6 +12,7 @@ import type { Note } from '@/models/entities/Note.js';
import type { EmojisRepository } from '@/models/index.js';
import { UtilityService } from '@/core/UtilityService.js';
import { ReactionService } from '@/core/ReactionService.js';
import { bindThis } from '@/decorators.js';
/**
*
@ -20,7 +21,6 @@ type PopulatedEmoji = {
name: string;
url: string;
};
import { bindThis } from '@/decorators.js';
@Injectable()
export class CustomEmojiService {

View File

@ -31,6 +31,7 @@ import { InternalStorageService } from '@/core/InternalStorageService.js';
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FileInfoService } from '@/core/FileInfoService.js';
import { bindThis } from '@/decorators.js';
import type S3 from 'aws-sdk/clients/s3.js';
type AddFileArgs = {
@ -71,7 +72,6 @@ type UploadFromUrlArgs = {
requestIp?: string | null;
requestHeaders?: Record<string, string> | null;
};
import { bindThis } from '@/decorators.js';
@Injectable()
export class DriveService {

View File

@ -10,6 +10,7 @@ import type Logger from '@/logger.js';
import { DI } from '@/di-symbols.js';
import { LoggerService } from '@/core/LoggerService.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js';
import type { DOMWindow } from 'jsdom';
type NodeInfo = {
@ -30,7 +31,6 @@ type NodeInfo = {
themeColor?: unknown;
};
};
import { bindThis } from '@/decorators.js';
@Injectable()
export class FetchInstanceMetadataService {

View File

@ -50,26 +50,32 @@ export class GlobalEventService {
}));
}
@bindThis
public publishInternalEvent<K extends keyof InternalStreamTypes>(type: K, value?: InternalStreamTypes[K]): void {
this.publish('internal', type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishUserEvent<K extends keyof UserStreamTypes>(userId: User['id'], type: K, value?: UserStreamTypes[K]): void {
this.publish(`user:${userId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishBroadcastStream<K extends keyof BroadcastTypes>(type: K, value?: BroadcastTypes[K]): void {
this.publish('broadcast', type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishMainStream<K extends keyof MainStreamTypes>(userId: User['id'], type: K, value?: MainStreamTypes[K]): void {
this.publish(`mainStream:${userId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishDriveStream<K extends keyof DriveStreamTypes>(userId: User['id'], type: K, value?: DriveStreamTypes[K]): void {
this.publish(`driveStream:${userId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishNoteStream<K extends keyof NoteStreamTypes>(noteId: Note['id'], type: K, value?: NoteStreamTypes[K]): void {
this.publish(`noteStream:${noteId}`, type, {
id: noteId,
@ -77,26 +83,32 @@ export class GlobalEventService {
});
}
@bindThis
public publishChannelStream<K extends keyof ChannelStreamTypes>(channelId: Channel['id'], type: K, value?: ChannelStreamTypes[K]): void {
this.publish(`channelStream:${channelId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishUserListStream<K extends keyof UserListStreamTypes>(listId: UserList['id'], type: K, value?: UserListStreamTypes[K]): void {
this.publish(`userListStream:${listId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishAntennaStream<K extends keyof AntennaStreamTypes>(antennaId: Antenna['id'], type: K, value?: AntennaStreamTypes[K]): void {
this.publish(`antennaStream:${antennaId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishMessagingStream<K extends keyof MessagingStreamTypes>(userId: User['id'], otherpartyId: User['id'], type: K, value?: MessagingStreamTypes[K]): void {
this.publish(`messagingStream:${userId}-${otherpartyId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishGroupMessagingStream<K extends keyof GroupMessagingStreamTypes>(groupId: UserGroup['id'], type: K, value?: GroupMessagingStreamTypes[K]): void {
this.publish(`messagingStream:${groupId}`, type, typeof value === 'undefined' ? null : value);
}
@bindThis
public publishMessagingIndexStream<K extends keyof MessagingIndexStreamTypes>(userId: User['id'], type: K, value?: MessagingIndexStreamTypes[K]): void {
this.publish(`messagingIndexStream:${userId}`, type, typeof value === 'undefined' ? null : value);
}
@ -106,6 +118,7 @@ export class GlobalEventService {
this.publish('notesStream', null, note);
}
@bindThis
public publishAdminStream<K extends keyof AdminStreamTypes>(userId: User['id'], type: K, value?: AdminStreamTypes[K]): void {
this.publish(`adminStream:${userId}`, type, typeof value === 'undefined' ? null : value);
}

View File

@ -5,9 +5,9 @@ import type { UsersRepository } from '@/models/index.js';
import { Cache } from '@/misc/cache.js';
import { DI } from '@/di-symbols.js';
import { CreateSystemUserService } from '@/core/CreateSystemUserService.js';
import { bindThis } from '@/decorators.js';
const ACTOR_USERNAME = 'instance.actor' as const;
import { bindThis } from '@/decorators.js';
@Injectable()
export class InstanceActorService {

View File

@ -5,12 +5,12 @@ import { dirname } from 'node:path';
import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
import { bindThis } from '@/decorators.js';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
const path = Path.resolve(_dirname, '../../../../files');
import { bindThis } from '@/decorators.js';
@Injectable()
export class InternalStorageService {

View File

@ -7,6 +7,7 @@ import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import { intersperse } from '@/misc/prelude/array.js';
import type { IMentionedRemoteUsers } from '@/models/entities/Note.js';
import { bindThis } from '@/decorators.js';
import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js';
import type * as mfm from 'mfm-js';
@ -14,7 +15,6 @@ const treeAdapter = TreeAdapter.defaultTreeAdapter;
const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
import { bindThis } from '@/decorators.js';
@Injectable()
export class MfmService {

View File

@ -40,6 +40,7 @@ import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerService.js';
import { NoteReadService } from '@/core/NoteReadService.js';
import { RemoteUserResolveService } from '@/core/RemoteUserResolveService.js';
import { bindThis } from '@/decorators.js';
const mutedWordsCache = new Cache<{ userId: UserProfile['userId']; mutedWords: UserProfile['mutedWords']; }[]>(1000 * 60 * 5);
@ -132,7 +133,6 @@ type Option = {
url?: string | null;
app?: App | null;
};
import { bindThis } from '@/decorators.js';
@Injectable()
export class NoteCreateService {

View File

@ -6,6 +6,7 @@ import type { Packed } from '@/misc/schema';
import { getNoteSummary } from '@/misc/get-note-summary.js';
import type { SwSubscriptionsRepository } from '@/models/index.js';
import { MetaService } from '@/core/MetaService.js';
import { bindThis } from '@/decorators.js';
// Defined also packages/sw/types.ts#L14-L21
type pushNotificationsTypes = {
@ -37,7 +38,6 @@ function truncateNotification(notification: Packed<'Notification'>): any {
return notification;
}
import { bindThis } from '@/decorators.js';
@Injectable()
export class PushNotificationService {

View File

@ -17,6 +17,7 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { MetaService } from '@/core/MetaService.js';
import { bindThis } from '@/decorators.js';
import { UtilityService } from './UtilityService.js';
const legacies: Record<string, string> = {
@ -49,7 +50,6 @@ type DecodedReaction = {
*/
host?: string | null;
};
import { bindThis } from '@/decorators.js';
@Injectable()
export class ReactionService {

View File

@ -10,9 +10,9 @@ import { CreateSystemUserService } from '@/core/CreateSystemUserService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { DI } from '@/di-symbols.js';
import { deepClone } from '@/misc/clone.js';
import { bindThis } from '@/decorators.js';
const ACTOR_USERNAME = 'relay.actor' as const;
import { bindThis } from '@/decorators.js';
@Injectable()
export class RelayService {

View File

@ -4,6 +4,7 @@ import * as jsrsasign from 'jsrsasign';
import { DI } from '@/di-symbols.js';
import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js';
import { bindThis } from '@/decorators.js';
const ECC_PRELUDE = Buffer.from([0x04]);
const NULL_BYTE = Buffer.from([0]);
@ -103,7 +104,6 @@ function PEMString(pemBuffer: Buffer, type = 'CERTIFICATE') {
`\n-----END ${type}-----\n`
);
}
import { bindThis } from '@/decorators.js';
@Injectable()
export class TwoFactorAuthenticationService {

View File

@ -13,9 +13,10 @@ import { WebhookService } from '@/core/WebhookService.js';
import { CreateNotificationService } from '@/core/CreateNotificationService.js';
import { DI } from '@/di-symbols.js';
import type { BlockingsRepository, FollowingsRepository, FollowRequestsRepository, InstancesRepository, UserProfilesRepository, UsersRepository } from '@/models/index.js';
import Logger from '../logger.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
import { bindThis } from '@/decorators.js';
import Logger from '../logger.js';
const logger = new Logger('following/create');
@ -31,7 +32,6 @@ type Remote = IRemoteUser | {
inbox: IRemoteUser['inbox'];
};
type Both = Local | Remote;
import { bindThis } from '@/decorators.js';
@Injectable()
export class UserFollowingService {

View File

@ -4,6 +4,7 @@ import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
import { query as urlQuery } from '@/misc/prelude/url.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js';
type ILink = {
href: string;
@ -14,7 +15,6 @@ type IWebFinger = {
links: ILink[];
subject: string;
};
import { bindThis } from '@/decorators.js';
@Injectable()
export class WebfingerService {