remove more default exports

This commit is contained in:
Johann150 2023-05-19 23:08:06 +02:00
parent b0d8e15796
commit 2c3f731ae2
Signed by: 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 { IEndpoint } from './endpoints.js';
import authenticate, { AuthenticationError } from './authenticate.js';
import { authenticate, AuthenticationError } from './authenticate.js';
import call from './call.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;
// check if there is an authorization header set
@ -66,4 +66,4 @@ export default async (authorization: string | null | undefined, bodyToken: strin
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 { getIpHash } from '@/misc/get-ip-hash.js';
import { limiter } from './limiter.js';
import endpoints, { IEndpointMeta } from './endpoints.js';
import { endpoints, IEndpointMeta } from './endpoints.js';
import { ApiError } from './error.js';
import { apiLogger } from './logger.js';

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ import cors from '@koa/cors';
import { Instances, AccessTokens, Users } from '@/models/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 signup from './private/signup.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 { I18n } from '@/misc/i18n.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 { 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 { Users } from '@/models/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 => {
// Init websocket server