Refactor (#7394)
* wip * wip * wip * wip * wip * Update define.ts * Update update.ts * Update user.ts * wip * wip * Update request.ts * URL * wip * wip * wip * wip * Update invite.ts * Update create.ts
This commit is contained in:
parent
62cc14c93b
commit
ce340aba7a
109 changed files with 252 additions and 201 deletions
|
|
@ -4,14 +4,14 @@ import { sign } from 'http-signature';
|
|||
import * as crypto from 'crypto';
|
||||
|
||||
import config from '@/config';
|
||||
import { ILocalUser } from '../../models/entities/user';
|
||||
import { User } from '@/models/entities/user';
|
||||
import { getAgentByUrl } from '@/misc/fetch';
|
||||
import { URL } from 'url';
|
||||
import got from 'got';
|
||||
import * as Got from 'got';
|
||||
import { getUserKeypair } from '@/misc/keypair-store';
|
||||
|
||||
export default async (user: ILocalUser, url: string, object: any) => {
|
||||
export default async (user: { id: User['id'] }, url: string, object: any) => {
|
||||
const timeout = 10 * 1000;
|
||||
|
||||
const { protocol, hostname, port, pathname, search } = new URL(url);
|
||||
|
|
@ -24,7 +24,7 @@ export default async (user: ILocalUser, url: string, object: any) => {
|
|||
|
||||
const keypair = await getUserKeypair(user.id);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const req = https.request({
|
||||
agent: getAgentByUrl(new URL(`https://example.net`)),
|
||||
protocol,
|
||||
|
|
@ -69,7 +69,7 @@ export default async (user: ILocalUser, url: string, object: any) => {
|
|||
* @param user http-signature user
|
||||
* @param url URL to fetch
|
||||
*/
|
||||
export async function signedGet(url: string, user: ILocalUser) {
|
||||
export async function signedGet(url: string, user: { id: User['id'] }) {
|
||||
const timeout = 10 * 1000;
|
||||
|
||||
const keypair = await getUserKeypair(user.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue