mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-18 14:47:43 +00:00
Merge branch 'master' into dev/AutoUpdate
This commit is contained in:
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://donorbox.org/electron-net
|
||||
@@ -1,6 +1,7 @@
|
||||
language: csharp
|
||||
mono: none
|
||||
dotnet: 2.1.300
|
||||
dist: xenial
|
||||
dotnet: 2.2
|
||||
before_script:
|
||||
- export PATH="$PATH:/home/travis/.dotnet/tools"
|
||||
- npm install electron-packager --global
|
||||
|
||||
29
Changelog.md
29
Changelog.md
@@ -1,4 +1,31 @@
|
||||
# not release
|
||||
# Not released
|
||||
|
||||
# 5.22.14
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Fixed bug: Build fails with latest electron-builder version [\#288](https://github.com/ElectronNET/Electron.NET/issues/288)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Fixed bug: Electron tray icon TypeError ([Electron original issue](https://github.com/electron/electron/issues/7657)) (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
* Fixed bug: Wrong tray icon path in the application built via `electronize build` command (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
* Fixed bug: fix async issue where same port is considered open [\#261](https://github.com/ElectronNET/Electron.NET/issues/261) (thanks [netpoetica](https://github.com/netpoetica))
|
||||
|
||||
ElectronNET.WebApp:
|
||||
|
||||
* Fixed usage of the `Electron.Tray.Show` according fixed bugs in the ElectronNET.CLI (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
|
||||
|
||||
# Released
|
||||
|
||||
# 5.22.13
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Fixed bug: Menu Item visibility [\#257](https://github.com/ElectronNET/Electron.NET/issues/257)
|
||||
* Fixed bug: electron.manifest.json - singleInstance not working [\#258](https://github.com/ElectronNET/Electron.NET/issues/258)
|
||||
* Fixed security issue: ASP.NET Core process is now bound to 127.0.0.1 instead of the broader localhost [\#258](https://github.com/ElectronNET/Electron.NET/pull/266)
|
||||
|
||||
# 5.22.12
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>..\artifacts</PackageOutputPath>
|
||||
<PackageId>ElectronNET.API</PackageId>
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ElectronNET.API.Entities
|
||||
public bool DevTools { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether node integration is enabled. Default is true.
|
||||
/// Whether node integration is enabled. Required to enable IPC. Default is true.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool NodeIntegration { get; set; } = true;
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace ElectronNET.API
|
||||
if(HybridSupport.IsElectronActive)
|
||||
{
|
||||
builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
|
||||
.UseUrls("http://localhost:" + BridgeSettings.WebPort);
|
||||
.UseUrls("http://127.0.0.1:" + BridgeSettings.WebPort);
|
||||
}
|
||||
|
||||
return builder;
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace ElectronNET.CLI.Commands.Actions
|
||||
{
|
||||
case "win":
|
||||
netCorePublishRid = "win-x64";
|
||||
electronPackerPlatform = "win32";
|
||||
electronPackerPlatform = "win";
|
||||
break;
|
||||
case "osx":
|
||||
netCorePublishRid = "osx-x64";
|
||||
electronPackerPlatform = "darwin";
|
||||
electronPackerPlatform = "mac";
|
||||
break;
|
||||
case "linux":
|
||||
netCorePublishRid = "linux-x64";
|
||||
@@ -44,12 +44,12 @@ namespace ElectronNET.CLI.Commands.Actions
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
netCorePublishRid = $"win-x{(Environment.Is64BitOperatingSystem ? "64" : "86")}";
|
||||
electronPackerPlatform = "win32";
|
||||
electronPackerPlatform = "win";
|
||||
}
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
netCorePublishRid = "osx-x64";
|
||||
electronPackerPlatform = "darwin";
|
||||
electronPackerPlatform = "mac";
|
||||
}
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
|
||||
@@ -154,8 +154,6 @@ namespace ElectronNET.CLI.Commands
|
||||
|
||||
Console.WriteLine("Executing electron magic in this directory: " + buildPath);
|
||||
|
||||
// ToDo: Need a solution for --asar support
|
||||
|
||||
string electronArch = "x64";
|
||||
if (parser.Arguments.ContainsKey(_paramElectronArch))
|
||||
{
|
||||
@@ -173,7 +171,7 @@ namespace ElectronNET.CLI.Commands
|
||||
ProcessHelper.CmdExecute($"node build-helper.js", tempPath);
|
||||
|
||||
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
|
||||
ProcessHelper.CmdExecute($"electron-builder . --config=./bin/electron-builder.json --platform={platformInfo.ElectronPackerPlatform} --arch={electronArch} {electronParams}", tempPath);
|
||||
ProcessHelper.CmdExecute($"electron-builder . --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=5.0.8 {electronParams}", tempPath);
|
||||
|
||||
Console.WriteLine("... done");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyName>electronize</AssemblyName>
|
||||
|
||||
<PackageType>DotnetCliTool</PackageType>
|
||||
|
||||
@@ -52,8 +52,8 @@ module.exports = (socket) => {
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('trayMenuItemClicked', id);
|
||||
});
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
|
||||
tray = new electron_1.Tray(imagePath);
|
||||
const trayIcon = electron_1.nativeImage.createFromPath(image);
|
||||
tray = new electron_1.Tray(trayIcon);
|
||||
tray.setContextMenu(menu);
|
||||
});
|
||||
socket.on('tray-destroy', () => {
|
||||
|
||||
@@ -60,9 +60,9 @@ export = (socket: SocketIO.Socket) => {
|
||||
electronSocket.emit('trayMenuItemClicked', id);
|
||||
});
|
||||
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
|
||||
const trayIcon = nativeImage.createFromPath(image);
|
||||
|
||||
tray = new Tray(imagePath);
|
||||
tray = new Tray(trayIcon);
|
||||
tray.setContextMenu(menu);
|
||||
});
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ function startSocketApiBridge(port) {
|
||||
server.listen(port, 'localhost');
|
||||
server.on('listening', function () {
|
||||
console.log('Electron Socket started on port %s at %s', server.address().port, server.address().address);
|
||||
// Now that socket connection is established, we can guarantee port will not be open for portscanner
|
||||
startAspCoreBackend(port);
|
||||
});
|
||||
|
||||
startAspCoreBackend(port);
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
global['electronsocket'] = socket;
|
||||
global['electronsocket'].setMaxListeners(0);
|
||||
|
||||
1976
ElectronNET.Host/package-lock.json
generated
Normal file
1976
ElectronNET.Host/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,6 @@
|
||||
"@types/socket.io": "^2.1.2",
|
||||
"tslint": "^5.12.0",
|
||||
"typescript": "^3.2.2",
|
||||
"electron": "^5.0.1"
|
||||
"electron": "^5.0.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,21 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class TrayController : Controller
|
||||
{
|
||||
private readonly IHostingEnvironment _env;
|
||||
|
||||
public TrayController(IHostingEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (HybridSupport.IsElectronActive)
|
||||
@@ -21,7 +31,7 @@ namespace ElectronNET.WebApp.Controllers
|
||||
Click = () => Electron.Tray.Destroy()
|
||||
};
|
||||
|
||||
Electron.Tray.Show("/Assets/electron_32x32.png", menu);
|
||||
Electron.Tray.Show(Path.Combine(_env.ContentRootPath, "Assets/electron_32x32.png"), menu);
|
||||
Electron.Tray.SetToolTip("Electron Demo in the tray.");
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
|
||||
<TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
|
||||
</PropertyGroup>
|
||||
@@ -11,7 +11,6 @@
|
||||
<Content Remove="Views\Windows\HandleErrorCrashes.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets\" />
|
||||
<Folder Include="wwwroot\assets\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -28,6 +28,6 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:50395/"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
90
README.md
90
README.md
@@ -47,8 +47,8 @@ You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension.
|
||||
public static IWebHost BuildWebHost(string[] args)
|
||||
{
|
||||
return WebHost.CreateDefaultBuilder(args)
|
||||
.UseElectron(args)
|
||||
.UseStartup<Startup>()
|
||||
.UseElectron(args)
|
||||
.Build();
|
||||
}
|
||||
```
|
||||
@@ -86,17 +86,23 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
|
||||
|
||||
__Please note:__ Currently it is important to use ASP.NET Core with MVC. If you are working with the dotnet CLI, use
|
||||
|
||||
dotnet new mvc
|
||||
```
|
||||
dotnet new mvc
|
||||
```
|
||||
|
||||
## Start the Application
|
||||
|
||||
To start the application make sure you have installed the "[ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)" packages as global tool:
|
||||
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
```
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
```
|
||||
|
||||
* Make sure you have __node.js v8.6.0__ and on __macOS/Linux__ the electron-builder installed!
|
||||
|
||||
sudo npm install electron-packager --global
|
||||
|
||||
```
|
||||
sudo npm install electron-builder --global
|
||||
```
|
||||
|
||||
At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:
|
||||
|
||||
@@ -129,15 +135,15 @@ In this YouTube video, we show you how you can create a new project, use the Ele
|
||||
Here you need the Electron.NET CLI as well. Type the following command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
electronize build /target win
|
||||
electronize build /target win
|
||||
```
|
||||
|
||||
There are additional platforms available:
|
||||
|
||||
```
|
||||
electronize build /target win
|
||||
electronize build /target osx
|
||||
electronize build /target linux
|
||||
electronize build /target win
|
||||
electronize build /target osx
|
||||
electronize build /target linux
|
||||
```
|
||||
|
||||
Those three "default" targets will produce x64 packages for those platforms.
|
||||
@@ -145,7 +151,7 @@ Those three "default" targets will produce x64 packages for those platforms.
|
||||
For certain NuGet packages or certain scenarios you may want to build a pure x86 application. To support those things you can define the desired [.NET Core runtime](https://docs.microsoft.com/en-us/dotnet/core/rid-catalog), the [electron platform](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#platform) and [electron architecture](https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#arch) like this:
|
||||
|
||||
```
|
||||
electronize build /target custom win7-x86;win32 /electron-arch ia32
|
||||
electronize build /target custom win7-x86;win32 /electron-arch ia32
|
||||
```
|
||||
|
||||
The end result should be an electron app under your __/bin/desktop__ folder.
|
||||
@@ -187,23 +193,77 @@ MIT-licensed
|
||||
|
||||
# Important notes
|
||||
|
||||
## ElectronNET.API & ElectronNET.CLI Version 5.22.12
|
||||
|
||||
Make sure you also have the new Electron.NET CLI 5.22.12 version. This now uses [electron-builder](https://www.electron.build/configuration/configuration) and the necessary configuration to build is made in the **electron.manifest.json** file. In addition, own Electron.NET configurations are stored. Please make sure that your **electron.manifest.json** file has the following new structure:
|
||||
|
||||
```
|
||||
{
|
||||
"executable": "{{executable}}",
|
||||
"splashscreen": {
|
||||
"imageFile": ""
|
||||
},
|
||||
"singleInstance": false,
|
||||
"build": {
|
||||
"appId": "com.{{executable}}.app",
|
||||
"productName": "{{executable}}",
|
||||
"copyright": "Copyright © 2019",
|
||||
"buildVersion": "1.0.0",
|
||||
"compression": "maximum",
|
||||
"directories": {
|
||||
"output": "../../../bin/Desktop"
|
||||
},
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "./bin",
|
||||
"to": "bin",
|
||||
"filter": ["**/*"]
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
{
|
||||
"from": "./ElectronHostHook/node_modules",
|
||||
"to": "ElectronHostHook/node_modules",
|
||||
"filter": ["**/*"]
|
||||
},
|
||||
"**/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## ElectronNET.CLI Version 0.0.9
|
||||
|
||||
In the Version 0.0.9 the CLI was not a global tool and needed to be registred like this in the .csproj:
|
||||
|
||||
```
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
|
||||
</ItemGroup>
|
||||
```
|
||||
|
||||
After you edited the .csproj-file, you need to restore your NuGet packages within your Project. Run the follwoing command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
dotnet restore
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
|
||||
If you still use this version you will need to invoke it like this:
|
||||
|
||||
dotnet electronize ...
|
||||
```
|
||||
dotnet electronize ...
|
||||
```
|
||||
|
||||
## Node Integration
|
||||
Electron.NET requires Node Integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node Integration like so:
|
||||
|
||||
```csharp
|
||||
WebPreferences wp = new WebPreferences();
|
||||
wp.NodeIntegration = false;
|
||||
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
|
||||
{
|
||||
WebPreferences = wp
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
set ENETVER=5.22.13
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --force /property:Version=5.22.12
|
||||
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts"
|
||||
dotnet build --configuration Release --force /property:Version=%ENETVER%
|
||||
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
|
||||
cd ..
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNet.CLI
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --force /property:Version=5.22.12
|
||||
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts"
|
||||
dotnet build --configuration Release --force /property:Version=%ENETVER%
|
||||
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
|
||||
cd ..
|
||||
15
buildReleaseNuGetPackages.sh
Executable file
15
buildReleaseNuGetPackages.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNET.API && \
|
||||
dotnet restore && \
|
||||
dotnet build --configuration Release --force /property:Version=5.22.12 && \
|
||||
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts";
|
||||
|
||||
cd ../;
|
||||
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNET.CLI && \
|
||||
dotnet restore && \
|
||||
dotnet build --configuration Release --force /property:Version=5.22.12 && \
|
||||
dotnet pack /p:Version=5.22.12 --configuration Release --force --output "%~dp0artifacts";
|
||||
Reference in New Issue
Block a user