File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ const kUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (
1717const gotLock = app . requestSingleInstanceLock ( )
1818if ( ! gotLock ) { app . quit ( ) ; process . exit ( 0 ) }
1919
20+ // Register watermorph:// protocol handler (runtime fallback — installer also handles this)
21+ app . setAsDefaultProtocolClient ( 'watermorph' )
22+
2023// ── State ────────────────────────────────────────────────────────────────────
2124
2225let win = null
@@ -213,10 +216,22 @@ app.whenReady().then(() => {
213216 registerAutostart ( )
214217} )
215218
216- app . on ( 'second-instance' , ( ) => {
219+ app . on ( 'second-instance' , ( _event , argv ) => {
220+ // Handle watermorph:// deep-link from second instance
221+ const url = argv . find ( ( a ) => a . startsWith ( 'watermorph://' ) )
222+ if ( url ) handleProtocolUrl ( url )
217223 if ( win ) { win . show ( ) ; win . focus ( ) }
218224} )
219225
226+ app . on ( 'open-url' , ( _event , url ) => {
227+ handleProtocolUrl ( url )
228+ } )
229+
230+ function handleProtocolUrl ( url ) {
231+ if ( ! url . startsWith ( 'watermorph://' ) ) return
232+ if ( win ) { win . show ( ) ; win . focus ( ) }
233+ }
234+
220235app . on ( 'window-all-closed' , ( e ) => {
221236 e . preventDefault ( ) // Keep running in tray
222237} )
Original file line number Diff line number Diff line change 1212 "appId" : " ai.95ent.watermorph.helper" ,
1313 "productName" : " Water Morph" ,
1414 "publish" : null ,
15+ "protocols" : [
16+ { "name" : " Water Morph" , "schemes" : [" watermorph" ] }
17+ ],
1518 "win" : {
1619 "target" : [{ "target" : " nsis" , "arch" : [" x64" ] }],
1720 "artifactName" : " Water_Morph_1.0.0_Windows.exe"
You can’t perform that action at this time.
0 commit comments