Merge tag '12.108.0-simkey' into develop
This commit is contained in:
10
packages/backend/src/@types/langmap.d.ts
vendored
10
packages/backend/src/@types/langmap.d.ts
vendored
@ -1,10 +0,0 @@
|
||||
declare module 'langmap' {
|
||||
type Lang = {
|
||||
nativeName: string;
|
||||
englishName: string;
|
||||
};
|
||||
|
||||
const langmap: { [lang: string]: Lang };
|
||||
|
||||
export = langmap;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
declare module 'probe-image-size' {
|
||||
import { ReadStream } from 'fs';
|
||||
import { ReadStream } from 'node:fs';
|
||||
|
||||
type ProbeOptions = {
|
||||
retries: 1;
|
||||
|
@ -1,18 +1,18 @@
|
||||
import * as cluster from 'cluster';
|
||||
import * as chalk from 'chalk';
|
||||
import Xev from 'xev';
|
||||
import cluster from 'node:cluster';
|
||||
import chalk from 'chalk';
|
||||
import { default as Xev } from 'xev';
|
||||
|
||||
import Logger from '@/services/logger';
|
||||
import { envOption } from '../env';
|
||||
import Logger from '@/services/logger.js';
|
||||
import { envOption } from '../env.js';
|
||||
|
||||
// for typeorm
|
||||
import 'reflect-metadata';
|
||||
import { masterMain } from './master';
|
||||
import { workerMain } from './worker';
|
||||
import { masterMain } from './master.js';
|
||||
import { workerMain } from './worker.js';
|
||||
|
||||
const logger = new Logger('core', 'cyan');
|
||||
const clusterLogger = logger.createSubLogger('cluster', 'orange', false);
|
||||
const ev = new Xev();
|
||||
const ev = new Xev.default();
|
||||
|
||||
/**
|
||||
* Init process
|
||||
|
@ -1,22 +1,22 @@
|
||||
import * as fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import * as os from 'os';
|
||||
import * as cluster from 'cluster';
|
||||
import * as chalk from 'chalk';
|
||||
import * as fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
import * as os from 'node:os';
|
||||
import cluster from 'node:cluster';
|
||||
import chalk from 'chalk';
|
||||
import chalkTemplate from 'chalk-template';
|
||||
import * as portscanner from 'portscanner';
|
||||
import { getConnection } from 'typeorm';
|
||||
|
||||
import Logger from '@/services/logger';
|
||||
import loadConfig from '@/config/load';
|
||||
import { Config } from '@/config/types';
|
||||
import { lessThan } from '@/prelude/array';
|
||||
import { envOption } from '../env';
|
||||
import { showMachineInfo } from '@/misc/show-machine-info';
|
||||
import { initDb } from '../db/postgre';
|
||||
import Logger from '@/services/logger.js';
|
||||
import loadConfig from '@/config/load.js';
|
||||
import { Config } from '@/config/types.js';
|
||||
import { lessThan } from '@/prelude/array.js';
|
||||
import { envOption } from '../env.js';
|
||||
import { showMachineInfo } from '@/misc/show-machine-info.js';
|
||||
import { initDb } from '../db/postgre.js';
|
||||
|
||||
//const _filename = fileURLToPath(import.meta.url);
|
||||
const _filename = __filename;
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
||||
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 bootLogger = logger.createSubLogger('boot', 'magenta', false);
|
||||
|
||||
const themeColor = chalk.hex('#86b300');
|
||||
|
||||
function greet() {
|
||||
if (!envOption.quiet) {
|
||||
//#region Misskey logo
|
||||
const v = `v${meta.version}`;
|
||||
console.log(' _____ _ _ ');
|
||||
console.log(' | |_|___ ___| |_ ___ _ _ ');
|
||||
console.log(' | | | | |_ -|_ -| \'_| -_| | |');
|
||||
console.log(' |_|_|_|_|___|___|_,_|___|_ |');
|
||||
console.log(' ' + chalk.gray(v) + (' |___|\n'.substr(v.length)));
|
||||
console.log(themeColor(' _____ _ _ '));
|
||||
console.log(themeColor(' | |_|___ ___| |_ ___ _ _ '));
|
||||
console.log(themeColor(' | | | | |_ -|_ -| \'_| -_| | |'));
|
||||
console.log(themeColor(' |_|_|_|_|___|___|_,_|___|_ |'));
|
||||
console.log(' ' + chalk.gray(v) + themeColor(' |___|\n'.substr(v.length)));
|
||||
//#endregion
|
||||
|
||||
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(chalk`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`);
|
||||
console.log(chalkTemplate`--- ${os.hostname()} {gray (PID: ${process.pid.toString()})} ---`);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (!envOption.noDaemons) {
|
||||
require('../daemons/server-stats').default();
|
||||
require('../daemons/queue-stats').default();
|
||||
require('../daemons/janitor').default();
|
||||
import('../daemons/server-stats.js').then(x => x.default());
|
||||
import('../daemons/queue-stats.js').then(x => x.default());
|
||||
import('../daemons/janitor.js').then(x => x.default());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as cluster from 'cluster';
|
||||
import { initDb } from '../db/postgre';
|
||||
import cluster from 'node:cluster';
|
||||
import { initDb } from '../db/postgre.js';
|
||||
|
||||
/**
|
||||
* Init worker process
|
||||
@ -8,10 +8,10 @@ export async function workerMain() {
|
||||
await initDb();
|
||||
|
||||
// start server
|
||||
await require('../server').default();
|
||||
await import('../server/index.js').then(x => x.default());
|
||||
|
||||
// start job queue
|
||||
require('../queue').default();
|
||||
import('../queue/index.js').then(x => x.default());
|
||||
|
||||
if (cluster.isWorker) {
|
||||
// Send a 'ready' message to parent process
|
||||
|
@ -1,3 +1,3 @@
|
||||
import load from './load';
|
||||
import load from './load.js';
|
||||
|
||||
export default load();
|
||||
|
@ -2,14 +2,13 @@
|
||||
* Config loader
|
||||
*/
|
||||
|
||||
import * as fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import * as fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
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 = __filename;
|
||||
const _filename = fileURLToPath(import.meta.url);
|
||||
const _dirname = dirname(_filename);
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,6 @@ export type Source = {
|
||||
feedback_url?: string;
|
||||
url: string;
|
||||
port: number;
|
||||
https?: { [x: string]: string };
|
||||
disableHsts?: boolean;
|
||||
db: {
|
||||
host: string;
|
||||
@ -62,6 +61,7 @@ export type Source = {
|
||||
};
|
||||
|
||||
mediaProxy?: string;
|
||||
proxyRemoteFiles?: boolean;
|
||||
|
||||
signToActivityPubGet?: boolean;
|
||||
};
|
||||
|
@ -1,3 +1,5 @@
|
||||
export const MAX_NOTE_TEXT_LENGTH = 3000;
|
||||
|
||||
export const USER_ONLINE_THRESHOLD = 1000 * 60 * 10; // 10min
|
||||
export const USER_ACTIVE_THRESHOLD = 1000 * 60 * 60 * 24 * 3; // 3days
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// TODO: 消したい
|
||||
|
||||
const interval = 30 * 60 * 1000;
|
||||
import { AttestationChallenges } from '@/models/index';
|
||||
import { AttestationChallenges } from '@/models/index.js';
|
||||
import { LessThan } from 'typeorm';
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Xev from 'xev';
|
||||
import { deliverQueue, inboxQueue } from '../queue/queues';
|
||||
import { default as Xev } from 'xev';
|
||||
import { deliverQueue, inboxQueue } from '../queue/queues.js';
|
||||
|
||||
const ev = new Xev();
|
||||
const ev = new Xev.default();
|
||||
|
||||
const interval = 10000;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as si from 'systeminformation';
|
||||
import Xev from 'xev';
|
||||
import si from 'systeminformation';
|
||||
import { default as Xev } from 'xev';
|
||||
import * as osUtils from 'os-utils';
|
||||
|
||||
const ev = new Xev();
|
||||
const ev = new Xev.default();
|
||||
|
||||
const interval = 2000;
|
||||
|
||||
@ -36,8 +36,8 @@ export default function() {
|
||||
tx: round(Math.max(0, netStats.tx_sec)),
|
||||
},
|
||||
fs: {
|
||||
r: round(Math.max(0, fsStats.rIO_sec)),
|
||||
w: round(Math.max(0, fsStats.wIO_sec)),
|
||||
r: round(Math.max(0, fsStats.rIO_sec ?? 0)),
|
||||
w: round(Math.max(0, fsStats.wIO_sec ?? 0)),
|
||||
},
|
||||
};
|
||||
ev.emit('serverStats', stats);
|
||||
@ -51,9 +51,9 @@ export default function() {
|
||||
}
|
||||
|
||||
// CPU STAT
|
||||
function cpuUsage() {
|
||||
function cpuUsage(): Promise<number> {
|
||||
return new Promise((res, rej) => {
|
||||
osUtils.cpuUsage((cpuUsage: number) => {
|
||||
osUtils.cpuUsage((cpuUsage) => {
|
||||
res(cpuUsage);
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as elasticsearch from '@elastic/elasticsearch';
|
||||
import config from '@/config/index';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
const index = {
|
||||
settings: {
|
||||
|
@ -1,3 +1,3 @@
|
||||
import Logger from '@/services/logger';
|
||||
import Logger from '@/services/logger.js';
|
||||
|
||||
export const dbLogger = new Logger('db');
|
||||
|
@ -1,78 +1,78 @@
|
||||
// https://github.com/typeorm/typeorm/issues/2400
|
||||
const types = require('pg').types;
|
||||
types.setTypeParser(20, Number);
|
||||
import pg from 'pg';
|
||||
pg.types.setTypeParser(20, Number);
|
||||
|
||||
import { createConnection, Logger, getConnection } from 'typeorm';
|
||||
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 { DriveFile } from '@/models/entities/drive-file';
|
||||
import { DriveFolder } from '@/models/entities/drive-folder';
|
||||
import { AccessToken } from '@/models/entities/access-token';
|
||||
import { App } from '@/models/entities/app';
|
||||
import { PollVote } from '@/models/entities/poll-vote';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction';
|
||||
import { NoteWatching } from '@/models/entities/note-watching';
|
||||
import { NoteThreadMuting } from '@/models/entities/note-thread-muting';
|
||||
import { NoteUnread } from '@/models/entities/note-unread';
|
||||
import { Notification } from '@/models/entities/notification';
|
||||
import { Meta } from '@/models/entities/meta';
|
||||
import { Following } from '@/models/entities/following';
|
||||
import { Instance } from '@/models/entities/instance';
|
||||
import { Muting } from '@/models/entities/muting';
|
||||
import { SwSubscription } from '@/models/entities/sw-subscription';
|
||||
import { Blocking } from '@/models/entities/blocking';
|
||||
import { UserList } from '@/models/entities/user-list';
|
||||
import { UserListJoining } from '@/models/entities/user-list-joining';
|
||||
import { UserGroup } from '@/models/entities/user-group';
|
||||
import { UserGroupJoining } from '@/models/entities/user-group-joining';
|
||||
import { UserGroupInvitation } from '@/models/entities/user-group-invitation';
|
||||
import { Hashtag } from '@/models/entities/hashtag';
|
||||
import { NoteFavorite } from '@/models/entities/note-favorite';
|
||||
import { AbuseUserReport } from '@/models/entities/abuse-user-report';
|
||||
import { RegistrationTicket } from '@/models/entities/registration-tickets';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message';
|
||||
import { Signin } from '@/models/entities/signin';
|
||||
import { AuthSession } from '@/models/entities/auth-session';
|
||||
import { FollowRequest } from '@/models/entities/follow-request';
|
||||
import { Emoji } from '@/models/entities/emoji';
|
||||
import { UserNotePining } from '@/models/entities/user-note-pining';
|
||||
import { Poll } from '@/models/entities/poll';
|
||||
import { UserKeypair } from '@/models/entities/user-keypair';
|
||||
import { UserPublickey } from '@/models/entities/user-publickey';
|
||||
import { UserProfile } from '@/models/entities/user-profile';
|
||||
import { UserSecurityKey } from '@/models/entities/user-security-key';
|
||||
import { AttestationChallenge } from '@/models/entities/attestation-challenge';
|
||||
import { Page } from '@/models/entities/page';
|
||||
import { PageLike } from '@/models/entities/page-like';
|
||||
import { GalleryPost } from '@/models/entities/gallery-post';
|
||||
import { GalleryLike } from '@/models/entities/gallery-like';
|
||||
import { ModerationLog } from '@/models/entities/moderation-log';
|
||||
import { UsedUsername } from '@/models/entities/used-username';
|
||||
import { Announcement } from '@/models/entities/announcement';
|
||||
import { AnnouncementRead } from '@/models/entities/announcement-read';
|
||||
import { Clip } from '@/models/entities/clip';
|
||||
import { ClipNote } from '@/models/entities/clip-note';
|
||||
import { Antenna } from '@/models/entities/antenna';
|
||||
import { AntennaNote } from '@/models/entities/antenna-note';
|
||||
import { PromoNote } from '@/models/entities/promo-note';
|
||||
import { PromoRead } from '@/models/entities/promo-read';
|
||||
import { envOption } from '../env';
|
||||
import { Relay } from '@/models/entities/relay';
|
||||
import { MutedNote } from '@/models/entities/muted-note';
|
||||
import { Channel } from '@/models/entities/channel';
|
||||
import { ChannelFollowing } from '@/models/entities/channel-following';
|
||||
import { ChannelNotePining } from '@/models/entities/channel-note-pining';
|
||||
import { RegistryItem } from '@/models/entities/registry-item';
|
||||
import { Ad } from '@/models/entities/ad';
|
||||
import { PasswordResetRequest } from '@/models/entities/password-reset-request';
|
||||
import { UserPending } from '@/models/entities/user-pending';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { DriveFolder } from '@/models/entities/drive-folder.js';
|
||||
import { AccessToken } from '@/models/entities/access-token.js';
|
||||
import { App } from '@/models/entities/app.js';
|
||||
import { PollVote } from '@/models/entities/poll-vote.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { NoteReaction } from '@/models/entities/note-reaction.js';
|
||||
import { NoteWatching } from '@/models/entities/note-watching.js';
|
||||
import { NoteThreadMuting } from '@/models/entities/note-thread-muting.js';
|
||||
import { NoteUnread } from '@/models/entities/note-unread.js';
|
||||
import { Notification } from '@/models/entities/notification.js';
|
||||
import { Meta } from '@/models/entities/meta.js';
|
||||
import { Following } from '@/models/entities/following.js';
|
||||
import { Instance } from '@/models/entities/instance.js';
|
||||
import { Muting } from '@/models/entities/muting.js';
|
||||
import { SwSubscription } from '@/models/entities/sw-subscription.js';
|
||||
import { Blocking } from '@/models/entities/blocking.js';
|
||||
import { UserList } from '@/models/entities/user-list.js';
|
||||
import { UserListJoining } from '@/models/entities/user-list-joining.js';
|
||||
import { UserGroup } from '@/models/entities/user-group.js';
|
||||
import { UserGroupJoining } from '@/models/entities/user-group-joining.js';
|
||||
import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js';
|
||||
import { Hashtag } from '@/models/entities/hashtag.js';
|
||||
import { NoteFavorite } from '@/models/entities/note-favorite.js';
|
||||
import { AbuseUserReport } from '@/models/entities/abuse-user-report.js';
|
||||
import { RegistrationTicket } from '@/models/entities/registration-tickets.js';
|
||||
import { MessagingMessage } from '@/models/entities/messaging-message.js';
|
||||
import { Signin } from '@/models/entities/signin.js';
|
||||
import { AuthSession } from '@/models/entities/auth-session.js';
|
||||
import { FollowRequest } from '@/models/entities/follow-request.js';
|
||||
import { Emoji } from '@/models/entities/emoji.js';
|
||||
import { UserNotePining } from '@/models/entities/user-note-pining.js';
|
||||
import { Poll } from '@/models/entities/poll.js';
|
||||
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
||||
import { UserPublickey } from '@/models/entities/user-publickey.js';
|
||||
import { UserProfile } from '@/models/entities/user-profile.js';
|
||||
import { UserSecurityKey } from '@/models/entities/user-security-key.js';
|
||||
import { AttestationChallenge } from '@/models/entities/attestation-challenge.js';
|
||||
import { Page } from '@/models/entities/page.js';
|
||||
import { PageLike } from '@/models/entities/page-like.js';
|
||||
import { GalleryPost } from '@/models/entities/gallery-post.js';
|
||||
import { GalleryLike } from '@/models/entities/gallery-like.js';
|
||||
import { ModerationLog } from '@/models/entities/moderation-log.js';
|
||||
import { UsedUsername } from '@/models/entities/used-username.js';
|
||||
import { Announcement } from '@/models/entities/announcement.js';
|
||||
import { AnnouncementRead } from '@/models/entities/announcement-read.js';
|
||||
import { Clip } from '@/models/entities/clip.js';
|
||||
import { ClipNote } from '@/models/entities/clip-note.js';
|
||||
import { Antenna } from '@/models/entities/antenna.js';
|
||||
import { AntennaNote } from '@/models/entities/antenna-note.js';
|
||||
import { PromoNote } from '@/models/entities/promo-note.js';
|
||||
import { PromoRead } from '@/models/entities/promo-read.js';
|
||||
import { envOption } from '../env.js';
|
||||
import { Relay } from '@/models/entities/relay.js';
|
||||
import { MutedNote } from '@/models/entities/muted-note.js';
|
||||
import { Channel } from '@/models/entities/channel.js';
|
||||
import { ChannelFollowing } from '@/models/entities/channel-following.js';
|
||||
import { ChannelNotePining } from '@/models/entities/channel-note-pining.js';
|
||||
import { RegistryItem } from '@/models/entities/registry-item.js';
|
||||
import { Ad } from '@/models/entities/ad.js';
|
||||
import { PasswordResetRequest } from '@/models/entities/password-reset-request.js';
|
||||
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);
|
||||
|
||||
@ -184,7 +184,7 @@ export function initDb(justBorrow = false, sync = false, forceRecreate = false)
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
const log = process.env.NODE_ENV != 'production';
|
||||
const log = process.env.NODE_ENV !== 'production';
|
||||
|
||||
return createConnection({
|
||||
type: 'postgres',
|
||||
@ -193,7 +193,10 @@ export function initDb(justBorrow = false, sync = false, forceRecreate = false)
|
||||
username: config.db.user,
|
||||
password: config.db.pass,
|
||||
database: config.db.db,
|
||||
extra: config.db.extra,
|
||||
extra: {
|
||||
statement_timeout: 1000 * 10,
|
||||
...config.db.extra,
|
||||
},
|
||||
synchronize: process.env.NODE_ENV === 'test' || sync,
|
||||
dropSchema: process.env.NODE_ENV === 'test' && !justBorrow,
|
||||
cache: !config.db.disableCache ? {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as redis from 'redis';
|
||||
import config from '@/config/index';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
export function createConnection() {
|
||||
return redis.createClient(
|
||||
|
@ -2,10 +2,12 @@
|
||||
* Misskey Entry Point!
|
||||
*/
|
||||
|
||||
import { EventEmitter } from 'node:events';
|
||||
import boot from './boot/index.js';
|
||||
|
||||
Error.stackTraceLimit = Infinity;
|
||||
EventEmitter.defaultMaxListeners = 128;
|
||||
|
||||
require('events').EventEmitter.defaultMaxListeners = 128;
|
||||
|
||||
import boot from './boot/index';
|
||||
|
||||
boot();
|
||||
boot().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as parse5 from 'parse5';
|
||||
import treeAdapter = require('parse5/lib/tree-adapters/default');
|
||||
import { URL } from 'url';
|
||||
import treeAdapter from 'parse5/lib/tree-adapters/default.js';
|
||||
import { URL } from 'node:url';
|
||||
|
||||
const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
|
||||
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { JSDOM } from 'jsdom';
|
||||
import * as mfm from 'mfm-js';
|
||||
import config from '@/config/index';
|
||||
import { intersperse } from '@/prelude/array';
|
||||
import { IMentionedRemoteUsers } from '@/models/entities/note';
|
||||
import config from '@/config/index.js';
|
||||
import { intersperse } from '@/prelude/array.js';
|
||||
import { IMentionedRemoteUsers } from '@/models/entities/note.js';
|
||||
|
||||
export function toHtml(nodes: mfm.MfmNode[] | null, mentionedRemoteUsers: IMentionedRemoteUsers = []) {
|
||||
if (nodes == null) {
|
||||
|
14
packages/backend/src/misc/acct.ts
Normal file
14
packages/backend/src/misc/acct.ts
Normal 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}`;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import { Antennas } from '@/models/index';
|
||||
import { Antenna } from '@/models/entities/antenna';
|
||||
import { subsdcriber } from '../db/redis';
|
||||
import { Antennas } from '@/models/index.js';
|
||||
import { Antenna } from '@/models/entities/antenna.js';
|
||||
import { subsdcriber } from '../db/redis.js';
|
||||
|
||||
let antennasFetched = false;
|
||||
let antennas: Antenna[] = [];
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { redisClient } from '../db/redis';
|
||||
import { promisify } from 'util';
|
||||
import * as redisLock from 'redis-lock';
|
||||
import { redisClient } from '../db/redis.js';
|
||||
import { promisify } from 'node:util';
|
||||
import redisLock from 'redis-lock';
|
||||
|
||||
/**
|
||||
* Retry delay (ms) for lock acquisition
|
||||
|
@ -1,7 +1,7 @@
|
||||
import fetch from 'node-fetch';
|
||||
import { URLSearchParams } from 'url';
|
||||
import { getAgentByUrl } from './fetch';
|
||||
import config from '@/config/index';
|
||||
import { URLSearchParams } from 'node:url';
|
||||
import { getAgentByUrl } from './fetch.js';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
export async function verifyRecaptcha(secret: string, response: string) {
|
||||
const result = await getCaptchaResponse('https://www.recaptcha.net/recaptcha/api/siteverify', secret, response).catch(e => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Antenna } from '@/models/entities/antenna';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { UserListJoinings, UserGroupJoinings } from '@/models/index';
|
||||
import { getFullApAccount } from './convert-host';
|
||||
import * as Acct from 'misskey-js/built/acct';
|
||||
import { Packed } from './schema';
|
||||
import { Antenna } from '@/models/entities/antenna.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { UserListJoinings, UserGroupJoinings } from '@/models/index.js';
|
||||
import { getFullApAccount } from './convert-host.js';
|
||||
import * as Acct from '@/misc/acct.js';
|
||||
import { Packed } from './schema.js';
|
||||
|
||||
/**
|
||||
* noteUserFollowers / antennaUserFollowing はどちらか一方が指定されていればよい
|
||||
|
@ -1,6 +1,6 @@
|
||||
const RE2 = require('re2');
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { User } from '@/models/entities/user';
|
||||
import RE2 from 're2';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
|
||||
type NoteLike = {
|
||||
userId: Note['userId'];
|
||||
|
@ -1,4 +1,4 @@
|
||||
const cd = require('content-disposition');
|
||||
import cd from 'content-disposition';
|
||||
|
||||
export function contentDisposition(type: 'inline' | 'attachment', filename: string): string {
|
||||
const fallback = filename.replace(/[^\w.-]/g, '_');
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { URL } from 'url';
|
||||
import config from '@/config/index';
|
||||
import { toASCII } from 'punycode/';
|
||||
import { URL } from 'node:url';
|
||||
import config from '@/config/index.js';
|
||||
import { toASCII } from 'punycode';
|
||||
|
||||
export function getFullApAccount(username: string, host: string | null) {
|
||||
return host ? `${username}@${toPuny(host)}` : `${username}@${toPuny(config.host)}`;
|
||||
|
@ -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> {
|
||||
// 指定したユーザーの指定したノートのリノートがいくつあるか数える
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { createTemp } from './create-temp';
|
||||
import { downloadUrl } from './download-url';
|
||||
import { detectType } from './get-file-info';
|
||||
import { createTemp } from './create-temp.js';
|
||||
import { downloadUrl } from './download-url.js';
|
||||
import { detectType } from './get-file-info.js';
|
||||
|
||||
export async function detectUrlMime(url: string) {
|
||||
const [path, cleanup] = await createTemp();
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as fs from 'fs';
|
||||
import * as util from 'util';
|
||||
import Logger from '@/services/logger';
|
||||
import { createTemp } from './create-temp';
|
||||
import { downloadUrl } from './download-url';
|
||||
import * as fs from 'node:fs';
|
||||
import * as util from 'node:util';
|
||||
import Logger from '@/services/logger.js';
|
||||
import { createTemp } from './create-temp.js';
|
||||
import { downloadUrl } from './download-url.js';
|
||||
|
||||
const logger = new Logger('download-text-file');
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
import * as fs from 'fs';
|
||||
import * as stream from 'stream';
|
||||
import * as util from 'util';
|
||||
import * as fs from 'node:fs';
|
||||
import * as stream from 'node:stream';
|
||||
import * as util from 'node:util';
|
||||
import got, * as Got from 'got';
|
||||
import { httpAgent, httpsAgent, StatusError } from './fetch';
|
||||
import config from '@/config/index';
|
||||
import * as chalk from 'chalk';
|
||||
import Logger from '@/services/logger';
|
||||
import { httpAgent, httpsAgent, StatusError } from './fetch.js';
|
||||
import config from '@/config/index.js';
|
||||
import chalk from 'chalk';
|
||||
import Logger from '@/services/logger.js';
|
||||
import * as IPCIDR from 'ip-cidr';
|
||||
const PrivateIp = require('private-ip');
|
||||
import PrivateIp from 'private-ip';
|
||||
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
const twemojiRegex = require('twemoji-parser/dist/lib/regex').default;
|
||||
import twemoji from 'twemoji-parser/dist/lib/regex.js';
|
||||
const twemojiRegex = twemoji.default;
|
||||
|
||||
export const emojiRegex = new RegExp(`(${twemojiRegex.source})`);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as mfm from 'mfm-js';
|
||||
import { unique } from '@/prelude/array';
|
||||
import { unique } from '@/prelude/array.js';
|
||||
|
||||
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {
|
||||
const emojiNodes = mfm.extract(nodes, (node) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as mfm from 'mfm-js';
|
||||
import { unique } from '@/prelude/array';
|
||||
import { unique } from '@/prelude/array.js';
|
||||
|
||||
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
||||
const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Meta } from '@/models/entities/meta';
|
||||
import { Meta } from '@/models/entities/meta.js';
|
||||
import { getConnection } from 'typeorm';
|
||||
|
||||
let cache: Meta;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { fetchMeta } from './fetch-meta';
|
||||
import { ILocalUser } from '@/models/entities/user';
|
||||
import { Users } from '@/models/index';
|
||||
import { fetchMeta } from './fetch-meta.js';
|
||||
import { ILocalUser } from '@/models/entities/user.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
|
||||
export async function fetchProxyAccount(): Promise<ILocalUser | null> {
|
||||
const meta = await fetchMeta();
|
||||
|
@ -3,8 +3,8 @@ import * as https from 'https';
|
||||
import CacheableLookup from 'cacheable-lookup';
|
||||
import fetch from 'node-fetch';
|
||||
import { HttpProxyAgent, HttpsProxyAgent } from 'hpagent';
|
||||
import config from '@/config/index';
|
||||
import { URL } from 'url';
|
||||
import config from '@/config/index.js';
|
||||
import { URL } from 'node:url';
|
||||
|
||||
export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: Record<string, string>) {
|
||||
const res = await getResponse({
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { ulid } from 'ulid';
|
||||
import { genAid } from './id/aid';
|
||||
import { genMeid } from './id/meid';
|
||||
import { genMeidg } from './id/meidg';
|
||||
import { genObjectId } from './id/object-id';
|
||||
import config from '@/config/index';
|
||||
import { genAid } from './id/aid.js';
|
||||
import { genMeid } from './id/meid.js';
|
||||
import { genMeidg } from './id/meidg.js';
|
||||
import { genObjectId } from './id/object-id.js';
|
||||
import config from '@/config/index.js';
|
||||
|
||||
const metohd = config.id.toLowerCase();
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
* https://en.wikipedia.org/wiki/Identicon
|
||||
*/
|
||||
|
||||
import { WriteStream } from 'node:fs';
|
||||
import * as p from 'pureimage';
|
||||
import * as gen from 'random-seed';
|
||||
import { WriteStream } from 'fs';
|
||||
import gen from 'random-seed';
|
||||
|
||||
const size = 256; // px
|
||||
const n = 5; // resolution
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as crypto from 'crypto';
|
||||
import * as util from 'util';
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as util from 'node:util';
|
||||
|
||||
const generateKeyPair = util.promisify(crypto.generateKeyPair);
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
import * as fs from 'fs';
|
||||
import * as crypto from 'crypto';
|
||||
import * as stream from 'stream';
|
||||
import * as util from 'util';
|
||||
import * as fileType from 'file-type';
|
||||
import * as fs from 'node:fs';
|
||||
import * as crypto from 'node:crypto';
|
||||
import * as stream from 'node:stream';
|
||||
import * as util from 'node:util';
|
||||
import { fileTypeFromFile } from 'file-type';
|
||||
import isSvg from 'is-svg';
|
||||
import * as probeImageSize from 'probe-image-size';
|
||||
import * as sharp from 'sharp';
|
||||
import probeImageSize from 'probe-image-size';
|
||||
import sharp from 'sharp';
|
||||
import { encode } from 'blurhash';
|
||||
|
||||
const pipeline = util.promisify(stream.pipeline);
|
||||
@ -109,7 +109,7 @@ export async function detectType(path: string): Promise<{
|
||||
return TYPE_OCTET_STREAM;
|
||||
}
|
||||
|
||||
const type = await fileType.fromFile(path);
|
||||
const type = await fileTypeFromFile(path);
|
||||
|
||||
if (type) {
|
||||
// XMLはSVGかもしれない
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Packed } from './schema';
|
||||
import { Packed } from './schema.js';
|
||||
|
||||
/**
|
||||
* 投稿を表す文字列を取得します。
|
||||
|
@ -1,7 +1,7 @@
|
||||
// AID
|
||||
// 長さ8の[2000年1月1日からの経過ミリ秒をbase36でエンコードしたもの] + 長さ2の[ノイズ文字列]
|
||||
|
||||
import * as crypto from 'crypto';
|
||||
import * as crypto from 'node:crypto';
|
||||
|
||||
const TIME2000 = 946684800000;
|
||||
let counter = crypto.randomBytes(2).readUInt16LE(0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Packed } from "./schema";
|
||||
import { Packed } from './schema.js';
|
||||
|
||||
export function isInstanceMuted(note: Packed<'Note'>, mutedInstances: Set<string>): boolean {
|
||||
if (mutedInstances.has(note?.user?.host ?? '')) return true;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
|
||||
export default function(note: Note): boolean {
|
||||
return note.renoteId != null && (note.text != null || note.hasPoll || (note.fileIds != null && note.fileIds.length > 0));
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { UserKeypairs } from '@/models/index';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { UserKeypair } from '@/models/entities/user-keypair';
|
||||
import { Cache } from './cache';
|
||||
import { UserKeypairs } from '@/models/index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { UserKeypair } from '@/models/entities/user-keypair.js';
|
||||
import { Cache } from './cache.js';
|
||||
|
||||
const cache = new Cache<UserKeypair>(Infinity);
|
||||
|
||||
|
666
packages/backend/src/misc/langmap.ts
Normal file
666
packages/backend/src/misc/langmap.ts
Normal file
@ -0,0 +1,666 @@
|
||||
// TODO: sharedに置いてフロントエンドのと統合したい
|
||||
export const langmap = {
|
||||
'ach': {
|
||||
nativeName: 'Lwo',
|
||||
},
|
||||
'ady': {
|
||||
nativeName: 'Адыгэбзэ',
|
||||
},
|
||||
'af': {
|
||||
nativeName: 'Afrikaans',
|
||||
},
|
||||
'af-NA': {
|
||||
nativeName: 'Afrikaans (Namibia)',
|
||||
},
|
||||
'af-ZA': {
|
||||
nativeName: 'Afrikaans (South Africa)',
|
||||
},
|
||||
'ak': {
|
||||
nativeName: 'Tɕɥi',
|
||||
},
|
||||
'ar': {
|
||||
nativeName: 'العربية',
|
||||
},
|
||||
'ar-AR': {
|
||||
nativeName: 'العربية',
|
||||
},
|
||||
'ar-MA': {
|
||||
nativeName: 'العربية',
|
||||
},
|
||||
'ar-SA': {
|
||||
nativeName: 'العربية (السعودية)',
|
||||
},
|
||||
'ay-BO': {
|
||||
nativeName: 'Aymar aru',
|
||||
},
|
||||
'az': {
|
||||
nativeName: 'Azərbaycan dili',
|
||||
},
|
||||
'az-AZ': {
|
||||
nativeName: 'Azərbaycan dili',
|
||||
},
|
||||
'be-BY': {
|
||||
nativeName: 'Беларуская',
|
||||
},
|
||||
'bg': {
|
||||
nativeName: 'Български',
|
||||
},
|
||||
'bg-BG': {
|
||||
nativeName: 'Български',
|
||||
},
|
||||
'bn': {
|
||||
nativeName: 'বাংলা',
|
||||
},
|
||||
'bn-IN': {
|
||||
nativeName: 'বাংলা (ভারত)',
|
||||
},
|
||||
'bn-BD': {
|
||||
nativeName: 'বাংলা(বাংলাদেশ)',
|
||||
},
|
||||
'br': {
|
||||
nativeName: 'Brezhoneg',
|
||||
},
|
||||
'bs-BA': {
|
||||
nativeName: 'Bosanski',
|
||||
},
|
||||
'ca': {
|
||||
nativeName: 'Català',
|
||||
},
|
||||
'ca-ES': {
|
||||
nativeName: 'Català',
|
||||
},
|
||||
'cak': {
|
||||
nativeName: 'Maya Kaqchikel',
|
||||
},
|
||||
'ck-US': {
|
||||
nativeName: 'ᏣᎳᎩ (tsalagi)',
|
||||
},
|
||||
'cs': {
|
||||
nativeName: 'Čeština',
|
||||
},
|
||||
'cs-CZ': {
|
||||
nativeName: 'Čeština',
|
||||
},
|
||||
'cy': {
|
||||
nativeName: 'Cymraeg',
|
||||
},
|
||||
'cy-GB': {
|
||||
nativeName: 'Cymraeg',
|
||||
},
|
||||
'da': {
|
||||
nativeName: 'Dansk',
|
||||
},
|
||||
'da-DK': {
|
||||
nativeName: 'Dansk',
|
||||
},
|
||||
'de': {
|
||||
nativeName: 'Deutsch',
|
||||
},
|
||||
'de-AT': {
|
||||
nativeName: 'Deutsch (Österreich)',
|
||||
},
|
||||
'de-DE': {
|
||||
nativeName: 'Deutsch (Deutschland)',
|
||||
},
|
||||
'de-CH': {
|
||||
nativeName: 'Deutsch (Schweiz)',
|
||||
},
|
||||
'dsb': {
|
||||
nativeName: 'Dolnoserbšćina',
|
||||
},
|
||||
'el': {
|
||||
nativeName: 'Ελληνικά',
|
||||
},
|
||||
'el-GR': {
|
||||
nativeName: 'Ελληνικά',
|
||||
},
|
||||
'en': {
|
||||
nativeName: 'English',
|
||||
},
|
||||
'en-GB': {
|
||||
nativeName: 'English (UK)',
|
||||
},
|
||||
'en-AU': {
|
||||
nativeName: 'English (Australia)',
|
||||
},
|
||||
'en-CA': {
|
||||
nativeName: 'English (Canada)',
|
||||
},
|
||||
'en-IE': {
|
||||
nativeName: 'English (Ireland)',
|
||||
},
|
||||
'en-IN': {
|
||||
nativeName: 'English (India)',
|
||||
},
|
||||
'en-PI': {
|
||||
nativeName: 'English (Pirate)',
|
||||
},
|
||||
'en-SG': {
|
||||
nativeName: 'English (Singapore)',
|
||||
},
|
||||
'en-UD': {
|
||||
nativeName: 'English (Upside Down)',
|
||||
},
|
||||
'en-US': {
|
||||
nativeName: 'English (US)',
|
||||
},
|
||||
'en-ZA': {
|
||||
nativeName: 'English (South Africa)',
|
||||
},
|
||||
'en@pirate': {
|
||||
nativeName: 'English (Pirate)',
|
||||
},
|
||||
'eo': {
|
||||
nativeName: 'Esperanto',
|
||||
},
|
||||
'eo-EO': {
|
||||
nativeName: 'Esperanto',
|
||||
},
|
||||
'es': {
|
||||
nativeName: 'Español',
|
||||
},
|
||||
'es-AR': {
|
||||
nativeName: 'Español (Argentine)',
|
||||
},
|
||||
'es-419': {
|
||||
nativeName: 'Español (Latinoamérica)',
|
||||
},
|
||||
'es-CL': {
|
||||
nativeName: 'Español (Chile)',
|
||||
},
|
||||
'es-CO': {
|
||||
nativeName: 'Español (Colombia)',
|
||||
},
|
||||
'es-EC': {
|
||||
nativeName: 'Español (Ecuador)',
|
||||
},
|
||||
'es-ES': {
|
||||
nativeName: 'Español (España)',
|
||||
},
|
||||
'es-LA': {
|
||||
nativeName: 'Español (Latinoamérica)',
|
||||
},
|
||||
'es-NI': {
|
||||
nativeName: 'Español (Nicaragua)',
|
||||
},
|
||||
'es-MX': {
|
||||
nativeName: 'Español (México)',
|
||||
},
|
||||
'es-US': {
|
||||
nativeName: 'Español (Estados Unidos)',
|
||||
},
|
||||
'es-VE': {
|
||||
nativeName: 'Español (Venezuela)',
|
||||
},
|
||||
'et': {
|
||||
nativeName: 'eesti keel',
|
||||
},
|
||||
'et-EE': {
|
||||
nativeName: 'Eesti (Estonia)',
|
||||
},
|
||||
'eu': {
|
||||
nativeName: 'Euskara',
|
||||
},
|
||||
'eu-ES': {
|
||||
nativeName: 'Euskara',
|
||||
},
|
||||
'fa': {
|
||||
nativeName: 'فارسی',
|
||||
},
|
||||
'fa-IR': {
|
||||
nativeName: 'فارسی',
|
||||
},
|
||||
'fb-LT': {
|
||||
nativeName: 'Leet Speak',
|
||||
},
|
||||
'ff': {
|
||||
nativeName: 'Fulah',
|
||||
},
|
||||
'fi': {
|
||||
nativeName: 'Suomi',
|
||||
},
|
||||
'fi-FI': {
|
||||
nativeName: 'Suomi',
|
||||
},
|
||||
'fo': {
|
||||
nativeName: 'Føroyskt',
|
||||
},
|
||||
'fo-FO': {
|
||||
nativeName: 'Føroyskt (Færeyjar)',
|
||||
},
|
||||
'fr': {
|
||||
nativeName: 'Français',
|
||||
},
|
||||
'fr-CA': {
|
||||
nativeName: 'Français (Canada)',
|
||||
},
|
||||
'fr-FR': {
|
||||
nativeName: 'Français (France)',
|
||||
},
|
||||
'fr-BE': {
|
||||
nativeName: 'Français (Belgique)',
|
||||
},
|
||||
'fr-CH': {
|
||||
nativeName: 'Français (Suisse)',
|
||||
},
|
||||
'fy-NL': {
|
||||
nativeName: 'Frysk',
|
||||
},
|
||||
'ga': {
|
||||
nativeName: 'Gaeilge',
|
||||
},
|
||||
'ga-IE': {
|
||||
nativeName: 'Gaeilge',
|
||||
},
|
||||
'gd': {
|
||||
nativeName: 'Gàidhlig',
|
||||
},
|
||||
'gl': {
|
||||
nativeName: 'Galego',
|
||||
},
|
||||
'gl-ES': {
|
||||
nativeName: 'Galego',
|
||||
},
|
||||
'gn-PY': {
|
||||
nativeName: 'Avañe\'ẽ',
|
||||
},
|
||||
'gu-IN': {
|
||||
nativeName: 'ગુજરાતી',
|
||||
},
|
||||
'gv': {
|
||||
nativeName: 'Gaelg',
|
||||
},
|
||||
'gx-GR': {
|
||||
nativeName: 'Ἑλληνική ἀρχαία',
|
||||
},
|
||||
'he': {
|
||||
nativeName: 'עברית',
|
||||
},
|
||||
'he-IL': {
|
||||
nativeName: 'עברית',
|
||||
},
|
||||
'hi': {
|
||||
nativeName: 'हिन्दी',
|
||||
},
|
||||
'hi-IN': {
|
||||
nativeName: 'हिन्दी',
|
||||
},
|
||||
'hr': {
|
||||
nativeName: 'Hrvatski',
|
||||
},
|
||||
'hr-HR': {
|
||||
nativeName: 'Hrvatski',
|
||||
},
|
||||
'hsb': {
|
||||
nativeName: 'Hornjoserbšćina',
|
||||
},
|
||||
'ht': {
|
||||
nativeName: 'Kreyòl',
|
||||
},
|
||||
'hu': {
|
||||
nativeName: 'Magyar',
|
||||
},
|
||||
'hu-HU': {
|
||||
nativeName: 'Magyar',
|
||||
},
|
||||
'hy': {
|
||||
nativeName: 'Հայերեն',
|
||||
},
|
||||
'hy-AM': {
|
||||
nativeName: 'Հայերեն (Հայաստան)',
|
||||
},
|
||||
'id': {
|
||||
nativeName: 'Bahasa Indonesia',
|
||||
},
|
||||
'id-ID': {
|
||||
nativeName: 'Bahasa Indonesia',
|
||||
},
|
||||
'is': {
|
||||
nativeName: 'Íslenska',
|
||||
},
|
||||
'is-IS': {
|
||||
nativeName: 'Íslenska (Iceland)',
|
||||
},
|
||||
'it': {
|
||||
nativeName: 'Italiano',
|
||||
},
|
||||
'it-IT': {
|
||||
nativeName: 'Italiano',
|
||||
},
|
||||
'ja': {
|
||||
nativeName: '日本語',
|
||||
},
|
||||
'ja-JP': {
|
||||
nativeName: '日本語 (日本)',
|
||||
},
|
||||
'jv-ID': {
|
||||
nativeName: 'Basa Jawa',
|
||||
},
|
||||
'ka-GE': {
|
||||
nativeName: 'ქართული',
|
||||
},
|
||||
'kk-KZ': {
|
||||
nativeName: 'Қазақша',
|
||||
},
|
||||
'km': {
|
||||
nativeName: 'ភាសាខ្មែរ',
|
||||
},
|
||||
'kl': {
|
||||
nativeName: 'kalaallisut',
|
||||
},
|
||||
'km-KH': {
|
||||
nativeName: 'ភាសាខ្មែរ',
|
||||
},
|
||||
'kab': {
|
||||
nativeName: 'Taqbaylit',
|
||||
},
|
||||
'kn': {
|
||||
nativeName: 'ಕನ್ನಡ',
|
||||
},
|
||||
'kn-IN': {
|
||||
nativeName: 'ಕನ್ನಡ (India)',
|
||||
},
|
||||
'ko': {
|
||||
nativeName: '한국어',
|
||||
},
|
||||
'ko-KR': {
|
||||
nativeName: '한국어 (한국)',
|
||||
},
|
||||
'ku-TR': {
|
||||
nativeName: 'Kurdî',
|
||||
},
|
||||
'kw': {
|
||||
nativeName: 'Kernewek',
|
||||
},
|
||||
'la': {
|
||||
nativeName: 'Latin',
|
||||
},
|
||||
'la-VA': {
|
||||
nativeName: 'Latin',
|
||||
},
|
||||
'lb': {
|
||||
nativeName: 'Lëtzebuergesch',
|
||||
},
|
||||
'li-NL': {
|
||||
nativeName: 'Lèmbörgs',
|
||||
},
|
||||
'lt': {
|
||||
nativeName: 'Lietuvių',
|
||||
},
|
||||
'lt-LT': {
|
||||
nativeName: 'Lietuvių',
|
||||
},
|
||||
'lv': {
|
||||
nativeName: 'Latviešu',
|
||||
},
|
||||
'lv-LV': {
|
||||
nativeName: 'Latviešu',
|
||||
},
|
||||
'mai': {
|
||||
nativeName: 'मैथिली, মৈথিলী',
|
||||
},
|
||||
'mg-MG': {
|
||||
nativeName: 'Malagasy',
|
||||
},
|
||||
'mk': {
|
||||
nativeName: 'Македонски',
|
||||
},
|
||||
'mk-MK': {
|
||||
nativeName: 'Македонски (Македонски)',
|
||||
},
|
||||
'ml': {
|
||||
nativeName: 'മലയാളം',
|
||||
},
|
||||
'ml-IN': {
|
||||
nativeName: 'മലയാളം',
|
||||
},
|
||||
'mn-MN': {
|
||||
nativeName: 'Монгол',
|
||||
},
|
||||
'mr': {
|
||||
nativeName: 'मराठी',
|
||||
},
|
||||
'mr-IN': {
|
||||
nativeName: 'मराठी',
|
||||
},
|
||||
'ms': {
|
||||
nativeName: 'Bahasa Melayu',
|
||||
},
|
||||
'ms-MY': {
|
||||
nativeName: 'Bahasa Melayu',
|
||||
},
|
||||
'mt': {
|
||||
nativeName: 'Malti',
|
||||
},
|
||||
'mt-MT': {
|
||||
nativeName: 'Malti',
|
||||
},
|
||||
'my': {
|
||||
nativeName: 'ဗမာစကာ',
|
||||
},
|
||||
'no': {
|
||||
nativeName: 'Norsk',
|
||||
},
|
||||
'nb': {
|
||||
nativeName: 'Norsk (bokmål)',
|
||||
},
|
||||
'nb-NO': {
|
||||
nativeName: 'Norsk (bokmål)',
|
||||
},
|
||||
'ne': {
|
||||
nativeName: 'नेपाली',
|
||||
},
|
||||
'ne-NP': {
|
||||
nativeName: 'नेपाली',
|
||||
},
|
||||
'nl': {
|
||||
nativeName: 'Nederlands',
|
||||
},
|
||||
'nl-BE': {
|
||||
nativeName: 'Nederlands (België)',
|
||||
},
|
||||
'nl-NL': {
|
||||
nativeName: 'Nederlands (Nederland)',
|
||||
},
|
||||
'nn-NO': {
|
||||
nativeName: 'Norsk (nynorsk)',
|
||||
},
|
||||
'oc': {
|
||||
nativeName: 'Occitan',
|
||||
},
|
||||
'or-IN': {
|
||||
nativeName: 'ଓଡ଼ିଆ',
|
||||
},
|
||||
'pa': {
|
||||
nativeName: 'ਪੰਜਾਬੀ',
|
||||
},
|
||||
'pa-IN': {
|
||||
nativeName: 'ਪੰਜਾਬੀ (ਭਾਰਤ ਨੂੰ)',
|
||||
},
|
||||
'pl': {
|
||||
nativeName: 'Polski',
|
||||
},
|
||||
'pl-PL': {
|
||||
nativeName: 'Polski',
|
||||
},
|
||||
'ps-AF': {
|
||||
nativeName: 'پښتو',
|
||||
},
|
||||
'pt': {
|
||||
nativeName: 'Português',
|
||||
},
|
||||
'pt-BR': {
|
||||
nativeName: 'Português (Brasil)',
|
||||
},
|
||||
'pt-PT': {
|
||||
nativeName: 'Português (Portugal)',
|
||||
},
|
||||
'qu-PE': {
|
||||
nativeName: 'Qhichwa',
|
||||
},
|
||||
'rm-CH': {
|
||||
nativeName: 'Rumantsch',
|
||||
},
|
||||
'ro': {
|
||||
nativeName: 'Română',
|
||||
},
|
||||
'ro-RO': {
|
||||
nativeName: 'Română',
|
||||
},
|
||||
'ru': {
|
||||
nativeName: 'Русский',
|
||||
},
|
||||
'ru-RU': {
|
||||
nativeName: 'Русский',
|
||||
},
|
||||
'sa-IN': {
|
||||
nativeName: 'संस्कृतम्',
|
||||
},
|
||||
'se-NO': {
|
||||
nativeName: 'Davvisámegiella',
|
||||
},
|
||||
'sh': {
|
||||
nativeName: 'српскохрватски',
|
||||
},
|
||||
'si-LK': {
|
||||
nativeName: 'සිංහල',
|
||||
},
|
||||
'sk': {
|
||||
nativeName: 'Slovenčina',
|
||||
},
|
||||
'sk-SK': {
|
||||
nativeName: 'Slovenčina (Slovakia)',
|
||||
},
|
||||
'sl': {
|
||||
nativeName: 'Slovenščina',
|
||||
},
|
||||
'sl-SI': {
|
||||
nativeName: 'Slovenščina',
|
||||
},
|
||||
'so-SO': {
|
||||
nativeName: 'Soomaaliga',
|
||||
},
|
||||
'sq': {
|
||||
nativeName: 'Shqip',
|
||||
},
|
||||
'sq-AL': {
|
||||
nativeName: 'Shqip',
|
||||
},
|
||||
'sr': {
|
||||
nativeName: 'Српски',
|
||||
},
|
||||
'sr-RS': {
|
||||
nativeName: 'Српски (Serbia)',
|
||||
},
|
||||
'su': {
|
||||
nativeName: 'Basa Sunda',
|
||||
},
|
||||
'sv': {
|
||||
nativeName: 'Svenska',
|
||||
},
|
||||
'sv-SE': {
|
||||
nativeName: 'Svenska',
|
||||
},
|
||||
'sw': {
|
||||
nativeName: 'Kiswahili',
|
||||
},
|
||||
'sw-KE': {
|
||||
nativeName: 'Kiswahili',
|
||||
},
|
||||
'ta': {
|
||||
nativeName: 'தமிழ்',
|
||||
},
|
||||
'ta-IN': {
|
||||
nativeName: 'தமிழ்',
|
||||
},
|
||||
'te': {
|
||||
nativeName: 'తెలుగు',
|
||||
},
|
||||
'te-IN': {
|
||||
nativeName: 'తెలుగు',
|
||||
},
|
||||
'tg': {
|
||||
nativeName: 'забо́ни тоҷикӣ́',
|
||||
},
|
||||
'tg-TJ': {
|
||||
nativeName: 'тоҷикӣ',
|
||||
},
|
||||
'th': {
|
||||
nativeName: 'ภาษาไทย',
|
||||
},
|
||||
'th-TH': {
|
||||
nativeName: 'ภาษาไทย (ประเทศไทย)',
|
||||
},
|
||||
'fil': {
|
||||
nativeName: 'Filipino',
|
||||
},
|
||||
'tlh': {
|
||||
nativeName: 'tlhIngan-Hol',
|
||||
},
|
||||
'tr': {
|
||||
nativeName: 'Türkçe',
|
||||
},
|
||||
'tr-TR': {
|
||||
nativeName: 'Türkçe',
|
||||
},
|
||||
'tt-RU': {
|
||||
nativeName: 'татарча',
|
||||
},
|
||||
'uk': {
|
||||
nativeName: 'Українська',
|
||||
},
|
||||
'uk-UA': {
|
||||
nativeName: 'Українська',
|
||||
},
|
||||
'ur': {
|
||||
nativeName: 'اردو',
|
||||
},
|
||||
'ur-PK': {
|
||||
nativeName: 'اردو',
|
||||
},
|
||||
'uz': {
|
||||
nativeName: 'O\'zbek',
|
||||
},
|
||||
'uz-UZ': {
|
||||
nativeName: 'O\'zbek',
|
||||
},
|
||||
'vi': {
|
||||
nativeName: 'Tiếng Việt',
|
||||
},
|
||||
'vi-VN': {
|
||||
nativeName: 'Tiếng Việt',
|
||||
},
|
||||
'xh-ZA': {
|
||||
nativeName: 'isiXhosa',
|
||||
},
|
||||
'yi': {
|
||||
nativeName: 'ייִדיש',
|
||||
},
|
||||
'yi-DE': {
|
||||
nativeName: 'ייִדיש (German)',
|
||||
},
|
||||
'zh': {
|
||||
nativeName: '中文',
|
||||
},
|
||||
'zh-Hans': {
|
||||
nativeName: '中文简体',
|
||||
},
|
||||
'zh-Hant': {
|
||||
nativeName: '中文繁體',
|
||||
},
|
||||
'zh-CN': {
|
||||
nativeName: '中文(中国大陆)',
|
||||
},
|
||||
'zh-HK': {
|
||||
nativeName: '中文(香港)',
|
||||
},
|
||||
'zh-SG': {
|
||||
nativeName: '中文(新加坡)',
|
||||
},
|
||||
'zh-TW': {
|
||||
nativeName: '中文(台灣)',
|
||||
},
|
||||
'zu-ZA': {
|
||||
nativeName: 'isiZulu',
|
||||
},
|
||||
};
|
@ -1,12 +1,12 @@
|
||||
import { In } from 'typeorm';
|
||||
import { Emojis } from '@/models/index';
|
||||
import { Emoji } from '@/models/entities/emoji';
|
||||
import { Note } from '@/models/entities/note';
|
||||
import { Cache } from './cache';
|
||||
import { isSelfHost, toPunyNullable } from './convert-host';
|
||||
import { decodeReaction } from './reaction-lib';
|
||||
import config from '@/config/index';
|
||||
import { query } from '@/prelude/url';
|
||||
import { Emojis } from '@/models/index.js';
|
||||
import { Emoji } from '@/models/entities/emoji.js';
|
||||
import { Note } from '@/models/entities/note.js';
|
||||
import { Cache } from './cache.js';
|
||||
import { isSelfHost, toPunyNullable } from './convert-host.js';
|
||||
import { decodeReaction } from './reaction-lib.js';
|
||||
import config from '@/config/index.js';
|
||||
import { query } from '@/prelude/url.js';
|
||||
|
||||
const cache = new Cache<Emoji | null>(1000 * 60 * 60 * 12);
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* eslint-disable key-spacing */
|
||||
import { emojiRegex } from './emoji-regex';
|
||||
import { fetchMeta } from './fetch-meta';
|
||||
import { Emojis } from '@/models/index';
|
||||
import { toPunyNullable } from './convert-host';
|
||||
import { emojiRegex } from './emoji-regex.js';
|
||||
import { fetchMeta } from './fetch-meta.js';
|
||||
import { Emojis } from '@/models/index.js';
|
||||
import { toPunyNullable } from './convert-host.js';
|
||||
|
||||
const legacies: Record<string, string> = {
|
||||
'like': '👍',
|
||||
|
@ -6,29 +6,29 @@ import {
|
||||
packedMeDetailedSchema,
|
||||
packedUserDetailedSchema,
|
||||
packedUserSchema,
|
||||
} from '@/models/schema/user';
|
||||
import { packedNoteSchema } from '@/models/schema/note';
|
||||
import { packedUserListSchema } from '@/models/schema/user-list';
|
||||
import { packedAppSchema } from '@/models/schema/app';
|
||||
import { packedMessagingMessageSchema } from '@/models/schema/messaging-message';
|
||||
import { packedNotificationSchema } from '@/models/schema/notification';
|
||||
import { packedDriveFileSchema } from '@/models/schema/drive-file';
|
||||
import { packedDriveFolderSchema } from '@/models/schema/drive-folder';
|
||||
import { packedFollowingSchema } from '@/models/schema/following';
|
||||
import { packedMutingSchema } from '@/models/schema/muting';
|
||||
import { packedBlockingSchema } from '@/models/schema/blocking';
|
||||
import { packedNoteReactionSchema } from '@/models/schema/note-reaction';
|
||||
import { packedHashtagSchema } from '@/models/schema/hashtag';
|
||||
import { packedPageSchema } from '@/models/schema/page';
|
||||
import { packedUserGroupSchema } from '@/models/schema/user-group';
|
||||
import { packedNoteFavoriteSchema } from '@/models/schema/note-favorite';
|
||||
import { packedChannelSchema } from '@/models/schema/channel';
|
||||
import { packedAntennaSchema } from '@/models/schema/antenna';
|
||||
import { packedClipSchema } from '@/models/schema/clip';
|
||||
import { packedFederationInstanceSchema } from '@/models/schema/federation-instance';
|
||||
import { packedQueueCountSchema } from '@/models/schema/queue';
|
||||
import { packedGalleryPostSchema } from '@/models/schema/gallery-post';
|
||||
import { packedEmojiSchema } from '@/models/schema/emoji';
|
||||
} from '@/models/schema/user.js';
|
||||
import { packedNoteSchema } from '@/models/schema/note.js';
|
||||
import { packedUserListSchema } from '@/models/schema/user-list.js';
|
||||
import { packedAppSchema } from '@/models/schema/app.js';
|
||||
import { packedMessagingMessageSchema } from '@/models/schema/messaging-message.js';
|
||||
import { packedNotificationSchema } from '@/models/schema/notification.js';
|
||||
import { packedDriveFileSchema } from '@/models/schema/drive-file.js';
|
||||
import { packedDriveFolderSchema } from '@/models/schema/drive-folder.js';
|
||||
import { packedFollowingSchema } from '@/models/schema/following.js';
|
||||
import { packedMutingSchema } from '@/models/schema/muting.js';
|
||||
import { packedBlockingSchema } from '@/models/schema/blocking.js';
|
||||
import { packedNoteReactionSchema } from '@/models/schema/note-reaction.js';
|
||||
import { packedHashtagSchema } from '@/models/schema/hashtag.js';
|
||||
import { packedPageSchema } from '@/models/schema/page.js';
|
||||
import { packedUserGroupSchema } from '@/models/schema/user-group.js';
|
||||
import { packedNoteFavoriteSchema } from '@/models/schema/note-favorite.js';
|
||||
import { packedChannelSchema } from '@/models/schema/channel.js';
|
||||
import { packedAntennaSchema } from '@/models/schema/antenna.js';
|
||||
import { packedClipSchema } from '@/models/schema/clip.js';
|
||||
import { packedFederationInstanceSchema } from '@/models/schema/federation-instance.js';
|
||||
import { packedQueueCountSchema } from '@/models/schema/queue.js';
|
||||
import { packedGalleryPostSchema } from '@/models/schema/gallery-post.js';
|
||||
import { packedEmojiSchema } from '@/models/schema/emoji.js';
|
||||
|
||||
export const refs = {
|
||||
UserLite: packedUserLiteSchema,
|
||||
@ -63,18 +63,13 @@ export const refs = {
|
||||
Emoji: packedEmojiSchema,
|
||||
};
|
||||
|
||||
// Packed = SchemaTypeDef<typeof refs[x]>; とすると展開されてマウスホバー時に型表示が使い物にならなくなる
|
||||
// ObjType<r['properties']>を指定すると(なぜか)展開されずにPacked<'Hoge'>と表示される
|
||||
type PackedDef<r extends { properties?: Obj; oneOf?: ReadonlyArray<MinimumSchema>; allOf?: ReadonlyArray<MinimumSchema> }> =
|
||||
r['allOf'] extends ReadonlyArray<MinimumSchema> ? UnionToIntersection<UnionSchemaType<r['allOf']>> :
|
||||
r['oneOf'] extends ReadonlyArray<MinimumSchema> ? UnionSchemaType<r['oneOf']> :
|
||||
r['properties'] extends Obj ? ObjType<r['properties']> :
|
||||
never;
|
||||
export type Packed<x extends keyof typeof refs> = PackedDef<typeof refs[x]>;
|
||||
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
|
||||
|
||||
type TypeStringef = 'boolean' | 'number' | 'string' | 'array' | 'object' | 'any';
|
||||
type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any';
|
||||
type StringDefToType<T extends TypeStringef> =
|
||||
T extends 'null' ? null :
|
||||
T extends 'boolean' ? boolean :
|
||||
T extends 'integer' ? number :
|
||||
T extends 'number' ? number :
|
||||
T extends 'string' ? string | Date :
|
||||
T extends 'array' ? ReadonlyArray<any> :
|
||||
@ -83,17 +78,18 @@ type StringDefToType<T extends TypeStringef> =
|
||||
|
||||
// https://swagger.io/specification/?sbsearch=optional#schema-object
|
||||
type OfSchema = {
|
||||
readonly anyOf?: ReadonlyArray<MinimumSchema>;
|
||||
readonly oneOf?: ReadonlyArray<MinimumSchema>;
|
||||
readonly allOf?: ReadonlyArray<MinimumSchema>;
|
||||
readonly anyOf?: ReadonlyArray<Schema>;
|
||||
readonly oneOf?: ReadonlyArray<Schema>;
|
||||
readonly allOf?: ReadonlyArray<Schema>;
|
||||
}
|
||||
|
||||
export interface MinimumSchema extends OfSchema {
|
||||
export interface Schema extends OfSchema {
|
||||
readonly type?: TypeStringef;
|
||||
readonly nullable?: boolean;
|
||||
readonly optional?: boolean;
|
||||
readonly items?: MinimumSchema;
|
||||
readonly items?: Schema;
|
||||
readonly properties?: Obj;
|
||||
readonly required?: ReadonlyArray<keyof NonNullable<this['properties']>>;
|
||||
readonly description?: string;
|
||||
readonly example?: any;
|
||||
readonly format?: string;
|
||||
@ -104,26 +100,22 @@ export interface MinimumSchema extends OfSchema {
|
||||
readonly minLength?: number;
|
||||
}
|
||||
|
||||
export interface Schema extends MinimumSchema {
|
||||
readonly nullable: boolean;
|
||||
readonly optional: boolean;
|
||||
}
|
||||
|
||||
type NonUndefinedPropertyNames<T extends Obj> = {
|
||||
[K in keyof T]: T[K]['optional'] extends true ? never : K
|
||||
}[keyof T];
|
||||
|
||||
type UndefinedPropertyNames<T extends Obj> = {
|
||||
[K in keyof T]: T[K]['optional'] extends true ? K : never
|
||||
}[keyof T];
|
||||
type RequiredPropertyNames<s extends Obj> = {
|
||||
[K in keyof s]:
|
||||
// K is not optional
|
||||
s[K]['optional'] extends false ? K :
|
||||
// K has default value
|
||||
s[K]['default'] extends null | string | number | boolean | Record<string, unknown> ? K : never
|
||||
}[keyof s];
|
||||
|
||||
export interface Obj { [key: string]: Schema; }
|
||||
|
||||
export type ObjType<s extends Obj> =
|
||||
{ -readonly [P in UndefinedPropertyNames<s>]?: SchemaType<s[P]> } &
|
||||
{ -readonly [P in NonUndefinedPropertyNames<s>]: SchemaType<s[P]> };
|
||||
export type ObjType<s extends Obj, RequiredProps extends keyof s> =
|
||||
{ -readonly [P in keyof s]?: SchemaType<s[P]> } &
|
||||
{ -readonly [P in RequiredProps]: SchemaType<s[P]> } &
|
||||
{ -readonly [P in RequiredPropertyNames<s>]: SchemaType<s[P]> };
|
||||
|
||||
type NullOrUndefined<p extends MinimumSchema, T> =
|
||||
type NullOrUndefined<p extends Schema, T> =
|
||||
p['nullable'] extends true
|
||||
? p['optional'] extends true
|
||||
? (T | null | undefined)
|
||||
@ -132,15 +124,18 @@ type NullOrUndefined<p extends MinimumSchema, T> =
|
||||
? (T | undefined)
|
||||
: T;
|
||||
|
||||
// 共用体型を交差型にする型 https://stackoverflow.com/questions/54938141/typescript-convert-union-to-intersection
|
||||
// https://stackoverflow.com/questions/54938141/typescript-convert-union-to-intersection
|
||||
// Get intersection from union
|
||||
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
||||
|
||||
// https://github.com/misskey-dev/misskey/pull/8144#discussion_r785287552
|
||||
// 単純にSchemaTypeDef<X>で判定するだけではダメ
|
||||
type UnionSchemaType<a extends readonly any[], X extends MinimumSchema = a[number]> = X extends any ? SchemaType<X> : never;
|
||||
// To get union, we use `Foo extends any ? Hoge<Foo> : never`
|
||||
type UnionSchemaType<a extends readonly any[], X extends Schema = a[number]> = X extends any ? SchemaType<X> : never;
|
||||
type ArrayUnion<T> = T extends any ? Array<T> : never;
|
||||
|
||||
export type SchemaTypeDef<p extends MinimumSchema> =
|
||||
export type SchemaTypeDef<p extends Schema> =
|
||||
p['type'] extends 'null' ? null :
|
||||
p['type'] extends 'integer' ? number :
|
||||
p['type'] extends 'number' ? number :
|
||||
p['type'] extends 'string' ? (
|
||||
p['enum'] extends readonly string[] ?
|
||||
@ -151,22 +146,22 @@ export type SchemaTypeDef<p extends MinimumSchema> =
|
||||
p['type'] extends 'boolean' ? boolean :
|
||||
p['type'] extends 'object' ? (
|
||||
p['ref'] extends keyof typeof refs ? Packed<p['ref']> :
|
||||
p['properties'] extends NonNullable<Obj> ? ObjType<p['properties']> :
|
||||
p['anyOf'] extends ReadonlyArray<MinimumSchema> ? UnionSchemaType<p['anyOf']> & Partial<UnionToIntersection<UnionSchemaType<p['anyOf']>>> :
|
||||
p['allOf'] extends ReadonlyArray<MinimumSchema> ? UnionToIntersection<UnionSchemaType<p['allOf']>> :
|
||||
p['properties'] extends NonNullable<Obj> ? ObjType<p['properties'], NonNullable<p['required']>[number]> :
|
||||
p['anyOf'] extends ReadonlyArray<Schema> ? UnionSchemaType<p['anyOf']> & Partial<UnionToIntersection<UnionSchemaType<p['anyOf']>>> :
|
||||
p['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<p['allOf']>> :
|
||||
any
|
||||
) :
|
||||
p['type'] extends 'array' ? (
|
||||
p['items'] extends OfSchema ? (
|
||||
p['items']['anyOf'] extends ReadonlyArray<MinimumSchema> ? UnionSchemaType<NonNullable<p['items']['anyOf']>>[] :
|
||||
p['items']['oneOf'] extends ReadonlyArray<MinimumSchema> ? ArrayUnion<UnionSchemaType<NonNullable<p['items']['oneOf']>>> :
|
||||
p['items']['allOf'] extends ReadonlyArray<MinimumSchema> ? UnionToIntersection<UnionSchemaType<NonNullable<p['items']['allOf']>>>[] :
|
||||
p['items']['anyOf'] extends ReadonlyArray<Schema> ? UnionSchemaType<NonNullable<p['items']['anyOf']>>[] :
|
||||
p['items']['oneOf'] extends ReadonlyArray<Schema> ? ArrayUnion<UnionSchemaType<NonNullable<p['items']['oneOf']>>> :
|
||||
p['items']['allOf'] extends ReadonlyArray<Schema> ? UnionToIntersection<UnionSchemaType<NonNullable<p['items']['allOf']>>>[] :
|
||||
never
|
||||
) :
|
||||
p['items'] extends NonNullable<MinimumSchema> ? SchemaTypeDef<p['items']>[] :
|
||||
p['items'] extends NonNullable<Schema> ? SchemaTypeDef<p['items']>[] :
|
||||
any[]
|
||||
) :
|
||||
p['oneOf'] extends ReadonlyArray<MinimumSchema> ? UnionSchemaType<p['oneOf']> :
|
||||
p['oneOf'] extends ReadonlyArray<Schema> ? UnionSchemaType<p['oneOf']> :
|
||||
any;
|
||||
|
||||
export type SchemaType<p extends MinimumSchema> = NullOrUndefined<p, SchemaTypeDef<p>>;
|
||||
export type SchemaType<p extends Schema> = NullOrUndefined<p, SchemaTypeDef<p>>;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as crypto from 'crypto';
|
||||
import * as crypto from 'node:crypto';
|
||||
|
||||
const L_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||||
const LU_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as os from 'os';
|
||||
import * as sysUtils from 'systeminformation';
|
||||
import Logger from '@/services/logger';
|
||||
import * as os from 'node:os';
|
||||
import sysUtils from 'systeminformation';
|
||||
import Logger from '@/services/logger.js';
|
||||
|
||||
export async function showMachineInfo(parentLogger: Logger) {
|
||||
const logger = parentLogger.createSubLogger('machine');
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class AbuseUserReport {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { App } from './app';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { App } from './app.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class AccessToken {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Ad {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { Announcement } from './announcement';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { Announcement } from './announcement.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'announcementId'], { unique: true })
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Entity, Index, Column, PrimaryColumn } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Announcement {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { Antenna } from './antenna';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note.js';
|
||||
import { Antenna } from './antenna.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['noteId', 'antennaId'], { unique: true })
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { UserList } from './user-list';
|
||||
import { UserGroupJoining } from './user-group-joining';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { UserList } from './user-list.js';
|
||||
import { UserGroupJoining } from './user-group-joining.js';
|
||||
|
||||
@Entity()
|
||||
export class Antenna {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Entity, PrimaryColumn, Column, Index, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class App {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, JoinColumn, Column, ManyToOne, Index } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class AttestationChallenge {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, PrimaryColumn, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { App } from './app';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { App } from './app.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class AuthSession {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['blockerId', 'blockeeId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Channel } from './channel';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { Channel } from './channel.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['followerId', 'followeeId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { Channel } from './channel';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note.js';
|
||||
import { Channel } from './channel.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['channelId', 'noteId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { DriveFile } from './drive-file';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { DriveFile } from './drive-file.js';
|
||||
|
||||
@Entity()
|
||||
export class Channel {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { Clip } from './clip';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note.js';
|
||||
import { Clip } from './clip.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['noteId', 'clipId'], { unique: true })
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Clip {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { DriveFolder } from './drive-folder';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { DriveFolder } from './drive-folder.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'folderId', 'id'])
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { JoinColumn, ManyToOne, Entity, PrimaryColumn, Index, Column } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class DriveFolder {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['name', 'host'], { unique: true })
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['followerId', 'followeeId'], { unique: true })
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['followerId', 'followeeId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { GalleryPost } from './gallery-post';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { GalleryPost } from './gallery-post.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'postId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { DriveFile } from './drive-file';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { DriveFile } from './drive-file.js';
|
||||
|
||||
@Entity()
|
||||
export class GalleryPost {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Hashtag {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Entity, PrimaryColumn, Index, Column } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Instance {
|
||||
@ -59,22 +59,6 @@ export class Instance {
|
||||
})
|
||||
public followersCount: number;
|
||||
|
||||
/**
|
||||
* ドライブ使用量
|
||||
*/
|
||||
@Column('bigint', {
|
||||
default: 0,
|
||||
})
|
||||
public driveUsage: number;
|
||||
|
||||
/**
|
||||
* ドライブのファイル数
|
||||
*/
|
||||
@Column('integer', {
|
||||
default: 0,
|
||||
})
|
||||
public driveFiles: number;
|
||||
|
||||
/**
|
||||
* 直近のリクエスト送信日時
|
||||
*/
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { DriveFile } from './drive-file';
|
||||
import { id } from '../id';
|
||||
import { UserGroup } from './user-group';
|
||||
import { User } from './user.js';
|
||||
import { DriveFile } from './drive-file.js';
|
||||
import { id } from '../id.js';
|
||||
import { UserGroup } from './user-group.js';
|
||||
|
||||
@Entity()
|
||||
export class MessagingMessage {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, Column, PrimaryColumn, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Clip } from './clip';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { Clip } from './clip.js';
|
||||
|
||||
@Entity()
|
||||
export class Meta {
|
||||
@ -137,11 +137,6 @@ export class Meta {
|
||||
})
|
||||
public cacheRemoteFiles: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
public proxyRemoteFiles: boolean;
|
||||
|
||||
@Column({
|
||||
...id(),
|
||||
nullable: true,
|
||||
@ -205,12 +200,6 @@ export class Meta {
|
||||
})
|
||||
public remoteDriveCapacityMb: number;
|
||||
|
||||
@Column('integer', {
|
||||
default: 500,
|
||||
comment: 'Max allowed note text length in characters',
|
||||
})
|
||||
public maxNoteTextLength: number;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 128,
|
||||
nullable: true,
|
||||
@ -355,6 +344,20 @@ export class Meta {
|
||||
})
|
||||
public feedbackUrl: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 8192,
|
||||
default: null,
|
||||
nullable: true,
|
||||
})
|
||||
public defaultLightTheme: string | null;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 8192,
|
||||
default: null,
|
||||
nullable: true,
|
||||
})
|
||||
public defaultDarkTheme: string | null;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class ModerationLog {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Entity, Index, JoinColumn, Column, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { mutedNoteReasons } from '../../types';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { mutedNoteReasons } from '../../types.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['noteId', 'userId'], { unique: true })
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['muterId', 'muteeId'], { unique: true })
|
||||
@ -14,6 +14,13 @@ export class Muting {
|
||||
})
|
||||
public createdAt: Date;
|
||||
|
||||
@Index()
|
||||
@Column('timestamp with time zone', {
|
||||
nullable: true,
|
||||
default: null,
|
||||
})
|
||||
public expiresAt: Date | null;
|
||||
|
||||
@Index()
|
||||
@Column({
|
||||
...id(),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { Note } from './note';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { Note } from './note.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { Note } from './note';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { Note } from './note.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'threadId'], { unique: true })
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { Note } from './note';
|
||||
import { id } from '../id';
|
||||
import { Channel } from './channel';
|
||||
import { User } from './user.js';
|
||||
import { Note } from './note.js';
|
||||
import { id } from '../id.js';
|
||||
import { Channel } from './channel.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { Note } from './note';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { Note } from './note.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { DriveFile } from './drive-file';
|
||||
import { id } from '../id';
|
||||
import { noteVisibilities } from '../../types';
|
||||
import { Channel } from './channel';
|
||||
import { User } from './user.js';
|
||||
import { DriveFile } from './drive-file.js';
|
||||
import { id } from '../id.js';
|
||||
import { noteVisibilities } from '../../types.js';
|
||||
import { Channel } from './channel.js';
|
||||
|
||||
@Entity()
|
||||
@Index('IDX_NOTE_TAGS', { synchronize: false })
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { Entity, Index, JoinColumn, ManyToOne, Column, PrimaryColumn } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note';
|
||||
import { FollowRequest } from './follow-request';
|
||||
import { UserGroupInvitation } from './user-group-invitation';
|
||||
import { AccessToken } from './access-token';
|
||||
import { notificationTypes } from '@/types';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { Note } from './note.js';
|
||||
import { FollowRequest } from './follow-request.js';
|
||||
import { UserGroupInvitation } from './user-group-invitation.js';
|
||||
import { AccessToken } from './access-token.js';
|
||||
import { notificationTypes } from '@/types.js';
|
||||
|
||||
@Entity()
|
||||
export class Notification {
|
||||
@ -59,7 +59,8 @@ export class Notification {
|
||||
* renote - (自分または自分がWatchしている)投稿がRenoteされた
|
||||
* quote - (自分または自分がWatchしている)投稿が引用Renoteされた
|
||||
* reaction - (自分または自分がWatchしている)投稿にリアクションされた
|
||||
* pollVote - (自分または自分がWatchしている)投稿の投票に投票された
|
||||
* pollVote - (自分または自分がWatchしている)投稿のアンケートに投票された
|
||||
* pollEnded - 自分のアンケートもしくは自分が投票したアンケートが終了した
|
||||
* receiveFollowRequest - フォローリクエストされた
|
||||
* followRequestAccepted - 自分の送ったフォローリクエストが承認された
|
||||
* groupInvited - グループに招待された
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Page } from './page';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { Page } from './page.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'pageId'], { unique: true })
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Entity, Index, JoinColumn, Column, PrimaryColumn, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { DriveFile } from './drive-file';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
import { DriveFile } from './drive-file.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'name'], { unique: true })
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { User } from './user';
|
||||
import { id } from '../id.js';
|
||||
import { User } from './user.js';
|
||||
|
||||
@Entity()
|
||||
export class PasswordResetRequest {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { Note } from './note';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { Note } from './note.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId', 'choice'], { unique: true })
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note';
|
||||
import { User } from './user';
|
||||
import { noteVisibilities } from '../../types';
|
||||
import { id } from '../id.js';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
import { noteVisibilities } from '../../types.js';
|
||||
|
||||
@Entity()
|
||||
export class Poll {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, OneToOne } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class PromoNote {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { Note } from './note';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { Note } from './note.js';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
@Index(['userId', 'noteId'], { unique: true })
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class RegistrationTicket {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
// TODO: 同じdomain、同じscope、同じkeyのレコードは二つ以上存在しないように制約付けたい
|
||||
@Entity()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { PrimaryColumn, Entity, Index, Column } from 'typeorm';
|
||||
import { id } from '../id';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Relay {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { PrimaryColumn, Entity, Index, JoinColumn, Column, ManyToOne } from 'typeorm';
|
||||
import { User } from './user';
|
||||
import { id } from '../id';
|
||||
import { User } from './user.js';
|
||||
import { id } from '../id.js';
|
||||
|
||||
@Entity()
|
||||
export class Signin {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user