mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
chore(deps): remove node-fetch, migration to node v18 fetch API
This commit is contained in:
@ -2,7 +2,6 @@ const { promises } = require('node:fs'); // Used for caching
|
||||
const path = require('node:path');
|
||||
|
||||
const { ElectronBlocker } = require('@cliqz/adblocker-electron');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const SOURCES = [
|
||||
'https://raw.githubusercontent.com/kbinani/adblock-youtube-ads/master/signed.txt',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
const { ipcRenderer } = require('electron');
|
||||
const { Titlebar, TitlebarColor } = require('custom-electron-titlebar');
|
||||
const { Titlebar, Color } = require('custom-electron-titlebar');
|
||||
|
||||
const config = require('../../config');
|
||||
const { isEnabled } = require('../../config/plugins');
|
||||
@ -12,9 +12,9 @@ module.exports = () => {
|
||||
const visible = () => Boolean($('.cet-menubar').firstChild);
|
||||
const bar = new Titlebar({
|
||||
icon: 'https://cdn-icons-png.flaticon.com/512/5358/5358672.png',
|
||||
backgroundColor: TitlebarColor.fromHex('#050505'),
|
||||
itemBackgroundColor: TitlebarColor.fromHex('#1d1d1d'),
|
||||
svgColor: TitlebarColor.WHITE,
|
||||
backgroundColor: Color.fromHex('#050505'),
|
||||
itemBackgroundColor: Color.fromHex('#1d1d1d'),
|
||||
svgColor: Color.WHITE,
|
||||
menu: config.get('options.hideMenu') ? null : undefined,
|
||||
});
|
||||
bar.updateTitle(' ');
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const { shell } = require('electron');
|
||||
const fetch = require('node-fetch');
|
||||
const md5 = require('md5');
|
||||
|
||||
const { setOptions } = require('../../config/plugins');
|
||||
|
||||
@ -3,7 +3,6 @@ const { join } = require('node:path');
|
||||
const { ipcMain } = require('electron');
|
||||
const is = require('electron-is');
|
||||
const { convert } = require('html-to-text');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const { cleanupName } = require('../../providers/song-info');
|
||||
const { injectCSS } = require('../utils');
|
||||
@ -99,7 +98,7 @@ const getLyrics = async (url) => {
|
||||
}
|
||||
|
||||
const html = await response.text();
|
||||
const lyrics = convert(html, {
|
||||
return convert(html, {
|
||||
baseElements: {
|
||||
selectors: ['[class^="Lyrics__Container"]', '.lyrics'],
|
||||
},
|
||||
@ -116,7 +115,6 @@ const getLyrics = async (url) => {
|
||||
},
|
||||
},
|
||||
});
|
||||
return lyrics;
|
||||
};
|
||||
|
||||
module.exports.toggleRomanized = toggleRomanized;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const { ipcMain } = require('electron');
|
||||
const fetch = require('node-fetch');
|
||||
const is = require('electron-is');
|
||||
|
||||
const { sortSegments } = require('./segments');
|
||||
@ -38,11 +37,9 @@ const fetchSegments = async (apiURL, categories) => {
|
||||
}
|
||||
|
||||
const segments = await resp.json();
|
||||
const sortedSegments = sortSegments(
|
||||
return sortSegments(
|
||||
segments.map((submission) => submission.segment),
|
||||
);
|
||||
|
||||
return sortedSegments;
|
||||
} catch (error) {
|
||||
if (is.dev()) {
|
||||
console.log('error on sponsorblock request:', error);
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
const { ipcMain } = require('electron');
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const registerCallback = require('../../providers/song-info');
|
||||
|
||||
@ -24,7 +23,7 @@ const post = async (data) => {
|
||||
'Access-Control-Allow-Headers': '*',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
};
|
||||
const url = `http://localhost:${port}/`;
|
||||
const url = `http://127.0.0.1:${port}/`;
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers,
|
||||
|
||||
Reference in New Issue
Block a user