remove more default exports

This commit is contained in:
Johann150 2023-05-19 23:08:06 +02:00
parent b0d8e15796
commit 2c3f731ae2
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
9 changed files with 10 additions and 12 deletions

View file

@ -1,7 +1,7 @@
import Koa from 'koa'; import Koa from 'koa';
import { IEndpoint } from './endpoints.js'; import { IEndpoint } from './endpoints.js';
import authenticate, { AuthenticationError } from './authenticate.js'; import { authenticate, AuthenticationError } from './authenticate.js';
import call from './call.js'; import call from './call.js';
import { ApiError } from './error.js'; import { ApiError } from './error.js';

View file

@ -11,7 +11,7 @@ export class AuthenticationError extends Error {
} }
} }
export default async (authorization: string | null | undefined, bodyToken: string | null | undefined): Promise<[ILocalUser | null | undefined, AccessToken | null | undefined]> => { export async function authenticate(authorization: string | null | undefined, bodyToken: string | null | undefined): Promise<[ILocalUser | null | undefined, AccessToken | null | undefined]> {
let maybeToken: string | null = null; let maybeToken: string | null = null;
// check if there is an authorization header set // check if there is an authorization header set
@ -66,4 +66,4 @@ export default async (authorization: string | null | undefined, bodyToken: strin
return [user, accessToken]; return [user, accessToken];
} }
}; }

View file

@ -4,7 +4,7 @@ import { ILocalUser } from '@/models/entities/user.js';
import { AccessToken } from '@/models/entities/access-token.js'; import { AccessToken } from '@/models/entities/access-token.js';
import { getIpHash } from '@/misc/get-ip-hash.js'; import { getIpHash } from '@/misc/get-ip-hash.js';
import { limiter } from './limiter.js'; import { limiter } from './limiter.js';
import endpoints, { IEndpointMeta } from './endpoints.js'; import { endpoints, IEndpointMeta } from './endpoints.js';
import { ApiError } from './error.js'; import { ApiError } from './error.js';
import { apiLogger } from './logger.js'; import { apiLogger } from './logger.js';

View file

@ -713,7 +713,7 @@ export interface IEndpoint {
params: Schema; params: Schema;
} }
const endpoints: IEndpoint[] = eps.map(([name, ep]) => { export const endpoints: IEndpoint[] = eps.map(([name, ep]) => {
return { return {
name, name,
exec: ep.default, exec: ep.default,
@ -721,5 +721,3 @@ const endpoints: IEndpoint[] = eps.map(([name, ep]) => {
params: ep.paramDef, params: ep.paramDef,
}; };
}); });
export default endpoints;

View file

@ -1,5 +1,5 @@
import define from '@/server/api/define.js'; import define from '@/server/api/define.js';
import endpoints from '@/server/api/endpoints.js'; import { endpoints } from '@/server/api/endpoints.js';
export const meta = { export const meta = {
requireCredential: false, requireCredential: false,

View file

@ -1,5 +1,5 @@
import define from '@/server/api/define.js'; import define from '@/server/api/define.js';
import endpoints from '@/server/api/endpoints.js'; import { endpoints } from '@/server/api/endpoints.js';
export const meta = { export const meta = {
requireCredential: false, requireCredential: false,

View file

@ -10,7 +10,7 @@ import cors from '@koa/cors';
import { Instances, AccessTokens, Users } from '@/models/index.js'; import { Instances, AccessTokens, Users } from '@/models/index.js';
import config from '@/config/index.js'; import config from '@/config/index.js';
import endpoints from './endpoints.js'; import { endpoints } from './endpoints.js';
import { handler } from './api-handler.js'; import { handler } from './api-handler.js';
import signup from './private/signup.js'; import signup from './private/signup.js';
import signin from './private/signin.js'; import signin from './private/signin.js';

View file

@ -2,7 +2,7 @@ import config from '@/config/index.js';
import { kinds } from '@/misc/api-permissions.js'; import { kinds } from '@/misc/api-permissions.js';
import { I18n } from '@/misc/i18n.js'; import { I18n } from '@/misc/i18n.js';
import { errors as errorDefinitions } from '@/server/api/error.js'; import { errors as errorDefinitions } from '@/server/api/error.js';
import endpoints from '@/server/api/endpoints.js'; import { endpoints } from '@/server/api/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';

View file

@ -6,7 +6,7 @@ import { SECOND, MINUTE } from '@/const.js';
import { subscriber as redisClient } from '@/db/redis.js'; import { subscriber as redisClient } from '@/db/redis.js';
import { Users } from '@/models/index.js'; import { Users } from '@/models/index.js';
import { Connection } from './stream/index.js'; import { Connection } from './stream/index.js';
import authenticate from './authenticate.js'; import { authenticate } from './authenticate.js';
export const initializeStreamingServer = (server: http.Server): void => { export const initializeStreamingServer = (server: http.Server): void => {
// Init websocket server // Init websocket server