Update dependencies 🚀

This commit is contained in:
syuilo
2019-11-24 17:09:32 +09:00
parent 50598bcefb
commit f7a328d66e
21 changed files with 837 additions and 517 deletions

View File

@ -1,5 +1,5 @@
import * as cluster from 'cluster';
import chalk from 'chalk';
import * as chalk from 'chalk';
import Xev from 'xev';
import Logger from '../services/logger';

View File

@ -1,6 +1,6 @@
import * as os from 'os';
import * as cluster from 'cluster';
import chalk from 'chalk';
import * as chalk from 'chalk';
import * as portscanner from 'portscanner';
import * as isRoot from 'is-root';

View File

@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as request from 'request';
import config from '../config';
import chalk from 'chalk';
import * as chalk from 'chalk';
import Logger from '../services/logger';
export async function downloadUrl(url: string, path: string) {

View File

@ -2,7 +2,7 @@ import webFinger from './webfinger';
import config from '../config';
import { createPerson, updatePerson } from './activitypub/models/person';
import { remoteLogger } from './logger';
import chalk from 'chalk';
import * as chalk from 'chalk';
import { User, IRemoteUser } from '../models/entities/user';
import { Users } from '../models';
import { toPuny } from '../misc/convert-host';

View File

@ -5,7 +5,7 @@ import authenticate from './authenticate';
import call from './call';
import { ApiError } from './error';
export default (endpoint: IEndpoint, ctx: Koa.BaseContext) => new Promise((res) => {
export default (endpoint: IEndpoint, ctx: Koa.Context) => new Promise((res) => {
const body = ctx.request.body;
const reply = (x?: any, y?: ApiError) => {

View File

@ -6,7 +6,7 @@ import { Signins } from '../../../models';
import { genId } from '../../../misc/gen-id';
import { publishMainStream } from '../../../services/stream';
export default function(ctx: Koa.BaseContext, user: ILocalUser, redirect = false) {
export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) {
if (redirect) {
//#region Cookie
const expires = 1000 * 60 * 60 * 24 * 365; // One Year

View File

@ -10,7 +10,7 @@ import { ensure } from '../../../prelude/ensure';
import { verifyLogin, hash } from '../2fa';
import { randomBytes } from 'crypto';
export default async (ctx: Koa.BaseContext) => {
export default async (ctx: Koa.Context) => {
ctx.set('Access-Control-Allow-Origin', config.url);
ctx.set('Access-Control-Allow-Credentials', 'true');

View File

@ -15,8 +15,8 @@ import { UserProfile } from '../../../models/entities/user-profile';
import { getConnection } from 'typeorm';
import { UsedUsername } from '../../../models/entities/used-username';
export default async (ctx: Koa.BaseContext) => {
const body = ctx.request.body as any;
export default async (ctx: Koa.Context) => {
const body = ctx.request.body;
const instance = await fetchMeta(true);

View File

@ -12,11 +12,11 @@ import { Users, UserProfiles } from '../../../models';
import { ILocalUser } from '../../../models/entities/user';
import { ensure } from '../../../prelude/ensure';
function getUserToken(ctx: Koa.BaseContext) {
function getUserToken(ctx: Koa.Context) {
return ((ctx.headers['cookie'] || '').match(/i=(\w+)/) || [null, null])[1];
}
function compareOrigin(ctx: Koa.BaseContext) {
function compareOrigin(ctx: Koa.Context) {
function normalizeUrl(url: string) {
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';
}

View File

@ -12,11 +12,11 @@ import { Users, UserProfiles } from '../../../models';
import { ILocalUser } from '../../../models/entities/user';
import { ensure } from '../../../prelude/ensure';
function getUserToken(ctx: Koa.BaseContext) {
function getUserToken(ctx: Koa.Context) {
return ((ctx.headers['cookie'] || '').match(/i=(\w+)/) || [null, null])[1];
}
function compareOrigin(ctx: Koa.BaseContext) {
function compareOrigin(ctx: Koa.Context) {
function normalizeUrl(url: string) {
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';
}

View File

@ -11,11 +11,11 @@ import { Users, UserProfiles } from '../../../models';
import { ILocalUser } from '../../../models/entities/user';
import { ensure } from '../../../prelude/ensure';
function getUserToken(ctx: Koa.BaseContext) {
function getUserToken(ctx: Koa.Context) {
return ((ctx.headers['cookie'] || '').match(/i=(\w+)/) || [null, null])[1];
}
function compareOrigin(ctx: Koa.BaseContext) {
function compareOrigin(ctx: Koa.Context) {
function normalizeUrl(url: string) {
return url.endsWith('/') ? url.substr(0, url.length - 1) : url;
}

View File

@ -8,12 +8,12 @@ import { InternalStorage } from '../../services/drive/internal-storage';
const assets = `${__dirname}/../../server/file/assets/`;
const commonReadableHandlerGenerator = (ctx: Koa.BaseContext) => (e: Error): void => {
const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void => {
serverLogger.error(e);
ctx.status = 500;
};
export default async function(ctx: Koa.BaseContext) {
export default async function(ctx: Koa.Context) {
const key = ctx.params.key;
// Fetch drive file

View File

@ -6,7 +6,7 @@ import { createTemp } from '../../misc/create-temp';
import { downloadUrl } from '../../misc/donwload-url';
import { detectMine } from '../../misc/detect-mine';
export async function proxyMedia(ctx: Koa.BaseContext) {
export async function proxyMedia(ctx: Koa.Context) {
const url = 'url' in ctx.query ? ctx.query.url : 'https://' + ctx.params.url;
// Create temp file

View File

@ -2,7 +2,7 @@ import * as Koa from 'koa';
import * as manifest from '../../client/assets/manifest.json';
import { fetchMeta } from '../../misc/fetch-meta';
module.exports = async (ctx: Koa.BaseContext) => {
module.exports = async (ctx: Koa.Context) => {
const json = JSON.parse(JSON.stringify(manifest));
const instance = await fetchMeta(true);

View File

@ -8,7 +8,7 @@ import { query } from '../../prelude/url';
const logger = new Logger('url-preview');
module.exports = async (ctx: Koa.BaseContext) => {
module.exports = async (ctx: Koa.Context) => {
const meta = await fetchMeta();
logger.info(meta.summalyProxy

View File

@ -1,6 +1,6 @@
import * as cluster from 'cluster';
import * as os from 'os';
import chalk from 'chalk';
import * as chalk from 'chalk';
import * as dateformat from 'dateformat';
import { program } from '../argv';
import { getRepository } from 'typeorm';