File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,22 @@ function onClosed() {
8484
8585function loadPlugins ( win ) {
8686 injectCSS ( win . webContents , path . join ( __dirname , "youtube-music.css" ) ) ;
87+ // Load user CSS
88+ const cssFiles = config . get ( "options.cssFiles" ) ;
89+ if ( Array . isArray ( cssFiles ) ) {
90+ cssFiles . forEach ( ( cssFile ) => {
91+ fileExists (
92+ cssFile ,
93+ ( ) => {
94+ injectCSS ( win . webContents , cssFile ) ;
95+ } ,
96+ ( ) => {
97+ console . warn ( `CSS file "${ cssFile } " does not exist, ignoring` ) ;
98+ }
99+ ) ;
100+ } ) ;
101+ }
102+
87103 win . webContents . once ( "did-finish-load" , ( ) => {
88104 if ( is . dev ( ) ) {
89105 console . log ( "did finish load" ) ;
Original file line number Diff line number Diff line change @@ -32,9 +32,16 @@ module.exports.listenAction = (channel, callback) => {
3232 return ipcMain . on ( channel , callback ) ;
3333} ;
3434
35- module . exports . fileExists = ( path , callbackIfExists ) => {
35+ module . exports . fileExists = (
36+ path ,
37+ callbackIfExists ,
38+ callbackIfError = undefined
39+ ) => {
3640 fs . access ( path , fs . F_OK , ( err ) => {
3741 if ( err ) {
42+ if ( callbackIfError ) {
43+ callbackIfError ( ) ;
44+ }
3845 return ;
3946 }
4047
You can’t perform that action at this time.
0 commit comments