Fix types
This commit is contained in:
@ -6,7 +6,7 @@ import call from './call';
|
||||
import { IUser } from '../../models/user';
|
||||
import { IApp } from '../../models/app';
|
||||
|
||||
export default async (endpoint: IEndpoint, ctx: Koa.Context) => {
|
||||
export default async (endpoint: IEndpoint, ctx: Koa.BaseContext) => {
|
||||
const body = ctx.is('multipart/form-data') ? (ctx.req as any).body : ctx.request.body;
|
||||
|
||||
const reply = (x?: any, y?: any) => {
|
||||
|
@ -3,7 +3,7 @@ import * as Koa from 'koa';
|
||||
import config from '../../../config';
|
||||
import { ILocalUser } from '../../../models/user';
|
||||
|
||||
export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) {
|
||||
export default function(ctx: Koa.BaseContext, user: ILocalUser, redirect = false) {
|
||||
if (redirect) {
|
||||
//#region Cookie
|
||||
const expires = 1000 * 60 * 60 * 24 * 365; // One Year
|
||||
|
@ -7,7 +7,7 @@ import { publishMainStream } from '../../../stream';
|
||||
import signin from '../common/signin';
|
||||
import config from '../../../config';
|
||||
|
||||
export default async (ctx: Koa.Context) => {
|
||||
export default async (ctx: Koa.BaseContext) => {
|
||||
ctx.set('Access-Control-Allow-Origin', config.url);
|
||||
ctx.set('Access-Control-Allow-Credentials', 'true');
|
||||
|
||||
|
@ -9,7 +9,7 @@ import RegistrationTicket from '../../../models/registration-tickets';
|
||||
import usersChart from '../../../chart/users';
|
||||
import fetchMeta from '../../../misc/fetch-meta';
|
||||
|
||||
export default async (ctx: Koa.Context) => {
|
||||
export default async (ctx: Koa.BaseContext) => {
|
||||
const body = ctx.request.body as any;
|
||||
|
||||
const instance = await fetchMeta();
|
||||
|
@ -10,11 +10,11 @@ import uuid = require('uuid');
|
||||
import signin from '../common/signin';
|
||||
import fetchMeta from '../../../misc/fetch-meta';
|
||||
|
||||
function getUserToken(ctx: Koa.Context) {
|
||||
function getUserToken(ctx: Koa.BaseContext) {
|
||||
return ((ctx.headers['cookie'] || '').match(/i=(!\w+)/) || [null, null])[1];
|
||||
}
|
||||
|
||||
function compareOrigin(ctx: Koa.Context) {
|
||||
function compareOrigin(ctx: Koa.BaseContext) {
|
||||
function normalizeUrl(url: string) {
|
||||
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ import uuid = require('uuid');
|
||||
import signin from '../common/signin';
|
||||
import fetchMeta from '../../../misc/fetch-meta';
|
||||
|
||||
function getUserToken(ctx: Koa.Context) {
|
||||
function getUserToken(ctx: Koa.BaseContext) {
|
||||
return ((ctx.headers['cookie'] || '').match(/i=(!\w+)/) || [null, null])[1];
|
||||
}
|
||||
|
||||
function compareOrigin(ctx: Koa.Context) {
|
||||
function compareOrigin(ctx: Koa.BaseContext) {
|
||||
function normalizeUrl(url: string) {
|
||||
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ import config from '../../../config';
|
||||
import signin from '../common/signin';
|
||||
import fetchMeta from '../../../misc/fetch-meta';
|
||||
|
||||
function getUserToken(ctx: Koa.Context) {
|
||||
function getUserToken(ctx: Koa.BaseContext) {
|
||||
return ((ctx.headers['cookie'] || '').match(/i=(!\w+)/) || [null, null])[1];
|
||||
}
|
||||
|
||||
function compareOrigin(ctx: Koa.Context) {
|
||||
function compareOrigin(ctx: Koa.BaseContext) {
|
||||
function normalizeUrl(url: string) {
|
||||
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
|
||||
}
|
||||
|
Reference in New Issue
Block a user