mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-09 18:27:36 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6e496b2c6 | ||
|
|
5974cb9e43 | ||
|
|
d4d4e9dddd | ||
|
|
3b5f21c724 | ||
|
|
5aebe807c3 | ||
|
|
bdee008cc8 | ||
|
|
7fc5c9b611 | ||
|
|
86e5d74c03 | ||
|
|
e79b029e16 | ||
|
|
5bdf6230b9 | ||
|
|
8c2382a05c | ||
|
|
10b1b686cb | ||
|
|
d7d2521d0c | ||
|
|
392419e5a7 | ||
|
|
f92f07a378 | ||
|
|
9b045cbf01 | ||
|
|
94ff3c1c4d | ||
|
|
773937448d | ||
|
|
b094051dcb | ||
|
|
3a10e7e98d | ||
|
|
056661028b | ||
|
|
27a8c69a9a | ||
|
|
8e900655b9 | ||
|
|
066efa80e2 | ||
|
|
0e83af032c | ||
|
|
1ec84cfef0 | ||
|
|
1620c50627 | ||
|
|
295b250e58 | ||
|
|
644628c803 | ||
|
|
a18944d4a4 | ||
|
|
b5858a697a | ||
|
|
58b9ad0125 | ||
|
|
e44927a655 | ||
|
|
ed9a24bb5e | ||
|
|
94df47efa6 | ||
|
|
d9f3da87a8 | ||
|
|
a33d76ae2f |
@@ -1,3 +1,10 @@
|
|||||||
|
# 0.5.2
|
||||||
|
|
||||||
|
## ElectronNET.Core
|
||||||
|
|
||||||
|
- Fixed token param being appended to external URLs (#1075)
|
||||||
|
- Added more variants for `UseElectron` (#1076) @AeonSake
|
||||||
|
|
||||||
# 0.5.1
|
# 0.5.1
|
||||||
|
|
||||||
## ElectronNET.Core
|
## ElectronNET.Core
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file:
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ElectronNET.Core" Version="0.5.0" />
|
<PackageReference Include="ElectronNET.Core" Version="0.5.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,6 @@
|
|||||||
|
|
||||||
internal static int? ElectronProcessId { get; set; }
|
internal static int? ElectronProcessId { get; set; }
|
||||||
|
|
||||||
internal static Func<Task> OnAppReadyCallback { get; set; }
|
|
||||||
|
|
||||||
internal static ISocketConnection GetSocket()
|
internal static ISocketConnection GetSocket()
|
||||||
{
|
{
|
||||||
return RuntimeControllerCore?.Socket;
|
return RuntimeControllerCore?.Socket;
|
||||||
|
|||||||
@@ -44,5 +44,98 @@
|
|||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Electron.NET support to the current ASP.NET Core application and registers an application-ready callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="WebApplicationBuilder"/> to extend.</param>
|
||||||
|
/// <param name="args">The command-line arguments passed to the process, forwarded to Electron.</param>
|
||||||
|
/// <param name="onAppReadyCallback">
|
||||||
|
/// An asynchronous callback invoked when the Electron app is ready. Use this to create windows or perform initialization.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The same <see cref="WebApplicationBuilder"/> instance to enable fluent configuration.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code language="csharp">
|
||||||
|
/// var builder = WebApplication.CreateBuilder(args)
|
||||||
|
/// .UseElectron(args, async (processArgs) =>
|
||||||
|
/// {
|
||||||
|
/// // Create the main browser window or perform other startup tasks.
|
||||||
|
/// });
|
||||||
|
///
|
||||||
|
/// var app = builder.Build();
|
||||||
|
/// app.MapRazorPages();
|
||||||
|
/// app.Run();
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static WebApplicationBuilder UseElectron(this WebApplicationBuilder builder, string[] args, Func<string[], Task> onAppReadyCallback)
|
||||||
|
{
|
||||||
|
builder.WebHost.UseElectron(args, onAppReadyCallback);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Electron.NET support to the current ASP.NET Core application and registers an application-ready callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="WebApplicationBuilder"/> to extend.</param>
|
||||||
|
/// <param name="args">The command-line arguments passed to the process, forwarded to Electron.</param>
|
||||||
|
/// <param name="onAppReadyCallback">
|
||||||
|
/// An asynchronous callback invoked when the Electron app is ready. Use this to create windows or perform initialization.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The same <see cref="WebApplicationBuilder"/> instance to enable fluent configuration.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code language="csharp">
|
||||||
|
/// var builder = WebApplication.CreateBuilder(args)
|
||||||
|
/// .UseElectron(args, async (serviceProvider) =>
|
||||||
|
/// {
|
||||||
|
/// // Create the main browser window or perform other startup tasks.
|
||||||
|
/// });
|
||||||
|
///
|
||||||
|
/// var app = builder.Build();
|
||||||
|
/// app.MapRazorPages();
|
||||||
|
/// app.Run();
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static WebApplicationBuilder UseElectron(this WebApplicationBuilder builder, string[] args, Func<IServiceProvider, Task> onAppReadyCallback)
|
||||||
|
{
|
||||||
|
builder.WebHost.UseElectron(args, onAppReadyCallback);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Electron.NET support to the current ASP.NET Core application and registers an application-ready callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="WebApplicationBuilder"/> to extend.</param>
|
||||||
|
/// <param name="args">The command-line arguments passed to the process, forwarded to Electron.</param>
|
||||||
|
/// <param name="onAppReadyCallback">
|
||||||
|
/// An asynchronous callback invoked when the Electron app is ready. Use this to create windows or perform initialization.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The same <see cref="WebApplicationBuilder"/> instance to enable fluent configuration.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code language="csharp">
|
||||||
|
/// var builder = WebApplication.CreateBuilder(args)
|
||||||
|
/// .UseElectron(args, async (serviceProvider, processArgs) =>
|
||||||
|
/// {
|
||||||
|
/// // Create the main browser window or perform other startup tasks.
|
||||||
|
/// });
|
||||||
|
///
|
||||||
|
/// var app = builder.Build();
|
||||||
|
/// app.MapRazorPages();
|
||||||
|
/// app.Run();
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static WebApplicationBuilder UseElectron(this WebApplicationBuilder builder, string[] args, Func<IServiceProvider, string[], Task> onAppReadyCallback)
|
||||||
|
{
|
||||||
|
builder.WebHost.UseElectron(args, onAppReadyCallback);
|
||||||
|
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,8 +61,154 @@
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<Task> onAppReadyCallback)
|
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<Task> onAppReadyCallback)
|
||||||
{
|
{
|
||||||
ElectronNetRuntime.OnAppReadyCallback = onAppReadyCallback;
|
builder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddSingleton<IAppReadyCallbackResolver>(_ => new AppReadyCallbackResolver(onAppReadyCallback));
|
||||||
|
});
|
||||||
|
|
||||||
|
return UseElectronCore(builder, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Electron.NET support to the current ASP.NET Core web host and registers an application-ready callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IWebHostBuilder"/> to extend.</param>
|
||||||
|
/// <param name="args">The command-line arguments passed to the process.</param>
|
||||||
|
/// <param name="onAppReadyCallback">
|
||||||
|
/// An asynchronous callback invoked when the Electron app is ready. Use this to create windows or perform initialization.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The same <see cref="IWebHostBuilder"/> instance to enable fluent configuration.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code language="csharp">
|
||||||
|
/// using Microsoft.AspNetCore.Hosting;
|
||||||
|
/// using Microsoft.Extensions.Hosting;
|
||||||
|
/// using ElectronNET.API;
|
||||||
|
///
|
||||||
|
/// public class Program
|
||||||
|
/// {
|
||||||
|
/// public static void Main(string[] args)
|
||||||
|
/// {
|
||||||
|
/// Host.CreateDefaultBuilder(args)
|
||||||
|
/// .ConfigureWebHostDefaults(webBuilder =>
|
||||||
|
/// {
|
||||||
|
/// webBuilder.UseStartup<Startup>();
|
||||||
|
/// webBuilder.UseElectron(args, async (processArgs) =>
|
||||||
|
/// {
|
||||||
|
/// // Create the main browser window or perform other startup tasks.
|
||||||
|
/// });
|
||||||
|
/// })
|
||||||
|
/// .Build()
|
||||||
|
/// .Run();
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<string[], Task> onAppReadyCallback)
|
||||||
|
{
|
||||||
|
builder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddSingleton<IAppReadyCallbackResolver>(_ => new AppReadyCallbackResolver(args, onAppReadyCallback));
|
||||||
|
});
|
||||||
|
|
||||||
|
return UseElectronCore(builder, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Electron.NET support to the current ASP.NET Core web host and registers an application-ready callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IWebHostBuilder"/> to extend.</param>
|
||||||
|
/// <param name="args">The command-line arguments passed to the process.</param>
|
||||||
|
/// <param name="onAppReadyCallback">
|
||||||
|
/// An asynchronous callback invoked when the Electron app is ready. Use this to create windows or perform initialization.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The same <see cref="IWebHostBuilder"/> instance to enable fluent configuration.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code language="csharp">
|
||||||
|
/// using Microsoft.AspNetCore.Hosting;
|
||||||
|
/// using Microsoft.Extensions.Hosting;
|
||||||
|
/// using ElectronNET.API;
|
||||||
|
///
|
||||||
|
/// public class Program
|
||||||
|
/// {
|
||||||
|
/// public static void Main(string[] args)
|
||||||
|
/// {
|
||||||
|
/// Host.CreateDefaultBuilder(args)
|
||||||
|
/// .ConfigureWebHostDefaults(webBuilder =>
|
||||||
|
/// {
|
||||||
|
/// webBuilder.UseStartup<Startup>();
|
||||||
|
/// webBuilder.UseElectron(args, async (serviceProvider) =>
|
||||||
|
/// {
|
||||||
|
/// // Create the main browser window or perform other startup tasks.
|
||||||
|
/// });
|
||||||
|
/// })
|
||||||
|
/// .Build()
|
||||||
|
/// .Run();
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<IServiceProvider, Task> onAppReadyCallback)
|
||||||
|
{
|
||||||
|
builder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddSingleton<IAppReadyCallbackResolver>(provider => new AppReadyCallbackResolver(provider, onAppReadyCallback));
|
||||||
|
});
|
||||||
|
|
||||||
|
return UseElectronCore(builder, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds Electron.NET support to the current ASP.NET Core web host and registers an application-ready callback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="builder">The <see cref="IWebHostBuilder"/> to extend.</param>
|
||||||
|
/// <param name="args">The command-line arguments passed to the process.</param>
|
||||||
|
/// <param name="onAppReadyCallback">
|
||||||
|
/// An asynchronous callback invoked when the Electron app is ready. Use this to create windows or perform initialization.
|
||||||
|
/// </param>
|
||||||
|
/// <returns>
|
||||||
|
/// The same <see cref="IWebHostBuilder"/> instance to enable fluent configuration.
|
||||||
|
/// </returns>
|
||||||
|
/// <example>
|
||||||
|
/// <code language="csharp">
|
||||||
|
/// using Microsoft.AspNetCore.Hosting;
|
||||||
|
/// using Microsoft.Extensions.Hosting;
|
||||||
|
/// using ElectronNET.API;
|
||||||
|
///
|
||||||
|
/// public class Program
|
||||||
|
/// {
|
||||||
|
/// public static void Main(string[] args)
|
||||||
|
/// {
|
||||||
|
/// Host.CreateDefaultBuilder(args)
|
||||||
|
/// .ConfigureWebHostDefaults(webBuilder =>
|
||||||
|
/// {
|
||||||
|
/// webBuilder.UseStartup<Startup>();
|
||||||
|
/// webBuilder.UseElectron(args, async (serviceProvider, processArgs) =>
|
||||||
|
/// {
|
||||||
|
/// // Create the main browser window or perform other startup tasks.
|
||||||
|
/// });
|
||||||
|
/// })
|
||||||
|
/// .Build()
|
||||||
|
/// .Run();
|
||||||
|
/// }
|
||||||
|
/// }
|
||||||
|
/// </code>
|
||||||
|
/// </example>
|
||||||
|
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args, Func<IServiceProvider, string[], Task> onAppReadyCallback)
|
||||||
|
{
|
||||||
|
builder.ConfigureServices(services =>
|
||||||
|
{
|
||||||
|
services.AddSingleton<IAppReadyCallbackResolver>(provider => new AppReadyCallbackResolver(provider, args, onAppReadyCallback));
|
||||||
|
});
|
||||||
|
|
||||||
|
return UseElectronCore(builder, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IWebHostBuilder UseElectronCore(IWebHostBuilder builder, string[] args)
|
||||||
|
{
|
||||||
// no matter how this is set - let's unset to prevent Electron not starting as expected
|
// no matter how this is set - let's unset to prevent Electron not starting as expected
|
||||||
// e.g., VS Code sets this env variable, but this will cause `require("electron")` to not
|
// e.g., VS Code sets this env variable, but this will cause `require("electron")` to not
|
||||||
// work as expected, see issue #952
|
// work as expected, see issue #952
|
||||||
|
|||||||
@@ -17,13 +17,15 @@
|
|||||||
{
|
{
|
||||||
private readonly IServer server;
|
private readonly IServer server;
|
||||||
private readonly AspNetLifetimeAdapter aspNetLifetimeAdapter;
|
private readonly AspNetLifetimeAdapter aspNetLifetimeAdapter;
|
||||||
|
private readonly IAppReadyCallbackResolver callbackResolver;
|
||||||
private readonly IElectronAuthenticationService authenticationService;
|
private readonly IElectronAuthenticationService authenticationService;
|
||||||
private SocketBridgeService socketBridge;
|
private SocketBridgeService socketBridge;
|
||||||
|
|
||||||
protected RuntimeControllerAspNetBase(IServer server, AspNetLifetimeAdapter aspNetLifetimeAdapter, IElectronAuthenticationService authenticationService = null)
|
protected RuntimeControllerAspNetBase(IServer server, AspNetLifetimeAdapter aspNetLifetimeAdapter, IAppReadyCallbackResolver callbackResolver, IElectronAuthenticationService authenticationService = null)
|
||||||
{
|
{
|
||||||
this.server = server;
|
this.server = server;
|
||||||
this.aspNetLifetimeAdapter = aspNetLifetimeAdapter;
|
this.aspNetLifetimeAdapter = aspNetLifetimeAdapter;
|
||||||
|
this.callbackResolver = callbackResolver;
|
||||||
this.authenticationService = authenticationService;
|
this.authenticationService = authenticationService;
|
||||||
this.aspNetLifetimeAdapter.Ready += this.AspNetLifetimeAdapter_Ready;
|
this.aspNetLifetimeAdapter.Ready += this.AspNetLifetimeAdapter_Ready;
|
||||||
this.aspNetLifetimeAdapter.Stopping += this.AspNetLifetimeAdapter_Stopping;
|
this.aspNetLifetimeAdapter.Stopping += this.AspNetLifetimeAdapter_Stopping;
|
||||||
@@ -130,15 +132,15 @@
|
|||||||
|
|
||||||
private async Task RunReadyCallback()
|
private async Task RunReadyCallback()
|
||||||
{
|
{
|
||||||
if (ElectronNetRuntime.OnAppReadyCallback == null)
|
if (!callbackResolver.HasCallback)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Warning: Non OnReadyCallback provided in UseElectron() setup.");
|
Console.WriteLine("Warning: No OnReadyCallback provided in UseElectron() setup.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ElectronNetRuntime.OnAppReadyCallback().ConfigureAwait(false);
|
await callbackResolver.Invoke().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
{
|
{
|
||||||
private ElectronProcessBase electronProcess;
|
private ElectronProcessBase electronProcess;
|
||||||
|
|
||||||
public RuntimeControllerAspNetDotnetFirst(IServer server, AspNetLifetimeAdapter aspNetLifetimeAdapter, IElectronAuthenticationService authenticationService = null) : base(server, aspNetLifetimeAdapter, authenticationService)
|
public RuntimeControllerAspNetDotnetFirst(IServer server, AspNetLifetimeAdapter aspNetLifetimeAdapter, IAppReadyCallbackResolver callbackResolver, IElectronAuthenticationService authenticationService = null) : base(server, aspNetLifetimeAdapter, callbackResolver, authenticationService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
{
|
{
|
||||||
private ElectronProcessBase electronProcess;
|
private ElectronProcessBase electronProcess;
|
||||||
|
|
||||||
public RuntimeControllerAspNetElectronFirst(IServer server, AspNetLifetimeAdapter aspNetLifetimeAdapter, IElectronAuthenticationService authenticationService = null) : base(server, aspNetLifetimeAdapter, authenticationService)
|
public RuntimeControllerAspNetElectronFirst(IServer server, AspNetLifetimeAdapter aspNetLifetimeAdapter, IAppReadyCallbackResolver callbackResolver, IElectronAuthenticationService authenticationService = null) : base(server, aspNetLifetimeAdapter, callbackResolver, authenticationService)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronNET.AspNet.Runtime
|
||||||
|
{
|
||||||
|
internal class AppReadyCallbackResolver : IAppReadyCallbackResolver
|
||||||
|
{
|
||||||
|
private readonly Func<Task> _callback;
|
||||||
|
|
||||||
|
public AppReadyCallbackResolver()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public AppReadyCallbackResolver(Func<Task> callback)
|
||||||
|
{
|
||||||
|
_callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppReadyCallbackResolver(string[] args, Func<string[], Task> callback)
|
||||||
|
{
|
||||||
|
if (callback != null)
|
||||||
|
{
|
||||||
|
_callback = () => callback.Invoke(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppReadyCallbackResolver(IServiceProvider serviceProvider, Func<IServiceProvider, Task> callback)
|
||||||
|
{
|
||||||
|
if (callback != null)
|
||||||
|
{
|
||||||
|
_callback = () => callback.Invoke(serviceProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AppReadyCallbackResolver(IServiceProvider serviceProvider, string[] args, Func<IServiceProvider, string[], Task> callback)
|
||||||
|
{
|
||||||
|
if (callback != null)
|
||||||
|
{
|
||||||
|
_callback = () => callback.Invoke(serviceProvider, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasCallback => _callback != null;
|
||||||
|
|
||||||
|
public Task Invoke() => _callback?.Invoke() ?? Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ElectronNET.AspNet.Runtime
|
||||||
|
{
|
||||||
|
internal interface IAppReadyCallbackResolver
|
||||||
|
{
|
||||||
|
public bool HasCallback { get; }
|
||||||
|
|
||||||
|
public Task Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" Condition="$(ElectronNetDevMode)" />
|
<ProjectReference Include="..\ElectronNET.API\ElectronNET.API.csproj" Condition="$(ElectronNetDevMode)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ElectronNET.Core" Version="0.5.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
<PackageReference Include="ElectronNET.Core" Version="0.5.1" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="..\ElectronNET\build\ElectronNET.Core.targets" Condition="$(ElectronNetDevMode)" />
|
<Import Project="..\ElectronNET\build\ElectronNET.Core.targets" Condition="$(ElectronNetDevMode)" />
|
||||||
|
|||||||
@@ -280,8 +280,20 @@ module.exports = (socket, app) => {
|
|||||||
// Append authentication token to initial URL if available
|
// Append authentication token to initial URL if available
|
||||||
const token = global["authToken"];
|
const token = global["authToken"];
|
||||||
if (token) {
|
if (token) {
|
||||||
const separator = loadUrl.includes("?") ? "&" : "?";
|
try {
|
||||||
window.loadURL(`${loadUrl}${separator}token=${token}`);
|
const url = new URL(loadUrl);
|
||||||
|
const isLocal = url.hostname === "localhost" ||
|
||||||
|
url.hostname === "127.0.0.1" ||
|
||||||
|
url.hostname === "::1";
|
||||||
|
if (isLocal) {
|
||||||
|
url.searchParams.set("token", token);
|
||||||
|
}
|
||||||
|
window.loadURL(url.toString());
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// Handle invalid URLs or file:// URLs if needed
|
||||||
|
window.loadURL(loadUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.loadURL(loadUrl);
|
window.loadURL(loadUrl);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -313,8 +313,23 @@ export = (socket: Socket, app: Electron.App) => {
|
|||||||
const token = global["authToken"];
|
const token = global["authToken"];
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
const separator = loadUrl.includes("?") ? "&" : "?";
|
try {
|
||||||
window.loadURL(`${loadUrl}${separator}token=${token}`);
|
const url = new URL(loadUrl);
|
||||||
|
|
||||||
|
const isLocal =
|
||||||
|
url.hostname === "localhost" ||
|
||||||
|
url.hostname === "127.0.0.1" ||
|
||||||
|
url.hostname === "::1";
|
||||||
|
|
||||||
|
if (isLocal) {
|
||||||
|
url.searchParams.set("token", token);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.loadURL(url.toString());
|
||||||
|
} catch {
|
||||||
|
// Handle invalid URLs or file:// URLs if needed
|
||||||
|
window.loadURL(loadUrl);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
window.loadURL(loadUrl);
|
window.loadURL(loadUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
22
src/ElectronNET.Host/package-lock.json
generated
22
src/ElectronNET.Host/package-lock.json
generated
@@ -868,9 +868,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/engine.io": {
|
"node_modules/engine.io": {
|
||||||
"version": "6.6.8",
|
"version": "6.6.9",
|
||||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.8.tgz",
|
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.9.tgz",
|
||||||
"integrity": "sha512-2agL3ueZhqxoVrfmntO8yuVj+uNSlIOnhykYHk3Cq0ShYPdUjjUiSJrQvXjq01I9jAuI0Zl2YO8Evv5Mqytm5g==",
|
"integrity": "sha512-clKkw4C7nJ22mGgoVcCg6V/W/TxdNyIOTr89k2ONZu81qqkddPFDF0LXcbAwhzPD8DjkiRCjzuiO6Y+fkpD4vg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/cors": "^2.8.12",
|
"@types/cors": "^2.8.12",
|
||||||
@@ -882,7 +882,7 @@
|
|||||||
"cors": "~2.8.5",
|
"cors": "~2.8.5",
|
||||||
"debug": "~4.4.1",
|
"debug": "~4.4.1",
|
||||||
"engine.io-parser": "~5.2.1",
|
"engine.io-parser": "~5.2.1",
|
||||||
"ws": "~8.20.1"
|
"ws": "~8.21.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.2.0"
|
"node": ">=10.2.0"
|
||||||
@@ -2042,13 +2042,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/socket.io-adapter": {
|
"node_modules/socket.io-adapter": {
|
||||||
"version": "2.5.7",
|
"version": "2.5.8",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.7.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.8.tgz",
|
||||||
"integrity": "sha512-e0LyK91f3cUxTmv95/KzoLg47+zF+s/sbxRGDNsyG4dmIP8ZSX8ax6byOxfJXeNNtS/8AZlfD+uP7gBeR7DLlg==",
|
"integrity": "sha512-6Oy52pbg+kvdCVvjcN+FnY7BvxZ7cIHNScbvztT/It5d0vbwoJoVZmF2gjJmnV0/4WlXRfG15zc45ySk9Ah8bw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "~4.4.1",
|
"debug": "~4.4.1",
|
||||||
"ws": "~8.20.1"
|
"ws": "~8.21.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/socket.io-parser": {
|
"node_modules/socket.io-parser": {
|
||||||
@@ -2227,9 +2227,9 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/ws": {
|
"node_modules/ws": {
|
||||||
"version": "8.20.1",
|
"version": "8.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.20.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
|
||||||
"integrity": "sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w==",
|
"integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- When this is enabled, the project will be switched from nuget packages to consuming the ElectronNet orchestration directly -->
|
<!-- When this is enabled, the project will be switched from nuget packages to consuming the ElectronNet orchestration directly -->
|
||||||
<ElectronNetDevMode>true</ElectronNetDevMode>
|
<ElectronNetDevMode>true</ElectronNetDevMode>
|
||||||
|
<IsTest>True</IsTest>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="..\ElectronNET\build\ElectronNET.Core.props" Condition="$(ElectronNetDevMode)" />
|
<Import Project="..\ElectronNET\build\ElectronNET.Core.props" Condition="$(ElectronNetDevMode)" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<ResourcePreloader />
|
<ResourcePreloader />
|
||||||
<link rel="stylesheet" href="@Assets["lib/bootstrap/dist/css/bootstrap.min.css"]" />
|
<link rel="stylesheet" href="@Assets["lib/bootstrap/dist/css/bootstrap.min.css"]" />
|
||||||
<link rel="stylesheet" href="@Assets["app.css"]" />
|
<link rel="stylesheet" href="@Assets["app.css"]" />
|
||||||
<link rel="stylesheet" href="@Assets["electronnet-samples-blazorsignalr.styles.css"]" />
|
<link rel="stylesheet" href="@Assets["electronnet-samples-authmiddleware.styles.css"]" />
|
||||||
<ImportMap />
|
<ImportMap />
|
||||||
<link rel="icon" type="image/png" href="favicon.png" />
|
<link rel="icon" type="image/png" href="favicon.png" />
|
||||||
<HeadOutlet />
|
<HeadOutlet />
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="top-row ps-3 navbar navbar-dark">
|
<div class="top-row ps-3 navbar navbar-dark">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="">ElectronNET.Samples.BlazorSignalR</a>
|
<a class="navbar-brand" href="">ElectronNET.Samples.AuthMiddleware</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<TypeScriptUseNodeJS>true</TypeScriptUseNodeJS>
|
<TypeScriptUseNodeJS>true</TypeScriptUseNodeJS>
|
||||||
<TypeScriptTSConfig>ElectronHostHook/tsconfig.json</TypeScriptTSConfig>
|
<TypeScriptTSConfig>ElectronHostHook/tsconfig.json</TypeScriptTSConfig>
|
||||||
<TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled>
|
<TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled>
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
<TypeScriptCompileBlocked>false</TypeScriptCompileBlocked>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ElectronNET.Core" Version="0.5.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
<PackageReference Include="ElectronNET.Core" Version="0.5.1" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||||
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.5.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.5.1" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||||
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
|
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1337,10 +1337,20 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
"node_modules/js-yaml": {
|
||||||
"version": "4.1.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
|
||||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/puzrin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/nodeca"
|
||||||
|
}
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"argparse": "^2.0.1"
|
"argparse": "^2.0.1"
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
<ProjectReference Include="..\ElectronNET.AspNet\ElectronNET.AspNet.csproj" Condition="$(ElectronNetDevMode)" />
|
<ProjectReference Include="..\ElectronNET.AspNet\ElectronNET.AspNet.csproj" Condition="$(ElectronNetDevMode)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ElectronNET.Core" Version="0.5.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
<PackageReference Include="ElectronNET.Core" Version="0.5.1" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||||
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.5.0" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
<PackageReference Include="ElectronNET.Core.AspNet" Version="0.5.1" Condition="'$(ElectronNetDevMode)' != 'true'" />
|
||||||
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
|
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.9.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<PropertyGroup Label="ElectronNetCommon">
|
<PropertyGroup Label="ElectronNetCommon">
|
||||||
<ElectronVersion>30.4.0</ElectronVersion>
|
<ElectronVersion>30.4.0</ElectronVersion>
|
||||||
<ElectronBuilderVersion>26.0</ElectronBuilderVersion>
|
<ElectronBuilderVersion>26.0</ElectronBuilderVersion>
|
||||||
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x64</RuntimeIdentifier>
|
<!-- Default to the host SDK's RID (e.g. linux-x64, win-x64, osx-arm64) when none is passed,
|
||||||
|
so `dotnet build/publish` without -r targets the current OS. -->
|
||||||
|
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)</RuntimeIdentifier>
|
||||||
<ElectronSingleInstance>true</ElectronSingleInstance>
|
<ElectronSingleInstance>true</ElectronSingleInstance>
|
||||||
<ElectronSplashScreen></ElectronSplashScreen>
|
<ElectronSplashScreen></ElectronSplashScreen>
|
||||||
<ElectronIcon></ElectronIcon>
|
<ElectronIcon></ElectronIcon>
|
||||||
|
|||||||
@@ -177,9 +177,12 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<!-- tsconfig.json is a build-time config, not a runtime file. Excluding it also stops
|
||||||
|
Microsoft.TypeScript.MSBuild from discovering and compiling the host's tsconfig
|
||||||
|
(types:["node"]) in the consumer project when hook TypeScript compilation is enabled. -->
|
||||||
<ElectronSourceFiles
|
<ElectronSourceFiles
|
||||||
Include="$(ElectronSourceFilesPath)\**\*.js;$(ElectronSourceFilesPath)\**\*.json;$(ElectronSourceFilesPath)\**\*.html"
|
Include="$(ElectronSourceFilesPath)\**\*.js;$(ElectronSourceFilesPath)\**\*.json;$(ElectronSourceFilesPath)\**\*.html"
|
||||||
Exclude="$(ElectronSourceFilesPath)\**\build-helper.js" />
|
Exclude="$(ElectronSourceFilesPath)\**\build-helper.js;$(ElectronSourceFilesPath)\**\tsconfig.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -213,6 +216,35 @@
|
|||||||
</ElectronCustomHookPackageJson>
|
</ElectronCustomHookPackageJson>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Committed-JS mode (TypeScriptCompileBlocked=true): the hook TypeScript is not compiled
|
||||||
|
during the build, so the committed ElectronHostHook JavaScript (and source maps) are
|
||||||
|
packaged as-is. Reclassify them from None into .electron\ElectronHostHook content
|
||||||
|
(mirroring ElectronSourceFiles) so they reach the build output and, at publish, are swept
|
||||||
|
into app\ -> app.asar. When compilation is enabled (TypeScriptCompileBlocked!=true) this
|
||||||
|
is skipped: Microsoft.TypeScript.MSBuild compiles the hook and ElectronAdjustHostHookOutput
|
||||||
|
routes the output, so reclassifying would duplicate .electron\ElectronHostHook items.
|
||||||
|
Without one of these, require('electron-host-hook') fails ('Cannot find module .../index.js'). -->
|
||||||
|
<ItemGroup Condition="'$(ElectronHasCustomHookCode)' == 'true' AND '$(TypeScriptCompileBlocked)' == 'true'">
|
||||||
|
<None Remove="ElectronHostHook\**\*.js;ElectronHostHook\**\*.js.map" />
|
||||||
|
<ElectronCustomHookJsFiles Include="ElectronHostHook\**\*.js;ElectronHostHook\**\*.js.map"
|
||||||
|
Exclude="ElectronHostHook\node_modules\**" />
|
||||||
|
<ElectronCustomHookJsFiles Update="@(ElectronCustomHookJsFiles)">
|
||||||
|
<Link>$(ElectronDirName)\ElectronHostHook\%(RecursiveDir)%(FileName)%(Extension)</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</ElectronCustomHookJsFiles>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<AssignTargetPath Files="@(ElectronCustomHookJsFiles)" RootFolder="$(MSBuildProjectDirectory)"
|
||||||
|
Condition="'$(ElectronHasCustomHookCode)' == 'true' AND '$(TypeScriptCompileBlocked)' == 'true'">
|
||||||
|
<Output TaskParameter="AssignedFiles" ItemName="ElectronCustomHookJsFilesWithTargetPath" />
|
||||||
|
</AssignTargetPath>
|
||||||
|
|
||||||
|
<ItemGroup Condition="'$(ElectronHasCustomHookCode)' == 'true' AND '$(TypeScriptCompileBlocked)' == 'true'">
|
||||||
|
<FilesForPackagingFromProject Include="@(ElectronCustomHookJsFilesWithTargetPath->'%(Identity)')" />
|
||||||
|
<ContentWithTargetPath Include="@(ElectronCustomHookJsFilesWithTargetPath->'%(Identity)')" />
|
||||||
|
<Content Include="@(ElectronCustomHookJsFiles->'%(Identity)')" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ElectronIntermediatePackageJson Include="$(ElectronIntermediatePackageJson)" />
|
<ElectronIntermediatePackageJson Include="$(ElectronIntermediatePackageJson)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -231,13 +263,45 @@
|
|||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- When hook TypeScript compilation is enabled (TypeScriptCompileBlocked!=true), restore the
|
||||||
|
hook's npm dependencies into ElectronHostHook\node_modules before tsc runs so its imports
|
||||||
|
(e.g. socket.io) resolve. Incremental: only re-runs when the hook package.json changes or
|
||||||
|
node_modules is missing. Skipped in committed-JS mode and at design time. -->
|
||||||
|
<Target Name="ElectronRestoreHostHookDependencies"
|
||||||
|
BeforeTargets="CompileTypeScriptWithTSConfig;CompileTypeScript"
|
||||||
|
Condition="'@(ElectronCustomHookTsFiles->Count())' > 1 AND Exists('$(MSBuildProjectDirectory)\ElectronHostHook\package.json') AND '$(TypeScriptCompileBlocked)' != 'true' AND '$(DesignTimeBuild)' != 'true'"
|
||||||
|
Inputs="$(MSBuildProjectDirectory)\ElectronHostHook\package.json"
|
||||||
|
Outputs="$(MSBuildProjectDirectory)\ElectronHostHook\node_modules\.package-lock.json">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<IsLinuxWsl>false</IsLinuxWsl>
|
||||||
|
<IsLinuxWsl Condition="'$(ElectronPlatform)' == 'linux' AND $([MSBuild]::IsOSPlatform('Windows'))">true</IsLinuxWsl>
|
||||||
|
<_NpmCmd>npm install</_NpmCmd>
|
||||||
|
<_NpmCmd Condition="'$(IsLinuxWsl)' == 'true'">wsl bash -ic '$(_NpmCmd)'</_NpmCmd>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Message Importance="High" Text="Restoring ElectronHostHook npm dependencies for TypeScript compilation..." />
|
||||||
|
|
||||||
|
<Exec Command="$(_NpmCmd)"
|
||||||
|
WorkingDirectory="$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', 'ElectronHostHook'))"
|
||||||
|
Timeout="600000" StandardOutputImportance="Low" StandardErrorImportance="High" ContinueOnError="false" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
<!-- Run before GetTypeScriptOutputForPublishing to adjust the target directory -->
|
<!-- Run before GetTypeScriptOutputForPublishing to adjust the target directory -->
|
||||||
<Target Name="ElectronAdjustHostHookOutput" BeforeTargets="GetTypeScriptOutputForPublishing" DependsOnTargets="CompileTypeScriptWithTSConfig">
|
<Target Name="ElectronAdjustHostHookOutput" BeforeTargets="GetTypeScriptOutputForPublishing" DependsOnTargets="CompileTypeScriptWithTSConfig">
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<!-- Route the compiled hook JS to .electron\ElectronHostHook. Do NOT reuse
|
||||||
|
%(DestinationRelativePath): with no outDir in the hook tsconfig, VsTsc leaves it as
|
||||||
|
an absolute path, which would produce .electron\<absolute-path>. Derive the target
|
||||||
|
from the file name instead (hook files are flat). Link is set because
|
||||||
|
GetTypeScriptOutputForPublishing re-runs AssignTargetPath, which honors Link for the
|
||||||
|
publish TargetPath. -->
|
||||||
<GeneratedJavascript Update="@(GeneratedJavascript)">
|
<GeneratedJavascript Update="@(GeneratedJavascript)">
|
||||||
<DestinationRelativePath>$(ElectronDirName)\%(DestinationRelativePath)</DestinationRelativePath>
|
<DestinationRelativePath>$(ElectronDirName)\ElectronHostHook\%(Filename)%(Extension)</DestinationRelativePath>
|
||||||
<TargetPath>$(ElectronDirName)\%(DestinationRelativePath)</TargetPath>
|
<TargetPath>$(ElectronDirName)\ElectronHostHook\%(Filename)%(Extension)</TargetPath>
|
||||||
|
<Link>$(ElectronDirName)\ElectronHostHook\%(Filename)%(Extension)</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</GeneratedJavascript>
|
</GeneratedJavascript>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -449,6 +513,10 @@
|
|||||||
<PublishDir>$(_OriginalPublishDir)</PublishDir>
|
<PublishDir>$(_OriginalPublishDir)</PublishDir>
|
||||||
<PublishDir Condition="'$(_NonIntermediatePublishDir)' != ''">$(_NonIntermediatePublishDir)</PublishDir>
|
<PublishDir Condition="'$(_NonIntermediatePublishDir)' != ''">$(_NonIntermediatePublishDir)</PublishDir>
|
||||||
<ElectronPublishDir>$(_OriginalPublishDir)</ElectronPublishDir>
|
<ElectronPublishDir>$(_OriginalPublishDir)</ElectronPublishDir>
|
||||||
|
<!-- The Electron host files (main.js, package.json, runtime node_modules, ...) are packed
|
||||||
|
into app.asar. They live in a dedicated 'app' subfolder so the .NET app in 'bin' is NOT
|
||||||
|
swept into the asar by electron-builder's default 'files' glob. See directories.app below. -->
|
||||||
|
<ElectronAppDir>$(ElectronPublishDir)app\</ElectronAppDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
@@ -489,7 +557,7 @@ For more information, see: https://github.com/ElectronNET/Electron.NET/wiki/Migr
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ElectronPublishFilesToMove Update="@(ElectronPublishFilesToMove)" >
|
<ElectronPublishFilesToMove Update="@(ElectronPublishFilesToMove)" >
|
||||||
<MoveTargetPath>$(ElectronPublishDir)%(RecursiveDir)%(FileName)%(Extension)</MoveTargetPath>
|
<MoveTargetPath>$(ElectronAppDir)%(RecursiveDir)%(FileName)%(Extension)</MoveTargetPath>
|
||||||
</ElectronPublishFilesToMove>
|
</ElectronPublishFilesToMove>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@@ -503,14 +571,55 @@ For more information, see: https://github.com/ElectronNET/Electron.NET/wiki/Migr
|
|||||||
<ElectronPublishUrlFullPath>$([System.IO.Path]::GetFullPath('$(PublishUrl.TrimEnd("\"))'))</ElectronPublishUrlFullPath>
|
<ElectronPublishUrlFullPath>$([System.IO.Path]::GetFullPath('$(PublishUrl.TrimEnd("\"))'))</ElectronPublishUrlFullPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<ElectronAppDirFullPath>$([System.IO.Path]::GetFullPath('$(ElectronAppDir)'))</ElectronAppDirFullPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsLinuxWsl>false</IsLinuxWsl>
|
<IsLinuxWsl>false</IsLinuxWsl>
|
||||||
<IsLinuxWsl Condition="'$(ElectronPlatform)' == 'linux' AND $([MSBuild]::IsOSPlatform('Windows'))">true</IsLinuxWsl>
|
<IsLinuxWsl Condition="'$(ElectronPlatform)' == 'linux' AND $([MSBuild]::IsOSPlatform('Windows'))">true</IsLinuxWsl>
|
||||||
<_NpmCmd>npm install electron-builder@$(ElectronBuilderVersion) --save-dev </_NpmCmd>
|
|
||||||
<_NpmCmd Condition="'$(IsLinuxWsl)' == 'true'">wsl bash -ic '$(_NpmCmd)'</_NpmCmd>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Message Importance="High" Text="ElectronPublishApp: ElectronPublishDirFullPath - $(ElectronPublishDirFullPath)" />
|
<Message Importance="High" Text="ElectronPublishApp: ElectronPublishDirFullPath - $(ElectronPublishDirFullPath)" />
|
||||||
|
<Message Importance="High" Text="ElectronPublishApp: ElectronAppDirFullPath - $(ElectronAppDirFullPath)" />
|
||||||
|
|
||||||
|
<!-- Install the app's runtime (prod) dependencies into app\node_modules so they end up
|
||||||
|
inside app.asar. devDependencies (electron, eslint, typescript) are not needed here:
|
||||||
|
TypeScript is already compiled at build time and electron-builder fetches Electron itself. -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<_NpmAppDepsCmd>npm install --omit=dev</_NpmAppDepsCmd>
|
||||||
|
<_NpmAppDepsCmd Condition="'$(IsLinuxWsl)' == 'true'">wsl bash -ic '$(_NpmAppDepsCmd)'</_NpmAppDepsCmd>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<Exec Command="$(_NpmAppDepsCmd)" WorkingDirectory="$(ElectronAppDirFullPath)" Timeout="600000" StandardOutputImportance="High" StandardErrorImportance="High" ContinueOnError="false" Condition="@(CopiedFiles->Count()) > 0">
|
||||||
|
<Output TaskParameter="ExitCode" PropertyName="ExecExitCode"/>
|
||||||
|
</Exec>
|
||||||
|
|
||||||
|
<Message Importance="High" Text="Electron app dependency install failed!" Condition="'$(ExecExitCode)' != '0'" />
|
||||||
|
|
||||||
|
<!-- Install electron-builder (the dev tool) into the publish root, which is the
|
||||||
|
electron-builder projectDir (cwd). app metadata + runtime deps are read from
|
||||||
|
app\ via directories.app (standard electron-builder two-package.json layout).
|
||||||
|
Render the dev package.json first: the two-package.json layout requires a
|
||||||
|
package.json at the projectDir, and electron-builder requires the 'build'
|
||||||
|
configuration to live in this development package.json (it is rejected in the
|
||||||
|
application package.json under app\). The .NET app's metadata/version come from
|
||||||
|
app\package.json instead. -->
|
||||||
|
<ItemGroup>
|
||||||
|
<DevTemplateProperty Include="ElectronPackageId" Value="$(ElectronPackageId)" />
|
||||||
|
<DevTemplateProperty Include="Title" Value="$(Title)" />
|
||||||
|
<DevTemplateProperty Include="Version" Value="$(Version)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ReplaceTemplateTask TemplateFile="$(MSBuildThisFileDirectory)package.dev.template.json"
|
||||||
|
OutputFile="$([System.IO.Path]::Combine('$(ElectronPublishDirFullPath)', 'package.json'))"
|
||||||
|
TemplateProperties="@(DevTemplateProperty)"
|
||||||
|
Condition="@(CopiedFiles->Count()) > 0" />
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<_NpmCmd>npm install electron-builder@$(ElectronBuilderVersion)</_NpmCmd>
|
||||||
|
<_NpmCmd Condition="'$(IsLinuxWsl)' == 'true'">wsl bash -ic '$(_NpmCmd)'</_NpmCmd>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<Exec Command="$(_NpmCmd)" WorkingDirectory="$(ElectronPublishDirFullPath)" Timeout="600000" StandardOutputImportance="High" StandardErrorImportance="High" ContinueOnError="false" Condition="@(CopiedFiles->Count()) > 0">
|
<Exec Command="$(_NpmCmd)" WorkingDirectory="$(ElectronPublishDirFullPath)" Timeout="600000" StandardOutputImportance="High" StandardErrorImportance="High" ContinueOnError="false" Condition="@(CopiedFiles->Count()) > 0">
|
||||||
<Output TaskParameter="ExitCode" PropertyName="ExecExitCode"/>
|
<Output TaskParameter="ExitCode" PropertyName="ExecExitCode"/>
|
||||||
@@ -529,6 +638,10 @@ For more information, see: https://github.com/ElectronNET/Electron.NET/wiki/Migr
|
|||||||
<ElectronPaParams Condition="'$(Version)' != ''">$(ElectronPaParams) -c.buildVersion "$(Version)"</ElectronPaParams>
|
<ElectronPaParams Condition="'$(Version)' != ''">$(ElectronPaParams) -c.buildVersion "$(Version)"</ElectronPaParams>
|
||||||
<ElectronPaParams Condition="'$(Copyright)' != ''">$(ElectronPaParams) -c.copyright "$(Copyright)"</ElectronPaParams>
|
<ElectronPaParams Condition="'$(Copyright)' != ''">$(ElectronPaParams) -c.copyright "$(Copyright)"</ElectronPaParams>
|
||||||
<ElectronPaParams>$(ElectronPaParams) -c.extraResources "bin/**/*"</ElectronPaParams>
|
<ElectronPaParams>$(ElectronPaParams) -c.extraResources "bin/**/*"</ElectronPaParams>
|
||||||
|
<!-- Build app.asar from the 'app' subfolder only (host JS + runtime node_modules),
|
||||||
|
keeping the .NET app under 'bin' out of the asar. cwd stays the publish root so
|
||||||
|
extraResources and user icon paths under bin/ still resolve. -->
|
||||||
|
<ElectronPaParams>$(ElectronPaParams) -c.directories.app "app"</ElectronPaParams>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -437,6 +437,8 @@
|
|||||||
<EnumValue Name="40.10.0" DisplayName="40.10.0" />
|
<EnumValue Name="40.10.0" DisplayName="40.10.0" />
|
||||||
<EnumValue Name="40.10.1" DisplayName="40.10.1" />
|
<EnumValue Name="40.10.1" DisplayName="40.10.1" />
|
||||||
<EnumValue Name="40.10.2" DisplayName="40.10.2" />
|
<EnumValue Name="40.10.2" DisplayName="40.10.2" />
|
||||||
|
<EnumValue Name="40.10.3" DisplayName="40.10.3" />
|
||||||
|
<EnumValue Name="40.10.4" DisplayName="40.10.4" />
|
||||||
<EnumValue Name="41.0.0" DisplayName="41.0.0" />
|
<EnumValue Name="41.0.0" DisplayName="41.0.0" />
|
||||||
<EnumValue Name="41.0.1" DisplayName="41.0.1" />
|
<EnumValue Name="41.0.1" DisplayName="41.0.1" />
|
||||||
<EnumValue Name="41.0.2" DisplayName="41.0.2" />
|
<EnumValue Name="41.0.2" DisplayName="41.0.2" />
|
||||||
@@ -456,6 +458,8 @@
|
|||||||
<EnumValue Name="41.6.1" DisplayName="41.6.1" />
|
<EnumValue Name="41.6.1" DisplayName="41.6.1" />
|
||||||
<EnumValue Name="41.7.0" DisplayName="41.7.0" />
|
<EnumValue Name="41.7.0" DisplayName="41.7.0" />
|
||||||
<EnumValue Name="41.7.1" DisplayName="41.7.1" />
|
<EnumValue Name="41.7.1" DisplayName="41.7.1" />
|
||||||
|
<EnumValue Name="41.7.2" DisplayName="41.7.2" />
|
||||||
|
<EnumValue Name="41.8.0" DisplayName="41.8.0" />
|
||||||
<EnumValue Name="42.0.0" DisplayName="42.0.0" />
|
<EnumValue Name="42.0.0" DisplayName="42.0.0" />
|
||||||
<EnumValue Name="42.0.1" DisplayName="42.0.1" />
|
<EnumValue Name="42.0.1" DisplayName="42.0.1" />
|
||||||
<EnumValue Name="42.1.0" DisplayName="42.1.0" />
|
<EnumValue Name="42.1.0" DisplayName="42.1.0" />
|
||||||
@@ -464,6 +468,8 @@
|
|||||||
<EnumValue Name="42.3.1" DisplayName="42.3.1" />
|
<EnumValue Name="42.3.1" DisplayName="42.3.1" />
|
||||||
<EnumValue Name="42.3.2" DisplayName="42.3.2" />
|
<EnumValue Name="42.3.2" DisplayName="42.3.2" />
|
||||||
<EnumValue Name="42.3.3" DisplayName="42.3.3" />
|
<EnumValue Name="42.3.3" DisplayName="42.3.3" />
|
||||||
|
<EnumValue Name="42.4.0" DisplayName="42.4.0" />
|
||||||
|
<EnumValue Name="42.4.1" DisplayName="42.4.1" />
|
||||||
</EnumProperty>
|
</EnumProperty>
|
||||||
|
|
||||||
<EnumProperty Name="ElectronBuilderVersion"
|
<EnumProperty Name="ElectronBuilderVersion"
|
||||||
|
|||||||
19
src/ElectronNET/build/package.dev.template.json
Normal file
19
src/ElectronNET/build/package.dev.template.json
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "electron-builder-host",
|
||||||
|
"version": "$(Version)",
|
||||||
|
"private": true,
|
||||||
|
"build": {
|
||||||
|
"appId": "$(ElectronPackageId)",
|
||||||
|
"linux": {
|
||||||
|
"desktop": {
|
||||||
|
"entry": { "Name": "$(Title)" }
|
||||||
|
},
|
||||||
|
"executableName": "$(ElectronPackageId)"
|
||||||
|
},
|
||||||
|
"deb": {
|
||||||
|
"desktop": {
|
||||||
|
"entry": { "Name": "$(Title)" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "$(ElectronPackageId)",
|
"name": "$(ElectronPackageId)",
|
||||||
"productName": "$(ElectronTitle)",
|
"productName": "$(ElectronTitle)",
|
||||||
"build": {
|
|
||||||
"appId": "$(ElectronPackageId)",
|
|
||||||
"linux": {
|
|
||||||
"desktop": {
|
|
||||||
"entry": { "Name": "$(Title)" }
|
|
||||||
},
|
|
||||||
"executableName": "$(ElectronPackageId)"
|
|
||||||
},
|
|
||||||
"deb": {
|
|
||||||
"desktop": {
|
|
||||||
"entry": { "Name": "$(Title)" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"description": "$(Description)",
|
"description": "$(Description)",
|
||||||
"version": "$(Version)",
|
"version": "$(Version)",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>0.5.1</Version>
|
<Version>0.5.2</Version>
|
||||||
<PackageNamePrefix>ElectronNET.Core</PackageNamePrefix>
|
<PackageNamePrefix>ElectronNET.Core</PackageNamePrefix>
|
||||||
<Authors>Gregor Biswanger, Florian Rappl, softworkz</Authors>
|
<Authors>Gregor Biswanger, Florian Rappl, softworkz</Authors>
|
||||||
<Product>Electron.NET</Product>
|
<Product>Electron.NET</Product>
|
||||||
|
|||||||
Reference in New Issue
Block a user