server: auto-fix lints

This commit is contained in:
Norm 2022-12-07 13:39:21 -05:00
parent 18664dbca3
commit b66f7550ab
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE
12 changed files with 14 additions and 15 deletions

View file

@ -153,7 +153,7 @@ async function spawnWorkers(clusterLimits: Required<Config['clusterLimits']>): P
bootLogger.info(`Starting ${total} workers...`); bootLogger.info(`Starting ${total} workers...`);
await Promise.all(workers.map(mode => spawnWorker(mode))); await Promise.all(workers.map(mode => spawnWorker(mode)));
bootLogger.succ(`All workers started`); bootLogger.succ('All workers started');
} }
function spawnWorker(mode: 'web' | 'queue'): Promise<void> { function spawnWorker(mode: 'web' | 'queue'): Promise<void> {

View file

@ -27,7 +27,7 @@ export async function skippedInstances(hosts: Array<Instance['host']>): Promise<
return skipped.concat( return skipped.concat(
await db.query( await db.query(
`SELECT host FROM instance WHERE ("isSuspended" OR "latestStatus" = 410 OR "lastCommunicatedAt" < $1::date) AND host = ANY(string_to_array($2, ','))`, 'SELECT host FROM instance WHERE ("isSuspended" OR "latestStatus" = 410 OR "lastCommunicatedAt" < $1::date) AND host = ANY(string_to_array($2, \',\'))',
[ [
deadTime.toISOString(), deadTime.toISOString(),
// don't check hosts again that we already know are suspended // don't check hosts again that we already know are suspended

View file

@ -45,5 +45,5 @@ export class AuthSession {
nullable: true, nullable: true,
comment: 'PKCE code_challenge value, if provided (OAuth only)', comment: 'PKCE code_challenge value, if provided (OAuth only)',
}) })
pkceChallenge: string | null; pkceChallenge: string | null;
} }

View file

@ -147,8 +147,8 @@ export default class DeliverManager {
// get (unique) list of hosts // get (unique) list of hosts
Array.from(new Set( Array.from(new Set(
Array.from(inboxes) Array.from(inboxes)
.map(inbox => new URL(inbox).host) .map(inbox => new URL(inbox).host),
)) )),
); );
// deliver // deliver

View file

@ -23,7 +23,7 @@ function authUserFromApId(uri: string): Promise<AuthUser | null> {
return uriPersonCache.fetch(uri) return uriPersonCache.fetch(uri)
.then(async user => { .then(async user => {
if (!user) return null; if (!user) return null;
let key = await publicKeyByUserIdCache.fetch(user.id); const key = await publicKeyByUserIdCache.fetch(user.id);
if (!key) return null; if (!key) return null;
return { user, key }; return { user, key };
}); });

View file

@ -23,8 +23,8 @@ import { StatusError } from '@/misc/fetch.js';
import { uriPersonCache } from '@/services/user-cache.js'; import { uriPersonCache } from '@/services/user-cache.js';
import { publishInternalEvent } from '@/services/stream.js'; import { publishInternalEvent } from '@/services/stream.js';
import { db } from '@/db/postgre.js'; import { db } from '@/db/postgre.js';
import { apLogger } from '../logger.js';
import { fromHtml } from '@/mfm/from-html.js'; import { fromHtml } from '@/mfm/from-html.js';
import { apLogger } from '../logger.js';
import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor } from '../type.js'; import { isCollectionOrOrderedCollection, isCollection, IActor, getApId, getOneApHrefNullable, IObject, isPropertyValue, getApType, isActor } from '../type.js';
import Resolver from '../resolver.js'; import Resolver from '../resolver.js';
import { extractApHashtags } from './tag.js'; import { extractApHashtags } from './tag.js';

View file

@ -127,5 +127,4 @@ export async function oauth(ctx: Koa.Context): void {
token_type: 'bearer', token_type: 'bearer',
scope: session.accessToken.permission.join(' '), scope: session.accessToken.permission.join(' '),
}; };
}
};

View file

@ -57,7 +57,7 @@ export const paramDef = {
minLength: 1, minLength: 1,
}, },
}, },
required: ['clientId'] required: ['clientId'],
}, { }, {
properties: { properties: {
appSecret: { type: 'string' }, appSecret: { type: 'string' },

View file

@ -1,5 +1,5 @@
import { MONTH } from '@/const.js';
import { Brackets } from 'typeorm'; import { Brackets } from 'typeorm';
import { MONTH } from '@/const.js';
import { Followings, Users } from '@/models/index.js'; import { Followings, Users } from '@/models/index.js';
import { User } from '@/models/entities/user.js'; import { User } from '@/models/entities/user.js';
import define from '../../define.js'; import define from '../../define.js';

View file

@ -1,10 +1,10 @@
import config from '@/config/index.js'; import config from '@/config/index.js';
import { kinds } from '@/misc/api-permissions.js';
import { I18n } from '@/misc/i18n.js';
import { errors as errorDefinitions } from '../error.js'; import { errors as errorDefinitions } from '../error.js';
import endpoints from '../endpoints.js'; import endpoints from '../endpoints.js';
import { schemas, convertSchemaToOpenApiSchema } from './schemas.js'; import { schemas, convertSchemaToOpenApiSchema } from './schemas.js';
import { httpCodes } from './http-codes.js'; import { httpCodes } from './http-codes.js';
import { kinds } from '@/misc/api-permissions.js';
import { I18n } from '@/misc/i18n.js';
const i18n = new I18n('en-US'); const i18n = new I18n('en-US');

View file

@ -68,7 +68,7 @@ export async function vote(user: CacheableUser, note: Note, choice: number): Pro
createNotification(note.userId, 'pollVote', { createNotification(note.userId, 'pollVote', {
notifierId: user.id, notifierId: user.id,
noteId: note.id, noteId: note.id,
choice: choice, choice,
}); });
} }

View file

@ -29,7 +29,7 @@ subscriber.on('message', async (_, data) => {
const user = await Users.findOneByOrFail({ id: body.id }); const user = await Users.findOneByOrFail({ id: body.id });
userByIdCache.set(user.id, user); userByIdCache.set(user.id, user);
for (const [k, v] of uriPersonCache.cache.entries()) { for (const [k, v] of uriPersonCache.cache.entries()) {
if (v.value?.id === user.id) { if (v.value.id === user.id) {
uriPersonCache.set(k, user); uriPersonCache.set(k, user);
} }
} }