forked from FoundKeyGang/FoundKey
remove more default exports
This commit is contained in:
parent
b0d8e15796
commit
2c3f731ae2
9 changed files with 10 additions and 12 deletions
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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];
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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';
|
||||||
|
|
|
@ -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';
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue