mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-13 12:18:08 +00:00
Automatic Port Selection and Secured Communication (#1038)
Adds dynamic OS-selected socket port handling and secured Electron/.NET communication. The dotnet-first startup flow now generates the auth token on the .NET side and passes it to Electron through an environment variable. Electron reports the selected socket port through a temporary startup-info file, avoiding any dependency on parsing Electron console output. Also avoids logging backend startup parameters because they include the auth token.
This commit is contained in:
@@ -277,7 +277,15 @@ module.exports = (socket, app) => {
|
||||
}
|
||||
});
|
||||
if (loadUrl) {
|
||||
window.loadURL(loadUrl);
|
||||
// Append authentication token to initial URL if available
|
||||
const token = global["authToken"];
|
||||
if (token) {
|
||||
const separator = loadUrl.includes("?") ? "&" : "?";
|
||||
window.loadURL(`${loadUrl}${separator}token=${token}`);
|
||||
}
|
||||
else {
|
||||
window.loadURL(loadUrl);
|
||||
}
|
||||
}
|
||||
if (app.commandLine.hasSwitch("clear-cache") &&
|
||||
app.commandLine.getSwitchValue("clear-cache")) {
|
||||
|
||||
Reference in New Issue
Block a user