fix(server): node-fetchおよびgotを使う以前の実装に戻す

see #9710
This commit is contained in:
syuilo 2023-01-25 12:00:04 +09:00
parent 2a2e8d0cf6
commit d4fb201d05
13 changed files with 203 additions and 427 deletions

View file

@ -2,6 +2,7 @@ import { URL } from 'node:url';
import { Inject, Injectable } from '@nestjs/common';
import { JSDOM } from 'jsdom';
import tinycolor from 'tinycolor2';
import fetch from 'node-fetch';
import type { Instance } from '@/models/entities/Instance.js';
import type { InstancesRepository } from '@/models/index.js';
import { AppLockService } from '@/core/AppLockService.js';
@ -190,7 +191,9 @@ export class FetchInstanceMetadataService {
const faviconUrl = url + '/favicon.ico';
const favicon = await this.httpRequestService.fetch(faviconUrl, {}, { noOkError: true });
const favicon = await this.httpRequestService.send(faviconUrl, {
method: 'HEAD',
}, { throwErrorWhenResponseNotOk: false });
if (favicon.ok) {
return faviconUrl;