Update dependencies 🚀
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import * as json from 'koa-json-body';
|
||||
import * as httpSignature from 'http-signature';
|
||||
|
||||
@ -23,7 +23,7 @@ const router = new Router();
|
||||
|
||||
//#region Routing
|
||||
|
||||
function inbox(ctx: Router.IRouterContext) {
|
||||
function inbox(ctx: Router.RouterContext) {
|
||||
let signature;
|
||||
|
||||
ctx.req.headers.authorization = `Signature ${ctx.req.headers.signature}`;
|
||||
@ -40,13 +40,13 @@ function inbox(ctx: Router.IRouterContext) {
|
||||
ctx.status = 202;
|
||||
}
|
||||
|
||||
function isActivityPubReq(ctx: Router.IRouterContext) {
|
||||
function isActivityPubReq(ctx: Router.RouterContext) {
|
||||
ctx.response.vary('Accept');
|
||||
const accepted = ctx.accepts('html', 'application/activity+json', 'application/ld+json');
|
||||
return ['application/activity+json', 'application/ld+json'].includes(accepted as string);
|
||||
}
|
||||
|
||||
export function setResponseType(ctx: Router.IRouterContext) {
|
||||
export function setResponseType(ctx: Router.RouterContext) {
|
||||
const accpet = ctx.accepts('application/activity+json', 'application/ld+json');
|
||||
if (accpet === 'application/ld+json') {
|
||||
ctx.response.type = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"; charset=utf-8';
|
||||
@ -146,7 +146,7 @@ router.get('/users/:user/publickey', async ctx => {
|
||||
});
|
||||
|
||||
// user
|
||||
async function userInfo(ctx: Router.IRouterContext, user: User | undefined) {
|
||||
async function userInfo(ctx: Router.RouterContext, user: User | undefined) {
|
||||
if (user == null) {
|
||||
ctx.status = 404;
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import config from '../../config';
|
||||
import { renderActivity } from '../../remote/activitypub/renderer';
|
||||
import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-collection';
|
||||
@ -7,7 +7,7 @@ import renderNote from '../../remote/activitypub/renderer/note';
|
||||
import { Users, Notes, UserNotePinings } from '../../models';
|
||||
import { ensure } from '../../prelude/ensure';
|
||||
|
||||
export default async (ctx: Router.IRouterContext) => {
|
||||
export default async (ctx: Router.RouterContext) => {
|
||||
const userId = ctx.params.user;
|
||||
|
||||
// Verify user
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import config from '../../config';
|
||||
import $ from 'cafy';
|
||||
import { ID } from '../../misc/cafy-id';
|
||||
@ -11,7 +11,7 @@ import { setResponseType } from '../activitypub';
|
||||
import { Users, Followings } from '../../models';
|
||||
import { LessThan } from 'typeorm';
|
||||
|
||||
export default async (ctx: Router.IRouterContext) => {
|
||||
export default async (ctx: Router.RouterContext) => {
|
||||
const userId = ctx.params.user;
|
||||
|
||||
// Get 'cursor' parameter
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import config from '../../config';
|
||||
import $ from 'cafy';
|
||||
import { ID } from '../../misc/cafy-id';
|
||||
@ -12,7 +12,7 @@ import { Users, Followings } from '../../models';
|
||||
import { LessThan, FindConditions } from 'typeorm';
|
||||
import { Following } from '../../models/entities/following';
|
||||
|
||||
export default async (ctx: Router.IRouterContext) => {
|
||||
export default async (ctx: Router.RouterContext) => {
|
||||
const userId = ctx.params.user;
|
||||
|
||||
// Get 'cursor' parameter
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import config from '../../config';
|
||||
import $ from 'cafy';
|
||||
import { ID } from '../../misc/cafy-id';
|
||||
@ -17,7 +17,7 @@ import { Brackets } from 'typeorm';
|
||||
import { Note } from '../../models/entities/note';
|
||||
import { ensure } from '../../prelude/ensure';
|
||||
|
||||
export default async (ctx: Router.IRouterContext) => {
|
||||
export default async (ctx: Router.RouterContext) => {
|
||||
const userId = ctx.params.user;
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
|
@ -6,7 +6,7 @@ import call from './call';
|
||||
import { ApiError } from './error';
|
||||
|
||||
export default (endpoint: IEndpoint, ctx: Koa.BaseContext) => new Promise((res) => {
|
||||
const body = ctx.is('multipart/form-data') ? (ctx.req as any).body : ctx.request.body;
|
||||
const body = ctx.request.body;
|
||||
|
||||
const reply = (x?: any, y?: ApiError) => {
|
||||
if (x == null) {
|
||||
@ -31,7 +31,7 @@ export default (endpoint: IEndpoint, ctx: Koa.BaseContext) => new Promise((res)
|
||||
// Authentication
|
||||
authenticate(body['i']).then(([user, app]) => {
|
||||
// API invoking
|
||||
call(endpoint.name, user, app, body, (ctx.req as any).file).then((res: any) => {
|
||||
call(endpoint.name, user, app, body, (ctx as any).file).then((res: any) => {
|
||||
reply(res);
|
||||
}).catch((e: ApiError) => {
|
||||
reply(e.httpStatusCode ? e.httpStatusCode : e.kind == 'client' ? 400 : 500, e);
|
||||
|
@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import * as Koa from 'koa';
|
||||
import * as Router from 'koa-router';
|
||||
import * as multer from 'koa-multer';
|
||||
import * as Router from '@koa/router';
|
||||
import * as multer from '@koa/multer';
|
||||
import * as bodyParser from 'koa-bodyparser';
|
||||
import * as cors from '@koa/cors';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as Koa from 'koa';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import * as request from 'request';
|
||||
import { OAuth2 } from 'oauth';
|
||||
import config from '../../../config';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as Koa from 'koa';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import * as request from 'request';
|
||||
import { OAuth2 } from 'oauth';
|
||||
import config from '../../../config';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as Koa from 'koa';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import autwh from 'autwh';
|
||||
import redis from '../../../db/redis';
|
||||
|
@ -5,7 +5,7 @@
|
||||
import * as fs from 'fs';
|
||||
import * as Koa from 'koa';
|
||||
import * as cors from '@koa/cors';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import sendDriveFile from './send-drive-file';
|
||||
|
||||
// Init app
|
||||
|
@ -8,7 +8,7 @@ import * as http2 from 'http2';
|
||||
import * as https from 'https';
|
||||
import * as zlib from 'zlib';
|
||||
import * as Koa from 'koa';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import * as mount from 'koa-mount';
|
||||
import * as compress from 'koa-compress';
|
||||
import * as koaLogger from 'koa-logger';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import config from '../config';
|
||||
import { fetchMeta } from '../misc/fetch-meta';
|
||||
// import User from '../models/user';
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
import * as Koa from 'koa';
|
||||
import * as cors from '@koa/cors';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import { proxyMedia } from './proxy-media';
|
||||
|
||||
// Init app
|
||||
|
@ -7,7 +7,7 @@ import * as path from 'path';
|
||||
import * as showdown from 'showdown';
|
||||
import 'showdown-highlightjs-extension';
|
||||
import ms = require('ms');
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import * as send from 'koa-send';
|
||||
import * as glob from 'glob';
|
||||
import config from '../../config';
|
||||
|
@ -5,7 +5,7 @@
|
||||
import * as os from 'os';
|
||||
import ms = require('ms');
|
||||
import * as Koa from 'koa';
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
import * as send from 'koa-send';
|
||||
import * as favicon from 'koa-favicon';
|
||||
import * as views from 'koa-views';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as Router from 'koa-router';
|
||||
import * as Router from '@koa/router';
|
||||
|
||||
import config from '../config';
|
||||
import parseAcct from '../misc/acct/parse';
|
||||
|
Reference in New Issue
Block a user