@@ -14,7 +14,9 @@ const settings = {
1414 locallyInstalledVersion : null
1515} ;
1616
17- const MPVSchemePrefix = "mpv://watch#" ;
17+ function createMpvSchemeURI ( url ) {
18+ return `mpv://watch#${ url . replace ( / ' / g, "%27" ) } ` ;
19+ }
1820
1921function contextMenuPatch ( tree , context ) {
2022 const href = context . target . href || context . target . parentNode . href
@@ -28,14 +30,14 @@ function contextMenuPatch(tree, context) {
2830 console . log ( "open-in-mpv: link is " + href ) ;
2931
3032 if ( settings . locallyInstalledVersion && settings . locallyInstalledVersion >= desktopFileVersion ) {
31- const newWindow = window . open ( MPVSchemePrefix + href , "_blank" , "noopener noreferrer" ) ;
33+ const newWindow = window . open ( createMpvSchemeURI ( href ) , "_blank" , "noopener noreferrer" ) ;
3234
3335 if ( newWindow === null ) { // is null because opens in external application
3436 BdApi . UI . showToast ( "" + href + " opened in mpv." , { type : "success" } ) ;
3537 console . log ( "open-in-mpv: success" ) ;
3638 } else {
3739 BdApi . UI . showToast ( "" + href + " failed to open in mpv." , { type : "error" } ) ;
38- console . log ( `open-in-mpv: failed to open ${ MPVSchemePrefix } ${ href } in mpv.` ) ;
40+ console . log ( `open-in-mpv: failed to open ${ createMpvSchemeURI ( href ) } in mpv.` ) ;
3941 }
4042 } else {
4143 BdApi . UI . showConfirmationModal ( "Open in mpv" ,
0 commit comments