mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
chore(deps): remove node-fetch, migration to node v18 fetch API
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
|
||||
const { Titlebar, Color } = require('custom-electron-titlebar');
|
||||
|
||||
module.exports = () => {
|
||||
new Titlebar({
|
||||
backgroundColor: TitlebarColor.fromHex('#050505'),
|
||||
backgroundColor: Color.fromHex('#050505'),
|
||||
minimizable: false,
|
||||
maximizable: false,
|
||||
menu: null,
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const { ipcMain, nativeImage } = require('electron');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const config = require('../config');
|
||||
const { cache } = require('../providers/decorators');
|
||||
@ -31,8 +30,8 @@ const getImage = cache(
|
||||
*/
|
||||
async (src) => {
|
||||
const result = await fetch(src);
|
||||
const buffer = await result.buffer();
|
||||
const output = nativeImage.createFromBuffer(buffer);
|
||||
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)
|
||||
return getImage(src.slice(0, src.lastIndexOf('.jpg') + 4));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user