ActivityPubでリモートのオブジェクトをGETするときのリクエストをHTTP Signatureで署名するオプション (#6731)

* Sign ActivityPub GET

* Fix v12, v12.48.0 UI bug
This commit is contained in:
MeiMei
2020-10-18 01:46:40 +09:00
committed by GitHub
parent ba3c62bf9c
commit 85a0f696bc
10 changed files with 298 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import fetch, { HeadersInit } from 'node-fetch';
import { HttpProxyAgent } from 'http-proxy-agent';
import { HttpsProxyAgent } from 'https-proxy-agent';
import config from '../config';
import { URL } from 'url';
export async function getJson(url: string, accept = 'application/json, */*', timeout = 10000, headers?: HeadersInit) {
const res = await fetch(url, {
@ -69,14 +70,14 @@ const _https = new https.Agent({
* Get http proxy or non-proxy agent
*/
export const httpAgent = config.proxy
? new HttpProxyAgent(config.proxy)
? new HttpProxyAgent(config.proxy) as unknown as http.Agent
: _http;
/**
* Get https proxy or non-proxy agent
*/
export const httpsAgent = config.proxy
? new HttpsProxyAgent(config.proxy)
? new HttpsProxyAgent(config.proxy) as unknown as https.Agent
: _https;
/**