refactor: Use ESM (#8358)

* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
This commit is contained in:
syuilo 2022-02-27 11:07:39 +09:00 committed by GitHub
parent 0a882471f3
commit d071d18dd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
737 changed files with 4135 additions and 3678 deletions

View file

@ -1,6 +1,9 @@
{ {
"extension": ["ts","js","cjs","mjs"], "extension": ["ts","js","cjs","mjs"],
"require": ["ts-node/register", "tsconfig-paths/register"], "node-option": [
"experimental-specifier-resolution=node",
"loader=./test/loader.js"
],
"slow": 1000, "slow": 1000,
"timeout": 35000, "timeout": 35000,
"exit": true "exit": true

View file

@ -1,6 +1,7 @@
{ {
"main": "./index.js", "main": "./index.js",
"private": true, "private": true,
"type": "module",
"scripts": { "scripts": {
"init": "npm run migrate", "init": "npm run migrate",
"build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json", "build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json",
@ -18,14 +19,13 @@
"@elastic/elasticsearch": "7.11.0", "@elastic/elasticsearch": "7.11.0",
"@koa/cors": "3.1.0", "@koa/cors": "3.1.0",
"@koa/multer": "3.0.0", "@koa/multer": "3.0.0",
"@koa/router": "9.0.1", "@koa/router": "10.1.1",
"@sinonjs/fake-timers": "9.1.0", "@sinonjs/fake-timers": "9.1.0",
"@syuilo/aiscript": "0.11.1", "@syuilo/aiscript": "0.11.1",
"@types/bcryptjs": "2.4.2", "@types/bcryptjs": "2.4.2",
"@types/bull": "3.15.8", "@types/bull": "3.15.8",
"@types/cbor": "6.0.0", "@types/cbor": "6.0.0",
"@types/escape-regexp": "0.0.1", "@types/escape-regexp": "0.0.1",
"@types/glob": "7.2.0",
"@types/is-url": "1.2.30", "@types/is-url": "1.2.30",
"@types/js-yaml": "4.0.5", "@types/js-yaml": "4.0.5",
"@types/jsdom": "16.2.14", "@types/jsdom": "16.2.14",
@ -82,8 +82,10 @@
"cacheable-lookup": "6.0.4", "cacheable-lookup": "6.0.4",
"cafy": "15.2.1", "cafy": "15.2.1",
"cbor": "8.1.0", "cbor": "8.1.0",
"chalk": "4.1.2", "chalk": "5.0.0",
"chalk-template": "0.3.1",
"cli-highlight": "2.1.11", "cli-highlight": "2.1.11",
"color-convert": "2.0.1",
"content-disposition": "0.5.4", "content-disposition": "0.5.4",
"date-fns": "2.28.0", "date-fns": "2.28.0",
"deep-email-validator": "0.1.21", "deep-email-validator": "0.1.21",
@ -94,7 +96,6 @@
"feed": "4.2.2", "feed": "4.2.2",
"file-type": "16.5.3", "file-type": "16.5.3",
"fluent-ffmpeg": "2.1.2", "fluent-ffmpeg": "2.1.2",
"glob": "7.2.0",
"got": "11.8.2", "got": "11.8.2",
"hpagent": "0.1.2", "hpagent": "0.1.2",
"http-signature": "1.3.6", "http-signature": "1.3.6",

View file

@ -1,5 +1,5 @@
declare module 'probe-image-size' { declare module 'probe-image-size' {
import { ReadStream } from 'fs'; import { ReadStream } from 'node:fs';
type ProbeOptions = { type ProbeOptions = {
retries: 1; retries: 1;

View file

@ -1,18 +1,18 @@
import * as cluster from 'cluster'; import cluster from 'node:cluster';
import * as chalk from 'chalk'; import chalk from 'chalk';
import Xev from 'xev'; import { default as Xev } from 'xev';
import Logger from '@/services/logger'; import Logger from '@/services/logger.js';
import { envOption } from '../env'; import { envOption } from '../env.js';
// for typeorm // for typeorm
import 'reflect-metadata'; import 'reflect-metadata';
import { masterMain } from './master'; import { masterMain } from './master.js';
import { workerMain } from './worker'; import { workerMain } from './worker.js';
const logger = new Logger('core', 'cyan'); const logger = new Logger('core', 'cyan');
const clusterLogger = logger.createSubLogger('cluster', 'orange', false); const clusterLogger = logger.createSubLogger('cluster', 'orange', false);
const ev = new Xev(); const ev = new Xev.default();
/** /**
* Init process * Init process

View file

@ -1,22 +1,22 @@
import * as fs from 'fs'; import * as fs from 'node:fs';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'node:url';
import { dirname } from 'path'; import { dirname } from 'node:path';
import * as os from 'os'; import * as os from 'node:os';
import * as cluster from 'cluster'; import cluster from 'node:cluster';
import * as chalk from 'chalk'; import chalk from 'chalk';
import chalkTemplate from 'chalk-template';
import * as portscanner from 'portscanner'; import * as portscanner from 'portscanner';
import { getConnection } from 'typeorm'; import { getConnection } from 'typeorm';
import Logger from '@/services/logger'; import Logger from '@/services/logger.js';
import loadConfig from '@/config/load'; import loadConfig from '@/config/load.js';
import { Config } from '@/config/types'; import { Config } from '@/config/types.js';
import { lessThan } from '@/prelude/array'; import { lessThan } from '@/prelude/array.js';
import { envOption } from '../env'; import { envOption } from '../env.js';
import { showMachineInfo } from '@/misc/show-machine-info'; import { showMachineInfo } from '@/misc/show-machine-info.js';
import { initDb } from '../db/postgre'; import { initDb } from '../db/postgre.js';
//const _filename = fileURLToPath(import.meta.url); const _filename = fileURLToPath(import.meta.url);
const _filename = __filename;
const _dirname = dirname(_filename); const _dirname = dirname(_filename);
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/meta.json`, 'utf-8')); const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/meta.json`, 'utf-8'));
@ -24,22 +24,24 @@ const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../../built/meta.json
const logger = new Logger('core', 'cyan'); const logger = new Logger('core', 'cyan');
const bootLogger = logger.createSubLogger('boot', 'magenta', false); const bootLogger = logger.createSubLogger('boot', 'magenta', false);
const themeColor = chalk.hex('#86b300');
function greet() { function greet() {
if (!envOption.quiet) { if (!envOption.quiet) {
//#region Misskey logo //#region Misskey logo
const v = `v${meta.version}`; const v = `v${meta.version}`;
console.log(' _____ _ _ '); console.log(themeColor(' _____ _ _ '));
console.log(' | |_|___ ___| |_ ___ _ _ '); console.log(themeColor(' | |_|___ ___| |_ ___ _ _ '));
console.log(' | | | | |_ -|_ -| \'_| -_| | |'); console.log(themeColor(' | | | | |_ -|_ -| \'_| -_| | |'));
console.log(' |_|_|_|_|___|___|_,_|___|_ |'); console.log(themeColor(' |_|_|_|_|___|___|_,_|___|_ |'));
console.log(' ' + chalk.gray(v) + (' |___|\n'.substr(v.length))); console.log(' ' + chalk.gray(v) + themeColor(' |___|\n'.substr(v.length)));
//#endregion //#endregion
console.log(' Misskey is an open-source decentralized microblogging platform.'); console.log(' Misskey is an open-source decentralized microblogging platform.');
console.log(chalk.keyword('orange')(' If you like Misskey, please donate to support development. https://www.patreon.com/syuilo')); console.log(chalk.rgb(255, 136, 0)(' If you like Misskey, please donate to support development. https://www.patreon.com/syuilo'));
console.log(''); console.log('');
console.log(chalk`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`); console.log(chalkTemplate`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`);
} }
bootLogger.info('Welcome to Misskey!'); bootLogger.info('Welcome to Misskey!');
@ -80,9 +82,9 @@ export async function masterMain() {
bootLogger.succ(`Now listening on port ${config.port} on ${config.url}`, null, true); bootLogger.succ(`Now listening on port ${config.port} on ${config.url}`, null, true);
if (!envOption.noDaemons) { if (!envOption.noDaemons) {
require('../daemons/server-stats').default(); import('../daemons/server-stats.js').then(x => x.default());
require('../daemons/queue-stats').default(); import('../daemons/queue-stats.js').then(x => x.default());
require('../daemons/janitor').default(); import('../daemons/janitor.js').then(x => x.default());
} }
} }

View file

@ -1,5 +1,5 @@
import * as cluster from 'cluster'; import cluster from 'node:cluster';
import { initDb } from '../db/postgre'; import { initDb } from '../db/postgre.js';
/** /**
* Init worker process * Init worker process
@ -8,10 +8,10 @@ export async function workerMain() {
await initDb(); await initDb();
// start server // start server
await require('../server').default(); await import('../server/index.js').then(x => x.default());
// start job queue // start job queue
require('../queue').default(); import('../queue/index.js').then(x => x.default());
if (cluster.isWorker) { if (cluster.isWorker) {
// Send a 'ready' message to parent process // Send a 'ready' message to parent process

View file

@ -1,3 +1,3 @@
import load from './load'; import load from './load.js';
export default load(); export default load();

View file

@ -2,14 +2,13 @@
* Config loader * Config loader
*/ */
import * as fs from 'fs'; import * as fs from 'node:fs';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'node:url';
import { dirname } from 'path'; import { dirname } from 'node:path';
import * as yaml from 'js-yaml'; import * as yaml from 'js-yaml';
import { Source, Mixin } from './types'; import { Source, Mixin } from './types.js';
//const _filename = fileURLToPath(import.meta.url); const _filename = fileURLToPath(import.meta.url);
const _filename = __filename;
const _dirname = dirname(_filename); const _dirname = dirname(_filename);
/** /**

View file

@ -1,7 +1,7 @@
// TODO: 消したい // TODO: 消したい
const interval = 30 * 60 * 1000; const interval = 30 * 60 * 1000;
import { AttestationChallenges } from '@/models/index'; import { AttestationChallenges } from '@/models/index.js';
import { LessThan } from 'typeorm'; import { LessThan } from 'typeorm';
/** /**

View file

@ -1,7 +1,7 @@
import Xev from 'xev'; import { default as Xev } from 'xev';
import { deliverQueue, inboxQueue } from '../queue/queues'; import { deliverQueue, inboxQueue } from '../queue/queues.js';
const ev = new Xev(); const ev = new Xev.default();
const interval = 10000; const interval = 10000;

View file

@ -1,8 +1,8 @@
import * as si from 'systeminformation'; import si from 'systeminformation';
import Xev from 'xev'; import { default as Xev } from 'xev';
import * as osUtils from 'os-utils'; import * as osUtils from 'os-utils';
const ev = new Xev(); const ev = new Xev.default();
const interval = 2000; const interval = 2000;

View file

@ -1,5 +1,5 @@
import * as elasticsearch from '@elastic/elasticsearch'; import * as elasticsearch from '@elastic/elasticsearch';
import config from '@/config/index'; import config from '@/config/index.js';
const index = { const index = {
settings: { settings: {

View file

@ -1,3 +1,3 @@
import Logger from '@/services/logger'; import Logger from '@/services/logger.js';
export const dbLogger = new Logger('db'); export const dbLogger = new Logger('db');

View file

@ -1,78 +1,78 @@
// https://github.com/typeorm/typeorm/issues/2400 // https://github.com/typeorm/typeorm/issues/2400
const types = require('pg').types; import pg from 'pg';
types.setTypeParser(20, Number); pg.types.setTypeParser(20, Number);
import { createConnection, Logger, getConnection } from 'typeorm'; import { createConnection, Logger, getConnection } from 'typeorm';
import * as highlight from 'cli-highlight'; import * as highlight from 'cli-highlight';
import config from '@/config/index'; import config from '@/config/index.js';
import { dbLogger } from './logger'; import { dbLogger } from './logger.js';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user.js';
import { DriveFile } from '@/models/entities/drive-file'; import { DriveFile } from '@/models/entities/drive-file.js';
import { DriveFolder } from '@/models/entities/drive-folder'; import { DriveFolder } from '@/models/entities/drive-folder.js';
import { AccessToken } from '@/models/entities/access-token'; import { AccessToken } from '@/models/entities/access-token.js';
import { App } from '@/models/entities/app'; import { App } from '@/models/entities/app.js';
import { PollVote } from '@/models/entities/poll-vote'; import { PollVote } from '@/models/entities/poll-vote.js';
import { Note } from '@/models/entities/note'; import { Note } from '@/models/entities/note.js';
import { NoteReaction } from '@/models/entities/note-reaction'; import { NoteReaction } from '@/models/entities/note-reaction.js';
import { NoteWatching } from '@/models/entities/note-watching'; import { NoteWatching } from '@/models/entities/note-watching.js';
import { NoteThreadMuting } from '@/models/entities/note-thread-muting'; import { NoteThreadMuting } from '@/models/entities/note-thread-muting.js';
import { NoteUnread } from '@/models/entities/note-unread'; import { NoteUnread } from '@/models/entities/note-unread.js';
import { Notification } from '@/models/entities/notification'; import { Notification } from '@/models/entities/notification.js';
import { Meta } from '@/models/entities/meta'; import { Meta } from '@/models/entities/meta.js';
import { Following } from '@/models/entities/following'; import { Following } from '@/models/entities/following.js';
import { Instance } from '@/models/entities/instance'; import { Instance } from '@/models/entities/instance.js';
import { Muting } from '@/models/entities/muting'; import { Muting } from '@/models/entities/muting.js';
import { SwSubscription } from '@/models/entities/sw-subscription'; import { SwSubscription } from '@/models/entities/sw-subscription.js';
import { Blocking } from '@/models/entities/blocking'; import { Blocking } from '@/models/entities/blocking.js';
import { UserList } from '@/models/entities/user-list'; import { UserList } from '@/models/entities/user-list.js';
import { UserListJoining } from '@/models/entities/user-list-joining'; import { UserListJoining } from '@/models/entities/user-list-joining.js';
import { UserGroup } from '@/models/entities/user-group'; import { UserGroup } from '@/models/entities/user-group.js';
import { UserGroupJoining } from '@/models/entities/user-group-joining'; import { UserGroupJoining } from '@/models/entities/user-group-joining.js';
import { UserGroupInvitation } from '@/models/entities/user-group-invitation'; import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js';
import { Hashtag } from '@/models/entities/hashtag'; import { Hashtag } from '@/models/entities/hashtag.js';
import { NoteFavorite } from '@/models/entities/note-favorite'; import { NoteFavorite } from '@/models/entities/note-favorite.js';
import { AbuseUserReport } from '@/models/entities/abuse-user-report'; import { AbuseUserReport } from '@/models/entities/abuse-user-report.js';
import { RegistrationTicket } from '@/models/entities/registration-tickets'; import { RegistrationTicket } from '@/models/entities/registration-tickets.js';
import { MessagingMessage } from '@/models/entities/messaging-message'; import { MessagingMessage } from '@/models/entities/messaging-message.js';
import { Signin } from '@/models/entities/signin'; import { Signin } from '@/models/entities/signin.js';
import { AuthSession } from '@/models/entities/auth-session'; import { AuthSession } from '@/models/entities/auth-session.js';
import { FollowRequest } from '@/models/entities/follow-request'; import { FollowRequest } from '@/models/entities/follow-request.js';
import { Emoji } from '@/models/entities/emoji'; import { Emoji } from '@/models/entities/emoji.js';
import { UserNotePining } from '@/models/entities/user-note-pining'; import { UserNotePining } from '@/models/entities/user-note-pining.js';
import { Poll } from '@/models/entities/poll'; import { Poll } from '@/models/entities/poll.js';
import { UserKeypair } from '@/models/entities/user-keypair'; import { UserKeypair } from '@/models/entities/user-keypair.js';
import { UserPublickey } from '@/models/entities/user-publickey'; import { UserPublickey } from '@/models/entities/user-publickey.js';
import { UserProfile } from '@/models/entities/user-profile'; import { UserProfile } from '@/models/entities/user-profile.js';
import { UserSecurityKey } from '@/models/entities/user-security-key'; import { UserSecurityKey } from '@/models/entities/user-security-key.js';
import { AttestationChallenge } from '@/models/entities/attestation-challenge'; import { AttestationChallenge } from '@/models/entities/attestation-challenge.js';
import { Page } from '@/models/entities/page'; import { Page } from '@/models/entities/page.js';
import { PageLike } from '@/models/entities/page-like'; import { PageLike } from '@/models/entities/page-like.js';
import { GalleryPost } from '@/models/entities/gallery-post'; import { GalleryPost } from '@/models/entities/gallery-post.js';
import { GalleryLike } from '@/models/entities/gallery-like'; import { GalleryLike } from '@/models/entities/gallery-like.js';
import { ModerationLog } from '@/models/entities/moderation-log'; import { ModerationLog } from '@/models/entities/moderation-log.js';
import { UsedUsername } from '@/models/entities/used-username'; import { UsedUsername } from '@/models/entities/used-username.js';
import { Announcement } from '@/models/entities/announcement'; import { Announcement } from '@/models/entities/announcement.js';
import { AnnouncementRead } from '@/models/entities/announcement-read'; import { AnnouncementRead } from '@/models/entities/announcement-read.js';
import { Clip } from '@/models/entities/clip'; import { Clip } from '@/models/entities/clip.js';
import { ClipNote } from '@/models/entities/clip-note'; import { ClipNote } from '@/models/entities/clip-note.js';
import { Antenna } from '@/models/entities/antenna'; import { Antenna } from '@/models/entities/antenna.js';
import { AntennaNote } from '@/models/entities/antenna-note'; import { AntennaNote } from '@/models/entities/antenna-note.js';
import { PromoNote } from '@/models/entities/promo-note'; import { PromoNote } from '@/models/entities/promo-note.js';
import { PromoRead } from '@/models/entities/promo-read'; import { PromoRead } from '@/models/entities/promo-read.js';
import { envOption } from '../env'; import { envOption } from '../env.js';
import { Relay } from '@/models/entities/relay'; import { Relay } from '@/models/entities/relay.js';
import { MutedNote } from '@/models/entities/muted-note'; import { MutedNote } from '@/models/entities/muted-note.js';
import { Channel } from '@/models/entities/channel'; import { Channel } from '@/models/entities/channel.js';
import { ChannelFollowing } from '@/models/entities/channel-following'; import { ChannelFollowing } from '@/models/entities/channel-following.js';
import { ChannelNotePining } from '@/models/entities/channel-note-pining'; import { ChannelNotePining } from '@/models/entities/channel-note-pining.js';
import { RegistryItem } from '@/models/entities/registry-item'; import { RegistryItem } from '@/models/entities/registry-item.js';
import { Ad } from '@/models/entities/ad'; import { Ad } from '@/models/entities/ad.js';
import { PasswordResetRequest } from '@/models/entities/password-reset-request'; import { PasswordResetRequest } from '@/models/entities/password-reset-request.js';
import { UserPending } from '@/models/entities/user-pending'; import { UserPending } from '@/models/entities/user-pending.js';
import { entities as charts } from '@/services/chart/entities'; import { entities as charts } from '@/services/chart/entities.js';
const sqlLogger = dbLogger.createSubLogger('sql', 'white', false); const sqlLogger = dbLogger.createSubLogger('sql', 'white', false);

View file

@ -1,5 +1,5 @@
import * as redis from 'redis'; import * as redis from 'redis';
import config from '@/config/index'; import config from '@/config/index.js';
export function createConnection() { export function createConnection() {
return redis.createClient( return redis.createClient(

View file

@ -2,10 +2,12 @@
* Misskey Entry Point! * Misskey Entry Point!
*/ */
import { EventEmitter } from 'node:events';
import boot from './boot/index.js';
Error.stackTraceLimit = Infinity; Error.stackTraceLimit = Infinity;
EventEmitter.defaultMaxListeners = 128;
require('events').EventEmitter.defaultMaxListeners = 128; boot().catch(err => {
console.error(err);
import boot from './boot/index'; });
boot();

View file

@ -1,6 +1,6 @@
import * as parse5 from 'parse5'; import * as parse5 from 'parse5';
import treeAdapter = require('parse5/lib/tree-adapters/default'); import treeAdapter from 'parse5/lib/tree-adapters/default.js';
import { URL } from 'url'; import { URL } from 'node:url';
const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/; const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/; const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;

View file

@ -1,8 +1,8 @@
import { JSDOM } from 'jsdom'; import { JSDOM } from 'jsdom';
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import config from '@/config/index'; import config from '@/config/index.js';
import { intersperse } from '@/prelude/array'; import { intersperse } from '@/prelude/array.js';
import { IMentionedRemoteUsers } from '@/models/entities/note'; import { IMentionedRemoteUsers } from '@/models/entities/note.js';
export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) { export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
if (nodes == null) { if (nodes == null) {

View file

@ -0,0 +1,14 @@
export type Acct = {
username: string;
host: string | null;
};
export function parse(acct: string): Acct {
if (acct.startsWith('@')) acct = acct.substr(1);
const split = acct.split('@', 2);
return { username: split[0], host: split[1] || null };
}
export function toString(acct: Acct): string {
return acct.host == null ? acct.username : `${acct.username}@${acct.host}`;
}

View file

@ -1,6 +1,6 @@
import { Antennas } from '@/models/index'; import { Antennas } from '@/models/index.js';
import { Antenna } from '@/models/entities/antenna'; import { Antenna } from '@/models/entities/antenna.js';
import { subsdcriber } from '../db/redis'; import { subsdcriber } from '../db/redis.js';
let antennasFetched = false; let antennasFetched = false;
let antennas: Antenna[] = []; let antennas: Antenna[] = [];

View file

@ -1,6 +1,6 @@
import { redisClient } from '../db/redis'; import { redisClient } from '../db/redis.js';
import { promisify } from 'util'; import { promisify } from 'node:util';
import * as redisLock from 'redis-lock'; import redisLock from 'redis-lock';
/** /**
* Retry delay (ms) for lock acquisition * Retry delay (ms) for lock acquisition

View file

@ -1,7 +1,7 @@
import fetch from 'node-fetch'; import fetch from 'node-fetch';
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'node:url';
import { getAgentByUrl } from './fetch'; import { getAgentByUrl } from './fetch.js';
import config from '@/config/index'; import config from '@/config/index.js';
export async function verifyRecaptcha(secret: string, response: string) { export async function verifyRecaptcha(secret: string, response: string) {
const result = await getCaptchaResponse('https://www.recaptcha.net/recaptcha/api/siteverify', secret, response).catch(e => { const result = await getCaptchaResponse('https://www.recaptcha.net/recaptcha/api/siteverify', secret, response).catch(e => {

View file

@ -1,10 +1,10 @@
import { Antenna } from '@/models/entities/antenna'; import { Antenna } from '@/models/entities/antenna.js';
import { Note } from '@/models/entities/note'; import { Note } from '@/models/entities/note.js';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user.js';
import { UserListJoinings, UserGroupJoinings } from '@/models/index'; import { UserListJoinings, UserGroupJoinings } from '@/models/index.js';
import { getFullApAccount } from './convert-host'; import { getFullApAccount } from './convert-host.js';
import * as Acct from 'misskey-js/built/acct'; import * as Acct from '@/misc/acct.js';
import { Packed } from './schema'; import { Packed } from './schema.js';
/** /**
* noteUserFollowers / antennaUserFollowing * noteUserFollowers / antennaUserFollowing

View file

@ -1,6 +1,6 @@
const RE2 = require('re2'); import RE2 from 're2';
import { Note } from '@/models/entities/note'; import { Note } from '@/models/entities/note.js';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user.js';
type NoteLike = { type NoteLike = {
userId: Note['userId']; userId: Note['userId'];

View file

@ -1,4 +1,4 @@
const cd = require('content-disposition'); import cd from 'content-disposition';
export function contentDisposition(type: 'inline' | 'attachment', filename: string): string { export function contentDisposition(type: 'inline' | 'attachment', filename: string): string {
const fallback = filename.replace(/[^\w.-]/g, '_'); const fallback = filename.replace(/[^\w.-]/g, '_');

View file

@ -1,6 +1,6 @@
import { URL } from 'url'; import { URL } from 'node:url';
import config from '@/config/index'; import config from '@/config/index.js';
import { toASCII } from 'punycode/'; import { toASCII } from 'punycode';
export function getFullApAccount(username: string, host: string | null) { export function getFullApAccount(username: string, host: string | null) {
return host ? `${username}@${toPuny(host)}` : `${username}@${toPuny(config.host)}`; return host ? `${username}@${toPuny(host)}` : `${username}@${toPuny(config.host)}`;

View file

@ -1,4 +1,4 @@
import { Notes } from '@/models/index'; import { Notes } from '@/models/index.js';
export async function countSameRenotes(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise<number> { export async function countSameRenotes(userId: string, renoteId: string, excludeNoteId: string | undefined): Promise<number> {
// 指定したユーザーの指定したノートのリノートがいくつあるか数える // 指定したユーザーの指定したノートのリノートがいくつあるか数える

View file

@ -1,6 +1,6 @@
import { createTemp } from './create-temp'; import { createTemp } from './create-temp.js';
import { downloadUrl } from './download-url'; import { downloadUrl } from './download-url.js';
import { detectType } from './get-file-info'; import { detectType } from './get-file-info.js';
export async function detectUrlMime(url: string) { export async function detectUrlMime(url: string) {
const [path, cleanup] = await createTemp(); const [path, cleanup] = await createTemp();

View file

@ -1,8 +1,8 @@
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as util from 'util'; import * as util from 'node:util';
import Logger from '@/services/logger'; import Logger from '@/services/logger.js';
import { createTemp } from './create-temp'; import { createTemp } from './create-temp.js';
import { downloadUrl } from './download-url'; import { downloadUrl } from './download-url.js';
const logger = new Logger('download-text-file'); const logger = new Logger('download-text-file');

View file

@ -1,13 +1,13 @@
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as stream from 'stream'; import * as stream from 'node:stream';
import * as util from 'util'; import * as util from 'node:util';
import got, * as Got from 'got'; import got, * as Got from 'got';
import { httpAgent, httpsAgent, StatusError } from './fetch'; import { httpAgent, httpsAgent, StatusError } from './fetch.js';
import config from '@/config/index'; import config from '@/config/index.js';
import * as chalk from 'chalk'; import chalk from 'chalk';
import Logger from '@/services/logger'; import Logger from '@/services/logger.js';
import * as IPCIDR from 'ip-cidr'; import * as IPCIDR from 'ip-cidr';
const PrivateIp = require('private-ip'); import PrivateIp from 'private-ip';
const pipeline = util.promisify(stream.pipeline); const pipeline = util.promisify(stream.pipeline);

View file

@ -1,3 +1,4 @@
const twemojiRegex = require('twemoji-parser/dist/lib/regex').default; import * as twemoji from 'twemoji-parser/dist/lib/regex.js';
const twemojiRegex = twemoji.default;
export const emojiRegex = new RegExp(`(${twemojiRegex.source})`); export const emojiRegex = new RegExp(`(${twemojiRegex.source})`);

View file

@ -1,5 +1,5 @@
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import { unique } from '@/prelude/array'; import { unique } from '@/prelude/array.js';
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {
const emojiNodes = mfm.extract(nodes, (node) => { const emojiNodes = mfm.extract(nodes, (node) => {

View file

@ -1,5 +1,5 @@
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import { unique } from '@/prelude/array'; import { unique } from '@/prelude/array.js';
export function extractHashtags(nodes: mfm.MfmNode[]): string[] { export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag'); const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag');

View file

@ -1,4 +1,4 @@
import { Meta } from '@/models/entities/meta'; import { Meta } from '@/models/entities/meta.js';
import { getConnection } from 'typeorm'; import { getConnection } from 'typeorm';
let cache: Meta; let cache: Meta;

View file

@ -1,6 +1,6 @@
import { fetchMeta } from './fetch-meta'; import { fetchMeta } from './fetch-meta.js';
import { ILocalUser } from '@/models/entities/user'; import { ILocalUser } from '@/models/entities/user.js';
import { Users } from '@/models/index'; import { Users } from '@/models/index.js';
export async function fetchProxyAccount(): Promise<ILocalUser | null> { export async function fetchProxyAccount(): Promise<ILocalUser | null> {
const meta = await fetchMeta(); const meta = await fetchMeta();

View file

@ -3,8 +3,8 @@ import * as https from 'https';
import CacheableLookup from 'cacheable-lookup'; import CacheableLookup from 'cacheable-lookup';
import fetch from 'node-fetch'; import fetch from 'node-fetch';
import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent'; import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';
import config from '@/config/index'; import config from '@/config/index.js';
import { URL } from 'url'; import { URL } from 'node:url';
export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: Record<string, string>) { export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: Record<string, string>) {
const res = await getResponse({ const res = await getResponse({

View file

@ -1,9 +1,9 @@
import { ulid } from 'ulid'; import { ulid } from 'ulid';
import { genAid } from './id/aid'; import { genAid } from './id/aid.js';
import { genMeid } from './id/meid'; import { genMeid } from './id/meid.js';
import { genMeidg } from './id/meidg'; import { genMeidg } from './id/meidg.js';
import { genObjectId } from './id/object-id'; import { genObjectId } from './id/object-id.js';
import config from '@/config/index'; import config from '@/config/index.js';
const metohd = config.id.toLowerCase(); const metohd = config.id.toLowerCase();

View file

@ -3,9 +3,9 @@
* https://en.wikipedia.org/wiki/Identicon * https://en.wikipedia.org/wiki/Identicon
*/ */
import { WriteStream } from 'node:fs';
import * as p from 'pureimage'; import * as p from 'pureimage';
import * as gen from 'random-seed'; import gen from 'random-seed';
import { WriteStream } from 'fs';
const size = 256; // px const size = 256; // px
const n = 5; // resolution const n = 5; // resolution

View file

@ -1,5 +1,5 @@
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
import * as util from 'util'; import * as util from 'node:util';
const generateKeyPair = util.promisify(crypto.generateKeyPair); const generateKeyPair = util.promisify(crypto.generateKeyPair);

View file

@ -1,11 +1,11 @@
import * as fs from 'fs'; import * as fs from 'node:fs';
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
import * as stream from 'stream'; import * as stream from 'node:stream';
import * as util from 'util'; import * as util from 'node:util';
import * as fileType from 'file-type'; import fileType from 'file-type';
import isSvg from 'is-svg'; import isSvg from 'is-svg';
import * as probeImageSize from 'probe-image-size'; import probeImageSize from 'probe-image-size';
import * as sharp from 'sharp'; import sharp from 'sharp';
import { encode } from 'blurhash'; import { encode } from 'blurhash';
const pipeline = util.promisify(stream.pipeline); const pipeline = util.promisify(stream.pipeline);

View file

@ -1,4 +1,4 @@
import { Packed } from './schema'; import { Packed } from './schema.js';
/** /**
* 稿 * 稿

View file

@ -1,7 +1,7 @@
// AID // AID
// 長さ8の[2000年1月1日からの経過ミリ秒をbase36でエンコードしたもの] + 長さ2の[ノイズ文字列] // 長さ8の[2000年1月1日からの経過ミリ秒をbase36でエンコードしたもの] + 長さ2の[ノイズ文字列]
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
const TIME2000 = 946684800000; const TIME2000 = 946684800000;
let counter = crypto.randomBytes(2).readUInt16LE(0); let counter = crypto.randomBytes(2).readUInt16LE(0);

View file

@ -1,4 +1,4 @@
import { Packed } from "./schema"; import { Packed } from './schema.js';
export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean { export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean {
if (mutedInstances.has(note?.user?.host ?? '')) return true; if (mutedInstances.has(note?.user?.host ?? '')) return true;

View file

@ -1,4 +1,4 @@
import { Note } from '@/models/entities/note'; import { Note } from '@/models/entities/note.js';
export default function(note: Note): boolean { export default function(note: Note): boolean {
return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0)); return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0));

View file

@ -1,7 +1,7 @@
import { UserKeypairs } from '@/models/index'; import { UserKeypairs } from '@/models/index.js';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user.js';
import { UserKeypair } from '@/models/entities/user-keypair'; import { UserKeypair } from '@/models/entities/user-keypair.js';
import { Cache } from './cache'; import { Cache } from './cache.js';
const cache = new Cache<UserKeypair>(Infinity); const cache = new Cache<UserKeypair>(Infinity);

View file

@ -1,12 +1,12 @@
import { In } from 'typeorm'; import { In } from 'typeorm';
import { Emojis } from '@/models/index'; import { Emojis } from '@/models/index.js';
import { Emoji } from '@/models/entities/emoji'; import { Emoji } from '@/models/entities/emoji.js';
import { Note } from '@/models/entities/note'; import { Note } from '@/models/entities/note.js';
import { Cache } from './cache'; import { Cache } from './cache.js';
import { isSelfHost, toPunyNullable } from './convert-host'; import { isSelfHost, toPunyNullable } from './convert-host.js';
import { decodeReaction } from './reaction-lib'; import { decodeReaction } from './reaction-lib.js';
import config from '@/config/index'; import config from '@/config/index.js';
import { query } from '@/prelude/url'; import { query } from '@/prelude/url.js';
const cache = new Cache<Emoji | null>(1000 * 60 * 60 * 12); const cache = new Cache<Emoji | null>(1000 * 60 * 60 * 12);

View file

@ -1,8 +1,8 @@
/* eslint-disable key-spacing */ /* eslint-disable key-spacing */
import { emojiRegex } from './emoji-regex'; import { emojiRegex } from './emoji-regex.js';
import { fetchMeta } from './fetch-meta'; import { fetchMeta } from './fetch-meta.js';
import { Emojis } from '@/models/index'; import { Emojis } from '@/models/index.js';
import { toPunyNullable } from './convert-host'; import { toPunyNullable } from './convert-host.js';
const legacies: Record<string, string> = { const legacies: Record<string, string> = {
'like': '👍', 'like': '👍',

View file

@ -6,29 +6,29 @@ import {
packedMeDetailedSchema, packedMeDetailedSchema,
packedUserDetailedSchema, packedUserDetailedSchema,
packedUserSchema, packedUserSchema,
} from '@/models/schema/user'; } from '@/models/schema/user.js';
import { packedNoteSchema } from '@/models/schema/note'; import { packedNoteSchema } from '@/models/schema/note.js';
import { packedUserListSchema } from '@/models/schema/user-list'; import { packedUserListSchema } from '@/models/schema/user-list.js';
import { packedAppSchema } from '@/models/schema/app'; import { packedAppSchema } from '@/models/schema/app.js';
import { packedMessagingMessageSchema } from '@/models/schema/messaging-message'; import { packedMessagingMessageSchema } from '@/models/schema/messaging-message.js';
import { packedNotificationSchema } from '@/models/schema/notification'; import { packedNotificationSchema } from '@/models/schema/notification.js';
import { packedDriveFileSchema } from '@/models/schema/drive-file'; import { packedDriveFileSchema } from '@/models/schema/drive-file.js';
import { packedDriveFolderSchema } from '@/models/schema/drive-folder'; import { packedDriveFolderSchema } from '@/models/schema/drive-folder.js';
import { packedFollowingSchema } from '@/models/schema/following'; import { packedFollowingSchema } from '@/models/schema/following.js';
import { packedMutingSchema } from '@/models/schema/muting'; import { packedMutingSchema } from '@/models/schema/muting.js';
import { packedBlockingSchema } from '@/models/schema/blocking'; import { packedBlockingSchema } from '@/models/schema/blocking.js';
import { packedNoteReactionSchema } from '@/models/schema/note-reaction'; import { packedNoteReactionSchema } from '@/models/schema/note-reaction.js';
import { packedHashtagSchema } from '@/models/schema/hashtag'; import { packedHashtagSchema } from '@/models/schema/hashtag.js';
import { packedPageSchema } from '@/models/schema/page'; import { packedPageSchema } from '@/models/schema/page.js';
import { packedUserGroupSchema } from '@/models/schema/user-group'; import { packedUserGroupSchema } from '@/models/schema/user-group.js';
import { packedNoteFavoriteSchema } from '@/models/schema/note-favorite'; import { packedNoteFavoriteSchema } from '@/models/schema/note-favorite.js';
import { packedChannelSchema } from '@/models/schema/channel'; import { packedChannelSchema } from '@/models/schema/channel.js';
import { packedAntennaSchema } from '@/models/schema/antenna'; import { packedAntennaSchema } from '@/models/schema/antenna.js';
import { packedClipSchema } from '@/models/schema/clip'; import { packedClipSchema } from '@/models/schema/clip.js';
import { packedFederationInstanceSchema } from '@/models/schema/federation-instance'; import { packedFederationInstanceSchema } from '@/models/schema/federation-instance.js';
import { packedQueueCountSchema } from '@/models/schema/queue'; import { packedQueueCountSchema } from '@/models/schema/queue.js';
import { packedGalleryPostSchema } from '@/models/schema/gallery-post'; import { packedGalleryPostSchema } from '@/models/schema/gallery-post.js';
import { packedEmojiSchema } from '@/models/schema/emoji'; import { packedEmojiSchema } from '@/models/schema/emoji.js';
export const refs = { export const refs = {
UserLite: packedUserLiteSchema, UserLite: packedUserLiteSchema,

View file

@ -1,4 +1,4 @@
import * as crypto from 'crypto'; import * as crypto from 'node:crypto';
const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'; const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz';
const LU_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; const LU_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

View file

@ -1,6 +1,6 @@
import * as os from 'os'; import * as os from 'node:os';
import * as sysUtils from 'systeminformation'; import sysUtils from 'systeminformation';
import Logger from '@/services/logger'; import Logger from '@/services/logger.js';
export async function showMachineInfo(parentLogger: Logger) { export async function showMachineInfo(parentLogger: Logger) {
const logger = parentLogger.createSubLogger('machine'); const logger = parentLogger.createSubLogger('machine');

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class AbuseUserReport { export class AbuseUserReport {

View file

@ -1,7 +1,7 @@
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { App } from './app'; import { App } from './app.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class AccessToken { export class AccessToken {

View file

@ -1,5 +1,5 @@
import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Ad { export class Ad {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { Announcement } from './announcement'; import { Announcement } from './announcement.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'announcementId'], { unique: true }) @Index(['userId', 'announcementId'], { unique: true })

View file

@ -1,5 +1,5 @@
import { Entity, Index, Column, PrimaryColumn } from 'typeorm'; import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Announcement { export class Announcement {

View file

@ -1,7 +1,7 @@
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { Antenna } from './antenna'; import { Antenna } from './antenna.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['noteId', 'antennaId'], { unique: true }) @Index(['noteId', 'antennaId'], { unique: true })

View file

@ -1,8 +1,8 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { UserList } from './user-list'; import { UserList } from './user-list.js';
import { UserGroupJoining } from './user-group-joining'; import { UserGroupJoining } from './user-group-joining.js';
@Entity() @Entity()
export class Antenna { export class Antenna {

View file

@ -1,6 +1,6 @@
import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm'; import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class App { export class App {

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm'; import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class AttestationChallenge { export class AttestationChallenge {

View file

@ -1,7 +1,7 @@
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { App } from './app'; import { App } from './app.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class AuthSession { export class AuthSession {

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['blockerId', 'blockeeId'], { unique: true }) @Index(['blockerId', 'blockeeId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { Channel } from './channel'; import { Channel } from './channel.js';
@Entity() @Entity()
@Index(['followerId', 'followeeId'], { unique: true }) @Index(['followerId', 'followeeId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { Channel } from './channel'; import { Channel } from './channel.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['channelId', 'noteId'], { unique: true }) @Index(['channelId', 'noteId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { DriveFile } from './drive-file'; import { DriveFile } from './drive-file.js';
@Entity() @Entity()
export class Channel { export class Channel {

View file

@ -1,7 +1,7 @@
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { Clip } from './clip'; import { Clip } from './clip.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['noteId', 'clipId'], { unique: true }) @Index(['noteId', 'clipId'], { unique: true })

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Clip { export class Clip {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { DriveFolder } from './drive-folder'; import { DriveFolder } from './drive-folder.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'folderId', 'id']) @Index(['userId', 'folderId', 'id'])

View file

@ -1,6 +1,6 @@
import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm'; import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class DriveFolder { export class DriveFolder {

View file

@ -1,5 +1,5 @@
import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['name', 'host'], { unique: true }) @Index(['name', 'host'], { unique: true })

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['followerId', 'followeeId'], { unique: true }) @Index(['followerId', 'followeeId'], { unique: true })

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['followerId', 'followeeId'], { unique: true }) @Index(['followerId', 'followeeId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { GalleryPost } from './gallery-post'; import { GalleryPost } from './gallery-post.js';
@Entity() @Entity()
@Index(['userId', 'postId'], { unique: true }) @Index(['userId', 'postId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { DriveFile } from './drive-file'; import { DriveFile } from './drive-file.js';
@Entity() @Entity()
export class GalleryPost { export class GalleryPost {

View file

@ -1,6 +1,6 @@
import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Hashtag { export class Hashtag {

View file

@ -1,5 +1,5 @@
import { Entity, PrimaryColumn, Index, Column } from 'typeorm'; import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Instance { export class Instance {

View file

@ -1,8 +1,8 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { DriveFile } from './drive-file'; import { DriveFile } from './drive-file.js';
import { id } from '../id'; import { id } from '../id.js';
import { UserGroup } from './user-group'; import { UserGroup } from './user-group.js';
@Entity() @Entity()
export class MessagingMessage { export class MessagingMessage {

View file

@ -1,7 +1,7 @@
import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm'; import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { Clip } from './clip'; import { Clip } from './clip.js';
@Entity() @Entity()
export class Meta { export class Meta {

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class ModerationLog { export class ModerationLog {

View file

@ -1,8 +1,8 @@
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm'; import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { mutedNoteReasons } from '../../types'; import { mutedNoteReasons } from '../../types.js';
@Entity() @Entity()
@Index(['noteId', 'userId'], { unique: true }) @Index(['noteId', 'userId'], { unique: true })

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['muterId', 'muteeId'], { unique: true }) @Index(['muterId', 'muteeId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'noteId'], { unique: true }) @Index(['userId', 'noteId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { Note } from './note'; import { Note } from './note.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'noteId'], { unique: true }) @Index(['userId', 'noteId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { Note } from './note'; import { Note } from './note.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'threadId'], { unique: true }) @Index(['userId', 'threadId'], { unique: true })

View file

@ -1,8 +1,8 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { Note } from './note'; import { Note } from './note.js';
import { id } from '../id'; import { id } from '../id.js';
import { Channel } from './channel'; import { Channel } from './channel.js';
@Entity() @Entity()
@Index(['userId', 'noteId'], { unique: true }) @Index(['userId', 'noteId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { Note } from './note'; import { Note } from './note.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'noteId'], { unique: true }) @Index(['userId', 'noteId'], { unique: true })

View file

@ -1,9 +1,9 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { DriveFile } from './drive-file'; import { DriveFile } from './drive-file.js';
import { id } from '../id'; import { id } from '../id.js';
import { noteVisibilities } from '../../types'; import { noteVisibilities } from '../../types.js';
import { Channel } from './channel'; import { Channel } from './channel.js';
@Entity() @Entity()
@Index('IDX_NOTE_TAGS', { synchronize: false }) @Index('IDX_NOTE_TAGS', { synchronize: false })

View file

@ -1,11 +1,11 @@
import { Entity, Index, JoinColumn, ManyToOne, Column, PrimaryColumn } from 'typeorm'; import { Entity, Index, JoinColumn, ManyToOne, Column, PrimaryColumn } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { Note } from './note'; import { Note } from './note.js';
import { FollowRequest } from './follow-request'; import { FollowRequest } from './follow-request.js';
import { UserGroupInvitation } from './user-group-invitation'; import { UserGroupInvitation } from './user-group-invitation.js';
import { AccessToken } from './access-token'; import { AccessToken } from './access-token.js';
import { notificationTypes } from '@/types'; import { notificationTypes } from '@/types.js';
@Entity() @Entity()
export class Notification { export class Notification {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { Page } from './page'; import { Page } from './page.js';
@Entity() @Entity()
@Index(['userId', 'pageId'], { unique: true }) @Index(['userId', 'pageId'], { unique: true })

View file

@ -1,7 +1,7 @@
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm'; import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
import { DriveFile } from './drive-file'; import { DriveFile } from './drive-file.js';
@Entity() @Entity()
@Index(['userId', 'name'], { unique: true }) @Index(['userId', 'name'], { unique: true })

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm'; import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
import { User } from './user'; import { User } from './user.js';
@Entity() @Entity()
export class PasswordResetRequest { export class PasswordResetRequest {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { Note } from './note'; import { Note } from './note.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'noteId', 'choice'], { unique: true }) @Index(['userId', 'noteId', 'choice'], { unique: true })

View file

@ -1,8 +1,8 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
import { Note } from './note'; import { Note } from './note.js';
import { User } from './user'; import { User } from './user.js';
import { noteVisibilities } from '../../types'; import { noteVisibilities } from '../../types.js';
@Entity() @Entity()
export class Poll { export class Poll {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class PromoNote { export class PromoNote {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { Note } from './note'; import { Note } from './note.js';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'noteId'], { unique: true }) @Index(['userId', 'noteId'], { unique: true })

View file

@ -1,5 +1,5 @@
import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class RegistrationTicket { export class RegistrationTicket {

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
// TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい // TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい
@Entity() @Entity()

View file

@ -1,5 +1,5 @@
import { PrimaryColumn, Entity, Index, Column } from 'typeorm'; import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Relay { export class Relay {

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class Signin { export class Signin {

View file

@ -1,6 +1,6 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
export class SwSubscription { export class SwSubscription {

View file

@ -1,7 +1,7 @@
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm'; import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
import { User } from './user'; import { User } from './user.js';
import { UserGroup } from './user-group'; import { UserGroup } from './user-group.js';
import { id } from '../id'; import { id } from '../id.js';
@Entity() @Entity()
@Index(['userId', 'userGroupId'], { unique: true }) @Index(['userId', 'userGroupId'], { unique: true })

Some files were not shown because too many files have changed in this diff Show more