mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 11:51:47 +00:00
chore(deps): remove node-fetch, migration to node v18 fetch API
This commit is contained in:
3480
package-lock.json
generated
3480
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -106,8 +106,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cliqz/adblocker-electron": "1.26.6",
|
"@cliqz/adblocker-electron": "1.26.6",
|
||||||
"@ffmpeg/core": "0.12.2",
|
"@ffmpeg/core": "0.11.0",
|
||||||
"@ffmpeg/ffmpeg": "0.12.5",
|
"@ffmpeg/ffmpeg": "0.11.6",
|
||||||
"@foobar404/wave": "2.0.4",
|
"@foobar404/wave": "2.0.4",
|
||||||
"@xhayper/discord-rpc": "1.0.22",
|
"@xhayper/discord-rpc": "1.0.22",
|
||||||
"async-mutex": "0.4.0",
|
"async-mutex": "0.4.0",
|
||||||
@ -115,7 +115,7 @@
|
|||||||
"butterchurn": "2.6.7",
|
"butterchurn": "2.6.7",
|
||||||
"butterchurn-presets": "2.4.7",
|
"butterchurn-presets": "2.4.7",
|
||||||
"custom-electron-prompt": "1.5.7",
|
"custom-electron-prompt": "1.5.7",
|
||||||
"custom-electron-titlebar": "4.2.7",
|
"custom-electron-titlebar": "4.1.6",
|
||||||
"electron-better-web-request": "1.0.1",
|
"electron-better-web-request": "1.0.1",
|
||||||
"electron-debug": "3.2.0",
|
"electron-debug": "3.2.0",
|
||||||
"electron-is": "3.0.0",
|
"electron-is": "3.0.0",
|
||||||
@ -130,7 +130,6 @@
|
|||||||
"keyboardevents-areequal": "0.2.2",
|
"keyboardevents-areequal": "0.2.2",
|
||||||
"md5": "2.3.0",
|
"md5": "2.3.0",
|
||||||
"mpris-service": "2.1.2",
|
"mpris-service": "2.1.2",
|
||||||
"node-fetch": "2.7.0",
|
|
||||||
"simple-youtube-age-restriction-bypass": "git+https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass.git#v2.5.9",
|
"simple-youtube-age-restriction-bypass": "git+https://github.com/zerodytrash/Simple-YouTube-Age-Restriction-Bypass.git#v2.5.9",
|
||||||
"vudio": "2.1.1",
|
"vudio": "2.1.1",
|
||||||
"youtubei.js": "6.1.0",
|
"youtubei.js": "6.1.0",
|
||||||
@ -138,6 +137,7 @@
|
|||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"xml2js": "0.6.2",
|
"xml2js": "0.6.2",
|
||||||
|
"node-fetch": "2.7.0",
|
||||||
"@electron/universal": "1.4.1"
|
"@electron/universal": "1.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -151,6 +151,7 @@
|
|||||||
"eslint-plugin-import": "2.28.1",
|
"eslint-plugin-import": "2.28.1",
|
||||||
"eslint-plugin-prettier": "5.0.0",
|
"eslint-plugin-prettier": "5.0.0",
|
||||||
"node-gyp": "9.4.0",
|
"node-gyp": "9.4.0",
|
||||||
|
"patch-package": "^8.0.0",
|
||||||
"playwright": "1.37.1"
|
"playwright": "1.37.1"
|
||||||
},
|
},
|
||||||
"auto-changelog": {
|
"auto-changelog": {
|
||||||
|
|||||||
@ -2,7 +2,6 @@ const { promises } = require('node:fs'); // Used for caching
|
|||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
|
||||||
const { ElectronBlocker } = require('@cliqz/adblocker-electron');
|
const { ElectronBlocker } = require('@cliqz/adblocker-electron');
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
const SOURCES = [
|
const SOURCES = [
|
||||||
'https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt',
|
'https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt',
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
const { ipcRenderer } = require('electron');
|
const { ipcRenderer } = require('electron');
|
||||||
const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
|
const { Titlebar, Color } = require('custom-electron-titlebar');
|
||||||
|
|
||||||
const config = require('../../config');
|
const config = require('../../config');
|
||||||
const { isEnabled } = require('../../config/plugins');
|
const { isEnabled } = require('../../config/plugins');
|
||||||
@ -12,9 +12,9 @@ module.exports = () => {
|
|||||||
const visible = () => Boolean($('.cet-menubar').firstChild);
|
const visible = () => Boolean($('.cet-menubar').firstChild);
|
||||||
const bar = new Titlebar({
|
const bar = new Titlebar({
|
||||||
icon: 'https://cdn-icons-png.flaticon.com/512/5358/5358672.png',
|
icon: 'https://cdn-icons-png.flaticon.com/512/5358/5358672.png',
|
||||||
backgroundColor: TitlebarColor.fromHex('#050505'),
|
backgroundColor: Color.fromHex('#050505'),
|
||||||
itemBackgroundColor: TitlebarColor.fromHex('#1d1d1d'),
|
itemBackgroundColor: Color.fromHex('#1d1d1d'),
|
||||||
svgColor: TitlebarColor.WHITE,
|
svgColor: Color.WHITE,
|
||||||
menu: config.get('options.hideMenu') ? null : undefined,
|
menu: config.get('options.hideMenu') ? null : undefined,
|
||||||
});
|
});
|
||||||
bar.updateTitle(' ');
|
bar.updateTitle(' ');
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
const { shell } = require('electron');
|
const { shell } = require('electron');
|
||||||
const fetch = require('node-fetch');
|
|
||||||
const md5 = require('md5');
|
const md5 = require('md5');
|
||||||
|
|
||||||
const { setOptions } = require('../../config/plugins');
|
const { setOptions } = require('../../config/plugins');
|
||||||
|
|||||||
@ -3,7 +3,6 @@ const { join } = require('node:path');
|
|||||||
const { ipcMain } = require('electron');
|
const { ipcMain } = require('electron');
|
||||||
const is = require('electron-is');
|
const is = require('electron-is');
|
||||||
const { convert } = require('html-to-text');
|
const { convert } = require('html-to-text');
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
const { cleanupName } = require('../../providers/song-info');
|
const { cleanupName } = require('../../providers/song-info');
|
||||||
const { injectCSS } = require('../utils');
|
const { injectCSS } = require('../utils');
|
||||||
@ -99,7 +98,7 @@ const getLyrics = async (url) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const html = await response.text();
|
const html = await response.text();
|
||||||
const lyrics = convert(html, {
|
return convert(html, {
|
||||||
baseElements: {
|
baseElements: {
|
||||||
selectors: ['[class^="Lyrics__Container"]', '.lyrics'],
|
selectors: ['[class^="Lyrics__Container"]', '.lyrics'],
|
||||||
},
|
},
|
||||||
@ -116,7 +115,6 @@ const getLyrics = async (url) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return lyrics;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.toggleRomanized = toggleRomanized;
|
module.exports.toggleRomanized = toggleRomanized;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
const { ipcMain } = require('electron');
|
const { ipcMain } = require('electron');
|
||||||
const fetch = require('node-fetch');
|
|
||||||
const is = require('electron-is');
|
const is = require('electron-is');
|
||||||
|
|
||||||
const { sortSegments } = require('./segments');
|
const { sortSegments } = require('./segments');
|
||||||
@ -38,11 +37,9 @@ const fetchSegments = async (apiURL, categories) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const segments = await resp.json();
|
const segments = await resp.json();
|
||||||
const sortedSegments = sortSegments(
|
return sortSegments(
|
||||||
segments.map((submission) => submission.segment),
|
segments.map((submission) => submission.segment),
|
||||||
);
|
);
|
||||||
|
|
||||||
return sortedSegments;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (is.dev()) {
|
if (is.dev()) {
|
||||||
console.log('error on sponsorblock request:', error);
|
console.log('error on sponsorblock request:', error);
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
const { ipcMain } = require('electron');
|
const { ipcMain } = require('electron');
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
const registerCallback = require('../../providers/song-info');
|
const registerCallback = require('../../providers/song-info');
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ const post = async (data) => {
|
|||||||
'Access-Control-Allow-Headers': '*',
|
'Access-Control-Allow-Headers': '*',
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
};
|
};
|
||||||
const url = `http://localhost:${port}/`;
|
const url = `http://127.0.0.1:${port}/`;
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers,
|
headers,
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
|
const { Titlebar, Color } = require('custom-electron-titlebar');
|
||||||
|
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
new Titlebar({
|
new Titlebar({
|
||||||
backgroundColor: TitlebarColor.fromHex('#050505'),
|
backgroundColor: Color.fromHex('#050505'),
|
||||||
minimizable: false,
|
minimizable: false,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
menu: null,
|
menu: null,
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
const { ipcMain, nativeImage } = require('electron');
|
const { ipcMain, nativeImage } = require('electron');
|
||||||
const fetch = require('node-fetch');
|
|
||||||
|
|
||||||
const config = require('../config');
|
const config = require('../config');
|
||||||
const { cache } = require('../providers/decorators');
|
const { cache } = require('../providers/decorators');
|
||||||
@ -31,8 +30,8 @@ const getImage = cache(
|
|||||||
*/
|
*/
|
||||||
async (src) => {
|
async (src) => {
|
||||||
const result = await fetch(src);
|
const result = await fetch(src);
|
||||||
const buffer = await result.buffer();
|
const buffer = await result.arrayBuffer();
|
||||||
const output = nativeImage.createFromBuffer(buffer);
|
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)
|
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));
|
return getImage(src.slice(0, src.lastIndexOf('.jpg') + 4));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user