lint fixes

This commit is contained in:
syuilo 2022-06-14 18:01:23 +09:00 committed by Chloe Kudryavtsev
parent cd5c12ebca
commit 9fcc0e460c
90 changed files with 204 additions and 204 deletions

View file

@ -1,12 +1,12 @@
import Koa from 'koa';
import { performance } from 'perf_hooks';
import { limiter } from './limiter.js';
import Koa from 'koa';
import { CacheableLocalUser, User } from '@/models/entities/user.js';
import { AccessToken } from '@/models/entities/access-token.js';
import { getIpHash } from '@/misc/get-ip-hash.js';
import { limiter } from './limiter.js';
import endpoints, { IEndpointMeta } from './endpoints.js';
import { ApiError } from './error.js';
import { apiLogger } from './logger.js';
import { AccessToken } from '@/models/entities/access-token.js';
import { getIpHash } from '@/misc/get-ip-hash.js';
const accessDenied = {
message: 'Access denied.',
@ -120,20 +120,20 @@ export default async (endpoint: string, user: CacheableLocalUser | null | undefi
if (e instanceof ApiError) {
throw e;
} else {
apiLogger.error(`Internal error occurred in ${ep.name}: ${e?.message}`, {
apiLogger.error(`Internal error occurred in ${ep.name}: ${e.message}`, {
ep: ep.name,
ps: data,
e: {
message: e?.message,
code: e?.name,
stack: e?.stack,
message: e.message,
code: e.name,
stack: e.stack,
},
});
throw new ApiError(null, {
e: {
message: e?.message,
code: e?.name,
stack: e?.stack,
message: e.message,
code: e.name,
stack: e.stack,
},
});
}

View file

@ -1,5 +1,5 @@
import define from '../define.js';
import { Announcements, AnnouncementReads } from '@/models/index.js';
import define from '../define.js';
import { makePaginationQuery } from '../common/make-pagination-query.js';
export const meta = {

View file

@ -1,6 +1,6 @@
import define from '../define.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { DriveFiles } from '@/models/index.js';
import define from '../define.js';
export const meta = {
tags: ['drive', 'account'],

View file

@ -1,6 +1,6 @@
import define from '../define.js';
import { createExportCustomEmojisJob } from '@/queue/index.js';
import ms from 'ms';
import { createExportCustomEmojisJob } from '@/queue/index.js';
import define from '../define.js';
export const meta = {
secure: true,

View file

@ -1,6 +1,6 @@
import { MoreThan } from 'typeorm';
import { USER_ONLINE_THRESHOLD } from '@/const.js';
import { Users } from '@/models/index.js';
import { MoreThan } from 'typeorm';
import define from '../define.js';
export const meta = {

View file

@ -1,5 +1,5 @@
import define from '../define.js';
import { Users } from '@/models/index.js';
import define from '../define.js';
export const meta = {
tags: ['account'],

View file

@ -1,11 +1,11 @@
import { Brackets } from 'typeorm';
import { Notifications, Followings, Mutings, Users } from '@/models/index.js';
import { notificationTypes } from '@/types.js';
import read from '@/services/note/read.js';
import { readNotification } from '../../common/read-notification.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateMutedInstanceNotificationQuery } from '../../common/generate-muted-instance-query.js';
import { Notifications, Followings, Mutings, Users } from '@/models/index.js';
import { notificationTypes } from '@/types.js';
import read from '@/services/note/read.js';
import { Brackets } from 'typeorm';
export const meta = {
tags: ['account', 'notifications'],
@ -67,7 +67,7 @@ export default define(meta, paramDef, async (ps, user) => {
.where('users.isSuspended = TRUE');
const query = makePaginationQuery(Notifications.createQueryBuilder('notification'), ps.sinceId, ps.untilId)
.andWhere(`notification.notifieeId = :meId`, { meId: user.id })
.andWhere('notification.notifieeId = :meId', { meId: user.id })
.leftJoinAndSelect('notification.notifier', 'notifier')
.leftJoinAndSelect('notification.note', 'note')
.leftJoinAndSelect('notifier.avatar', 'notifierAvatar')
@ -103,13 +103,13 @@ export default define(meta, paramDef, async (ps, user) => {
}
if (ps.includeTypes && ps.includeTypes.length > 0) {
query.andWhere(`notification.type IN (:...includeTypes)`, { includeTypes: ps.includeTypes });
query.andWhere('notification.type IN (:...includeTypes)', { includeTypes: ps.includeTypes });
} else if (ps.excludeTypes && ps.excludeTypes.length > 0) {
query.andWhere(`notification.type NOT IN (:...excludeTypes)`, { excludeTypes: ps.excludeTypes });
query.andWhere('notification.type NOT IN (:...excludeTypes)', { excludeTypes: ps.excludeTypes });
}
if (ps.unreadOnly) {
query.andWhere(`notification.isRead = false`);
query.andWhere('notification.isRead = false');
}
const notifications = await query.take(ps.limit).getMany();

View file

@ -1,10 +1,10 @@
import { IsNull, MoreThan } from 'typeorm';
import config from '@/config/index.js';
import define from '../define.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Ads, Emojis, Users } from '@/models/index.js';
import { DB_MAX_NOTE_TEXT_LENGTH } from '@/misc/hard-limits.js';
import { IsNull, MoreThan } from 'typeorm';
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
import define from '../define.js';
export const meta = {
tags: ['meta'],

View file

@ -1,6 +1,6 @@
import { Notes } from '@/models/index.js';
import define from '../define.js';
import { makePaginationQuery } from '../common/make-pagination-query.js';
import { Notes } from '@/models/index.js';
export const meta = {
tags: ['notes'],
@ -34,8 +34,8 @@ export const paramDef = {
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps) => {
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
.andWhere(`note.visibility = 'public'`)
.andWhere(`note.localOnly = FALSE`)
.andWhere('note.visibility = \'public\'')
.andWhere('note.localOnly = FALSE')
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('user.avatar', 'avatar')
.leftJoinAndSelect('user.banner', 'banner')
@ -61,7 +61,7 @@ export default define(meta, paramDef, async (ps) => {
}
if (ps.withFiles !== undefined) {
query.andWhere(ps.withFiles ? `note.fileIds != '{}'` : `note.fileIds = '{}'`);
query.andWhere(ps.withFiles ? 'note.fileIds != \'{}\'' : 'note.fileIds = \'{}\'');
}
if (ps.poll !== undefined) {

View file

@ -1,9 +1,9 @@
import { Brackets } from 'typeorm';
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { Brackets } from 'typeorm';
import { Notes } from '@/models/index.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query.js';
@ -38,13 +38,13 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => {
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
.andWhere(new Brackets(qb => { qb
.where(`note.replyId = :noteId`, { noteId: ps.noteId })
.where('note.replyId = :noteId', { noteId: ps.noteId })
.orWhere(new Brackets(qb => { qb
.where(`note.renoteId = :noteId`, { noteId: ps.noteId })
.where('note.renoteId = :noteId', { noteId: ps.noteId })
.andWhere(new Brackets(qb => { qb
.where(`note.text IS NOT NULL`)
.orWhere(`note.fileIds != '{}'`)
.orWhere(`note.hasPoll = TRUE`);
.where('note.text IS NOT NULL')
.orWhere('note.fileIds != \'{}\'')
.orWhere('note.hasPoll = TRUE');
}));
}));
}))

View file

@ -1,8 +1,8 @@
import define from '../../define.js';
import { In } from 'typeorm';
import { ClipNotes, Clips } from '@/models/index.js';
import define from '../../define.js';
import { getNote } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import { In } from 'typeorm';
export const meta = {
tags: ['clips', 'notes'],

View file

@ -1,8 +1,8 @@
import { Note } from '@/models/entities/note.js';
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { getNote } from '../../common/getters.js';
import { Note } from '@/models/entities/note.js';
import { Notes } from '@/models/index.js';
export const meta = {
tags: ['notes'],

View file

@ -1,9 +1,9 @@
import deleteNote from '@/services/note/delete.js';
import define from '../../define.js';
import ms from 'ms';
import deleteNote from '@/services/note/delete.js';
import { Users } from '@/models/index.js';
import define from '../../define.js';
import { getNote } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import { Users } from '@/models/index.js';
export const meta = {
tags: ['notes'],

View file

@ -1,8 +1,8 @@
import { NoteFavorites } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getNote } from '../../../common/getters.js';
import { NoteFavorites } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
export const meta = {
tags: ['notes', 'favorites'],

View file

@ -1,7 +1,7 @@
import { NoteFavorites } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getNote } from '../../../common/getters.js';
import { NoteFavorites } from '@/models/index.js';
export const meta = {
tags: ['notes', 'favorites'],

View file

@ -1,6 +1,6 @@
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { Notes } from '@/models/index.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
export const meta = {
@ -36,9 +36,9 @@ export default define(meta, paramDef, async (ps, user) => {
const query = Notes.createQueryBuilder('note')
.addSelect('note.score')
.where('note.userHost IS NULL')
.andWhere(`note.score > 0`)
.andWhere(`note.createdAt > :date`, { date: new Date(Date.now() - day) })
.andWhere(`note.visibility = 'public'`)
.andWhere('note.score > 0')
.andWhere('note.createdAt > :date', { date: new Date(Date.now() - day) })
.andWhere('note.visibility = \'public\'')
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('user.avatar', 'avatar')
.leftJoinAndSelect('user.banner', 'banner')

View file

@ -1,11 +1,11 @@
import define from '../../define.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Notes, Users } from '@/models/index.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { Notes, Users } from '@/models/index.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query.js';
import { activeUsersChart } from '@/services/chart/index.js';
import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';

View file

@ -1,13 +1,13 @@
import define from '../../define.js';
import { Brackets } from 'typeorm';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { Followings, Notes, Users } from '@/models/index.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { Followings, Notes, Users } from '@/models/index.js';
import { Brackets } from 'typeorm';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query.js';
import { activeUsersChart } from '@/services/chart/index.js';
import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateChannelQuery } from '../../common/generate-channel-query.js';

View file

@ -1,12 +1,12 @@
import define from '../../define.js';
import { Brackets } from 'typeorm';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { ApiError } from '../../error.js';
import { Notes, Users } from '@/models/index.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { activeUsersChart } from '@/services/chart/index.js';
import { Brackets } from 'typeorm';
import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateChannelQuery } from '../../common/generate-channel-query.js';

View file

@ -1,10 +1,10 @@
import define from '../../define.js';
import { Brackets } from 'typeorm';
import read from '@/services/note/read.js';
import { Notes, Followings } from '@/models/index.js';
import define from '../../define.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { Brackets } from 'typeorm';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedNoteThreadQuery } from '../../common/generate-muted-note-thread-query.js';

View file

@ -1,6 +1,6 @@
import define from '../../../define.js';
import { Polls, Mutings, Notes, PollVotes } from '@/models/index.js';
import { Brackets, In } from 'typeorm';
import { Polls, Mutings, Notes, PollVotes } from '@/models/index.js';
import define from '../../../define.js';
export const meta = {
tags: ['notes'],
@ -31,8 +31,8 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => {
const query = Polls.createQueryBuilder('poll')
.where('poll.userHost IS NULL')
.andWhere(`poll.userId != :meId`, { meId: user.id })
.andWhere(`poll.noteVisibility = 'public'`)
.andWhere('poll.userId != :meId', { meId: user.id })
.andWhere('poll.noteVisibility = \'public\'')
.andWhere(new Brackets(qb => { qb
.where('poll.expiresAt IS NULL')
.orWhere('poll.expiresAt > :now', { now: new Date() });

View file

@ -1,16 +1,16 @@
import { Not } from 'typeorm';
import { publishNoteStream } from '@/services/stream.js';
import { createNotification } from '@/services/create-notification.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getNote } from '../../../common/getters.js';
import { deliver } from '@/queue/index.js';
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
import renderVote from '@/remote/activitypub/renderer/vote.js';
import { deliverQuestionUpdate } from '@/services/note/polls/update.js';
import { PollVotes, NoteWatchings, Users, Polls, Blockings } from '@/models/index.js';
import { Not } from 'typeorm';
import { IRemoteUser } from '@/models/entities/user.js';
import { genId } from '@/misc/gen-id.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';
import define from '../../../define.js';
export const meta = {
tags: ['notes'],

View file

@ -1,6 +1,6 @@
import define from '../../../define.js';
import ms from 'ms';
import deleteReaction from '@/services/note/reaction/delete.js';
import define from '../../../define.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';

View file

@ -1,10 +1,10 @@
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { getNote } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { Notes } from '@/models/index.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
export const meta = {
@ -50,7 +50,7 @@ export default define(meta, paramDef, async (ps, user) => {
});
const query = makePaginationQuery(Notes.createQueryBuilder('note'), ps.sinceId, ps.untilId)
.andWhere(`note.renoteId = :renoteId`, { renoteId: note.id })
.andWhere('note.renoteId = :renoteId', { renoteId: note.id })
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('user.avatar', 'avatar')
.leftJoinAndSelect('user.banner', 'banner')

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';

View file

@ -1,11 +1,11 @@
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { Notes } from '@/models/index.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { Brackets } from 'typeorm';
import { Notes } from '@/models/index.js';
import { safeForSql } from '@/misc/safe-for-sql.js';
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
export const meta = {

View file

@ -1,8 +1,8 @@
import { In } from 'typeorm';
import { Notes } from '@/models/index.js';
import config from '@/config/index.js';
import es from '../../../../db/elasticsearch.js';
import define from '../../define.js';
import { Notes } from '@/models/index.js';
import { In } from 'typeorm';
import config from '@/config/index.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';

View file

@ -1,7 +1,7 @@
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { getNote } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import { Notes } from '@/models/index.js';
export const meta = {
tags: ['notes'],

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { NoteFavorites, Notes, NoteThreadMutings, NoteWatchings } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['notes'],

View file

@ -1,9 +1,9 @@
import define from '../../../define.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';
import { Notes, NoteThreadMutings } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import readNote from '@/services/note/read.js';
import define from '../../../define.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';
export const meta = {
tags: ['notes'],

View file

@ -1,7 +1,7 @@
import { NoteThreadMutings } from '@/models/index.js';
import define from '../../../define.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';
import { NoteThreadMutings } from '@/models/index.js';
export const meta = {
tags: ['notes'],

View file

@ -1,11 +1,11 @@
import { Brackets } from 'typeorm';
import { Notes, Followings } from '@/models/index.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { Notes, Followings } from '@/models/index.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query.js';
import { activeUsersChart } from '@/services/chart/index.js';
import { Brackets } from 'typeorm';
import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateChannelQuery } from '../../common/generate-channel-query.js';

View file

@ -1,9 +1,9 @@
import deleteNote from '@/services/note/delete.js';
import define from '../../define.js';
import ms from 'ms';
import deleteNote from '@/services/note/delete.js';
import { Notes, Users } from '@/models/index.js';
import define from '../../define.js';
import { getNote } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import { Notes, Users } from '@/models/index.js';
export const meta = {
tags: ['notes'],

View file

@ -1,10 +1,10 @@
import { Brackets } from 'typeorm';
import { UserLists, UserListJoinings, Notes } from '@/models/index.js';
import { activeUsersChart } from '@/services/chart/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { UserLists, UserListJoinings, Notes } from '@/models/index.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { activeUsersChart } from '@/services/chart/index.js';
import { Brackets } from 'typeorm';
export const meta = {
tags: ['notes', 'lists'],

View file

@ -1,5 +1,5 @@
import define from '../../../define.js';
import watch from '@/services/note/watch.js';
import define from '../../../define.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';

View file

@ -1,5 +1,5 @@
import define from '../../../define.js';
import unwatch from '@/services/note/unwatch.js';
import define from '../../../define.js';
import { getNote } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { createNotification } from '@/services/create-notification.js';
import define from '../../define.js';
export const meta = {
tags: ['notifications'],

View file

@ -1,7 +1,7 @@
import { publishMainStream } from '@/services/stream.js';
import { pushNotification } from '@/services/push-notification.js';
import define from '../../define.js';
import { Notifications } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['notifications', 'account'],

View file

@ -4,7 +4,7 @@ import { readNotification } from '../../common/read-notification.js';
export const meta = {
desc: {
'ja-JP': '通知を既読にします。',
'en-US': 'Mark a notification as read.'
'en-US': 'Mark a notification as read.',
},
tags: ['notifications', 'account'],

View file

@ -1,6 +1,6 @@
import define from '../define.js';
import { publishMainStream } from '@/services/stream.js';
import { Users, Pages } from '@/models/index.js';
import define from '../define.js';
import { ApiError } from '../error.js';
export const meta = {

View file

@ -1,8 +1,8 @@
import ms from 'ms';
import define from '../../define.js';
import { Pages, DriveFiles } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { Page } from '@/models/entities/page.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
export const meta = {
@ -51,7 +51,7 @@ export const paramDef = {
} },
script: { type: 'string' },
eyeCatchingImageId: { type: 'string', format: 'misskey:id', nullable: true },
font: { type: 'string', enum: ['serif', 'sans-serif'], default: "sans-serif" },
font: { type: 'string', enum: ['serif', 'sans-serif'], default: 'sans-serif' },
alignCenter: { type: 'boolean', default: false },
hideTitleWhenPinned: { type: 'boolean', default: false },
},

View file

@ -1,6 +1,6 @@
import { Pages } from '@/models/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { Pages } from '@/models/index.js';
export const meta = {
tags: ['pages'],

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { Pages } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['pages'],

View file

@ -1,7 +1,7 @@
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { Pages, PageLikes } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
export const meta = {
tags: ['pages'],

View file

@ -1,6 +1,6 @@
import { Pages, PageLikes } from '@/models/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { Pages, PageLikes } from '@/models/index.js';
export const meta = {
tags: ['pages'],

View file

@ -1,8 +1,8 @@
import ms from 'ms';
import { Not } from 'typeorm';
import { Pages, DriveFiles } from '@/models/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { Pages, DriveFiles } from '@/models/index.js';
import { Not } from 'typeorm';
export const meta = {
tags: ['pages'],

View file

@ -1,9 +1,9 @@
import define from '../define.js';
import { IsNull } from 'typeorm';
import { Users } from '@/models/index.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import * as Acct from '@/misc/acct.js';
import { User } from '@/models/entities/user.js';
import { IsNull } from 'typeorm';
import define from '../define.js';
export const meta = {
tags: ['users'],

View file

@ -1,8 +1,8 @@
import { PromoReads } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { getNote } from '../../common/getters.js';
import { PromoReads } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
export const meta = {
tags: ['notes'],

View file

@ -1,13 +1,13 @@
import { publishMainStream } from '@/services/stream.js';
import define from '../define.js';
import rndstr from 'rndstr';
import config from '@/config/index.js';
import ms from 'ms';
import { IsNull } from 'typeorm';
import { publishMainStream } from '@/services/stream.js';
import config from '@/config/index.js';
import { Users, UserProfiles, PasswordResetRequests } from '@/models/index.js';
import { sendEmail } from '@/services/send-email.js';
import { ApiError } from '../error.js';
import { genId } from '@/misc/gen-id.js';
import { IsNull } from 'typeorm';
import { ApiError } from '../error.js';
import define from '../define.js';
export const meta = {
tags: ['reset password'],

View file

@ -1,6 +1,6 @@
import { resetDb } from '@/db/postgre.js';
import define from '../define.js';
import { ApiError } from '../error.js';
import { resetDb } from '@/db/postgre.js';
export const meta = {
tags: ['non-productive'],

View file

@ -1,7 +1,7 @@
import bcrypt from 'bcryptjs';
import { publishMainStream } from '@/services/stream.js';
import define from '../define.js';
import { Users, UserProfiles, PasswordResetRequests } from '@/models/index.js';
import define from '../define.js';
import { ApiError } from '../error.js';
export const meta = {

View file

@ -1,5 +1,5 @@
import define from '../define.js';
import { Instances, NoteReactions, Notes, Users } from '@/models/index.js';
import define from '../define.js';
import { } from '@/services/chart/index.js';
import { IsNull } from 'typeorm';

View file

@ -1,7 +1,7 @@
import define from '../../define.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { genId } from '@/misc/gen-id.js';
import { SwSubscriptions } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['account'],

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { SwSubscriptions } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['account'],

View file

@ -1,6 +1,6 @@
import define from '../../define.js';
import { Users, UsedUsernames } from '@/models/index.js';
import { IsNull } from 'typeorm';
import { Users, UsedUsernames } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['users'],

View file

@ -1,5 +1,5 @@
import define from '../define.js';
import { Users } from '@/models/index.js';
import define from '../define.js';
import { generateMutedUserQueryForUsers } from '../common/generate-muted-user-query.js';
import { generateBlockQueryForUsers } from '../common/generate-block-query.js';
@ -25,8 +25,8 @@ export const paramDef = {
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
offset: { type: 'integer', default: 0 },
sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] },
state: { type: 'string', enum: ['all', 'admin', 'moderator', 'adminOrModerator', 'alive'], default: "all" },
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "local" },
state: { type: 'string', enum: ['all', 'admin', 'moderator', 'adminOrModerator', 'alive'], default: 'all' },
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
},
required: [],
} as const;

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { Clips } from '@/models/index.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
export const meta = {
@ -32,7 +32,7 @@ export const paramDef = {
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps, user) => {
const query = makePaginationQuery(Clips.createQueryBuilder('clip'), ps.sinceId, ps.untilId)
.andWhere(`clip.userId = :userId`, { userId: ps.userId })
.andWhere('clip.userId = :userId', { userId: ps.userId })
.andWhere('clip.isPublic = true');
const clips = await query

View file

@ -1,9 +1,9 @@
import { IsNull } from 'typeorm';
import { Users, Followings, UserProfiles } from '@/models/index.js';
import { toPunyNullable } from '@/misc/convert-host.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { Users, Followings, UserProfiles } from '@/models/index.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { toPunyNullable } from '@/misc/convert-host.js';
import { IsNull } from 'typeorm';
export const meta = {
tags: ['users'],
@ -96,7 +96,7 @@ export default define(meta, paramDef, async (ps, me) => {
}
const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId)
.andWhere(`following.followeeId = :userId`, { userId: user.id })
.andWhere('following.followeeId = :userId', { userId: user.id })
.innerJoinAndSelect('following.follower', 'follower');
const followings = await query

View file

@ -1,9 +1,9 @@
import { IsNull } from 'typeorm';
import { Users, Followings, UserProfiles } from '@/models/index.js';
import { toPunyNullable } from '@/misc/convert-host.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { Users, Followings, UserProfiles } from '@/models/index.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { toPunyNullable } from '@/misc/convert-host.js';
import { IsNull } from 'typeorm';
export const meta = {
tags: ['users'],
@ -96,7 +96,7 @@ export default define(meta, paramDef, async (ps, me) => {
}
const query = makePaginationQuery(Followings.createQueryBuilder('following'), ps.sinceId, ps.untilId)
.andWhere(`following.followerId = :userId`, { userId: user.id })
.andWhere('following.followerId = :userId', { userId: user.id })
.innerJoinAndSelect('following.followee', 'followee');
const followings = await query

View file

@ -1,9 +1,9 @@
import define from '../../define.js';
import { Not, In, IsNull } from 'typeorm';
import { maximum } from '@/prelude/array.js';
import { Notes, Users } from '@/models/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { getUser } from '../../common/getters.js';
import { Not, In, IsNull } from 'typeorm';
import { Notes, Users } from '@/models/index.js';
export const meta = {
tags: ['users'],

View file

@ -1,8 +1,8 @@
import define from '../../../define.js';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { UserGroup } from '@/models/entities/user-group.js';
import { UserGroupJoining } from '@/models/entities/user-group-joining.js';
import define from '../../../define.js';
export const meta = {
tags: ['groups'],

View file

@ -1,6 +1,6 @@
import { UserGroups } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserGroups } from '@/models/index.js';
export const meta = {
tags: ['groups'],

View file

@ -1,8 +1,8 @@
import define from '../../../../define.js';
import { ApiError } from '../../../../error.js';
import { UserGroupJoinings, UserGroupInvitations } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { UserGroupJoining } from '@/models/entities/user-group-joining.js';
import { ApiError } from '../../../../error.js';
import define from '../../../../define.js';
export const meta = {
tags: ['groups', 'users'],

View file

@ -1,6 +1,6 @@
import { UserGroupInvitations } from '@/models/index.js';
import define from '../../../../define.js';
import { ApiError } from '../../../../error.js';
import { UserGroupInvitations } from '@/models/index.js';
export const meta = {
tags: ['groups', 'users'],

View file

@ -1,10 +1,10 @@
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getUser } from '../../../common/getters.js';
import { UserGroups, UserGroupJoinings, UserGroupInvitations } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { UserGroupInvitation } from '@/models/entities/user-group-invitation.js';
import { createNotification } from '@/services/create-notification.js';
import { getUser } from '../../../common/getters.js';
import { ApiError } from '../../../error.js';
import define from '../../../define.js';
export const meta = {
tags: ['groups', 'users'],

View file

@ -1,6 +1,6 @@
import define from '../../../define.js';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import { Not, In } from 'typeorm';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import define from '../../../define.js';
export const meta = {
tags: ['groups', 'account'],

View file

@ -1,6 +1,6 @@
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
export const meta = {
tags: ['groups', 'users'],

View file

@ -1,5 +1,5 @@
import define from '../../../define.js';
import { UserGroups } from '@/models/index.js';
import define from '../../../define.js';
export const meta = {
tags: ['groups', 'account'],

View file

@ -1,7 +1,7 @@
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getUser } from '../../../common/getters.js';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
export const meta = {
tags: ['groups', 'users'],

View file

@ -1,6 +1,6 @@
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
export const meta = {
tags: ['groups', 'account'],

View file

@ -1,7 +1,7 @@
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getUser } from '../../../common/getters.js';
import { UserGroups, UserGroupJoinings } from '@/models/index.js';
export const meta = {
tags: ['groups', 'users'],

View file

@ -1,6 +1,6 @@
import { UserGroups } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserGroups } from '@/models/index.js';
export const meta = {
tags: ['groups'],

View file

@ -1,7 +1,7 @@
import define from '../../../define.js';
import { UserLists } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { UserList } from '@/models/entities/user-list.js';
import define from '../../../define.js';
export const meta = {
tags: ['lists'],

View file

@ -1,6 +1,6 @@
import { UserLists } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserLists } from '@/models/index.js';
export const meta = {
tags: ['lists'],

View file

@ -1,5 +1,5 @@
import define from '../../../define.js';
import { UserLists } from '@/models/index.js';
import define from '../../../define.js';
export const meta = {
tags: ['lists', 'account'],

View file

@ -1,8 +1,8 @@
import { publishUserListStream } from '@/services/stream.js';
import { UserLists, UserListJoinings, Users } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getUser } from '../../../common/getters.js';
import { UserLists, UserListJoinings, Users } from '@/models/index.js';
export const meta = {
tags: ['lists', 'users'],

View file

@ -1,8 +1,8 @@
import { pushUserToUserList } from '@/services/user-list/push.js';
import { UserLists, UserListJoinings, Blockings } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { getUser } from '../../../common/getters.js';
import { pushUserToUserList } from '@/services/user-list/push.js';
import { UserLists, UserListJoinings, Blockings } from '@/models/index.js';
export const meta = {
tags: ['lists', 'users'],

View file

@ -1,6 +1,6 @@
import { UserLists } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserLists } from '@/models/index.js';
export const meta = {
tags: ['lists', 'account'],

View file

@ -1,6 +1,6 @@
import { UserLists } from '@/models/index.js';
import define from '../../../define.js';
import { ApiError } from '../../../error.js';
import { UserLists } from '@/models/index.js';
export const meta = {
tags: ['lists'],

View file

@ -1,11 +1,11 @@
import { Brackets } from 'typeorm';
import { Notes } from '@/models/index.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { getUser } from '../../common/getters.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { Notes } from '@/models/index.js';
import { generateMutedUserQuery } from '../../common/generate-muted-user-query.js';
import { Brackets } from 'typeorm';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedInstanceQuery } from '../../common/generate-muted-instance-query.js';

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { Pages } from '@/models/index.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
export const meta = {
@ -32,7 +32,7 @@ export const paramDef = {
// eslint-disable-next-line import/no-default-export
export default define(meta, paramDef, async (ps, user) => {
const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId)
.andWhere(`page.userId = :userId`, { userId: ps.userId })
.andWhere('page.userId = :userId', { userId: ps.userId })
.andWhere('page.visibility = \'public\'');
const pages = await query

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { NoteReactions, UserProfiles } from '@/models/index.js';
import define from '../../define.js';
import { makePaginationQuery } from '../../common/make-pagination-query.js';
import { generateVisibilityQuery } from '../../common/generate-visibility-query.js';
import { ApiError } from '../../error.js';
@ -53,7 +53,7 @@ export default define(meta, paramDef, async (ps, me) => {
const query = makePaginationQuery(NoteReactions.createQueryBuilder('reaction'),
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere(`reaction.userId = :userId`, { userId: ps.userId })
.andWhere('reaction.userId = :userId', { userId: ps.userId })
.leftJoinAndSelect('reaction.note', 'note');
generateVisibilityQuery(query, me);

View file

@ -1,6 +1,6 @@
import ms from 'ms';
import define from '../../define.js';
import { Users, Followings } from '@/models/index.js';
import define from '../../define.js';
import { generateMutedUserQueryForUsers } from '../../common/generate-muted-user-query.js';
import { generateBlockedUserQuery, generateBlockQueryForUsers } from '../../common/generate-block-query.js';

View file

@ -1,5 +1,5 @@
import define from '../../define.js';
import { Users } from '@/models/index.js';
import define from '../../define.js';
export const meta = {
tags: ['users'],

View file

@ -1,12 +1,12 @@
import * as sanitizeHtml from 'sanitize-html';
import define from '../../define.js';
import { publishAdminStream } from '@/services/stream.js';
import { ApiError } from '../../error.js';
import { getUser } from '../../common/getters.js';
import { AbuseUserReports, Users } from '@/models/index.js';
import { genId } from '@/misc/gen-id.js';
import { sendEmail } from '@/services/send-email.js';
import { fetchMeta } from '@/misc/fetch-meta.js';
import { getUser } from '../../common/getters.js';
import { ApiError } from '../../error.js';
import define from '../../define.js';
export const meta = {
tags: ['users'],

View file

@ -1,8 +1,8 @@
import define from '../../define.js';
import { Followings, Users } from '@/models/index.js';
import { Brackets } from 'typeorm';
import { Followings, Users } from '@/models/index.js';
import { USER_ACTIVE_THRESHOLD } from '@/const.js';
import { User } from '@/models/entities/user.js';
import define from '../../define.js';
export const meta = {
tags: ['users'],
@ -67,7 +67,7 @@ export default define(meta, paramDef, async (ps, me) => {
const query = Users.createQueryBuilder('user')
.where(`user.id IN (${ followingQuery.getQuery() })`)
.andWhere(`user.id != :meId`, { meId: me.id })
.andWhere('user.id != :meId', { meId: me.id })
.andWhere('user.isSuspended = FALSE')
.andWhere('user.usernameLower LIKE :username', { username: ps.username.toLowerCase() + '%' })
.andWhere(new Brackets(qb => { qb
@ -85,7 +85,7 @@ export default define(meta, paramDef, async (ps, me) => {
if (users.length < ps.limit) {
const otherQuery = await Users.createQueryBuilder('user')
.where(`user.id NOT IN (${ followingQuery.getQuery() })`)
.andWhere(`user.id != :meId`, { meId: me.id })
.andWhere('user.id != :meId', { meId: me.id })
.andWhere('user.isSuspended = FALSE')
.andWhere('user.usernameLower LIKE :username', { username: ps.username.toLowerCase() + '%' })
.andWhere('user.updatedAt IS NOT NULL');

View file

@ -1,7 +1,7 @@
import define from '../../define.js';
import { Brackets } from 'typeorm';
import { UserProfiles, Users } from '@/models/index.js';
import { User } from '@/models/entities/user.js';
import { Brackets } from 'typeorm';
import define from '../../define.js';
export const meta = {
tags: ['users'],
@ -27,7 +27,7 @@ export const paramDef = {
query: { type: 'string' },
offset: { type: 'integer', default: 0 },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
origin: { type: 'string', enum: ['local', 'remote', 'combined'], default: "combined" },
origin: { type: 'string', enum: ['local', 'remote', 'combined'], default: 'combined' },
detail: { type: 'boolean', default: true },
},
required: ['query'],
@ -113,7 +113,7 @@ export default define(meta, paramDef, async (ps, me) => {
.orderBy('user.updatedAt', 'DESC', 'NULLS LAST')
.take(ps.limit)
.skip(ps.offset)
.getMany()
.getMany(),
);
}
}

View file

@ -1,10 +1,10 @@
import { FindOptionsWhere, In, IsNull } from 'typeorm';
import { resolveUser } from '@/remote/resolve-user.js';
import { Users } from '@/models/index.js';
import { User } from '@/models/entities/user.js';
import define from '../../define.js';
import { apiLogger } from '../../logger.js';
import { ApiError } from '../../error.js';
import { Users } from '@/models/index.js';
import { FindOptionsWhere, In, IsNull } from 'typeorm';
import { User } from '@/models/entities/user.js';
export const meta = {
tags: ['users'],

View file

@ -1,7 +1,7 @@
import define from '../../define.js';
import { ApiError } from '../../error.js';
import { DriveFiles, Followings, NoteFavorites, NoteReactions, Notes, PageLikes, PollVotes, Users } from '@/models/index.js';
import { awaitAll } from '@/prelude/await-all.js';
import define from '../../define.js';
import { ApiError } from '../../error.js';
export const meta = {
tags: ['users'],

View file

@ -1,8 +1,8 @@
import Limiter from 'ratelimiter';
import { redisClient } from '../../db/redis.js';
import { IEndpointMeta } from './endpoints.js';
import { CacheableLocalUser, User } from '@/models/entities/user.js';
import Logger from '@/services/logger.js';
import { redisClient } from '../../db/redis.js';
import { IEndpointMeta } from './endpoints.js';
const logger = new Logger('limiter');