Skip to content

Commit

Permalink
🐛 Fixed middle clicking localhost/frontend links
Browse files Browse the repository at this point in the history
  • Loading branch information
ZickZenni committed Aug 31, 2024
1 parent 7d8c0fe commit 955f5c3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ export default class WaveCordApp {

// Open urls in the user's browser
this.window.webContents.setWindowOpenHandler((edata) => {
const url = new URL(edata.url);
const port = process.env.PORT || 1212;

// Prevent opening link that link to the frontend
if (url.host === `localhost:${port}`) {

This comment has been minimized.

Copy link
@ZickZenni

ZickZenni Aug 31, 2024

Author Owner

This was not tested with a production build.

return { action: 'deny' };
}

shell.openExternal(edata.url);
return { action: 'deny' };
});
Expand Down

0 comments on commit 955f5c3

Please sign in to comment.