fix: use net.fetch instead of node native fetch

This commit is contained in:
JellyBrick
2023-09-01 21:22:21 +09:00
parent b67a4ed9bb
commit 3e3fdb3c3f
4 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
const { ipcMain, nativeImage } = require('electron');
const { ipcMain, nativeImage, net } = require('electron');
const config = require('../config');
const { cache } = require('../providers/decorators');
@ -29,7 +29,7 @@ const getImage = cache(
* @returns {Promise<Electron.NativeImage>}
*/
async (src) => {
const result = await fetch(src);
const result = await net.fetch(src);
const buffer = await result.arrayBuffer();
const output = nativeImage.createFromBuffer(Buffer.from(buffer));
if (output.isEmpty() && !src.endsWith('.jpg') && src.includes('.jpg')) { // Fix hidden webp files (https://github.com/th-ch/youtube-music/issues/315)