1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-24 15:16:30 +09:00

fix types

This commit is contained in:
syuilo 2022-04-03 16:30:22 +09:00
parent 41c2aed7dc
commit 91f4ec3747
4 changed files with 12 additions and 8 deletions

View File

@ -42,7 +42,8 @@ async function getCaptchaResponse(url: string, secret: string, response: string)
headers: { headers: {
'User-Agent': config.userAgent, 'User-Agent': config.userAgent,
}, },
timeout: 10 * 1000, // TODO
//timeout: 10 * 1000,
agent: getAgentByUrl, agent: getAgentByUrl,
}).catch(e => { }).catch(e => {
throw `${e.message || e}`; throw `${e.message || e}`;

View File

@ -113,7 +113,8 @@ export class LdSignature {
headers: { headers: {
Accept: 'application/ld+json, application/json', Accept: 'application/ld+json, application/json',
}, },
timeout: this.loderTimeout, // TODO
//timeout: this.loderTimeout,
agent: u => u.protocol === 'http:' ? httpAgent : httpsAgent, agent: u => u.protocol === 'http:' ? httpAgent : httpsAgent,
}).then(res => { }).then(res => {
if (!res.ok) { if (!res.ok) {

View File

@ -75,7 +75,8 @@ export default define(meta, paramDef, async (ps, user) => {
Accept: 'application/json, */*', Accept: 'application/json, */*',
}, },
body: params, body: params,
timeout: 10000, // TODO
//timeout: 10000,
agent: getAgentByUrl, agent: getAgentByUrl,
}); });

View File

@ -97,7 +97,7 @@ async function fetchNodeinfo(instance: Instance): Promise<NodeInfo> {
} else { } else {
throw e.statusCode || e.message; throw e.statusCode || e.message;
} }
}); }) as Record<string, unknown>;
if (wellknown.links == null || !Array.isArray(wellknown.links)) { if (wellknown.links == null || !Array.isArray(wellknown.links)) {
throw 'No wellknown links'; throw 'No wellknown links';
@ -121,7 +121,7 @@ async function fetchNodeinfo(instance: Instance): Promise<NodeInfo> {
logger.succ(`Successfuly fetched nodeinfo of ${instance.host}`); logger.succ(`Successfuly fetched nodeinfo of ${instance.host}`);
return info; return info as NodeInfo;
} catch (e) { } catch (e) {
logger.error(`Failed to fetch nodeinfo of ${instance.host}: ${e}`); logger.error(`Failed to fetch nodeinfo of ${instance.host}: ${e}`);
@ -142,12 +142,12 @@ async function fetchDom(instance: Instance): Promise<DOMWindow['document']> {
return doc; return doc;
} }
async function fetchManifest(instance: Instance): Promise<Record<string, any> | null> { async function fetchManifest(instance: Instance): Promise<Record<string, unknown> | null> {
const url = 'https://' + instance.host; const url = 'https://' + instance.host;
const manifestUrl = url + '/manifest.json'; const manifestUrl = url + '/manifest.json';
const manifest = await getJson(manifestUrl); const manifest = await getJson(manifestUrl) as Record<string, unknown>;
return manifest; return manifest;
} }
@ -167,7 +167,8 @@ async function fetchFaviconUrl(instance: Instance, doc: DOMWindow['document'] |
const faviconUrl = url + '/favicon.ico'; const faviconUrl = url + '/favicon.ico';
const favicon = await fetch(faviconUrl, { const favicon = await fetch(faviconUrl, {
timeout: 10000, // TODO
//timeout: 10000,
agent: getAgentByUrl, agent: getAgentByUrl,
}); });