Fix types

This commit is contained in:
syuilo
2019-01-22 21:42:05 +09:00
parent 97e8ac1d27
commit 8bf9e87117
11 changed files with 20 additions and 20 deletions

View File

@ -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) => {

View File

@ -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

View File

@ -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');

View File

@ -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();

View File

@ -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 : '';
}

View File

@ -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 : '';
}

View File

@ -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;
}