mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 02:51:46 +00:00
feat: migrate from rollup to electron-vite (#1364)
* feat: electron-vite PoC * fix: fix preload path * remove rollup deps and config * fix: debug mode * fix: build mode, asset path * fix: remove unused dependencies * feat: use `executeJavaScriptInIsolatedWorld` instead of `executeJavaScript` * feat: enable `minify` * fix(actions): update task name * fix: fix dev mode check * fix: remove unused variable
This commit is contained in:
@ -7,9 +7,10 @@ import config from './config';
|
||||
|
||||
import { cache } from '../../providers/decorators';
|
||||
import { SongInfo } from '../../providers/song-info';
|
||||
import { getAssetsDirectoryLocation } from '../utils';
|
||||
|
||||
const defaultIcon = path.join(getAssetsDirectoryLocation(), 'youtube-music.png');
|
||||
import youtubeMusicIcon from '../../../assets/youtube-music.png?asset';
|
||||
|
||||
|
||||
const userData = app.getPath('userData');
|
||||
const temporaryIcon = path.join(userData, 'tempIcon.png');
|
||||
const temporaryBanner = path.join(userData, 'tempBanner.png');
|
||||
@ -45,7 +46,7 @@ const nativeImageToLogo = cache((nativeImage: NativeImage) => {
|
||||
|
||||
export const notificationImage = (songInfo: SongInfo) => {
|
||||
if (!songInfo.image) {
|
||||
return defaultIcon;
|
||||
return youtubeMusicIcon;
|
||||
}
|
||||
|
||||
if (!config.get('interactive')) {
|
||||
@ -68,8 +69,9 @@ export const saveImage = cache((img: NativeImage, savePath: string) => {
|
||||
try {
|
||||
fs.writeFileSync(savePath, img.toPNG());
|
||||
} catch (error: unknown) {
|
||||
console.log(`Error writing song icon to disk:\n${String(error)}`);
|
||||
return defaultIcon;
|
||||
console.error('Error writing song icon to disk:');
|
||||
console.trace(error);
|
||||
return youtubeMusicIcon;
|
||||
}
|
||||
|
||||
return savePath;
|
||||
|
||||
Reference in New Issue
Block a user