|
@ -38,12 +38,12 @@ export class LogoService { |
|
|
return this.getBuffer(assetProfile.url); |
|
|
return this.getBuffer(assetProfile.url); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async getLogoByUrl(aUrl: string) { |
|
|
public getLogoByUrl(aUrl: string) { |
|
|
return this.getBuffer(aUrl); |
|
|
return this.getBuffer(aUrl); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private getBuffer(aUrl: string) { |
|
|
private async getBuffer(aUrl: string) { |
|
|
return fetch( |
|
|
const blob = await fetch( |
|
|
`https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${aUrl}&size=64`, |
|
|
`https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${aUrl}&size=64`, |
|
|
{ |
|
|
{ |
|
|
headers: { 'User-Agent': 'request' }, |
|
|
headers: { 'User-Agent': 'request' }, |
|
@ -51,8 +51,13 @@ export class LogoService { |
|
|
this.configurationService.get('REQUEST_TIMEOUT') |
|
|
this.configurationService.get('REQUEST_TIMEOUT') |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
) |
|
|
).then((res) => res.blob()); |
|
|
.then((res) => res.arrayBuffer()) |
|
|
|
|
|
.then((buffer) => Buffer.from(buffer)); |
|
|
return { |
|
|
|
|
|
buffer: await blob.arrayBuffer().then((arrayBuffer) => { |
|
|
|
|
|
return Buffer.from(arrayBuffer); |
|
|
|
|
|
}), |
|
|
|
|
|
type: blob.type |
|
|
|
|
|
}; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|