UndiciFetcherクラスを追加 (仮コミット, ビルドもstartもさせていない)

This commit is contained in:
tamaina 2023-01-03 12:37:00 +00:00
parent badca16d2a
commit 81bf00333d
12 changed files with 275 additions and 249 deletions

View File

@ -4,7 +4,6 @@ import type { UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService } from '@/core/HttpRequestService.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import { fetch } from 'undici';
type CaptchaResponse = { type CaptchaResponse = {
success: boolean; success: boolean;
@ -28,16 +27,20 @@ export class CaptchaService {
response, response,
}); });
const res = await fetch(url, { const res = await this.httpRequestService.fetch(
method: 'POST', url,
body: params, {
headers: { method: 'POST',
'User-Agent': this.config.userAgent, body: params,
headers: {
'User-Agent': this.config.userAgent,
},
}, },
// TODO {
//timeout: 10 * 1000, noOkError: true,
dispatcher: this.httpRequestService.getAgentByUrl(new URL(url)), bypassProxy: true,
}).catch(err => { }
).catch(err => {
throw `${err.message ?? err}`; throw `${err.message ?? err}`;
}); });

View File

@ -8,11 +8,12 @@ import got, * as Got from 'got';
import chalk from 'chalk'; import chalk from 'chalk';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
import { HttpRequestService } from '@/core/HttpRequestService.js'; import { HttpRequestService, UndiciFetcher } from '@/core/HttpRequestService.js';
import { createTemp } from '@/misc/create-temp.js'; import { createTemp } from '@/misc/create-temp.js';
import { StatusError } from '@/misc/status-error.js'; import { StatusError } from '@/misc/status-error.js';
import { LoggerService } from '@/core/LoggerService.js'; import { LoggerService } from '@/core/LoggerService.js';
import type Logger from '@/logger.js'; import type Logger from '@/logger.js';
import { buildConnector } from 'undici';
const pipeline = util.promisify(stream.pipeline); const pipeline = util.promisify(stream.pipeline);
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
@ -20,6 +21,7 @@ import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class DownloadService { export class DownloadService {
private logger: Logger; private logger: Logger;
private undiciFetcher: UndiciFetcher:;
constructor( constructor(
@Inject(DI.config) @Inject(DI.config)
@ -29,6 +31,16 @@ export class DownloadService {
private loggerService: LoggerService, private loggerService: LoggerService,
) { ) {
this.logger = this.loggerService.getLogger('download'); this.logger = this.loggerService.getLogger('download');
this.undiciFetcher = new UndiciFetcher(this.httpRequestService.getStandardUndiciFetcherConstructorOption({
connect: this.httpRequestService.getConnectorWithIpCheck(
buildConnector({
...this.httpRequestService.clientDefaults.connect,
}),
this.isPrivateIp
),
bodyTimeout: 30 * 1000,
}));
} }
@bindThis @bindThis
@ -39,21 +51,15 @@ export class DownloadService {
const operationTimeout = 60 * 1000; const operationTimeout = 60 * 1000;
const maxSize = this.config.maxFileSize ?? 262144000; const maxSize = this.config.maxFileSize ?? 262144000;
const response = await this.httpRequestService.fetch({ const response = await this.undiciFetcher.fetch(
method: 'GET',
url, url,
headers: { {
'User-Agent': this.config.userAgent, method: 'GET',
}, headers: {
timeout, 'User-Agent': this.config.userAgent,
size: maxSize, },
ipCheckers: }
(process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test') && );
!this.config.proxy ?
[{ type: 'black', fn: this.isPrivateIp }] :
undefined,
// http2: false, // default
});
if (response.body === null) { if (response.body === null) {
throw new StatusError('No body', 400, 'No body'); throw new StatusError('No body', 400, 'No body');

View File

@ -190,9 +190,7 @@ export class FetchInstanceMetadataService {
const faviconUrl = url + '/favicon.ico'; const faviconUrl = url + '/favicon.ico';
const favicon = await this.httpRequestService.fetch({ const favicon = await this.httpRequestService.fetch(faviconUrl, {}, { noOkError: true, bypassProxy: false });
url: faviconUrl,
});
if (favicon.ok) { if (favicon.ok) {
return faviconUrl; return faviconUrl;

View File

@ -9,23 +9,123 @@ import { StatusError } from '@/misc/status-error.js';
import { bindThis } from '@/decorators.js'; import { bindThis } from '@/decorators.js';
import * as undici from 'undici'; import * as undici from 'undici';
import { LookupFunction } from 'node:net'; import { LookupFunction } from 'node:net';
import { TransformStream } from 'node:stream/web';
import * as dns from 'node:dns';
// true to allow, false to deny
export type IpChecker = (ip: string) => boolean; export type IpChecker = (ip: string) => boolean;
@Injectable() /*
export class HttpRequestService { * Child class to create and save Agent for fetch.
* You should construct this when you want
* to change timeout, size limit, socket connect function, etc.
*/
export class UndiciFetcher {
/** /**
* Get http non-proxy agent (undici) * Get http non-proxy agent (undici)
*/ */
private nonProxiedAgent: undici.Agent; public nonProxiedAgent: undici.Agent;
/** /**
* Get http proxy or non-proxy agent (undici) * Get http proxy or non-proxy agent (undici)
*/ */
public agent: undici.ProxyAgent | undici.Agent; public agent: undici.ProxyAgent | undici.Agent;
private proxyBypassHosts: string[];
private userAgent: string | undefined;
constructor(args: {
agentOptions: undici.Agent.Options;
proxy?: {
uri: string;
options?: undici.Agent.Options; // Override of agentOptions
},
proxyBypassHosts?: string[];
userAgent?: string;
}) {
this.proxyBypassHosts = args.proxyBypassHosts ?? [];
this.userAgent = args.userAgent;
this.nonProxiedAgent = new undici.Agent({
...args.agentOptions,
});
this.agent = args.proxy
? new undici.ProxyAgent({
...args.agentOptions,
...args.proxy.options,
uri: args.proxy.uri,
})
: this.nonProxiedAgent;
}
/**
* Get agent by URL
* @param url URL
* @param bypassProxy Allways bypass proxy
*/
@bindThis
public getAgentByUrl(url: URL, bypassProxy = false): undici.Agent | undici.ProxyAgent {
if (bypassProxy || this.proxyBypassHosts.includes(url.hostname)) {
return this.nonProxiedAgent;
} else {
return this.agent;
}
}
@bindThis
public async fetch(
url: string | URL,
options: undici.RequestInit = {},
privateOptions: { noOkError?: boolean; bypassProxy?: boolean; } = { noOkError: false, bypassProxy: false }
): Promise<undici.Response> {
const res = await undici.fetch(url, {
dispatcher: this.getAgentByUrl(new URL(url), privateOptions.bypassProxy),
...options,
})
if (!res.ok && !privateOptions.noOkError) {
throw new StatusError(`${res.status} ${res.statusText}`, res.status, res.statusText);
}
return res;
}
@bindThis
public async getJson<T extends unknown>(url: string, accept = 'application/json, */*', headers?: Record<string, string>): Promise<T> {
const res = await this.fetch(
url,
{
headers: Object.assign({
'User-Agent': this.userAgent,
Accept: accept,
}, headers ?? {}),
}
);
return await res.json() as T;
}
@bindThis
public async getHtml(url: string, accept = 'text/html, */*', headers?: Record<string, string>): Promise<string> {
const res = await this.fetch(
url,
{
headers: Object.assign({
'User-Agent': this.userAgent,
Accept: accept,
}, headers ?? {}),
}
);
return await res.text();
}
}
@Injectable()
export class HttpRequestService {
public defaultFetcher: UndiciFetcher;
public fetch: UndiciFetcher['fetch'];
public getHtml: UndiciFetcher['getHtml'];
public defaultJsonFetcher: UndiciFetcher;
public getJson: UndiciFetcher['getJson'];
//#region for old http/https, only used in S3Service //#region for old http/https, only used in S3Service
// http non-proxy agent // http non-proxy agent
private http: http.Agent; private http: http.Agent;
@ -42,6 +142,7 @@ export class HttpRequestService {
public readonly dnsCache: CacheableLookup; public readonly dnsCache: CacheableLookup;
public readonly clientDefaults: undici.Agent.Options; public readonly clientDefaults: undici.Agent.Options;
private maxSockets: number;
constructor( constructor(
@Inject(DI.config) @Inject(DI.config)
@ -54,20 +155,35 @@ export class HttpRequestService {
}); });
this.clientDefaults = { this.clientDefaults = {
keepAliveTimeout: 4 * 1000, keepAliveTimeout: 30 * 1000,
keepAliveMaxTimeout: 10 * 60 * 1000, keepAliveMaxTimeout: 10 * 60 * 1000,
keepAliveTimeoutThreshold: 1 * 1000, keepAliveTimeoutThreshold: 1 * 1000,
strictContentLength: true, strictContentLength: true,
headersTimeout: 10 * 1000,
bodyTimeout: 10 * 1000,
maxHeaderSize: 16364, // default
maxResponseSize: 10 * 1024 * 1024,
connect: { connect: {
maxCachedSessions: 100, // TLSセッションのキャッシュ数 https://github.com/nodejs/undici/blob/v5.14.0/lib/core/connect.js#L80 timeout: 10 * 1000, // コネクションが確立するまでのタイムアウト
maxCachedSessions: 300, // TLSセッションのキャッシュ数 https://github.com/nodejs/undici/blob/v5.14.0/lib/core/connect.js#L80
lookup: this.dnsCache.lookup as LookupFunction, // https://github.com/nodejs/undici/blob/v5.14.0/lib/core/connect.js#L98 lookup: this.dnsCache.lookup as LookupFunction, // https://github.com/nodejs/undici/blob/v5.14.0/lib/core/connect.js#L98
}, },
} }
this.nonProxiedAgent = new undici.Agent({ this.maxSockets = Math.max(256, this.config.deliverJobConcurrency ?? 128);
...this.clientDefaults,
});
this.defaultFetcher = new UndiciFetcher(this.getStandardUndiciFetcherConstructorOption());
this.fetch = this.defaultFetcher.fetch;
this.getHtml = this.defaultFetcher.getHtml;
this.defaultJsonFetcher = new UndiciFetcher(this.getStandardUndiciFetcherConstructorOption({
maxResponseSize: 1024 * 256,
}));
this.getJson = this.defaultJsonFetcher.getJson;
//#region for old http/https, only used in S3Service
this.http = new http.Agent({ this.http = new http.Agent({
keepAlive: true, keepAlive: true,
keepAliveMsecs: 30 * 1000, keepAliveMsecs: 30 * 1000,
@ -80,23 +196,11 @@ export class HttpRequestService {
lookup: this.dnsCache.lookup, lookup: this.dnsCache.lookup,
} as https.AgentOptions); } as https.AgentOptions);
const maxSockets = Math.max(256, config.deliverJobConcurrency ?? 128);
this.agent = config.proxy
? new undici.ProxyAgent({
...this.clientDefaults,
connections: maxSockets,
uri: config.proxy,
})
: this.nonProxiedAgent;
//#region for old http/https, only used in S3Service
this.httpAgent = config.proxy this.httpAgent = config.proxy
? new HttpProxyAgent({ ? new HttpProxyAgent({
keepAlive: true, keepAlive: true,
keepAliveMsecs: 30 * 1000, keepAliveMsecs: 30 * 1000,
maxSockets, maxSockets: this.maxSockets,
maxFreeSockets: 256, maxFreeSockets: 256,
scheduling: 'lifo', scheduling: 'lifo',
proxy: config.proxy, proxy: config.proxy,
@ -107,26 +211,35 @@ export class HttpRequestService {
? new HttpsProxyAgent({ ? new HttpsProxyAgent({
keepAlive: true, keepAlive: true,
keepAliveMsecs: 30 * 1000, keepAliveMsecs: 30 * 1000,
maxSockets, maxSockets: this.maxSockets,
maxFreeSockets: 256, maxFreeSockets: 256,
scheduling: 'lifo', scheduling: 'lifo',
proxy: config.proxy, proxy: config.proxy,
}) })
: this.https; : this.https;
//#endregion
} }
//#endregion
/** /**
* Get agent by URL * Get http agent by URL
* @param url URL * @param url URL
* @param bypassProxy Allways bypass proxy * @param bypassProxy Allways bypass proxy
*/ */
@bindThis @bindThis
public getAgentByUrl(url: URL, bypassProxy = false): undici.Agent | undici.ProxyAgent { public getStandardUndiciFetcherConstructorOption(opts: undici.Agent.Options = {}) {
if (bypassProxy || (this.config.proxyBypassHosts || []).includes(url.hostname)) { return {
return this.nonProxiedAgent; agentOptions: {
} else { ...this.clientDefaults,
return this.agent; ...opts,
},
...(this.config.proxy ? {
proxy: {
uri: this.config.proxy,
options: {
connections: this.maxSockets,
}
}
} : {}),
} }
} }
@ -143,141 +256,33 @@ export class HttpRequestService {
return url.protocol === 'http:' ? this.httpAgent : this.httpsAgent; return url.protocol === 'http:' ? this.httpAgent : this.httpsAgent;
} }
} }
/** /**
* check ip * check ip
*/ */
@bindThis @bindThis
public checkIp(url: URL, fn: IpChecker): Promise<boolean> { public getConnectorWithIpCheck(connector: undici.buildConnector.connector, checkIp: IpChecker): undici.buildConnector.connectorAsync {
const lookup = this.dnsCache.lookup as LookupFunction || dns.lookup; return (options, cb) => {
connector(options, (err, socket) => {
return new Promise((resolve, reject) => {
lookup(url.hostname, {}, (err, ip) => {
if (err) { if (err) {
resolve(false); cb(err, null);
} else { return;
resolve(fn(ip));
} }
if (socket.remoteAddress == undefined) {
cb(new Error('remoteAddress is undefined (maybe socket destroyed)'), null);
return;
}
// allow
if (checkIp(socket.remoteAddress)) {
cb(null, socket);
return;
}
socket.destroy();
cb(new StatusError('IP is not allowed', 403, 'IP is not allowed'), null);
}); });
}); };
}
@bindThis
public async getJson<T extends unknown>(url: string, accept = 'application/json, */*', timeout = 10000, headers?: Record<string, string>): Promise<T> {
const res = await this.fetch({
url,
headers: Object.assign({
'User-Agent': this.config.userAgent,
Accept: accept,
}, headers ?? {}),
timeout,
size: 1024 * 256,
});
return await res.json() as T;
}
@bindThis
public async getHtml(url: string, accept = 'text/html, */*', timeout = 10000, headers?: Record<string, string>): Promise<string> {
const res = await this.fetch({
url,
headers: Object.assign({
'User-Agent': this.config.userAgent,
Accept: accept,
}, headers ?? {}),
timeout,
});
return await res.text();
}
@bindThis
public async fetch(args: {
url: string,
method?: string,
body?: string,
headers?: Record<string, string>,
timeout?: number,
size?: number,
redirect?: RequestRedirect | undefined,
dispatcher?: undici.Dispatcher,
ipCheckers?: {
type: 'black' | 'white',
fn: IpChecker,
}[],
noOkError?: boolean,
}): Promise<undici.Response> {
const url = new URL(args.url);
if (args.ipCheckers) {
for (const check of args.ipCheckers) {
const result = await this.checkIp(url, check.fn);
if (
(check.type === 'black' && result === true) ||
(check.type === 'white' && result === false)
) {
throw new StatusError('IP is not allowed', 403, 'IP is not allowed');
}
}
}
const timeout = args.timeout ?? 10 * 1000;
const controller = new AbortController();
setTimeout(() => {
controller.abort();
}, timeout * 6);
const res = await Promise.race([
undici.fetch(args.url, {
method: args.method ?? 'GET',
headers: args.headers,
body: args.body,
redirect: args.redirect,
dispatcher: args.dispatcher ?? this.getAgentByUrl(url),
keepalive: true,
signal: controller.signal,
}),
new Promise<null>((res) => setTimeout(() => res(null), timeout))
]);
if (res == null) {
throw new StatusError(`Gateway Timeout`, 504, 'Gateway Timeout');
}
if (!res.ok && !args.noOkError) {
throw new StatusError(`${res.status} ${res.statusText}`, res.status, res.statusText);
}
return ({
...res,
body: this.fetchLimiter(res, args.size),
});
}
/**
* Fetch body limiter
* @param res undici.Response
* @param size number of Max size (Bytes) (default: 10MiB)
* @returns ReadableStream<Uint8Array> (provided by node:stream/web)
*/
@bindThis
private fetchLimiter(res: undici.Response, size: number = 10 * 1024 * 1024) {
if (res.body == null) return null;
let total = 0;
return res.body.pipeThrough(new TransformStream({
start() {},
transform(chunk, controller) {
// TypeScirptグローバルの定義はUnit8ArrayだがundiciはReadableStream<any>を渡してくるので一応変換
const uint8 = new Uint8Array(chunk);
total += uint8.length;
if (total > size) {
controller.error(new StatusError(`Payload Too Large`, 413, 'Payload Too Large'));
} else {
controller.enqueue(uint8);
}
},
flush() {},
}));
} }
} }

View File

@ -180,11 +180,13 @@ export class ApRequestService {
}, },
}); });
const res = await this.httpRequestService.fetch({ const res = await this.httpRequestService.fetch(
url, url,
method: req.request.method, {
headers: req.request.headers, method: req.request.method,
}); headers: req.request.headers,
}
);
return await res.json(); return await res.json();
} }

View File

@ -115,15 +115,20 @@ class LdSignature {
@bindThis @bindThis
private async fetchDocument(url: string) { private async fetchDocument(url: string) {
const json = await this.httpRequestService.fetch({ const json = await this.httpRequestService.fetch(
url, url,
headers: { {
Accept: 'application/ld+json, application/json', headers: {
Accept: 'application/ld+json, application/json',
},
// TODO
//timeout: this.loderTimeout,
}, },
noOkError: true, {
// TODO noOkError: true,
//timeout: this.loderTimeout, bypassProxy: false,
}).then(res => { }
).then(res => {
if (!res.ok) { if (!res.ok) {
throw `${res.status} ${res.statusText}`; throw `${res.status} ${res.statusText}`;
} else { } else {

View File

@ -33,24 +33,26 @@ export class WebhookDeliverProcessorService {
try { try {
this.logger.debug(`delivering ${job.data.webhookId}`); this.logger.debug(`delivering ${job.data.webhookId}`);
const res = await this.httpRequestService.fetch({ const res = await this.httpRequestService.fetch(
url: job.data.to, job.data.to,
method: 'POST', {
headers: { method: 'POST',
'User-Agent': 'Misskey-Hooks', headers: {
'X-Misskey-Host': this.config.host, 'User-Agent': 'Misskey-Hooks',
'X-Misskey-Hook-Id': job.data.webhookId, 'X-Misskey-Host': this.config.host,
'X-Misskey-Hook-Secret': job.data.secret, 'X-Misskey-Hook-Id': job.data.webhookId,
}, 'X-Misskey-Hook-Secret': job.data.secret,
body: JSON.stringify({ },
hookId: job.data.webhookId, body: JSON.stringify({
userId: job.data.userId, hookId: job.data.webhookId,
eventId: job.data.eventId, userId: job.data.userId,
createdAt: job.data.createdAt, eventId: job.data.eventId,
type: job.data.type, createdAt: job.data.createdAt,
body: job.data.content, type: job.data.type,
}), body: job.data.content,
}); }),
}
);
this.webhooksRepository.update({ id: job.data.webhookId }, { this.webhooksRepository.update({ id: job.data.webhookId }, {
latestSentAt: new Date(), latestSentAt: new Date(),

View File

@ -33,15 +33,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
private httpRequestService: HttpRequestService, private httpRequestService: HttpRequestService,
) { ) {
super(meta, paramDef, async (ps, me) => { super(meta, paramDef, async (ps, me) => {
const res = await this.httpRequestService.fetch({ const res = await this.httpRequestService.fetch(
url: ps.url, ps.url,
method: 'GET', {
headers: Object.assign({ method: 'GET',
'User-Agent': config.userAgent, headers: Object.assign({
Accept: 'application/rss+xml, */*', 'User-Agent': config.userAgent,
}), Accept: 'application/rss+xml, */*',
timeout: 5000, }),
}); // timeout: 5000,
}
);
const text = await res.text(); const text = await res.text();

View File

@ -83,25 +83,29 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const endpoint = instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate'; const endpoint = instance.deeplIsPro ? 'https://api.deepl.com/v2/translate' : 'https://api-free.deepl.com/v2/translate';
const res = await this.httpRequestService.fetch({ const res = await this.httpRequestService.fetch(
url: endpoint, endpoint,
method: 'POST', {
headers: { method: 'POST',
'Content-Type': 'application/x-www-form-urlencoded', headers: {
'User-Agent': config.userAgent, 'Content-Type': 'application/x-www-form-urlencoded',
Accept: 'application/json, */*', 'User-Agent': config.userAgent,
Accept: 'application/json, */*',
},
body: params.toString(),
}, },
body: params.toString(), {
// TODO noOkError: false,
//timeout: 10000, bypassProxy: true,
}); }
);
const json = (await res.json()) as { const json = (await res.json()) as {
translations: { translations: {
detected_source_language: string; detected_source_language: string;
text: string; text: string;
}[]; }[];
}; };
return { return {
sourceLang: json.translations[0].detected_source_language, sourceLang: json.translations[0].detected_source_language,

View File

@ -181,7 +181,7 @@ export class DiscordServerService {
} }
})); }));
const { id, username, discriminator } = (await this.httpRequestService.getJson('https://discord.com/api/users/@me', '*/*', 10 * 1000, { const { id, username, discriminator } = (await this.httpRequestService.getJson('https://discord.com/api/users/@me', '*/*', {
'Authorization': `Bearer ${accessToken}`, 'Authorization': `Bearer ${accessToken}`,
})) as Record<string, unknown>; })) as Record<string, unknown>;
@ -249,7 +249,7 @@ export class DiscordServerService {
} }
})); }));
const { id, username, discriminator } = (await this.httpRequestService.getJson('https://discord.com/api/users/@me', '*/*', 10 * 1000, { const { id, username, discriminator } = (await this.httpRequestService.getJson('https://discord.com/api/users/@me', '*/*', {
'Authorization': `Bearer ${accessToken}`, 'Authorization': `Bearer ${accessToken}`,
})) as Record<string, unknown>; })) as Record<string, unknown>;
if (typeof id !== 'string' || typeof username !== 'string' || typeof discriminator !== 'string') { if (typeof id !== 'string' || typeof username !== 'string' || typeof discriminator !== 'string') {

View File

@ -174,7 +174,7 @@ export class GithubServerService {
} }
})); }));
const { login, id } = (await this.httpRequestService.getJson('https://api.github.com/user', 'application/vnd.github.v3+json', 10 * 1000, { const { login, id } = (await this.httpRequestService.getJson('https://api.github.com/user', 'application/vnd.github.v3+json', {
'Authorization': `bearer ${accessToken}`, 'Authorization': `bearer ${accessToken}`,
})) as Record<string, unknown>; })) as Record<string, unknown>;
if (typeof login !== 'string' || typeof id !== 'string') { if (typeof login !== 'string' || typeof id !== 'string') {
@ -223,7 +223,7 @@ export class GithubServerService {
} }
})); }));
const { login, id } = (await this.httpRequestService.getJson('https://api.github.com/user', 'application/vnd.github.v3+json', 10 * 1000, { const { login, id } = (await this.httpRequestService.getJson('https://api.github.com/user', 'application/vnd.github.v3+json', {
'Authorization': `bearer ${accessToken}`, 'Authorization': `bearer ${accessToken}`,
})) as Record<string, unknown>; })) as Record<string, unknown>;

View File

@ -63,7 +63,6 @@ export class UrlPreviewService {
this.logger.info(meta.summalyProxy this.logger.info(meta.summalyProxy
? `(Proxy) Getting preview of ${url}@${lang} ...` ? `(Proxy) Getting preview of ${url}@${lang} ...`
: `Getting preview of ${url}@${lang} ...`); : `Getting preview of ${url}@${lang} ...`);
try { try {
const summary = meta.summalyProxy ? await this.httpRequestService.getJson<ReturnType<typeof summaly.default>>(`${meta.summalyProxy}?${query({ const summary = meta.summalyProxy ? await this.httpRequestService.getJson<ReturnType<typeof summaly.default>>(`${meta.summalyProxy}?${query({
url: url, url: url,