mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-13 21:24:00 +00:00
Compare commits
28 Commits
23.6.1
...
legacy/bui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2910833e61 | ||
|
|
42e816e85c | ||
|
|
03c08503cc | ||
|
|
555f0378b4 | ||
|
|
79580327bd | ||
|
|
f6d17406cd | ||
|
|
9e79665690 | ||
|
|
9f98b5ca85 | ||
|
|
77b7141513 | ||
|
|
dbf85c6f14 | ||
|
|
c67f117bc7 | ||
|
|
9746edb936 | ||
|
|
23f4d39a30 | ||
|
|
05ac4a1886 | ||
|
|
33ac4edbe3 | ||
|
|
e5f9bae64f | ||
|
|
437404d6cc | ||
|
|
1ae2f1de93 | ||
|
|
6bfd0c33af | ||
|
|
6311d55a75 | ||
|
|
7b522c1779 | ||
|
|
b1c08f5865 | ||
|
|
a3f19055b9 | ||
|
|
ef9a95d9e9 | ||
|
|
2367035acd | ||
|
|
3470a70572 | ||
|
|
1365918efd | ||
|
|
e909de54af |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,6 +1,6 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
github: [GregorBiswanger, FlorianRappl]
|
||||
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
|
||||
|
||||
47
.github/workflows/ci.yml
vendored
Normal file
47
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
7.0.x
|
||||
|
||||
- name: Build
|
||||
run: ./build.sh
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
7.0.x
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
if ($env:GITHUB_REF -eq "refs/heads/main") {
|
||||
.\build.ps1 -Target Publish
|
||||
} elseif ($env:GITHUB_REF -eq "refs/heads/develop") {
|
||||
.\build.ps1 -Target PrePublish
|
||||
} else {
|
||||
.\build.ps1
|
||||
}
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -44,7 +44,7 @@ dlldata.c
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
!/artifacts/readme.md
|
||||
!/artifacts/.gitkeep
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
@@ -263,3 +263,6 @@ __pycache__/
|
||||
|
||||
# Mac Only settings file
|
||||
.DS_Store
|
||||
|
||||
# Nuke build tool
|
||||
.nuke/temp
|
||||
|
||||
144
.nuke/build.schema.json
Normal file
144
.nuke/build.schema.json
Normal file
@@ -0,0 +1,144 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Build Schema",
|
||||
"$ref": "#/definitions/build",
|
||||
"definitions": {
|
||||
"build": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Configuration": {
|
||||
"type": "string",
|
||||
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Release"
|
||||
]
|
||||
},
|
||||
"Continue": {
|
||||
"type": "boolean",
|
||||
"description": "Indicates to continue a previously failed build attempt"
|
||||
},
|
||||
"Help": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the help text for this build assembly"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "Host for execution. Default is 'automatic'",
|
||||
"enum": [
|
||||
"AppVeyor",
|
||||
"AzurePipelines",
|
||||
"Bamboo",
|
||||
"Bitbucket",
|
||||
"Bitrise",
|
||||
"GitHubActions",
|
||||
"GitLab",
|
||||
"Jenkins",
|
||||
"Rider",
|
||||
"SpaceAutomation",
|
||||
"TeamCity",
|
||||
"Terminal",
|
||||
"TravisCI",
|
||||
"VisualStudio",
|
||||
"VSCode"
|
||||
]
|
||||
},
|
||||
"NoLogo": {
|
||||
"type": "boolean",
|
||||
"description": "Disables displaying the NUKE logo"
|
||||
},
|
||||
"Partition": {
|
||||
"type": "string",
|
||||
"description": "Partition to use on CI"
|
||||
},
|
||||
"Plan": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the execution plan (HTML)"
|
||||
},
|
||||
"Profile": {
|
||||
"type": "array",
|
||||
"description": "Defines the profiles to load",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"ReleaseNotesFilePath": {
|
||||
"type": "string",
|
||||
"description": "ReleaseNotesFilePath - To determine the SemanticVersion"
|
||||
},
|
||||
"Root": {
|
||||
"type": "string",
|
||||
"description": "Root directory during build execution"
|
||||
},
|
||||
"Skip": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be skipped. Empty list skips all dependencies",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Clean",
|
||||
"Compile",
|
||||
"CompileSample",
|
||||
"CreatePackages",
|
||||
"Default",
|
||||
"ElectronizeCustomWin7TargetSample",
|
||||
"ElectronizeGenericTargetSample",
|
||||
"ElectronizeLinuxTargetSample",
|
||||
"ElectronizeMacOsTargetSample",
|
||||
"ElectronizeWindowsTargetSample",
|
||||
"Package",
|
||||
"PrePublish",
|
||||
"Publish",
|
||||
"PublishPackages",
|
||||
"PublishPreRelease",
|
||||
"PublishRelease",
|
||||
"Restore",
|
||||
"RunUnitTests"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Solution": {
|
||||
"type": "string",
|
||||
"description": "Path to a solution file that is automatically loaded"
|
||||
},
|
||||
"Target": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be invoked. Default is '{default_target}'",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Clean",
|
||||
"Compile",
|
||||
"CompileSample",
|
||||
"CreatePackages",
|
||||
"Default",
|
||||
"ElectronizeCustomWin7TargetSample",
|
||||
"ElectronizeGenericTargetSample",
|
||||
"ElectronizeLinuxTargetSample",
|
||||
"ElectronizeMacOsTargetSample",
|
||||
"ElectronizeWindowsTargetSample",
|
||||
"Package",
|
||||
"PrePublish",
|
||||
"Publish",
|
||||
"PublishPackages",
|
||||
"PublishPreRelease",
|
||||
"PublishRelease",
|
||||
"Restore",
|
||||
"RunUnitTests"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Verbosity": {
|
||||
"type": "string",
|
||||
"description": "Logging verbosity during build execution. Default is 'Normal'",
|
||||
"enum": [
|
||||
"Minimal",
|
||||
"Normal",
|
||||
"Quiet",
|
||||
"Verbose"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
4
.nuke/parameters.json
Normal file
4
.nuke/parameters.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "./build.schema.json",
|
||||
"Solution": "src/ElectronNET.sln"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
language: csharp
|
||||
mono: none
|
||||
dist: xenial
|
||||
dotnet: 3.1
|
||||
before_script:
|
||||
- export PATH="$PATH:/home/travis/.dotnet/tools"
|
||||
script:
|
||||
- ./buildAll.sh
|
||||
20
Changelog.md
20
Changelog.md
@@ -1,16 +1,26 @@
|
||||
# Not released
|
||||
|
||||
# 23.6.2
|
||||
|
||||
# Released
|
||||
## ElectronNET.API
|
||||
|
||||
* Fixed escaping of URL (#735) @cosmo0
|
||||
* Changed `ZoomFactor` type from `int` to `double` (#754) @Yuvix25
|
||||
|
||||
## ElectronNET.CLI
|
||||
|
||||
* (none)
|
||||
|
||||
## Infrastructure
|
||||
|
||||
* Changed build system to NUKE #757 @FlorianRappl
|
||||
* Updated target framework for host project #753 @r-pankevicius
|
||||
|
||||
# 23.6.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
## ElectronNET.CLI
|
||||
|
||||
* New Feature: Upgrade to .NET 6 support
|
||||
|
||||
ElectronNET.API:
|
||||
## ElectronNET.API
|
||||
|
||||
* New Feature: Native Electron 23.2.0 support, but not all new API features included (we search contributors)
|
||||
* New Feature: Upgrade to .NET 6 support
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Global using directives
|
||||
|
||||
global using System.Web;
|
||||
@@ -1,54 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace ElectronNET.CLI.Commands.Actions
|
||||
{
|
||||
public static class DeployEmbeddedElectronFiles
|
||||
{
|
||||
public static void Do(string tempPath)
|
||||
{
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "main.js");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "package.json");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(tempPath, "build-helper.js");
|
||||
|
||||
string vscodeFolder = Path.Combine(tempPath, ".vscode");
|
||||
if (Directory.Exists(vscodeFolder) == false)
|
||||
{
|
||||
Directory.CreateDirectory(vscodeFolder);
|
||||
}
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(vscodeFolder, "launch.json", ".vscode.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(vscodeFolder, "tasks.json", ".vscode.");
|
||||
|
||||
string hostApiFolder = Path.Combine(tempPath, "api");
|
||||
if (Directory.Exists(hostApiFolder) == false)
|
||||
{
|
||||
Directory.CreateDirectory(hostApiFolder);
|
||||
}
|
||||
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "ipc.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "app.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "browserWindows.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "commandLine.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "dialog.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "dock.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "menu.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "notification.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "tray.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "webContents.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "globalShortcut.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "shell.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "screen.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "clipboard.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "autoUpdater.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "browserView.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "powerMonitor.js", "api.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(hostApiFolder, "nativeTheme.js", "api.");
|
||||
|
||||
string splashscreenFolder = Path.Combine(tempPath, "splashscreen");
|
||||
if (Directory.Exists(splashscreenFolder) == false)
|
||||
{
|
||||
Directory.CreateDirectory(splashscreenFolder);
|
||||
}
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(splashscreenFolder, "index.html", "splashscreen.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyName>dotnet-electronize</AssemblyName>
|
||||
<ToolCommandName>electronize</ToolCommandName>
|
||||
<PackageType>DotnetCliTool</PackageType>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>..\artifacts</PackageOutputPath>
|
||||
<PackageId>ElectronNET.CLI</PackageId>
|
||||
<!-- Version 99 is just set for local development stuff to avoid a conflict with "real" packages on NuGet.org -->
|
||||
<Version>99.0.0.0</Version>
|
||||
<Authors>Gregor Biswanger, Florian Rappl</Authors>
|
||||
<Product>Electron.NET</Product>
|
||||
<Company />
|
||||
<Description>
|
||||
Building cross platform electron based desktop apps with .NET Core and ASP.NET Core.
|
||||
This package contains the dotnet tooling to electronize your application.
|
||||
</Description>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/ElectronNET/Electron.NET/</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/ElectronNET/Electron.NET/</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<PackageTags>electron aspnetcore</PackageTags>
|
||||
<PackageReleaseNotes>Changelog: https://github.com/ElectronNET/Electron.NET/blob/master/Changelog.md</PackageReleaseNotes>
|
||||
<PackageIcon>PackageIcon.png</PackageIcon>
|
||||
<PackAsTool>true</PackAsTool>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="ElectronHost\package-lock.json" />
|
||||
<None Remove="ElectronHost\package.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="PackageIcon.png" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\electron.manifest.json" Link="ElectronHost\electron.manifest.json" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\package.json" Link="ElectronHost\package.json" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\main.js" Link="ElectronHost\main.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\build-helper.js" Link="ElectronHost\build-helper.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\ipc.js" Link="ElectronHost\api\ipc.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\index.ts" Link="ElectronHost\ElectronHostHook\index.ts" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\connector.ts" Link="ElectronHost\ElectronHostHook\connector.ts" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\tsconfig.json" Link="ElectronHost\ElectronHostHook\tsconfig.json" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\package.json" Link="ElectronHost\ElectronHostHook\package.json" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\ElectronHostHook\.gitignore" Link="ElectronHost\ElectronHostHook\.gitignore" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\splashscreen\index.html" Link="ElectronHost\splashscreen\index.html" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\app.js" Link="ElectronHost\api\app.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\browserWindows.js" Link="ElectronHost\api\browserWindows.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\commandLine.js" Link="ElectronHost\api\commandLine.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\dialog.js" Link="ElectronHost\api\dialog.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\dock.js" Link="ElectronHost\api\dock.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\menu.js" Link="ElectronHost\api\menu.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\notification.js" Link="ElectronHost\api\notification.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\tray.js" Link="ElectronHost\api\tray.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\globalShortcut.js" Link="ElectronHost\api\globalShortcut.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\screen.js" Link="ElectronHost\api\screen.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\shell.js" Link="ElectronHost\api\shell.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\webContents.js" Link="ElectronHost\api\webContents.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\clipboard.js" Link="ElectronHost\api\clipboard.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\autoUpdater.js" Link="ElectronHost\api\autoUpdater.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\browserView.js" Link="ElectronHost\api\browserView.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\powerMonitor.js" Link="ElectronHost\api\powerMonitor.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\nativeTheme.js" Link="ElectronHost\api\nativeTheme.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\.vscode\launch.json" Link="ElectronHost\.vscode\launch.json" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\.vscode\tasks.json" Link="ElectronHost\.vscode\tasks.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.410601">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.cmd" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' != 'Windows_NT'">
|
||||
<Exec Command="$(ProjectDir)devCleanup.sh" IgnoreExitCode="true" />
|
||||
</Target>
|
||||
</Project>
|
||||
91
ElectronNET.Host/ElectronHostHook/.gitignore
vendored
91
ElectronNET.Host/ElectronHostHook/.gitignore
vendored
@@ -1,91 +0,0 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/node
|
||||
# Edit at https://www.gitignore.io/?templates=node
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# End of https://www.gitignore.io/api/node
|
||||
@@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Connector = void 0;
|
||||
class Connector {
|
||||
constructor(socket,
|
||||
// @ts-ignore
|
||||
app) {
|
||||
this.socket = socket;
|
||||
this.app = app;
|
||||
}
|
||||
on(key, javaScriptCode) {
|
||||
this.socket.on(key, (...args) => {
|
||||
const id = args.pop();
|
||||
try {
|
||||
javaScriptCode(...args, (data) => {
|
||||
if (data) {
|
||||
this.socket.emit(`${key}Complete${id}`, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Connector = Connector;
|
||||
//# sourceMappingURL=connector.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAClB,YAAoB,MAAuB;IACvC,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAiB;QAEhC,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI;gBACA,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD;gBACL,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;aACtE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { Socket } from 'socket.io';
|
||||
|
||||
export class Connector {
|
||||
constructor(private socket: Socket,
|
||||
// @ts-ignore
|
||||
public app: Electron.App) { }
|
||||
|
||||
on(key: string, javaScriptCode: Function): void {
|
||||
this.socket.on(key, (...args: any[]) => {
|
||||
const id: string = args.pop();
|
||||
|
||||
try {
|
||||
javaScriptCode(...args, (data) => {
|
||||
if (data) {
|
||||
this.socket.emit(`${key}Complete${id}`, data);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HookService = void 0;
|
||||
const connector_1 = require("./connector");
|
||||
class HookService extends connector_1.Connector {
|
||||
constructor(socket, app) {
|
||||
super(socket, app);
|
||||
this.app = app;
|
||||
}
|
||||
onHostReady() {
|
||||
// execute your own JavaScript Host logic here
|
||||
}
|
||||
}
|
||||
exports.HookService = HookService;
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,2CAAwC;AAExC,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAuB,EAAS,GAAiB;QACzD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADqB,QAAG,GAAH,GAAG,CAAc;IAE7D,CAAC;IAED,WAAW;QACP,8CAA8C;IAClD,CAAC;CACJ;AARD,kCAQC"}
|
||||
@@ -1,14 +0,0 @@
|
||||
// @ts-ignore
|
||||
import * as Electron from "electron";
|
||||
import { Socket } from "socket.io";
|
||||
import { Connector } from "./connector";
|
||||
|
||||
export class HookService extends Connector {
|
||||
constructor(socket: Socket, public app: Electron.App) {
|
||||
super(socket, app);
|
||||
}
|
||||
|
||||
onHostReady(): void {
|
||||
// execute your own JavaScript Host logic here
|
||||
}
|
||||
}
|
||||
441
ElectronNET.Host/ElectronHostHook/package-lock.json
generated
441
ElectronNET.Host/ElectronHostHook/package-lock.json
generated
@@ -1,441 +0,0 @@
|
||||
{
|
||||
"name": "electron-host-hook",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "electron-host-hook",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"socket.io": "^4.6.1",
|
||||
"typescript": "^5.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@socket.io/component-emitter": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
|
||||
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/cookie": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
|
||||
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/cors": {
|
||||
"version": "2.8.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz",
|
||||
"integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.15.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
|
||||
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/base64id": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
|
||||
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^4.5.0 || >= 5.9"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
|
||||
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ms": "2.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io": {
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.4.1.tgz",
|
||||
"integrity": "sha512-JFYQurD/nbsA5BSPmbaOSLa3tSVj8L6o4srSwXXY3NqE+gGUNmmPTbhn8tjzcCtSqhFgIeqef81ngny8JM25hw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/cookie": "^0.4.1",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/node": ">=10.0.0",
|
||||
"accepts": "~1.3.4",
|
||||
"base64id": "2.0.0",
|
||||
"cookie": "~0.4.1",
|
||||
"cors": "~2.8.5",
|
||||
"debug": "~4.3.1",
|
||||
"engine.io-parser": "~5.0.3",
|
||||
"ws": "~8.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/engine.io-parser": {
|
||||
"version": "5.0.6",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz",
|
||||
"integrity": "sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io": {
|
||||
"version": "4.6.1",
|
||||
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.6.1.tgz",
|
||||
"integrity": "sha512-KMcaAi4l/8+xEjkRICl6ak8ySoxsYG+gG6/XfRCPJPQ/haCRIJBTL4wIl8YCsmtaBovcAXGLOShyVWQ/FG8GZA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.4",
|
||||
"base64id": "~2.0.0",
|
||||
"debug": "~4.3.2",
|
||||
"engine.io": "~6.4.1",
|
||||
"socket.io-adapter": "~2.5.2",
|
||||
"socket.io-parser": "~4.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-adapter": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz",
|
||||
"integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ws": "~8.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socket.io-parser": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
|
||||
"integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
|
||||
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@socket.io/component-emitter": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz",
|
||||
"integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/cookie": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
|
||||
"integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/cors": {
|
||||
"version": "2.8.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz",
|
||||
"integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "18.15.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.5.tgz",
|
||||
"integrity": "sha512-Ark2WDjjZO7GmvsyFFf81MXuGTA/d6oP38anyxWOL6EREyBKAxKoFHwBhaZxCfLRLpO8JgVXwqOwSwa7jRcjew==",
|
||||
"dev": true
|
||||
},
|
||||
"accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
}
|
||||
},
|
||||
"base64id": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
|
||||
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
|
||||
"dev": true
|
||||
},
|
||||
"cookie": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
|
||||
"integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
|
||||
"dev": true
|
||||
},
|
||||
"cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ms": "2.1.2"
|
||||
}
|
||||
},
|
||||
"engine.io": {
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.4.1.tgz",
|
||||
"integrity": "sha512-JFYQurD/nbsA5BSPmbaOSLa3tSVj8L6o4srSwXXY3NqE+gGUNmmPTbhn8tjzcCtSqhFgIeqef81ngny8JM25hw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/cookie": "^0.4.1",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/node": ">=10.0.0",
|
||||
"accepts": "~1.3.4",
|
||||
"base64id": "2.0.0",
|
||||
"cookie": "~0.4.1",
|
||||
"cors": "~2.8.5",
|
||||
"debug": "~4.3.1",
|
||||
"engine.io-parser": "~5.0.3",
|
||||
"ws": "~8.11.0"
|
||||
}
|
||||
},
|
||||
"engine.io-parser": {
|
||||
"version": "5.0.6",
|
||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz",
|
||||
"integrity": "sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==",
|
||||
"dev": true
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"dev": true
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mime-db": "1.52.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
|
||||
"dev": true
|
||||
},
|
||||
"negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"dev": true
|
||||
},
|
||||
"object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"dev": true
|
||||
},
|
||||
"socket.io": {
|
||||
"version": "4.6.1",
|
||||
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.6.1.tgz",
|
||||
"integrity": "sha512-KMcaAi4l/8+xEjkRICl6ak8ySoxsYG+gG6/XfRCPJPQ/haCRIJBTL4wIl8YCsmtaBovcAXGLOShyVWQ/FG8GZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"accepts": "~1.3.4",
|
||||
"base64id": "~2.0.0",
|
||||
"debug": "~4.3.2",
|
||||
"engine.io": "~6.4.1",
|
||||
"socket.io-adapter": "~2.5.2",
|
||||
"socket.io-parser": "~4.2.1"
|
||||
}
|
||||
},
|
||||
"socket.io-adapter": {
|
||||
"version": "2.5.2",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.2.tgz",
|
||||
"integrity": "sha512-87C3LO/NOMc+eMcpcxUBebGjkpMDkNBS9tf7KJqcDsmL936EChtVva71Dw2q4tQcuVC+hAUy4an2NO/sYXmwRA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"ws": "~8.11.0"
|
||||
}
|
||||
},
|
||||
"socket.io-parser": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
|
||||
"integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@socket.io/component-emitter": "~3.1.0",
|
||||
"debug": "~4.3.1"
|
||||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.2.tgz",
|
||||
"integrity": "sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw==",
|
||||
"dev": true
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"dev": true
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.11.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
|
||||
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "es2015"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -1,252 +0,0 @@
|
||||
"use strict";
|
||||
let isQuitWindowAllClosed = true, electronSocket;
|
||||
let appWindowAllClosedEventId;
|
||||
module.exports = (socket, app) => {
|
||||
electronSocket = socket;
|
||||
// By default, quit when all windows are closed
|
||||
app.on('window-all-closed', () => {
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin' && isQuitWindowAllClosed) {
|
||||
app.quit();
|
||||
}
|
||||
else if (appWindowAllClosedEventId) {
|
||||
// If the user is on macOS
|
||||
// - OR -
|
||||
// If the user has indicated NOT to quit when all windows are closed,
|
||||
// emit the event.
|
||||
electronSocket.emit('app-window-all-closed' + appWindowAllClosedEventId);
|
||||
}
|
||||
});
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
appWindowAllClosedEventId = id;
|
||||
});
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
electronSocket.emit('app-before-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
electronSocket.emit('app-will-quit' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
electronSocket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
electronSocket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
electronSocket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
electronSocket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
electronSocket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
});
|
||||
socket.on('appQuit', () => {
|
||||
app.quit();
|
||||
});
|
||||
socket.on('appExit', (exitCode = 0) => {
|
||||
app.exit(exitCode);
|
||||
});
|
||||
socket.on('appRelaunch', (options) => {
|
||||
app.relaunch(options);
|
||||
});
|
||||
socket.on('appFocus', (options) => {
|
||||
app.focus(options);
|
||||
});
|
||||
socket.on('appHide', () => {
|
||||
app.hide();
|
||||
});
|
||||
socket.on('appShow', () => {
|
||||
app.show();
|
||||
});
|
||||
socket.on('appGetAppPath', () => {
|
||||
const path = app.getAppPath();
|
||||
electronSocket.emit('appGetAppPathCompleted', path);
|
||||
});
|
||||
socket.on('appSetAppLogsPath', (path) => {
|
||||
app.setAppLogsPath(path);
|
||||
});
|
||||
socket.on('appGetPath', (name) => {
|
||||
const path = app.getPath(name);
|
||||
electronSocket.emit('appGetPathCompleted', path);
|
||||
});
|
||||
socket.on('appGetFileIcon', async (path, options) => {
|
||||
let error = {};
|
||||
if (options) {
|
||||
const nativeImage = await app.getFileIcon(path, options).catch((errorFileIcon) => error = errorFileIcon);
|
||||
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
}
|
||||
else {
|
||||
const nativeImage = await app.getFileIcon(path).catch((errorFileIcon) => error = errorFileIcon);
|
||||
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
}
|
||||
});
|
||||
socket.on('appSetPath', (name, path) => {
|
||||
app.setPath(name, path);
|
||||
});
|
||||
socket.on('appGetVersion', () => {
|
||||
const version = app.getVersion();
|
||||
electronSocket.emit('appGetVersionCompleted', version);
|
||||
});
|
||||
socket.on('appGetName', () => {
|
||||
electronSocket.emit('appGetNameCompleted', app.name);
|
||||
});
|
||||
socket.on('appSetName', (name) => {
|
||||
app.name = name;
|
||||
});
|
||||
socket.on('appGetLocale', () => {
|
||||
const locale = app.getLocale();
|
||||
electronSocket.emit('appGetLocaleCompleted', locale);
|
||||
});
|
||||
socket.on('appAddRecentDocument', (path) => {
|
||||
app.addRecentDocument(path);
|
||||
});
|
||||
socket.on('appClearRecentDocuments', () => {
|
||||
app.clearRecentDocuments();
|
||||
});
|
||||
socket.on('appSetAsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.setAsDefaultProtocolClient(protocol, path, args);
|
||||
electronSocket.emit('appSetAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
socket.on('appRemoveAsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.removeAsDefaultProtocolClient(protocol, path, args);
|
||||
electronSocket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
socket.on('appIsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.isDefaultProtocolClient(protocol, path, args);
|
||||
electronSocket.emit('appIsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
socket.on('appSetUserTasks', (tasks) => {
|
||||
const success = app.setUserTasks(tasks);
|
||||
electronSocket.emit('appSetUserTasksCompleted', success);
|
||||
});
|
||||
socket.on('appGetJumpListSettings', () => {
|
||||
const jumpListSettings = app.getJumpListSettings();
|
||||
electronSocket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
|
||||
});
|
||||
socket.on('appSetJumpList', (categories) => {
|
||||
app.setJumpList(categories);
|
||||
});
|
||||
socket.on('appRequestSingleInstanceLock', () => {
|
||||
const success = app.requestSingleInstanceLock();
|
||||
electronSocket.emit('appRequestSingleInstanceLockCompleted', success);
|
||||
app.on('second-instance', (event, args = [], workingDirectory = '') => {
|
||||
electronSocket.emit('secondInstance', [args, workingDirectory]);
|
||||
});
|
||||
});
|
||||
socket.on('appHasSingleInstanceLock', () => {
|
||||
const hasLock = app.hasSingleInstanceLock();
|
||||
electronSocket.emit('appHasSingleInstanceLockCompleted', hasLock);
|
||||
});
|
||||
socket.on('appReleaseSingleInstanceLock', () => {
|
||||
app.releaseSingleInstanceLock();
|
||||
});
|
||||
socket.on('appSetUserActivity', (type, userInfo, webpageUrl) => {
|
||||
app.setUserActivity(type, userInfo, webpageUrl);
|
||||
});
|
||||
socket.on('appGetCurrentActivityType', () => {
|
||||
const activityType = app.getCurrentActivityType();
|
||||
electronSocket.emit('appGetCurrentActivityTypeCompleted', activityType);
|
||||
});
|
||||
socket.on('appInvalidateCurrentActivity', () => {
|
||||
app.invalidateCurrentActivity();
|
||||
});
|
||||
socket.on('appResignCurrentActivity', () => {
|
||||
app.resignCurrentActivity();
|
||||
});
|
||||
socket.on('appSetAppUserModelId', (id) => {
|
||||
app.setAppUserModelId(id);
|
||||
});
|
||||
socket.on('appImportCertificate', (options) => {
|
||||
app.importCertificate(options, (result) => {
|
||||
electronSocket.emit('appImportCertificateCompleted', result);
|
||||
});
|
||||
});
|
||||
socket.on('appGetAppMetrics', () => {
|
||||
const processMetrics = app.getAppMetrics();
|
||||
electronSocket.emit('appGetAppMetricsCompleted', processMetrics);
|
||||
});
|
||||
socket.on('appGetGpuFeatureStatus', () => {
|
||||
const gpuFeatureStatus = app.getGPUFeatureStatus();
|
||||
electronSocket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
|
||||
});
|
||||
socket.on('appSetBadgeCount', (count) => {
|
||||
const success = app.setBadgeCount(count);
|
||||
electronSocket.emit('appSetBadgeCountCompleted', success);
|
||||
});
|
||||
socket.on('appGetBadgeCount', () => {
|
||||
const count = app.getBadgeCount();
|
||||
electronSocket.emit('appGetBadgeCountCompleted', count);
|
||||
});
|
||||
socket.on('appIsUnityRunning', () => {
|
||||
const isUnityRunning = app.isUnityRunning();
|
||||
electronSocket.emit('appIsUnityRunningCompleted', isUnityRunning);
|
||||
});
|
||||
socket.on('appGetLoginItemSettings', (options) => {
|
||||
const loginItemSettings = app.getLoginItemSettings(options);
|
||||
electronSocket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
|
||||
});
|
||||
socket.on('appSetLoginItemSettings', (settings) => {
|
||||
app.setLoginItemSettings(settings);
|
||||
});
|
||||
socket.on('appIsAccessibilitySupportEnabled', () => {
|
||||
const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
|
||||
electronSocket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
|
||||
});
|
||||
socket.on('appSetAccessibilitySupportEnabled', (enabled) => {
|
||||
app.setAccessibilitySupportEnabled(enabled);
|
||||
});
|
||||
socket.on('appShowAboutPanel', () => {
|
||||
app.showAboutPanel();
|
||||
});
|
||||
socket.on('appSetAboutPanelOptions', (options) => {
|
||||
app.setAboutPanelOptions(options);
|
||||
});
|
||||
socket.on('appGetUserAgentFallback', () => {
|
||||
electronSocket.emit('appGetUserAgentFallbackCompleted', app.userAgentFallback);
|
||||
});
|
||||
socket.on('appSetUserAgentFallback', (userAgent) => {
|
||||
app.userAgentFallback = userAgent;
|
||||
});
|
||||
socket.on('register-app-on-event', (eventName, listenerName) => {
|
||||
app.on(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
}
|
||||
else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
});
|
||||
socket.on('register-app-once-event', (eventName, listenerName) => {
|
||||
app.once(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
}
|
||||
else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=app.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,312 +0,0 @@
|
||||
import { Socket } from "net";
|
||||
|
||||
let isQuitWindowAllClosed = true, electronSocket;
|
||||
let appWindowAllClosedEventId;
|
||||
export = (socket: Socket, app: Electron.App) => {
|
||||
electronSocket = socket;
|
||||
|
||||
// By default, quit when all windows are closed
|
||||
app.on('window-all-closed', () => {
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin' && isQuitWindowAllClosed) {
|
||||
app.quit();
|
||||
} else if (appWindowAllClosedEventId) {
|
||||
// If the user is on macOS
|
||||
// - OR -
|
||||
// If the user has indicated NOT to quit when all windows are closed,
|
||||
// emit the event.
|
||||
electronSocket.emit('app-window-all-closed' + appWindowAllClosedEventId);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
appWindowAllClosedEventId = id;
|
||||
});
|
||||
|
||||
socket.on('register-app-before-quit-event', (id) => {
|
||||
app.on('before-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
electronSocket.emit('app-before-quit' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-will-quit-event', (id) => {
|
||||
app.on('will-quit', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
electronSocket.emit('app-will-quit' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-blur-event', (id) => {
|
||||
app.on('browser-window-blur', () => {
|
||||
electronSocket.emit('app-browser-window-blur' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-focus-event', (id) => {
|
||||
app.on('browser-window-focus', () => {
|
||||
electronSocket.emit('app-browser-window-focus' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-browser-window-created-event', (id) => {
|
||||
app.on('browser-window-created', () => {
|
||||
electronSocket.emit('app-browser-window-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-web-contents-created-event', (id) => {
|
||||
app.on('web-contents-created', () => {
|
||||
electronSocket.emit('app-web-contents-created' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-accessibility-support-changed-event', (id) => {
|
||||
app.on('accessibility-support-changed', (event, accessibilitySupportEnabled) => {
|
||||
electronSocket.emit('app-accessibility-support-changed' + id, accessibilitySupportEnabled);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('appQuit', () => {
|
||||
app.quit();
|
||||
});
|
||||
|
||||
socket.on('appExit', (exitCode = 0) => {
|
||||
app.exit(exitCode);
|
||||
});
|
||||
|
||||
socket.on('appRelaunch', (options) => {
|
||||
app.relaunch(options);
|
||||
});
|
||||
|
||||
socket.on('appFocus', (options) => {
|
||||
app.focus(options);
|
||||
});
|
||||
|
||||
socket.on('appHide', () => {
|
||||
app.hide();
|
||||
});
|
||||
|
||||
socket.on('appShow', () => {
|
||||
app.show();
|
||||
});
|
||||
|
||||
socket.on('appGetAppPath', () => {
|
||||
const path = app.getAppPath();
|
||||
electronSocket.emit('appGetAppPathCompleted', path);
|
||||
});
|
||||
|
||||
socket.on('appSetAppLogsPath', (path) => {
|
||||
app.setAppLogsPath(path);
|
||||
});
|
||||
|
||||
socket.on('appGetPath', (name) => {
|
||||
const path = app.getPath(name);
|
||||
electronSocket.emit('appGetPathCompleted', path);
|
||||
});
|
||||
|
||||
socket.on('appGetFileIcon', async (path, options) => {
|
||||
let error = {};
|
||||
|
||||
if (options) {
|
||||
const nativeImage = await app.getFileIcon(path, options).catch((errorFileIcon) => error = errorFileIcon);
|
||||
|
||||
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
} else {
|
||||
const nativeImage = await app.getFileIcon(path).catch((errorFileIcon) => error = errorFileIcon);
|
||||
|
||||
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('appSetPath', (name, path) => {
|
||||
app.setPath(name, path);
|
||||
});
|
||||
|
||||
socket.on('appGetVersion', () => {
|
||||
const version = app.getVersion();
|
||||
electronSocket.emit('appGetVersionCompleted', version);
|
||||
});
|
||||
|
||||
socket.on('appGetName', () => {
|
||||
electronSocket.emit('appGetNameCompleted', app.name);
|
||||
});
|
||||
|
||||
socket.on('appSetName', (name) => {
|
||||
app.name = name;
|
||||
});
|
||||
|
||||
socket.on('appGetLocale', () => {
|
||||
const locale = app.getLocale();
|
||||
electronSocket.emit('appGetLocaleCompleted', locale);
|
||||
});
|
||||
|
||||
socket.on('appAddRecentDocument', (path) => {
|
||||
app.addRecentDocument(path);
|
||||
});
|
||||
|
||||
socket.on('appClearRecentDocuments', () => {
|
||||
app.clearRecentDocuments();
|
||||
});
|
||||
|
||||
socket.on('appSetAsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.setAsDefaultProtocolClient(protocol, path, args);
|
||||
electronSocket.emit('appSetAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appRemoveAsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.removeAsDefaultProtocolClient(protocol, path, args);
|
||||
electronSocket.emit('appRemoveAsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appIsDefaultProtocolClient', (protocol, path, args) => {
|
||||
const success = app.isDefaultProtocolClient(protocol, path, args);
|
||||
electronSocket.emit('appIsDefaultProtocolClientCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appSetUserTasks', (tasks) => {
|
||||
const success = app.setUserTasks(tasks);
|
||||
electronSocket.emit('appSetUserTasksCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appGetJumpListSettings', () => {
|
||||
const jumpListSettings = app.getJumpListSettings();
|
||||
electronSocket.emit('appGetJumpListSettingsCompleted', jumpListSettings);
|
||||
});
|
||||
|
||||
socket.on('appSetJumpList', (categories) => {
|
||||
app.setJumpList(categories);
|
||||
});
|
||||
|
||||
socket.on('appRequestSingleInstanceLock', () => {
|
||||
const success = app.requestSingleInstanceLock();
|
||||
electronSocket.emit('appRequestSingleInstanceLockCompleted', success);
|
||||
|
||||
app.on('second-instance', (event, args = [], workingDirectory = '') => {
|
||||
electronSocket.emit('secondInstance', [args, workingDirectory]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('appHasSingleInstanceLock', () => {
|
||||
const hasLock = app.hasSingleInstanceLock();
|
||||
|
||||
electronSocket.emit('appHasSingleInstanceLockCompleted', hasLock);
|
||||
});
|
||||
|
||||
socket.on('appReleaseSingleInstanceLock', () => {
|
||||
app.releaseSingleInstanceLock();
|
||||
});
|
||||
|
||||
socket.on('appSetUserActivity', (type, userInfo, webpageUrl) => {
|
||||
app.setUserActivity(type, userInfo, webpageUrl);
|
||||
});
|
||||
|
||||
socket.on('appGetCurrentActivityType', () => {
|
||||
const activityType = app.getCurrentActivityType();
|
||||
electronSocket.emit('appGetCurrentActivityTypeCompleted', activityType);
|
||||
});
|
||||
|
||||
socket.on('appInvalidateCurrentActivity', () => {
|
||||
app.invalidateCurrentActivity();
|
||||
});
|
||||
|
||||
socket.on('appResignCurrentActivity', () => {
|
||||
app.resignCurrentActivity();
|
||||
});
|
||||
|
||||
socket.on('appSetAppUserModelId', (id) => {
|
||||
app.setAppUserModelId(id);
|
||||
});
|
||||
|
||||
socket.on('appImportCertificate', (options) => {
|
||||
app.importCertificate(options, (result) => {
|
||||
electronSocket.emit('appImportCertificateCompleted', result);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('appGetAppMetrics', () => {
|
||||
const processMetrics = app.getAppMetrics();
|
||||
electronSocket.emit('appGetAppMetricsCompleted', processMetrics);
|
||||
});
|
||||
|
||||
socket.on('appGetGpuFeatureStatus', () => {
|
||||
const gpuFeatureStatus = app.getGPUFeatureStatus();
|
||||
electronSocket.emit('appGetGpuFeatureStatusCompleted', gpuFeatureStatus);
|
||||
});
|
||||
|
||||
socket.on('appSetBadgeCount', (count) => {
|
||||
const success = app.setBadgeCount(count);
|
||||
electronSocket.emit('appSetBadgeCountCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('appGetBadgeCount', () => {
|
||||
const count = app.getBadgeCount();
|
||||
electronSocket.emit('appGetBadgeCountCompleted', count);
|
||||
});
|
||||
|
||||
socket.on('appIsUnityRunning', () => {
|
||||
const isUnityRunning = app.isUnityRunning();
|
||||
electronSocket.emit('appIsUnityRunningCompleted', isUnityRunning);
|
||||
});
|
||||
|
||||
socket.on('appGetLoginItemSettings', (options) => {
|
||||
const loginItemSettings = app.getLoginItemSettings(options);
|
||||
electronSocket.emit('appGetLoginItemSettingsCompleted', loginItemSettings);
|
||||
});
|
||||
|
||||
socket.on('appSetLoginItemSettings', (settings) => {
|
||||
app.setLoginItemSettings(settings);
|
||||
});
|
||||
|
||||
socket.on('appIsAccessibilitySupportEnabled', () => {
|
||||
const isAccessibilitySupportEnabled = app.isAccessibilitySupportEnabled();
|
||||
electronSocket.emit('appIsAccessibilitySupportEnabledCompleted', isAccessibilitySupportEnabled);
|
||||
});
|
||||
|
||||
socket.on('appSetAccessibilitySupportEnabled', (enabled) => {
|
||||
app.setAccessibilitySupportEnabled(enabled);
|
||||
});
|
||||
|
||||
socket.on('appShowAboutPanel', () => {
|
||||
app.showAboutPanel();
|
||||
});
|
||||
|
||||
socket.on('appSetAboutPanelOptions', (options) => {
|
||||
app.setAboutPanelOptions(options);
|
||||
});
|
||||
|
||||
socket.on('appGetUserAgentFallback', () => {
|
||||
electronSocket.emit('appGetUserAgentFallbackCompleted', app.userAgentFallback);
|
||||
});
|
||||
|
||||
socket.on('appSetUserAgentFallback', (userAgent) => {
|
||||
app.userAgentFallback = userAgent;
|
||||
});
|
||||
|
||||
socket.on('register-app-on-event', (eventName, listenerName) => {
|
||||
app.on(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
} else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-app-once-event', (eventName, listenerName) => {
|
||||
app.once(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
} else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,114 +0,0 @@
|
||||
"use strict";
|
||||
const electron_updater_1 = require("electron-updater");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-autoUpdater-error-event', (id) => {
|
||||
electron_updater_1.autoUpdater.on('error', (error) => {
|
||||
electronSocket.emit('autoUpdater-error' + id, error.message);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
|
||||
electron_updater_1.autoUpdater.on('checking-for-update', () => {
|
||||
electronSocket.emit('autoUpdater-checking-for-update' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-available-event', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-not-available-event', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-not-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-download-progress-event', (id) => {
|
||||
electron_updater_1.autoUpdater.on('download-progress', (progressInfo) => {
|
||||
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
|
||||
});
|
||||
});
|
||||
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
|
||||
electron_updater_1.autoUpdater.on('update-downloaded', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
// Properties *****
|
||||
socket.on('autoUpdater-autoDownload-get', () => {
|
||||
electronSocket.emit('autoUpdater-autoDownload-get-reply', electron_updater_1.autoUpdater.autoDownload);
|
||||
});
|
||||
socket.on('autoUpdater-autoDownload-set', (value) => {
|
||||
electron_updater_1.autoUpdater.autoDownload = value;
|
||||
});
|
||||
socket.on('autoUpdater-autoInstallOnAppQuit-get', () => {
|
||||
electronSocket.emit('autoUpdater-autoInstallOnAppQuit-get-reply', electron_updater_1.autoUpdater.autoInstallOnAppQuit);
|
||||
});
|
||||
socket.on('autoUpdater-autoInstallOnAppQuit-set', (value) => {
|
||||
electron_updater_1.autoUpdater.autoInstallOnAppQuit = value;
|
||||
});
|
||||
socket.on('autoUpdater-allowPrerelease-get', () => {
|
||||
electronSocket.emit('autoUpdater-allowPrerelease-get-reply', electron_updater_1.autoUpdater.allowPrerelease);
|
||||
});
|
||||
socket.on('autoUpdater-allowPrerelease-set', (value) => {
|
||||
electron_updater_1.autoUpdater.allowPrerelease = value;
|
||||
});
|
||||
socket.on('autoUpdater-fullChangelog-get', () => {
|
||||
electronSocket.emit('autoUpdater-fullChangelog-get-reply', electron_updater_1.autoUpdater.fullChangelog);
|
||||
});
|
||||
socket.on('autoUpdater-fullChangelog-set', (value) => {
|
||||
electron_updater_1.autoUpdater.fullChangelog = value;
|
||||
});
|
||||
socket.on('autoUpdater-allowDowngrade-get', () => {
|
||||
electronSocket.emit('autoUpdater-allowDowngrade-get-reply', electron_updater_1.autoUpdater.allowDowngrade);
|
||||
});
|
||||
socket.on('autoUpdater-allowDowngrade-set', (value) => {
|
||||
electron_updater_1.autoUpdater.allowDowngrade = value;
|
||||
});
|
||||
socket.on('autoUpdater-updateConfigPath-get', () => {
|
||||
electronSocket.emit('autoUpdater-updateConfigPath-get-reply', electron_updater_1.autoUpdater.updateConfigPath || '');
|
||||
});
|
||||
socket.on('autoUpdater-updateConfigPath-set', (value) => {
|
||||
electron_updater_1.autoUpdater.updateConfigPath = value;
|
||||
});
|
||||
socket.on('autoUpdater-currentVersion-get', () => {
|
||||
electronSocket.emit('autoUpdater-currentVersion-get-reply', electron_updater_1.autoUpdater.currentVersion);
|
||||
});
|
||||
socket.on('autoUpdater-channel-get', () => {
|
||||
electronSocket.emit('autoUpdater-channel-get-reply', electron_updater_1.autoUpdater.channel || '');
|
||||
});
|
||||
socket.on('autoUpdater-channel-set', (value) => {
|
||||
electron_updater_1.autoUpdater.channel = value;
|
||||
});
|
||||
socket.on('autoUpdater-requestHeaders-get', () => {
|
||||
electronSocket.emit('autoUpdater-requestHeaders-get-reply', electron_updater_1.autoUpdater.requestHeaders);
|
||||
});
|
||||
socket.on('autoUpdater-requestHeaders-set', (value) => {
|
||||
electron_updater_1.autoUpdater.requestHeaders = value;
|
||||
});
|
||||
socket.on('autoUpdaterCheckForUpdatesAndNotify', async (guid) => {
|
||||
electron_updater_1.autoUpdater.checkForUpdatesAndNotify().then((updateCheckResult) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyComplete' + guid, updateCheckResult);
|
||||
}).catch((error) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyError' + guid, error);
|
||||
});
|
||||
});
|
||||
socket.on('autoUpdaterCheckForUpdates', async (guid) => {
|
||||
electron_updater_1.autoUpdater.checkForUpdates().then((updateCheckResult) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesComplete' + guid, updateCheckResult);
|
||||
}).catch((error) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesError' + guid, error);
|
||||
});
|
||||
});
|
||||
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
|
||||
electron_updater_1.autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
|
||||
});
|
||||
socket.on('autoUpdaterDownloadUpdate', async (guid) => {
|
||||
const downloadedPath = await electron_updater_1.autoUpdater.downloadUpdate();
|
||||
electronSocket.emit('autoUpdaterDownloadUpdateComplete' + guid, downloadedPath);
|
||||
});
|
||||
socket.on('autoUpdaterGetFeedURL', async (guid) => {
|
||||
const feedUrl = await electron_updater_1.autoUpdater.getFeedURL();
|
||||
electronSocket.emit('autoUpdaterGetFeedURLComplete' + guid, feedUrl || '');
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=autoUpdater.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"autoUpdater.js","sourceRoot":"","sources":["autoUpdater.ts"],"names":[],"mappings":";AACA,uDAA+C;AAC/C,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,EAAE,EAAE,EAAE;QACjD,8BAAW,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9B,cAAc,CAAC,IAAI,CAAC,mBAAmB,GAAG,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,C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;QAClD,MAAM,cAAc,GAAG,MAAM,8BAAW,CAAC,cAAc,EAAE,CAAC;QAC1D,cAAc,CAAC,IAAI,CAAC,mCAAmC,GAAG,IAAI,EAAE,cAAc,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC9C,MAAM,OAAO,GAAG,MAAM,8BAAW,CAAC,UAAU,EAAE,CAAC;QAC/C,cAAc,CAAC,IAAI,CAAC,+BAA+B,GAAG,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,143 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('register-autoUpdater-error-event', (id) => {
|
||||
autoUpdater.on('error', (error) => {
|
||||
electronSocket.emit('autoUpdater-error' + id, error.message);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-checking-for-update-event', (id) => {
|
||||
autoUpdater.on('checking-for-update', () => {
|
||||
electronSocket.emit('autoUpdater-checking-for-update' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-available-event', (id) => {
|
||||
autoUpdater.on('update-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-not-available-event', (id) => {
|
||||
autoUpdater.on('update-not-available', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-not-available' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-download-progress-event', (id) => {
|
||||
autoUpdater.on('download-progress', (progressInfo) => {
|
||||
electronSocket.emit('autoUpdater-download-progress' + id, progressInfo);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-autoUpdater-update-downloaded-event', (id) => {
|
||||
autoUpdater.on('update-downloaded', (updateInfo) => {
|
||||
electronSocket.emit('autoUpdater-update-downloaded' + id, updateInfo);
|
||||
});
|
||||
});
|
||||
|
||||
// Properties *****
|
||||
|
||||
socket.on('autoUpdater-autoDownload-get', () => {
|
||||
electronSocket.emit('autoUpdater-autoDownload-get-reply', autoUpdater.autoDownload);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-autoDownload-set', (value) => {
|
||||
autoUpdater.autoDownload = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-autoInstallOnAppQuit-get', () => {
|
||||
electronSocket.emit('autoUpdater-autoInstallOnAppQuit-get-reply', autoUpdater.autoInstallOnAppQuit);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-autoInstallOnAppQuit-set', (value) => {
|
||||
autoUpdater.autoInstallOnAppQuit = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-allowPrerelease-get', () => {
|
||||
electronSocket.emit('autoUpdater-allowPrerelease-get-reply', autoUpdater.allowPrerelease);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-allowPrerelease-set', (value) => {
|
||||
autoUpdater.allowPrerelease = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-fullChangelog-get', () => {
|
||||
electronSocket.emit('autoUpdater-fullChangelog-get-reply', autoUpdater.fullChangelog);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-fullChangelog-set', (value) => {
|
||||
autoUpdater.fullChangelog = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-allowDowngrade-get', () => {
|
||||
electronSocket.emit('autoUpdater-allowDowngrade-get-reply', autoUpdater.allowDowngrade);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-allowDowngrade-set', (value) => {
|
||||
autoUpdater.allowDowngrade = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-updateConfigPath-get', () => {
|
||||
electronSocket.emit('autoUpdater-updateConfigPath-get-reply', autoUpdater.updateConfigPath || '');
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-updateConfigPath-set', (value) => {
|
||||
autoUpdater.updateConfigPath = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-currentVersion-get', () => {
|
||||
electronSocket.emit('autoUpdater-currentVersion-get-reply', autoUpdater.currentVersion);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-channel-get', () => {
|
||||
electronSocket.emit('autoUpdater-channel-get-reply', autoUpdater.channel || '');
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-channel-set', (value) => {
|
||||
autoUpdater.channel = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-requestHeaders-get', () => {
|
||||
electronSocket.emit('autoUpdater-requestHeaders-get-reply', autoUpdater.requestHeaders);
|
||||
});
|
||||
|
||||
socket.on('autoUpdater-requestHeaders-set', (value) => {
|
||||
autoUpdater.requestHeaders = value;
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterCheckForUpdatesAndNotify', async (guid) => {
|
||||
autoUpdater.checkForUpdatesAndNotify().then((updateCheckResult) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyComplete' + guid, updateCheckResult);
|
||||
}).catch((error) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyError' + guid, error);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterCheckForUpdates', async (guid) => {
|
||||
autoUpdater.checkForUpdates().then((updateCheckResult) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesComplete' + guid, updateCheckResult);
|
||||
}).catch((error) => {
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesError' + guid, error);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
|
||||
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterDownloadUpdate', async (guid) => {
|
||||
const downloadedPath = await autoUpdater.downloadUpdate();
|
||||
electronSocket.emit('autoUpdaterDownloadUpdateComplete' + guid, downloadedPath);
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterGetFeedURL', async (guid) => {
|
||||
const feedUrl = await autoUpdater.getFeedURL();
|
||||
electronSocket.emit('autoUpdaterGetFeedURLComplete' + guid, feedUrl || '');
|
||||
});
|
||||
};
|
||||
@@ -1,61 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.browserViewMediateService = exports.browserViewApi = void 0;
|
||||
const electron_1 = require("electron");
|
||||
const browserViews = (global['browserViews'] = global['browserViews'] || []);
|
||||
let browserView, electronSocket;
|
||||
const proxyToCredentialsMap = (global['proxyToCredentialsMap'] = global['proxyToCredentialsMap'] || []);
|
||||
const browserViewApi = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('createBrowserView', (options) => {
|
||||
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
browserView = new electron_1.BrowserView(options);
|
||||
browserView['id'] = browserViews.length + 1;
|
||||
if (options.proxy) {
|
||||
browserView.webContents.session.setProxy({ proxyRules: options.proxy });
|
||||
}
|
||||
if (options.proxy && options.proxyCredentials) {
|
||||
proxyToCredentialsMap[options.proxy] = options.proxyCredentials;
|
||||
}
|
||||
browserViews.push(browserView);
|
||||
electronSocket.emit('BrowserViewCreated', browserView['id']);
|
||||
});
|
||||
socket.on('browserView-getBounds', (id) => {
|
||||
const bounds = getBrowserViewById(id).getBounds();
|
||||
electronSocket.emit('browserView-getBounds-reply', bounds);
|
||||
});
|
||||
socket.on('browserView-setBounds', (id, bounds) => {
|
||||
getBrowserViewById(id).setBounds(bounds);
|
||||
});
|
||||
socket.on('browserView-setAutoResize', (id, options) => {
|
||||
getBrowserViewById(id).setAutoResize(options);
|
||||
});
|
||||
socket.on('browserView-setBackgroundColor', (id, color) => {
|
||||
getBrowserViewById(id).setBackgroundColor(color);
|
||||
});
|
||||
function hasOwnChildreen(obj, ...childNames) {
|
||||
for (let i = 0; i < childNames.length; i++) {
|
||||
if (!obj || !obj.hasOwnProperty(childNames[i])) {
|
||||
return false;
|
||||
}
|
||||
obj = obj[childNames[i]];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
exports.browserViewApi = browserViewApi;
|
||||
const browserViewMediateService = (browserViewId) => {
|
||||
return getBrowserViewById(browserViewId);
|
||||
};
|
||||
exports.browserViewMediateService = browserViewMediateService;
|
||||
function getBrowserViewById(id) {
|
||||
for (let index = 0; index < browserViews.length; index++) {
|
||||
const browserViewItem = browserViews[index];
|
||||
if (browserViewItem['id'] === id) {
|
||||
return browserViewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=browserView.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"browserView.js","sourceRoot":"","sources":["browserView.ts"],"names":[],"mappings":";;;AACA,uCAAuC;AACvC,MAAM,YAAY,GAAkB,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,CAAkB,CAAC;AAC7G,IAAI,WAAwB,EAAE,cAAc,CAAC;AAC7C,MAAM,qBAAqB,GAAgC,CAAC,MAAM,CAAC,uBAAuB,CAAC,GAAG,MAAM,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAgC,CAAC;AAEpK,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,EAAE;IACtC,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE;QACvC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAE;YAChE,OAAO,GAAG,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EA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E,EAAE,KAAK,EAAE,EAAE;QACtD,kBAAkB,CAAC,EAAE,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,UAAU;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE;gBAC5C,OAAO,KAAK,CAAC;aAChB;YACD,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5B;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC,CAAC;AAeO,wCAAc;AAbvB,MAAM,yBAAyB,GAAG,CAAC,aAAqB,EAAe,EAAE;IACrE,OAAO,kBAAkB,CAAC,aAAa,CAAC,CAAC;AAC7C,CAAC,CAAC;AAWuB,8DAAyB;AATlD,SAAS,kBAAkB,CAAC,EAAU;IAClC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACtD,MAAM,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE;YAC9B,OAAO,eAAe,CAAC;SAC1B;KACJ;AACL,CAAC"}
|
||||
@@ -1,74 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { BrowserView } from 'electron';
|
||||
const browserViews: BrowserView[] = (global['browserViews'] = global['browserViews'] || []) as BrowserView[];
|
||||
let browserView: BrowserView, electronSocket;
|
||||
const proxyToCredentialsMap: { [proxy: string]: string } = (global['proxyToCredentialsMap'] = global['proxyToCredentialsMap'] || []) as { [proxy: string]: string };
|
||||
|
||||
const browserViewApi = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('createBrowserView', (options) => {
|
||||
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
|
||||
browserView = new BrowserView(options);
|
||||
browserView['id'] = browserViews.length + 1;
|
||||
|
||||
if (options.proxy) {
|
||||
browserView.webContents.session.setProxy({proxyRules: options.proxy});
|
||||
}
|
||||
|
||||
if (options.proxy && options.proxyCredentials) {
|
||||
proxyToCredentialsMap[options.proxy] = options.proxyCredentials;
|
||||
}
|
||||
|
||||
browserViews.push(browserView);
|
||||
|
||||
electronSocket.emit('BrowserViewCreated', browserView['id']);
|
||||
});
|
||||
|
||||
socket.on('browserView-getBounds', (id) => {
|
||||
const bounds = getBrowserViewById(id).getBounds();
|
||||
|
||||
electronSocket.emit('browserView-getBounds-reply', bounds);
|
||||
});
|
||||
|
||||
socket.on('browserView-setBounds', (id, bounds) => {
|
||||
getBrowserViewById(id).setBounds(bounds);
|
||||
});
|
||||
|
||||
socket.on('browserView-setAutoResize', (id, options) => {
|
||||
getBrowserViewById(id).setAutoResize(options);
|
||||
});
|
||||
|
||||
socket.on('browserView-setBackgroundColor', (id, color) => {
|
||||
getBrowserViewById(id).setBackgroundColor(color);
|
||||
});
|
||||
|
||||
function hasOwnChildreen(obj, ...childNames) {
|
||||
for (let i = 0; i < childNames.length; i++) {
|
||||
if (!obj || !obj.hasOwnProperty(childNames[i])) {
|
||||
return false;
|
||||
}
|
||||
obj = obj[childNames[i]];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
const browserViewMediateService = (browserViewId: number): BrowserView => {
|
||||
return getBrowserViewById(browserViewId);
|
||||
};
|
||||
|
||||
function getBrowserViewById(id: number) {
|
||||
for (let index = 0; index < browserViews.length; index++) {
|
||||
const browserViewItem = browserViews[index];
|
||||
if (browserViewItem['id'] === id) {
|
||||
return browserViewItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { browserViewApi, browserViewMediateService };
|
||||
@@ -1,595 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const browserView_1 = require("./browserView");
|
||||
const path = require('path');
|
||||
const windows = (global['browserWindows'] = global['browserWindows'] || []);
|
||||
let readyToShowWindowsIds = [];
|
||||
let window, lastOptions, electronSocket;
|
||||
let mainWindowURL;
|
||||
const proxyToCredentialsMap = (global['proxyToCredentialsMap'] = global['proxyToCredentialsMap'] || []);
|
||||
module.exports = (socket, app) => {
|
||||
electronSocket = socket;
|
||||
app.on('login', (event, webContents, request, authInfo, callback) => {
|
||||
if (authInfo.isProxy) {
|
||||
let proxy = `${authInfo.host}:${authInfo.port}`;
|
||||
if (proxy in proxyToCredentialsMap && proxyToCredentialsMap[proxy].split(':').length === 2) {
|
||||
event.preventDefault();
|
||||
let user = proxyToCredentialsMap[proxy].split(':')[0];
|
||||
let pass = proxyToCredentialsMap[proxy].split(':')[1];
|
||||
callback(user, pass);
|
||||
}
|
||||
}
|
||||
});
|
||||
socket.on('register-browserWindow-ready-to-show', (id) => {
|
||||
if (readyToShowWindowsIds.includes(id)) {
|
||||
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== id);
|
||||
electronSocket.emit('browserWindow-ready-to-show' + id);
|
||||
}
|
||||
getWindowById(id).on('ready-to-show', () => {
|
||||
readyToShowWindowsIds.push(id);
|
||||
electronSocket.emit('browserWindow-ready-to-show' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-page-title-updated', (id) => {
|
||||
getWindowById(id).on('page-title-updated', (event, title) => {
|
||||
electronSocket.emit('browserWindow-page-title-updated' + id, title);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-close', (id) => {
|
||||
getWindowById(id).on('close', () => {
|
||||
electronSocket.emit('browserWindow-close' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-closed', (id) => {
|
||||
getWindowById(id).on('closed', () => {
|
||||
electronSocket.emit('browserWindow-closed' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-session-end', (id) => {
|
||||
getWindowById(id).on('session-end', () => {
|
||||
electronSocket.emit('browserWindow-session-end' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-unresponsive', (id) => {
|
||||
getWindowById(id).on('unresponsive', () => {
|
||||
electronSocket.emit('browserWindow-unresponsive' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-responsive', (id) => {
|
||||
getWindowById(id).on('responsive', () => {
|
||||
electronSocket.emit('browserWindow-responsive' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-blur', (id) => {
|
||||
getWindowById(id).on('blur', () => {
|
||||
electronSocket.emit('browserWindow-blur' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-focus', (id) => {
|
||||
getWindowById(id).on('focus', () => {
|
||||
electronSocket.emit('browserWindow-focus' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-show', (id) => {
|
||||
getWindowById(id).on('show', () => {
|
||||
electronSocket.emit('browserWindow-show' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-hide', (id) => {
|
||||
getWindowById(id).on('hide', () => {
|
||||
electronSocket.emit('browserWindow-hide' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-maximize', (id) => {
|
||||
getWindowById(id).on('maximize', () => {
|
||||
electronSocket.emit('browserWindow-maximize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-unmaximize', (id) => {
|
||||
getWindowById(id).on('unmaximize', () => {
|
||||
electronSocket.emit('browserWindow-unmaximize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-minimize', (id) => {
|
||||
getWindowById(id).on('minimize', () => {
|
||||
electronSocket.emit('browserWindow-minimize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-restore', (id) => {
|
||||
getWindowById(id).on('restore', () => {
|
||||
electronSocket.emit('browserWindow-restore' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-resize', (id) => {
|
||||
getWindowById(id).on('resize', () => {
|
||||
electronSocket.emit('browserWindow-resize' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-move', (id) => {
|
||||
getWindowById(id).on('move', () => {
|
||||
electronSocket.emit('browserWindow-move' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-moved', (id) => {
|
||||
getWindowById(id).on('moved', () => {
|
||||
electronSocket.emit('browserWindow-moved' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-enter-full-screen', (id) => {
|
||||
getWindowById(id).on('enter-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-enter-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-leave-full-screen', (id) => {
|
||||
getWindowById(id).on('leave-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-leave-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-enter-html-full-screen', (id) => {
|
||||
getWindowById(id).on('enter-html-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-enter-html-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-leave-html-full-screen', (id) => {
|
||||
getWindowById(id).on('leave-html-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-leave-html-full-screen' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-app-command', (id) => {
|
||||
getWindowById(id).on('app-command', (event, command) => {
|
||||
electronSocket.emit('browserWindow-app-command' + id, command);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-swipe', (id) => {
|
||||
getWindowById(id).on('swipe', (event, direction) => {
|
||||
electronSocket.emit('browserWindow-swipe' + id, direction);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-sheet-begin', (id) => {
|
||||
getWindowById(id).on('sheet-begin', () => {
|
||||
electronSocket.emit('browserWindow-sheet-begin' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-sheet-end', (id) => {
|
||||
getWindowById(id).on('sheet-end', () => {
|
||||
electronSocket.emit('browserWindow-sheet-end' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-new-window-for-tab', (id) => {
|
||||
getWindowById(id).on('new-window-for-tab', () => {
|
||||
electronSocket.emit('browserWindow-new-window-for-tab' + id);
|
||||
});
|
||||
});
|
||||
socket.on('createBrowserWindow', (options, loadUrl) => {
|
||||
if (options.webPreferences && !('nodeIntegration' in options.webPreferences)) {
|
||||
options = { ...options, webPreferences: { ...options.webPreferences, nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
else if (!options.webPreferences) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
// we dont want to recreate the window when watch is ready.
|
||||
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
|
||||
window = app['mainWindow'];
|
||||
if (window) {
|
||||
window.reload();
|
||||
windows.push(window);
|
||||
electronSocket.emit('BrowserWindowCreated', window.id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
window = new electron_1.BrowserWindow(options);
|
||||
}
|
||||
if (options.proxy) {
|
||||
window.webContents.session.setProxy({ proxyRules: options.proxy });
|
||||
}
|
||||
if (options.proxy && options.proxyCredentials) {
|
||||
proxyToCredentialsMap[options.proxy] = options.proxyCredentials;
|
||||
}
|
||||
window.on('ready-to-show', () => {
|
||||
if (readyToShowWindowsIds.includes(window.id)) {
|
||||
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== window.id);
|
||||
}
|
||||
else {
|
||||
readyToShowWindowsIds.push(window.id);
|
||||
}
|
||||
});
|
||||
lastOptions = options;
|
||||
window.on('closed', (sender) => {
|
||||
for (let index = 0; index < windows.length; index++) {
|
||||
const windowItem = windows[index];
|
||||
try {
|
||||
windowItem.id;
|
||||
}
|
||||
catch (error) {
|
||||
if (error.message === 'Object has been destroyed') {
|
||||
windows.splice(index, 1);
|
||||
const ids = [];
|
||||
windows.forEach(x => ids.push(x.id));
|
||||
electronSocket.emit('BrowserWindowClosed', ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (window === null && lastOptions) {
|
||||
window = new electron_1.BrowserWindow(lastOptions);
|
||||
}
|
||||
});
|
||||
if (loadUrl) {
|
||||
window.loadURL(loadUrl);
|
||||
}
|
||||
if (app.commandLine.hasSwitch('clear-cache') &&
|
||||
app.commandLine.getSwitchValue('clear-cache')) {
|
||||
window.webContents.session.clearCache();
|
||||
console.log('auto clear-cache active for new window.');
|
||||
}
|
||||
// set main window url
|
||||
if (app['mainWindowURL'] == undefined || app['mainWindowURL'] == "") {
|
||||
app['mainWindowURL'] = loadUrl;
|
||||
app['mainWindow'] = window;
|
||||
}
|
||||
windows.push(window);
|
||||
electronSocket.emit('BrowserWindowCreated', window.id);
|
||||
});
|
||||
socket.on('browserWindowDestroy', (id) => {
|
||||
getWindowById(id).destroy();
|
||||
});
|
||||
socket.on('browserWindowClose', (id) => {
|
||||
getWindowById(id).close();
|
||||
});
|
||||
socket.on('browserWindowFocus', (id) => {
|
||||
getWindowById(id).focus();
|
||||
});
|
||||
socket.on('browserWindowBlur', (id) => {
|
||||
getWindowById(id).blur();
|
||||
});
|
||||
socket.on('browserWindowIsFocused', (id) => {
|
||||
const isFocused = getWindowById(id).isFocused();
|
||||
electronSocket.emit('browserWindow-isFocused-completed', isFocused);
|
||||
});
|
||||
socket.on('browserWindowIsDestroyed', (id) => {
|
||||
const isDestroyed = getWindowById(id).isDestroyed();
|
||||
electronSocket.emit('browserWindow-isDestroyed-completed', isDestroyed);
|
||||
});
|
||||
socket.on('browserWindowShow', (id) => {
|
||||
getWindowById(id).show();
|
||||
});
|
||||
socket.on('browserWindowShowInactive', (id) => {
|
||||
getWindowById(id).showInactive();
|
||||
});
|
||||
socket.on('browserWindowHide', (id) => {
|
||||
getWindowById(id).hide();
|
||||
});
|
||||
socket.on('browserWindowIsVisible', (id) => {
|
||||
const isVisible = getWindowById(id).isVisible();
|
||||
electronSocket.emit('browserWindow-isVisible-completed', isVisible);
|
||||
});
|
||||
socket.on('browserWindowIsModal', (id) => {
|
||||
const isModal = getWindowById(id).isModal();
|
||||
electronSocket.emit('browserWindow-isModal-completed', isModal);
|
||||
});
|
||||
socket.on('browserWindowMaximize', (id) => {
|
||||
getWindowById(id).maximize();
|
||||
});
|
||||
socket.on('browserWindowUnmaximize', (id) => {
|
||||
getWindowById(id).unmaximize();
|
||||
});
|
||||
socket.on('browserWindowIsMaximized', (id) => {
|
||||
const isMaximized = getWindowById(id).isMaximized();
|
||||
electronSocket.emit('browserWindow-isMaximized-completed', isMaximized);
|
||||
});
|
||||
socket.on('browserWindowMinimize', (id) => {
|
||||
getWindowById(id).minimize();
|
||||
});
|
||||
socket.on('browserWindowRestore', (id) => {
|
||||
getWindowById(id).restore();
|
||||
});
|
||||
socket.on('browserWindowIsMinimized', (id) => {
|
||||
const isMinimized = getWindowById(id).isMinimized();
|
||||
electronSocket.emit('browserWindow-isMinimized-completed', isMinimized);
|
||||
});
|
||||
socket.on('browserWindowSetFullScreen', (id, fullscreen) => {
|
||||
getWindowById(id).setFullScreen(fullscreen);
|
||||
});
|
||||
socket.on('browserWindowIsFullScreen', (id) => {
|
||||
const isFullScreen = getWindowById(id).isFullScreen();
|
||||
electronSocket.emit('browserWindow-isFullScreen-completed', isFullScreen);
|
||||
});
|
||||
socket.on('browserWindowSetAspectRatio', (id, aspectRatio, extraSize) => {
|
||||
getWindowById(id).setAspectRatio(aspectRatio, extraSize);
|
||||
});
|
||||
socket.on('browserWindowPreviewFile', (id, path, displayname) => {
|
||||
getWindowById(id).previewFile(path, displayname);
|
||||
});
|
||||
socket.on('browserWindowCloseFilePreview', (id) => {
|
||||
getWindowById(id).closeFilePreview();
|
||||
});
|
||||
socket.on('browserWindowSetBounds', (id, bounds, animate) => {
|
||||
getWindowById(id).setBounds(bounds, animate);
|
||||
});
|
||||
socket.on('browserWindowGetBounds', (id) => {
|
||||
const rectangle = getWindowById(id).getBounds();
|
||||
electronSocket.emit('browserWindow-getBounds-completed', rectangle);
|
||||
});
|
||||
socket.on('browserWindowSetContentBounds', (id, bounds, animate) => {
|
||||
getWindowById(id).setContentBounds(bounds, animate);
|
||||
});
|
||||
socket.on('browserWindowGetContentBounds', (id) => {
|
||||
const rectangle = getWindowById(id).getContentBounds();
|
||||
electronSocket.emit('browserWindow-getContentBounds-completed', rectangle);
|
||||
});
|
||||
socket.on('browserWindowSetSize', (id, width, height, animate) => {
|
||||
getWindowById(id).setSize(width, height, animate);
|
||||
});
|
||||
socket.on('browserWindowGetSize', (id) => {
|
||||
const size = getWindowById(id).getSize();
|
||||
electronSocket.emit('browserWindow-getSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetContentSize', (id, width, height, animate) => {
|
||||
getWindowById(id).setContentSize(width, height, animate);
|
||||
});
|
||||
socket.on('browserWindowGetContentSize', (id) => {
|
||||
const size = getWindowById(id).getContentSize();
|
||||
electronSocket.emit('browserWindow-getContentSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetMinimumSize', (id, width, height) => {
|
||||
getWindowById(id).setMinimumSize(width, height);
|
||||
});
|
||||
socket.on('browserWindowGetMinimumSize', (id) => {
|
||||
const size = getWindowById(id).getMinimumSize();
|
||||
electronSocket.emit('browserWindow-getMinimumSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetMaximumSize', (id, width, height) => {
|
||||
getWindowById(id).setMaximumSize(width, height);
|
||||
});
|
||||
socket.on('browserWindowGetMaximumSize', (id) => {
|
||||
const size = getWindowById(id).getMaximumSize();
|
||||
electronSocket.emit('browserWindow-getMaximumSize-completed', size);
|
||||
});
|
||||
socket.on('browserWindowSetResizable', (id, resizable) => {
|
||||
getWindowById(id).setResizable(resizable);
|
||||
});
|
||||
socket.on('browserWindowIsResizable', (id) => {
|
||||
const resizable = getWindowById(id).isResizable();
|
||||
electronSocket.emit('browserWindow-isResizable-completed', resizable);
|
||||
});
|
||||
socket.on('browserWindowSetMovable', (id, movable) => {
|
||||
getWindowById(id).setMovable(movable);
|
||||
});
|
||||
socket.on('browserWindowIsMovable', (id) => {
|
||||
const movable = getWindowById(id).isMovable();
|
||||
electronSocket.emit('browserWindow-isMovable-completed', movable);
|
||||
});
|
||||
socket.on('browserWindowSetMinimizable', (id, minimizable) => {
|
||||
getWindowById(id).setMinimizable(minimizable);
|
||||
});
|
||||
socket.on('browserWindowIsMinimizable', (id) => {
|
||||
const minimizable = getWindowById(id).isMinimizable();
|
||||
electronSocket.emit('browserWindow-isMinimizable-completed', minimizable);
|
||||
});
|
||||
socket.on('browserWindowSetMaximizable', (id, maximizable) => {
|
||||
getWindowById(id).setMaximizable(maximizable);
|
||||
});
|
||||
socket.on('browserWindowIsMaximizable', (id) => {
|
||||
const maximizable = getWindowById(id).isMaximizable();
|
||||
electronSocket.emit('browserWindow-isMaximizable-completed', maximizable);
|
||||
});
|
||||
socket.on('browserWindowSetFullScreenable', (id, fullscreenable) => {
|
||||
getWindowById(id).setFullScreenable(fullscreenable);
|
||||
});
|
||||
socket.on('browserWindowIsFullScreenable', (id) => {
|
||||
const fullscreenable = getWindowById(id).isFullScreenable();
|
||||
electronSocket.emit('browserWindow-isFullScreenable-completed', fullscreenable);
|
||||
});
|
||||
socket.on('browserWindowSetClosable', (id, closable) => {
|
||||
getWindowById(id).setClosable(closable);
|
||||
});
|
||||
socket.on('browserWindowIsClosable', (id) => {
|
||||
const closable = getWindowById(id).isClosable();
|
||||
electronSocket.emit('browserWindow-isClosable-completed', closable);
|
||||
});
|
||||
socket.on('browserWindowSetAlwaysOnTop', (id, flag, level, relativeLevel) => {
|
||||
getWindowById(id).setAlwaysOnTop(flag, level, relativeLevel);
|
||||
});
|
||||
socket.on('browserWindowIsAlwaysOnTop', (id) => {
|
||||
const isAlwaysOnTop = getWindowById(id).isAlwaysOnTop();
|
||||
electronSocket.emit('browserWindow-isAlwaysOnTop-completed', isAlwaysOnTop);
|
||||
});
|
||||
socket.on('browserWindowCenter', (id) => {
|
||||
getWindowById(id).center();
|
||||
});
|
||||
socket.on('browserWindowSetPosition', (id, x, y, animate) => {
|
||||
getWindowById(id).setPosition(x, y, animate);
|
||||
});
|
||||
socket.on('browserWindowGetPosition', (id) => {
|
||||
const position = getWindowById(id).getPosition();
|
||||
electronSocket.emit('browserWindow-getPosition-completed', position);
|
||||
});
|
||||
socket.on('browserWindowSetTitle', (id, title) => {
|
||||
getWindowById(id).setTitle(title);
|
||||
});
|
||||
socket.on('browserWindowGetTitle', (id) => {
|
||||
const title = getWindowById(id).getTitle();
|
||||
electronSocket.emit('browserWindow-getTitle-completed', title);
|
||||
});
|
||||
socket.on('browserWindowSetTitle', (id, title) => {
|
||||
getWindowById(id).setTitle(title);
|
||||
});
|
||||
socket.on('browserWindowSetSheetOffset', (id, offsetY, offsetX) => {
|
||||
if (offsetX) {
|
||||
getWindowById(id).setSheetOffset(offsetY, offsetX);
|
||||
}
|
||||
else {
|
||||
getWindowById(id).setSheetOffset(offsetY);
|
||||
}
|
||||
});
|
||||
socket.on('browserWindowFlashFrame', (id, flag) => {
|
||||
getWindowById(id).flashFrame(flag);
|
||||
});
|
||||
socket.on('browserWindowSetSkipTaskbar', (id, skip) => {
|
||||
getWindowById(id).setSkipTaskbar(skip);
|
||||
});
|
||||
socket.on('browserWindowSetKiosk', (id, flag) => {
|
||||
getWindowById(id).setKiosk(flag);
|
||||
});
|
||||
socket.on('browserWindowIsKiosk', (id) => {
|
||||
const isKiosk = getWindowById(id).isKiosk();
|
||||
electronSocket.emit('browserWindow-isKiosk-completed', isKiosk);
|
||||
});
|
||||
socket.on('browserWindowGetNativeWindowHandle', (id) => {
|
||||
const nativeWindowHandle = getWindowById(id).getNativeWindowHandle().readInt32LE(0).toString(16);
|
||||
electronSocket.emit('browserWindow-getNativeWindowHandle-completed', nativeWindowHandle);
|
||||
});
|
||||
socket.on('browserWindowSetRepresentedFilename', (id, filename) => {
|
||||
getWindowById(id).setRepresentedFilename(filename);
|
||||
});
|
||||
socket.on('browserWindowGetRepresentedFilename', (id) => {
|
||||
const pathname = getWindowById(id).getRepresentedFilename();
|
||||
electronSocket.emit('browserWindow-getRepresentedFilename-completed', pathname);
|
||||
});
|
||||
socket.on('browserWindowSetDocumentEdited', (id, edited) => {
|
||||
getWindowById(id).setDocumentEdited(edited);
|
||||
});
|
||||
socket.on('browserWindowIsDocumentEdited', (id) => {
|
||||
const edited = getWindowById(id).isDocumentEdited();
|
||||
electronSocket.emit('browserWindow-isDocumentEdited-completed', edited);
|
||||
});
|
||||
socket.on('browserWindowFocusOnWebView', (id) => {
|
||||
getWindowById(id).focusOnWebView();
|
||||
});
|
||||
socket.on('browserWindowBlurWebView', (id) => {
|
||||
getWindowById(id).blurWebView();
|
||||
});
|
||||
socket.on('browserWindowLoadURL', (id, url, options) => {
|
||||
getWindowById(id).loadURL(url, options);
|
||||
});
|
||||
socket.on('browserWindowReload', (id) => {
|
||||
getWindowById(id).reload();
|
||||
});
|
||||
socket.on('browserWindowSetMenu', (id, menuItems) => {
|
||||
let menu = null;
|
||||
if (menuItems) {
|
||||
menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('windowMenuItemClicked', id);
|
||||
});
|
||||
}
|
||||
getWindowById(id).setMenu(menu);
|
||||
});
|
||||
socket.on('browserWindowRemoveMenu', (id) => {
|
||||
getWindowById(id).removeMenu();
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
socket.on('browserWindowSetProgressBar', (id, progress) => {
|
||||
getWindowById(id).setProgressBar(progress);
|
||||
});
|
||||
socket.on('browserWindowSetProgressBar', (id, progress, options) => {
|
||||
getWindowById(id).setProgressBar(progress, options);
|
||||
});
|
||||
socket.on('browserWindowSetHasShadow', (id, hasShadow) => {
|
||||
getWindowById(id).setHasShadow(hasShadow);
|
||||
});
|
||||
socket.on('browserWindowHasShadow', (id) => {
|
||||
const hasShadow = getWindowById(id).hasShadow();
|
||||
electronSocket.emit('browserWindow-hasShadow-completed', hasShadow);
|
||||
});
|
||||
socket.on('browserWindowSetThumbarButtons', (id, thumbarButtons) => {
|
||||
thumbarButtons.forEach(thumbarButton => {
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', thumbarButton.icon.toString());
|
||||
thumbarButton.icon = electron_1.nativeImage.createFromPath(imagePath);
|
||||
thumbarButton.click = () => {
|
||||
electronSocket.emit('thumbarButtonClicked', thumbarButton['id']);
|
||||
};
|
||||
});
|
||||
const success = getWindowById(id).setThumbarButtons(thumbarButtons);
|
||||
electronSocket.emit('browserWindowSetThumbarButtons-completed', success);
|
||||
});
|
||||
socket.on('browserWindowSetThumbnailClip', (id, rectangle) => {
|
||||
getWindowById(id).setThumbnailClip(rectangle);
|
||||
});
|
||||
socket.on('browserWindowSetThumbnailToolTip', (id, toolTip) => {
|
||||
getWindowById(id).setThumbnailToolTip(toolTip);
|
||||
});
|
||||
socket.on('browserWindowSetAppDetails', (id, options) => {
|
||||
getWindowById(id).setAppDetails(options);
|
||||
});
|
||||
socket.on('browserWindowShowDefinitionForSelection', (id) => {
|
||||
getWindowById(id).showDefinitionForSelection();
|
||||
});
|
||||
socket.on('browserWindowSetAutoHideMenuBar', (id, hide) => {
|
||||
getWindowById(id).setAutoHideMenuBar(hide);
|
||||
});
|
||||
socket.on('browserWindowIsMenuBarAutoHide', (id) => {
|
||||
const isMenuBarAutoHide = getWindowById(id).isMenuBarAutoHide();
|
||||
electronSocket.emit('browserWindow-isMenuBarAutoHide-completed', isMenuBarAutoHide);
|
||||
});
|
||||
socket.on('browserWindowSetMenuBarVisibility', (id, visible) => {
|
||||
getWindowById(id).setMenuBarVisibility(visible);
|
||||
});
|
||||
socket.on('browserWindowIsMenuBarVisible', (id) => {
|
||||
const isMenuBarVisible = getWindowById(id).isMenuBarVisible();
|
||||
electronSocket.emit('browserWindow-isMenuBarVisible-completed', isMenuBarVisible);
|
||||
});
|
||||
socket.on('browserWindowSetVisibleOnAllWorkspaces', (id, visible) => {
|
||||
getWindowById(id).setVisibleOnAllWorkspaces(visible);
|
||||
});
|
||||
socket.on('browserWindowIsVisibleOnAllWorkspaces', (id) => {
|
||||
const isVisibleOnAllWorkspaces = getWindowById(id).isVisibleOnAllWorkspaces();
|
||||
electronSocket.emit('browserWindow-isVisibleOnAllWorkspaces-completed', isVisibleOnAllWorkspaces);
|
||||
});
|
||||
socket.on('browserWindowSetIgnoreMouseEvents', (id, ignore) => {
|
||||
getWindowById(id).setIgnoreMouseEvents(ignore);
|
||||
});
|
||||
socket.on('browserWindowSetContentProtection', (id, enable) => {
|
||||
getWindowById(id).setContentProtection(enable);
|
||||
});
|
||||
socket.on('browserWindowSetFocusable', (id, focusable) => {
|
||||
getWindowById(id).setFocusable(focusable);
|
||||
});
|
||||
socket.on('browserWindowSetParentWindow', (id, parent) => {
|
||||
const browserWindow = electron_1.BrowserWindow.fromId(parent.id);
|
||||
getWindowById(id).setParentWindow(browserWindow);
|
||||
});
|
||||
socket.on('browserWindowGetParentWindow', (id) => {
|
||||
const browserWindow = getWindowById(id).getParentWindow();
|
||||
electronSocket.emit('browserWindow-getParentWindow-completed', browserWindow.id);
|
||||
});
|
||||
socket.on('browserWindowGetChildWindows', (id) => {
|
||||
const browserWindows = getWindowById(id).getChildWindows();
|
||||
const ids = [];
|
||||
browserWindows.forEach(x => {
|
||||
ids.push(x.id);
|
||||
});
|
||||
electronSocket.emit('browserWindow-getChildWindows-completed', ids);
|
||||
});
|
||||
socket.on('browserWindowSetAutoHideCursor', (id, autoHide) => {
|
||||
getWindowById(id).setAutoHideCursor(autoHide);
|
||||
});
|
||||
socket.on('browserWindowSetVibrancy', (id, type) => {
|
||||
getWindowById(id).setVibrancy(type);
|
||||
});
|
||||
socket.on('browserWindow-setBrowserView', (id, browserViewId) => {
|
||||
getWindowById(id).setBrowserView((0, browserView_1.browserViewMediateService)(browserViewId));
|
||||
});
|
||||
function getWindowById(id) {
|
||||
for (let index = 0; index < windows.length; index++) {
|
||||
const element = windows[index];
|
||||
if (element.id === id) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=browserWindows.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,767 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { BrowserWindow, Menu, nativeImage } from 'electron';
|
||||
import { browserViewMediateService } from './browserView';
|
||||
const path = require('path');
|
||||
const windows: Electron.BrowserWindow[] = (global['browserWindows'] = global['browserWindows'] || []) as Electron.BrowserWindow[];
|
||||
let readyToShowWindowsIds: number[] = [];
|
||||
let window, lastOptions, electronSocket;
|
||||
let mainWindowURL;
|
||||
const proxyToCredentialsMap: { [proxy: string]: string } = (global['proxyToCredentialsMap'] = global['proxyToCredentialsMap'] || []) as { [proxy: string]: string };
|
||||
|
||||
export = (socket: Socket, app: Electron.App) => {
|
||||
electronSocket = socket;
|
||||
|
||||
app.on('login', (event, webContents, request, authInfo, callback) => {
|
||||
if (authInfo.isProxy) {
|
||||
let proxy = `${authInfo.host}:${authInfo.port}`
|
||||
if (proxy in proxyToCredentialsMap && proxyToCredentialsMap[proxy].split(':').length === 2) {
|
||||
event.preventDefault()
|
||||
let user = proxyToCredentialsMap[proxy].split(':')[0]
|
||||
let pass = proxyToCredentialsMap[proxy].split(':')[1]
|
||||
callback(user, pass)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
socket.on('register-browserWindow-ready-to-show', (id) => {
|
||||
if (readyToShowWindowsIds.includes(id)) {
|
||||
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== id);
|
||||
electronSocket.emit('browserWindow-ready-to-show' + id);
|
||||
}
|
||||
|
||||
getWindowById(id).on('ready-to-show', () => {
|
||||
readyToShowWindowsIds.push(id);
|
||||
electronSocket.emit('browserWindow-ready-to-show' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-page-title-updated', (id) => {
|
||||
getWindowById(id).on('page-title-updated', (event, title) => {
|
||||
electronSocket.emit('browserWindow-page-title-updated' + id, title);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-close', (id) => {
|
||||
getWindowById(id).on('close', () => {
|
||||
electronSocket.emit('browserWindow-close' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-closed', (id) => {
|
||||
getWindowById(id).on('closed', () => {
|
||||
electronSocket.emit('browserWindow-closed' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-session-end', (id) => {
|
||||
getWindowById(id).on('session-end', () => {
|
||||
electronSocket.emit('browserWindow-session-end' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-unresponsive', (id) => {
|
||||
getWindowById(id).on('unresponsive', () => {
|
||||
electronSocket.emit('browserWindow-unresponsive' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-responsive', (id) => {
|
||||
getWindowById(id).on('responsive', () => {
|
||||
electronSocket.emit('browserWindow-responsive' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-blur', (id) => {
|
||||
getWindowById(id).on('blur', () => {
|
||||
electronSocket.emit('browserWindow-blur' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-focus', (id) => {
|
||||
getWindowById(id).on('focus', () => {
|
||||
electronSocket.emit('browserWindow-focus' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-show', (id) => {
|
||||
getWindowById(id).on('show', () => {
|
||||
electronSocket.emit('browserWindow-show' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-hide', (id) => {
|
||||
getWindowById(id).on('hide', () => {
|
||||
electronSocket.emit('browserWindow-hide' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-maximize', (id) => {
|
||||
getWindowById(id).on('maximize', () => {
|
||||
electronSocket.emit('browserWindow-maximize' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-unmaximize', (id) => {
|
||||
getWindowById(id).on('unmaximize', () => {
|
||||
electronSocket.emit('browserWindow-unmaximize' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-minimize', (id) => {
|
||||
getWindowById(id).on('minimize', () => {
|
||||
electronSocket.emit('browserWindow-minimize' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-restore', (id) => {
|
||||
getWindowById(id).on('restore', () => {
|
||||
electronSocket.emit('browserWindow-restore' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-resize', (id) => {
|
||||
getWindowById(id).on('resize', () => {
|
||||
electronSocket.emit('browserWindow-resize' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-move', (id) => {
|
||||
getWindowById(id).on('move', () => {
|
||||
electronSocket.emit('browserWindow-move' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-moved', (id) => {
|
||||
getWindowById(id).on('moved', () => {
|
||||
electronSocket.emit('browserWindow-moved' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-enter-full-screen', (id) => {
|
||||
getWindowById(id).on('enter-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-enter-full-screen' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-leave-full-screen', (id) => {
|
||||
getWindowById(id).on('leave-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-leave-full-screen' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-enter-html-full-screen', (id) => {
|
||||
getWindowById(id).on('enter-html-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-enter-html-full-screen' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-leave-html-full-screen', (id) => {
|
||||
getWindowById(id).on('leave-html-full-screen', () => {
|
||||
electronSocket.emit('browserWindow-leave-html-full-screen' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-app-command', (id) => {
|
||||
getWindowById(id).on('app-command', (event, command) => {
|
||||
electronSocket.emit('browserWindow-app-command' + id, command);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-swipe', (id) => {
|
||||
getWindowById(id).on('swipe', (event, direction) => {
|
||||
electronSocket.emit('browserWindow-swipe' + id, direction);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-sheet-begin', (id) => {
|
||||
getWindowById(id).on('sheet-begin', () => {
|
||||
electronSocket.emit('browserWindow-sheet-begin' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-sheet-end', (id) => {
|
||||
getWindowById(id).on('sheet-end', () => {
|
||||
electronSocket.emit('browserWindow-sheet-end' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-new-window-for-tab', (id) => {
|
||||
getWindowById(id).on('new-window-for-tab', () => {
|
||||
electronSocket.emit('browserWindow-new-window-for-tab' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('createBrowserWindow', (options, loadUrl) => {
|
||||
if (options.webPreferences && !('nodeIntegration' in options.webPreferences)) {
|
||||
options = { ...options, webPreferences: { ...options.webPreferences, nodeIntegration: true, contextIsolation: false } };
|
||||
} else if (!options.webPreferences) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
|
||||
// we dont want to recreate the window when watch is ready.
|
||||
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
|
||||
window = app['mainWindow'];
|
||||
if (window) {
|
||||
window.reload();
|
||||
windows.push(window);
|
||||
electronSocket.emit('BrowserWindowCreated', window.id);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
window = new BrowserWindow(options);
|
||||
}
|
||||
|
||||
if (options.proxy) {
|
||||
window.webContents.session.setProxy({proxyRules: options.proxy});
|
||||
}
|
||||
|
||||
if (options.proxy && options.proxyCredentials) {
|
||||
proxyToCredentialsMap[options.proxy] = options.proxyCredentials;
|
||||
}
|
||||
|
||||
window.on('ready-to-show', () => {
|
||||
if (readyToShowWindowsIds.includes(window.id)) {
|
||||
readyToShowWindowsIds = readyToShowWindowsIds.filter(value => value !== window.id);
|
||||
} else {
|
||||
readyToShowWindowsIds.push(window.id);
|
||||
}
|
||||
});
|
||||
|
||||
lastOptions = options;
|
||||
|
||||
window.on('closed', (sender) => {
|
||||
for (let index = 0; index < windows.length; index++) {
|
||||
const windowItem = windows[index];
|
||||
try {
|
||||
windowItem.id;
|
||||
} catch (error) {
|
||||
if (error.message === 'Object has been destroyed') {
|
||||
windows.splice(index, 1);
|
||||
|
||||
const ids = [];
|
||||
windows.forEach(x => ids.push(x.id));
|
||||
electronSocket.emit('BrowserWindowClosed', ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.on('activate', () => {
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (window === null && lastOptions) {
|
||||
window = new BrowserWindow(lastOptions);
|
||||
}
|
||||
});
|
||||
|
||||
if (loadUrl) {
|
||||
window.loadURL(loadUrl);
|
||||
}
|
||||
|
||||
if (app.commandLine.hasSwitch('clear-cache') &&
|
||||
app.commandLine.getSwitchValue('clear-cache')) {
|
||||
window.webContents.session.clearCache();
|
||||
console.log('auto clear-cache active for new window.');
|
||||
}
|
||||
|
||||
// set main window url
|
||||
if (app['mainWindowURL'] == undefined || app['mainWindowURL'] == "") {
|
||||
app['mainWindowURL'] = loadUrl;
|
||||
app['mainWindow'] = window;
|
||||
}
|
||||
|
||||
windows.push(window);
|
||||
electronSocket.emit('BrowserWindowCreated', window.id);
|
||||
});
|
||||
|
||||
socket.on('browserWindowDestroy', (id) => {
|
||||
getWindowById(id).destroy();
|
||||
});
|
||||
|
||||
socket.on('browserWindowClose', (id) => {
|
||||
getWindowById(id).close();
|
||||
});
|
||||
|
||||
socket.on('browserWindowFocus', (id) => {
|
||||
getWindowById(id).focus();
|
||||
});
|
||||
|
||||
socket.on('browserWindowBlur', (id) => {
|
||||
getWindowById(id).blur();
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsFocused', (id) => {
|
||||
const isFocused = getWindowById(id).isFocused();
|
||||
|
||||
electronSocket.emit('browserWindow-isFocused-completed', isFocused);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsDestroyed', (id) => {
|
||||
const isDestroyed = getWindowById(id).isDestroyed();
|
||||
|
||||
electronSocket.emit('browserWindow-isDestroyed-completed', isDestroyed);
|
||||
});
|
||||
|
||||
socket.on('browserWindowShow', (id) => {
|
||||
getWindowById(id).show();
|
||||
});
|
||||
|
||||
socket.on('browserWindowShowInactive', (id) => {
|
||||
getWindowById(id).showInactive();
|
||||
});
|
||||
|
||||
socket.on('browserWindowHide', (id) => {
|
||||
getWindowById(id).hide();
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsVisible', (id) => {
|
||||
const isVisible = getWindowById(id).isVisible();
|
||||
|
||||
electronSocket.emit('browserWindow-isVisible-completed', isVisible);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsModal', (id) => {
|
||||
const isModal = getWindowById(id).isModal();
|
||||
|
||||
electronSocket.emit('browserWindow-isModal-completed', isModal);
|
||||
});
|
||||
|
||||
socket.on('browserWindowMaximize', (id) => {
|
||||
getWindowById(id).maximize();
|
||||
});
|
||||
|
||||
socket.on('browserWindowUnmaximize', (id) => {
|
||||
getWindowById(id).unmaximize();
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMaximized', (id) => {
|
||||
const isMaximized = getWindowById(id).isMaximized();
|
||||
|
||||
electronSocket.emit('browserWindow-isMaximized-completed', isMaximized);
|
||||
});
|
||||
|
||||
socket.on('browserWindowMinimize', (id) => {
|
||||
getWindowById(id).minimize();
|
||||
});
|
||||
|
||||
socket.on('browserWindowRestore', (id) => {
|
||||
getWindowById(id).restore();
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMinimized', (id) => {
|
||||
const isMinimized = getWindowById(id).isMinimized();
|
||||
|
||||
electronSocket.emit('browserWindow-isMinimized-completed', isMinimized);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetFullScreen', (id, fullscreen) => {
|
||||
getWindowById(id).setFullScreen(fullscreen);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsFullScreen', (id) => {
|
||||
const isFullScreen = getWindowById(id).isFullScreen();
|
||||
|
||||
electronSocket.emit('browserWindow-isFullScreen-completed', isFullScreen);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetAspectRatio', (id, aspectRatio, extraSize) => {
|
||||
getWindowById(id).setAspectRatio(aspectRatio, extraSize);
|
||||
});
|
||||
|
||||
socket.on('browserWindowPreviewFile', (id, path, displayname) => {
|
||||
getWindowById(id).previewFile(path, displayname);
|
||||
});
|
||||
|
||||
socket.on('browserWindowCloseFilePreview', (id) => {
|
||||
getWindowById(id).closeFilePreview();
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetBounds', (id, bounds, animate) => {
|
||||
getWindowById(id).setBounds(bounds, animate);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetBounds', (id) => {
|
||||
const rectangle = getWindowById(id).getBounds();
|
||||
|
||||
electronSocket.emit('browserWindow-getBounds-completed', rectangle);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetContentBounds', (id, bounds, animate) => {
|
||||
getWindowById(id).setContentBounds(bounds, animate);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetContentBounds', (id) => {
|
||||
const rectangle = getWindowById(id).getContentBounds();
|
||||
|
||||
electronSocket.emit('browserWindow-getContentBounds-completed', rectangle);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetSize', (id, width, height, animate) => {
|
||||
getWindowById(id).setSize(width, height, animate);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetSize', (id) => {
|
||||
const size = getWindowById(id).getSize();
|
||||
|
||||
electronSocket.emit('browserWindow-getSize-completed', size);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetContentSize', (id, width, height, animate) => {
|
||||
getWindowById(id).setContentSize(width, height, animate);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetContentSize', (id) => {
|
||||
const size = getWindowById(id).getContentSize();
|
||||
|
||||
electronSocket.emit('browserWindow-getContentSize-completed', size);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMinimumSize', (id, width, height) => {
|
||||
getWindowById(id).setMinimumSize(width, height);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetMinimumSize', (id) => {
|
||||
const size = getWindowById(id).getMinimumSize();
|
||||
|
||||
electronSocket.emit('browserWindow-getMinimumSize-completed', size);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMaximumSize', (id, width, height) => {
|
||||
getWindowById(id).setMaximumSize(width, height);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetMaximumSize', (id) => {
|
||||
const size = getWindowById(id).getMaximumSize();
|
||||
|
||||
electronSocket.emit('browserWindow-getMaximumSize-completed', size);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetResizable', (id, resizable) => {
|
||||
getWindowById(id).setResizable(resizable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsResizable', (id) => {
|
||||
const resizable = getWindowById(id).isResizable();
|
||||
|
||||
electronSocket.emit('browserWindow-isResizable-completed', resizable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMovable', (id, movable) => {
|
||||
getWindowById(id).setMovable(movable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMovable', (id) => {
|
||||
const movable = getWindowById(id).isMovable();
|
||||
|
||||
electronSocket.emit('browserWindow-isMovable-completed', movable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMinimizable', (id, minimizable) => {
|
||||
getWindowById(id).setMinimizable(minimizable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMinimizable', (id) => {
|
||||
const minimizable = getWindowById(id).isMinimizable();
|
||||
|
||||
electronSocket.emit('browserWindow-isMinimizable-completed', minimizable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMaximizable', (id, maximizable) => {
|
||||
getWindowById(id).setMaximizable(maximizable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMaximizable', (id) => {
|
||||
const maximizable = getWindowById(id).isMaximizable();
|
||||
|
||||
electronSocket.emit('browserWindow-isMaximizable-completed', maximizable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetFullScreenable', (id, fullscreenable) => {
|
||||
getWindowById(id).setFullScreenable(fullscreenable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsFullScreenable', (id) => {
|
||||
const fullscreenable = getWindowById(id).isFullScreenable();
|
||||
|
||||
electronSocket.emit('browserWindow-isFullScreenable-completed', fullscreenable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetClosable', (id, closable) => {
|
||||
getWindowById(id).setClosable(closable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsClosable', (id) => {
|
||||
const closable = getWindowById(id).isClosable();
|
||||
|
||||
electronSocket.emit('browserWindow-isClosable-completed', closable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetAlwaysOnTop', (id, flag, level, relativeLevel) => {
|
||||
getWindowById(id).setAlwaysOnTop(flag, level, relativeLevel);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsAlwaysOnTop', (id) => {
|
||||
const isAlwaysOnTop = getWindowById(id).isAlwaysOnTop();
|
||||
|
||||
electronSocket.emit('browserWindow-isAlwaysOnTop-completed', isAlwaysOnTop);
|
||||
});
|
||||
|
||||
socket.on('browserWindowCenter', (id) => {
|
||||
getWindowById(id).center();
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetPosition', (id, x, y, animate) => {
|
||||
getWindowById(id).setPosition(x, y, animate);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetPosition', (id) => {
|
||||
const position = getWindowById(id).getPosition();
|
||||
|
||||
electronSocket.emit('browserWindow-getPosition-completed', position);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetTitle', (id, title) => {
|
||||
getWindowById(id).setTitle(title);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetTitle', (id) => {
|
||||
const title = getWindowById(id).getTitle();
|
||||
|
||||
electronSocket.emit('browserWindow-getTitle-completed', title);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetTitle', (id, title) => {
|
||||
getWindowById(id).setTitle(title);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetSheetOffset', (id, offsetY, offsetX) => {
|
||||
if (offsetX) {
|
||||
getWindowById(id).setSheetOffset(offsetY, offsetX);
|
||||
} else {
|
||||
getWindowById(id).setSheetOffset(offsetY);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('browserWindowFlashFrame', (id, flag) => {
|
||||
getWindowById(id).flashFrame(flag);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetSkipTaskbar', (id, skip) => {
|
||||
getWindowById(id).setSkipTaskbar(skip);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetKiosk', (id, flag) => {
|
||||
getWindowById(id).setKiosk(flag);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsKiosk', (id) => {
|
||||
const isKiosk = getWindowById(id).isKiosk();
|
||||
|
||||
electronSocket.emit('browserWindow-isKiosk-completed', isKiosk);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetNativeWindowHandle', (id) => {
|
||||
const nativeWindowHandle = getWindowById(id).getNativeWindowHandle().readInt32LE(0).toString(16);
|
||||
electronSocket.emit('browserWindow-getNativeWindowHandle-completed', nativeWindowHandle);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetRepresentedFilename', (id, filename) => {
|
||||
getWindowById(id).setRepresentedFilename(filename);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetRepresentedFilename', (id) => {
|
||||
const pathname = getWindowById(id).getRepresentedFilename();
|
||||
|
||||
electronSocket.emit('browserWindow-getRepresentedFilename-completed', pathname);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetDocumentEdited', (id, edited) => {
|
||||
getWindowById(id).setDocumentEdited(edited);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsDocumentEdited', (id) => {
|
||||
const edited = getWindowById(id).isDocumentEdited();
|
||||
|
||||
electronSocket.emit('browserWindow-isDocumentEdited-completed', edited);
|
||||
});
|
||||
|
||||
socket.on('browserWindowFocusOnWebView', (id) => {
|
||||
getWindowById(id).focusOnWebView();
|
||||
});
|
||||
|
||||
socket.on('browserWindowBlurWebView', (id) => {
|
||||
getWindowById(id).blurWebView();
|
||||
});
|
||||
|
||||
socket.on('browserWindowLoadURL', (id, url, options) => {
|
||||
getWindowById(id).loadURL(url, options);
|
||||
});
|
||||
|
||||
socket.on('browserWindowReload', (id) => {
|
||||
getWindowById(id).reload();
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMenu', (id, menuItems) => {
|
||||
let menu = null;
|
||||
|
||||
if (menuItems) {
|
||||
menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('windowMenuItemClicked', id);
|
||||
});
|
||||
}
|
||||
|
||||
getWindowById(id).setMenu(menu);
|
||||
});
|
||||
|
||||
socket.on('browserWindowRemoveMenu', (id) => {
|
||||
getWindowById(id).removeMenu();
|
||||
});
|
||||
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
socket.on('browserWindowSetProgressBar', (id, progress) => {
|
||||
getWindowById(id).setProgressBar(progress);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetProgressBar', (id, progress, options) => {
|
||||
getWindowById(id).setProgressBar(progress, options);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetHasShadow', (id, hasShadow) => {
|
||||
getWindowById(id).setHasShadow(hasShadow);
|
||||
});
|
||||
|
||||
socket.on('browserWindowHasShadow', (id) => {
|
||||
const hasShadow = getWindowById(id).hasShadow();
|
||||
|
||||
electronSocket.emit('browserWindow-hasShadow-completed', hasShadow);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetThumbarButtons', (id, thumbarButtons: Electron.ThumbarButton[]) => {
|
||||
thumbarButtons.forEach(thumbarButton => {
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', thumbarButton.icon.toString());
|
||||
thumbarButton.icon = nativeImage.createFromPath(imagePath);
|
||||
thumbarButton.click = () => {
|
||||
electronSocket.emit('thumbarButtonClicked', thumbarButton['id']);
|
||||
};
|
||||
});
|
||||
|
||||
const success = getWindowById(id).setThumbarButtons(thumbarButtons);
|
||||
electronSocket.emit('browserWindowSetThumbarButtons-completed', success);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetThumbnailClip', (id, rectangle) => {
|
||||
getWindowById(id).setThumbnailClip(rectangle);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetThumbnailToolTip', (id, toolTip) => {
|
||||
getWindowById(id).setThumbnailToolTip(toolTip);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetAppDetails', (id, options) => {
|
||||
getWindowById(id).setAppDetails(options);
|
||||
});
|
||||
|
||||
socket.on('browserWindowShowDefinitionForSelection', (id) => {
|
||||
getWindowById(id).showDefinitionForSelection();
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetAutoHideMenuBar', (id, hide) => {
|
||||
getWindowById(id).setAutoHideMenuBar(hide);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMenuBarAutoHide', (id) => {
|
||||
const isMenuBarAutoHide = getWindowById(id).isMenuBarAutoHide();
|
||||
|
||||
electronSocket.emit('browserWindow-isMenuBarAutoHide-completed', isMenuBarAutoHide);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetMenuBarVisibility', (id, visible) => {
|
||||
getWindowById(id).setMenuBarVisibility(visible);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsMenuBarVisible', (id) => {
|
||||
const isMenuBarVisible = getWindowById(id).isMenuBarVisible();
|
||||
|
||||
electronSocket.emit('browserWindow-isMenuBarVisible-completed', isMenuBarVisible);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetVisibleOnAllWorkspaces', (id, visible) => {
|
||||
getWindowById(id).setVisibleOnAllWorkspaces(visible);
|
||||
});
|
||||
|
||||
socket.on('browserWindowIsVisibleOnAllWorkspaces', (id) => {
|
||||
const isVisibleOnAllWorkspaces = getWindowById(id).isVisibleOnAllWorkspaces();
|
||||
|
||||
electronSocket.emit('browserWindow-isVisibleOnAllWorkspaces-completed', isVisibleOnAllWorkspaces);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetIgnoreMouseEvents', (id, ignore) => {
|
||||
getWindowById(id).setIgnoreMouseEvents(ignore);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetContentProtection', (id, enable) => {
|
||||
getWindowById(id).setContentProtection(enable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetFocusable', (id, focusable) => {
|
||||
getWindowById(id).setFocusable(focusable);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetParentWindow', (id, parent) => {
|
||||
const browserWindow = BrowserWindow.fromId(parent.id);
|
||||
|
||||
getWindowById(id).setParentWindow(browserWindow);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetParentWindow', (id) => {
|
||||
const browserWindow = getWindowById(id).getParentWindow();
|
||||
|
||||
electronSocket.emit('browserWindow-getParentWindow-completed', browserWindow.id);
|
||||
});
|
||||
|
||||
socket.on('browserWindowGetChildWindows', (id) => {
|
||||
const browserWindows = getWindowById(id).getChildWindows();
|
||||
|
||||
const ids = [];
|
||||
|
||||
browserWindows.forEach(x => {
|
||||
ids.push(x.id);
|
||||
});
|
||||
|
||||
electronSocket.emit('browserWindow-getChildWindows-completed', ids);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetAutoHideCursor', (id, autoHide) => {
|
||||
getWindowById(id).setAutoHideCursor(autoHide);
|
||||
});
|
||||
|
||||
socket.on('browserWindowSetVibrancy', (id, type) => {
|
||||
getWindowById(id).setVibrancy(type);
|
||||
});
|
||||
|
||||
socket.on('browserWindow-setBrowserView', (id, browserViewId) => {
|
||||
getWindowById(id).setBrowserView(browserViewMediateService(browserViewId));
|
||||
});
|
||||
|
||||
function getWindowById(id: number): Electron.BrowserWindow {
|
||||
for (let index = 0; index < windows.length; index++) {
|
||||
const element = windows[index];
|
||||
if (element.id === id) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,68 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('clipboard-readText', (type) => {
|
||||
const text = electron_1.clipboard.readText(type);
|
||||
electronSocket.emit('clipboard-readText-Completed', text);
|
||||
});
|
||||
socket.on('clipboard-writeText', (text, type) => {
|
||||
electron_1.clipboard.writeText(text, type);
|
||||
});
|
||||
socket.on('clipboard-readHTML', (type) => {
|
||||
const content = electron_1.clipboard.readHTML(type);
|
||||
electronSocket.emit('clipboard-readHTML-Completed', content);
|
||||
});
|
||||
socket.on('clipboard-writeHTML', (markup, type) => {
|
||||
electron_1.clipboard.writeHTML(markup, type);
|
||||
});
|
||||
socket.on('clipboard-readRTF', (type) => {
|
||||
const content = electron_1.clipboard.readRTF(type);
|
||||
electronSocket.emit('clipboard-readRTF-Completed', content);
|
||||
});
|
||||
socket.on('clipboard-writeRTF', (text, type) => {
|
||||
electron_1.clipboard.writeHTML(text, type);
|
||||
});
|
||||
socket.on('clipboard-readBookmark', () => {
|
||||
const bookmark = electron_1.clipboard.readBookmark();
|
||||
electronSocket.emit('clipboard-readBookmark-Completed', bookmark);
|
||||
});
|
||||
socket.on('clipboard-writeBookmark', (title, url, type) => {
|
||||
electron_1.clipboard.writeBookmark(title, url, type);
|
||||
});
|
||||
socket.on('clipboard-readFindText', () => {
|
||||
const content = electron_1.clipboard.readFindText();
|
||||
electronSocket.emit('clipboard-readFindText-Completed', content);
|
||||
});
|
||||
socket.on('clipboard-writeFindText', (text) => {
|
||||
electron_1.clipboard.writeFindText(text);
|
||||
});
|
||||
socket.on('clipboard-clear', (type) => {
|
||||
electron_1.clipboard.clear(type);
|
||||
});
|
||||
socket.on('clipboard-availableFormats', (type) => {
|
||||
const formats = electron_1.clipboard.availableFormats(type);
|
||||
electronSocket.emit('clipboard-availableFormats-Completed', formats);
|
||||
});
|
||||
socket.on('clipboard-write', (data, type) => {
|
||||
electron_1.clipboard.write(data, type);
|
||||
});
|
||||
socket.on('clipboard-readImage', (type) => {
|
||||
const image = electron_1.clipboard.readImage(type);
|
||||
electronSocket.emit('clipboard-readImage-Completed', { 1: image.toPNG().toString('base64') });
|
||||
});
|
||||
socket.on('clipboard-writeImage', (data, type) => {
|
||||
const dataContent = JSON.parse(data);
|
||||
const image = electron_1.nativeImage.createEmpty();
|
||||
// tslint:disable-next-line: forin
|
||||
for (const key in dataContent) {
|
||||
const scaleFactor = key;
|
||||
const bytes = data[key];
|
||||
const buffer = Buffer.from(bytes, 'base64');
|
||||
image.addRepresentation({ scaleFactor: +scaleFactor, buffer: buffer });
|
||||
}
|
||||
electron_1.clipboard.writeImage(image, type);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=clipboard.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["clipboard.ts"],"names":[],"mappings":";AACA,uCAAkD;AAClD,IAAI,c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AAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,oBAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,+BAA+B,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,sBAAW,CAAC,WAAW,EAAE,CAAC;QAExC,kCAAkC;QAClC,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE;YAC3B,MAAM,WAAW,GAAG,GAAG,CAAC;YACxB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;YACxB,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC5C,KAAK,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;SAC1E;QAED,oBAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,84 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { clipboard, nativeImage } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('clipboard-readText', (type) => {
|
||||
const text = clipboard.readText(type);
|
||||
electronSocket.emit('clipboard-readText-Completed', text);
|
||||
});
|
||||
|
||||
socket.on('clipboard-writeText', (text, type) => {
|
||||
clipboard.writeText(text, type);
|
||||
});
|
||||
|
||||
socket.on('clipboard-readHTML', (type) => {
|
||||
const content = clipboard.readHTML(type);
|
||||
electronSocket.emit('clipboard-readHTML-Completed', content);
|
||||
});
|
||||
|
||||
socket.on('clipboard-writeHTML', (markup, type) => {
|
||||
clipboard.writeHTML(markup, type);
|
||||
});
|
||||
|
||||
socket.on('clipboard-readRTF', (type) => {
|
||||
const content = clipboard.readRTF(type);
|
||||
electronSocket.emit('clipboard-readRTF-Completed', content);
|
||||
});
|
||||
|
||||
socket.on('clipboard-writeRTF', (text, type) => {
|
||||
clipboard.writeHTML(text, type);
|
||||
});
|
||||
|
||||
socket.on('clipboard-readBookmark', () => {
|
||||
const bookmark = clipboard.readBookmark();
|
||||
electronSocket.emit('clipboard-readBookmark-Completed', bookmark);
|
||||
});
|
||||
|
||||
socket.on('clipboard-writeBookmark', (title, url, type) => {
|
||||
clipboard.writeBookmark(title, url, type);
|
||||
});
|
||||
|
||||
socket.on('clipboard-readFindText', () => {
|
||||
const content = clipboard.readFindText();
|
||||
electronSocket.emit('clipboard-readFindText-Completed', content);
|
||||
});
|
||||
|
||||
socket.on('clipboard-writeFindText', (text) => {
|
||||
clipboard.writeFindText(text);
|
||||
});
|
||||
|
||||
socket.on('clipboard-clear', (type) => {
|
||||
clipboard.clear(type);
|
||||
});
|
||||
|
||||
socket.on('clipboard-availableFormats', (type) => {
|
||||
const formats = clipboard.availableFormats(type);
|
||||
electronSocket.emit('clipboard-availableFormats-Completed', formats);
|
||||
});
|
||||
|
||||
socket.on('clipboard-write', (data, type) => {
|
||||
clipboard.write(data, type);
|
||||
});
|
||||
|
||||
socket.on('clipboard-readImage', (type) => {
|
||||
const image = clipboard.readImage(type);
|
||||
electronSocket.emit('clipboard-readImage-Completed', { 1: image.toPNG().toString('base64') });
|
||||
});
|
||||
|
||||
socket.on('clipboard-writeImage', (data, type) => {
|
||||
const dataContent = JSON.parse(data);
|
||||
const image = nativeImage.createEmpty();
|
||||
|
||||
// tslint:disable-next-line: forin
|
||||
for (const key in dataContent) {
|
||||
const scaleFactor = key;
|
||||
const bytes = data[key];
|
||||
const buffer = Buffer.from(bytes, 'base64');
|
||||
image.addRepresentation({ scaleFactor: +scaleFactor, buffer: buffer });
|
||||
}
|
||||
|
||||
clipboard.writeImage(image, type);
|
||||
});
|
||||
};
|
||||
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
let electronSocket;
|
||||
module.exports = (socket, app) => {
|
||||
electronSocket = socket;
|
||||
socket.on('appCommandLineAppendSwitch', (the_switch, value) => {
|
||||
app.commandLine.appendSwitch(the_switch, value);
|
||||
});
|
||||
socket.on('appCommandLineAppendArgument', (value) => {
|
||||
app.commandLine.appendArgument(value);
|
||||
});
|
||||
socket.on('appCommandLineHasSwitch', (value) => {
|
||||
const hasSwitch = app.commandLine.hasSwitch(value);
|
||||
electronSocket.emit('appCommandLineHasSwitchCompleted', hasSwitch);
|
||||
});
|
||||
socket.on('appCommandLineGetSwitchValue', (the_switch) => {
|
||||
const value = app.commandLine.getSwitchValue(the_switch);
|
||||
electronSocket.emit('appCommandLineGetSwitchValueCompleted', value);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=commandLine.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"commandLine.js","sourceRoot":"","sources":["commandLine.ts"],"names":[],"mappings":";AACA,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,GAAiB,EAAE,EAAE;IAC3C,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,UAAkB,EAAE,KAAa,EAAE,EAAE;QAC1E,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,KAAa,EAAE,EAAE;QACxD,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAa,EAAE,EAAE;QACnD,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,UAAkB,EAAE,EAAE;QAC7D,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACzD,cAAc,CAAC,IAAI,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket, app: Electron.App) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('appCommandLineAppendSwitch', (the_switch: string, value: string) => {
|
||||
app.commandLine.appendSwitch(the_switch, value);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineAppendArgument', (value: string) => {
|
||||
app.commandLine.appendArgument(value);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineHasSwitch', (value: string) => {
|
||||
const hasSwitch = app.commandLine.hasSwitch(value);
|
||||
electronSocket.emit('appCommandLineHasSwitchCompleted', hasSwitch);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineGetSwitchValue', (the_switch: string) => {
|
||||
const value = app.commandLine.getSwitchValue(the_switch);
|
||||
electronSocket.emit('appCommandLineGetSwitchValueCompleted', value);
|
||||
});
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('showMessageBox', async (browserWindow, options, guid) => {
|
||||
if ('id' in browserWindow) {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
const messageBoxReturnValue = await electron_1.dialog.showMessageBox(window, options);
|
||||
electronSocket.emit('showMessageBoxComplete' + guid, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
|
||||
}
|
||||
else {
|
||||
const id = guid || options;
|
||||
const messageBoxReturnValue = await electron_1.dialog.showMessageBox(browserWindow);
|
||||
electronSocket.emit('showMessageBoxComplete' + id, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
|
||||
}
|
||||
});
|
||||
socket.on('showOpenDialog', async (browserWindow, options, guid) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
const openDialogReturnValue = await electron_1.dialog.showOpenDialog(window, options);
|
||||
electronSocket.emit('showOpenDialogComplete' + guid, openDialogReturnValue.filePaths || []);
|
||||
});
|
||||
socket.on('showSaveDialog', async (browserWindow, options, guid) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
const saveDialogReturnValue = await electron_1.dialog.showSaveDialog(window, options);
|
||||
electronSocket.emit('showSaveDialogComplete' + guid, saveDialogReturnValue.filePath || '');
|
||||
});
|
||||
socket.on('showErrorBox', (title, content) => {
|
||||
electron_1.dialog.showErrorBox(title, content);
|
||||
});
|
||||
socket.on('showCertificateTrustDialog', async (browserWindow, options, guid) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
await electron_1.dialog.showCertificateTrustDialog(window, options);
|
||||
electronSocket.emit('showCertificateTrustDialogComplete' + guid);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=dialog.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["dialog.ts"],"names":[],"mappings":";AACA,uCAAiD;AACjD,IAAI,cAAsB,CAAC;AA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E,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,qBAAqB,GAAG,MAAM,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAE3E,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,qBAAqB,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACzC,iBAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC3E,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAEzD,cAAc,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,45 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { BrowserWindow, dialog } from 'electron';
|
||||
let electronSocket: Socket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('showMessageBox', async (browserWindow, options, guid) => {
|
||||
if ('id' in browserWindow) {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
|
||||
const messageBoxReturnValue = await dialog.showMessageBox(window, options);
|
||||
electronSocket.emit('showMessageBoxComplete' + guid, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
|
||||
} else {
|
||||
const id = guid || options;
|
||||
const messageBoxReturnValue = await dialog.showMessageBox(browserWindow);
|
||||
|
||||
electronSocket.emit('showMessageBoxComplete' + id, [messageBoxReturnValue.response, messageBoxReturnValue.checkboxChecked]);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('showOpenDialog', async (browserWindow, options, guid) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
const openDialogReturnValue = await dialog.showOpenDialog(window, options);
|
||||
|
||||
electronSocket.emit('showOpenDialogComplete' + guid, openDialogReturnValue.filePaths || []);
|
||||
});
|
||||
|
||||
socket.on('showSaveDialog', async (browserWindow, options, guid) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
const saveDialogReturnValue = await dialog.showSaveDialog(window, options);
|
||||
|
||||
electronSocket.emit('showSaveDialogComplete' + guid, saveDialogReturnValue.filePath || '');
|
||||
});
|
||||
|
||||
socket.on('showErrorBox', (title, content) => {
|
||||
dialog.showErrorBox(title, content);
|
||||
});
|
||||
|
||||
socket.on('showCertificateTrustDialog', async (browserWindow, options, guid) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
await dialog.showCertificateTrustDialog(window, options);
|
||||
|
||||
electronSocket.emit('showCertificateTrustDialogComplete' + guid);
|
||||
});
|
||||
};
|
||||
@@ -1,62 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('dock-bounce', (type) => {
|
||||
const id = electron_1.app.dock.bounce(type);
|
||||
electronSocket.emit('dock-bounce-completed', id);
|
||||
});
|
||||
socket.on('dock-cancelBounce', (id) => {
|
||||
electron_1.app.dock.cancelBounce(id);
|
||||
});
|
||||
socket.on('dock-downloadFinished', (filePath) => {
|
||||
electron_1.app.dock.downloadFinished(filePath);
|
||||
});
|
||||
socket.on('dock-setBadge', (text) => {
|
||||
electron_1.app.dock.setBadge(text);
|
||||
});
|
||||
socket.on('dock-getBadge', () => {
|
||||
const text = electron_1.app.dock.getBadge();
|
||||
electronSocket.emit('dock-getBadge-completed', text);
|
||||
});
|
||||
socket.on('dock-hide', () => {
|
||||
electron_1.app.dock.hide();
|
||||
});
|
||||
socket.on('dock-show', () => {
|
||||
electron_1.app.dock.show();
|
||||
});
|
||||
socket.on('dock-isVisible', () => {
|
||||
const isVisible = electron_1.app.dock.isVisible();
|
||||
electronSocket.emit('dock-isVisible-completed', isVisible);
|
||||
});
|
||||
socket.on('dock-setMenu', (menuItems) => {
|
||||
let menu = null;
|
||||
if (menuItems) {
|
||||
menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('dockMenuItemClicked', id);
|
||||
});
|
||||
}
|
||||
electron_1.app.dock.setMenu(menu);
|
||||
});
|
||||
// TODO: Menu (macOS) still to be implemented
|
||||
socket.on('dock-getMenu', () => {
|
||||
const menu = electron_1.app.dock.getMenu();
|
||||
electronSocket.emit('dock-getMenu-completed', menu);
|
||||
});
|
||||
socket.on('dock-setIcon', (image) => {
|
||||
electron_1.app.dock.setIcon(image);
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=dock.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"dock.js","sourceRoot":"","sources":["dock.ts"],"names":[],"mappings":";AACA,uCAAqC;AACrC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,EA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zB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC"}
|
||||
@@ -1,78 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { app, Menu } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('dock-bounce', (type) => {
|
||||
const id = app.dock.bounce(type);
|
||||
electronSocket.emit('dock-bounce-completed', id);
|
||||
});
|
||||
|
||||
socket.on('dock-cancelBounce', (id) => {
|
||||
app.dock.cancelBounce(id);
|
||||
});
|
||||
|
||||
socket.on('dock-downloadFinished', (filePath) => {
|
||||
app.dock.downloadFinished(filePath);
|
||||
});
|
||||
|
||||
socket.on('dock-setBadge', (text) => {
|
||||
app.dock.setBadge(text);
|
||||
});
|
||||
|
||||
socket.on('dock-getBadge', () => {
|
||||
const text = app.dock.getBadge();
|
||||
electronSocket.emit('dock-getBadge-completed', text);
|
||||
});
|
||||
|
||||
socket.on('dock-hide', () => {
|
||||
app.dock.hide();
|
||||
});
|
||||
|
||||
socket.on('dock-show', () => {
|
||||
app.dock.show();
|
||||
});
|
||||
|
||||
socket.on('dock-isVisible', () => {
|
||||
const isVisible = app.dock.isVisible();
|
||||
electronSocket.emit('dock-isVisible-completed', isVisible);
|
||||
});
|
||||
|
||||
socket.on('dock-setMenu', (menuItems) => {
|
||||
let menu = null;
|
||||
|
||||
if (menuItems) {
|
||||
menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('dockMenuItemClicked', id);
|
||||
});
|
||||
}
|
||||
|
||||
app.dock.setMenu(menu);
|
||||
});
|
||||
|
||||
// TODO: Menu (macOS) still to be implemented
|
||||
socket.on('dock-getMenu', () => {
|
||||
const menu = app.dock.getMenu();
|
||||
electronSocket.emit('dock-getMenu-completed', menu);
|
||||
});
|
||||
|
||||
socket.on('dock-setIcon', (image) => {
|
||||
app.dock.setIcon(image);
|
||||
});
|
||||
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('globalShortcut-register', (accelerator) => {
|
||||
electron_1.globalShortcut.register(accelerator, () => {
|
||||
electronSocket.emit('globalShortcut-pressed', accelerator);
|
||||
});
|
||||
});
|
||||
socket.on('globalShortcut-isRegistered', (accelerator) => {
|
||||
const isRegistered = electron_1.globalShortcut.isRegistered(accelerator);
|
||||
electronSocket.emit('globalShortcut-isRegisteredCompleted', isRegistered);
|
||||
});
|
||||
socket.on('globalShortcut-unregister', (accelerator) => {
|
||||
electron_1.globalShortcut.unregister(accelerator);
|
||||
});
|
||||
socket.on('globalShortcut-unregisterAll', () => {
|
||||
try {
|
||||
electron_1.globalShortcut.unregisterAll();
|
||||
}
|
||||
catch (error) { }
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=globalShortcut.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"globalShortcut.js","sourceRoot":"","sources":["globalShortcut.ts"],"names":[],"mappings":";AAAA,uCAA0C;AAE1C,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjD,yBAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;YACtC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,CAAC,WAAW,EAAE,EAAE;QACrD,MAAM,YAAY,GAAG,yBAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAE9D,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,YAAY,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,WAAW,EAAE,EAAE;QACnD,yBAAc,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QAC3C,IAAI;YACA,yBAAc,CAAC,aAAa,EAAE,CAAC;SAClC;QAAC,OAAO,KAAK,EAAE,GAAG;IACvB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { globalShortcut } from 'electron';
|
||||
import { Socket } from 'net';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('globalShortcut-register', (accelerator) => {
|
||||
globalShortcut.register(accelerator, () => {
|
||||
electronSocket.emit('globalShortcut-pressed', accelerator);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('globalShortcut-isRegistered', (accelerator) => {
|
||||
const isRegistered = globalShortcut.isRegistered(accelerator);
|
||||
|
||||
electronSocket.emit('globalShortcut-isRegisteredCompleted', isRegistered);
|
||||
});
|
||||
|
||||
socket.on('globalShortcut-unregister', (accelerator) => {
|
||||
globalShortcut.unregister(accelerator);
|
||||
});
|
||||
|
||||
socket.on('globalShortcut-unregisterAll', () => {
|
||||
try {
|
||||
globalShortcut.unregisterAll();
|
||||
} catch (error) { }
|
||||
});
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('registerIpcMainChannel', (channel) => {
|
||||
electron_1.ipcMain.on(channel, (event, args) => {
|
||||
electronSocket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
socket.on('registerSyncIpcMainChannel', (channel) => {
|
||||
electron_1.ipcMain.on(channel, (event, args) => {
|
||||
const x = socket;
|
||||
x.removeAllListeners(channel + 'Sync');
|
||||
socket.on(channel + 'Sync', (result) => {
|
||||
event.returnValue = result;
|
||||
});
|
||||
electronSocket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
socket.on('registerOnceIpcMainChannel', (channel) => {
|
||||
electron_1.ipcMain.once(channel, (event, args) => {
|
||||
electronSocket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
socket.on('removeAllListenersIpcMainChannel', (channel) => {
|
||||
electron_1.ipcMain.removeAllListeners(channel);
|
||||
});
|
||||
socket.on('sendToIpcRenderer', (browserWindow, channel, ...data) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
if (window) {
|
||||
window.webContents.send(channel, ...data);
|
||||
}
|
||||
});
|
||||
socket.on('sendToIpcRendererBrowserView', (id, channel, ...data) => {
|
||||
const browserViews = (global['browserViews'] = global['browserViews'] || []);
|
||||
let view = null;
|
||||
for (let i = 0; i < browserViews.length; i++) {
|
||||
if (browserViews[i]['id'] === id) {
|
||||
view = browserViews[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (view) {
|
||||
view.webContents.send(channel, ...data);
|
||||
}
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=ipc.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],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
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('registerIpcMainChannel', (channel) => {
|
||||
ipcMain.on(channel, (event, args) => {
|
||||
electronSocket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('registerSyncIpcMainChannel', (channel) => {
|
||||
ipcMain.on(channel, (event, args) => {
|
||||
const x = <any>socket;
|
||||
x.removeAllListeners(channel + 'Sync');
|
||||
socket.on(channel + 'Sync', (result) => {
|
||||
event.returnValue = result;
|
||||
});
|
||||
|
||||
electronSocket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('registerOnceIpcMainChannel', (channel) => {
|
||||
ipcMain.once(channel, (event, args) => {
|
||||
electronSocket.emit(channel, [event.preventDefault(), args]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('removeAllListenersIpcMainChannel', (channel) => {
|
||||
ipcMain.removeAllListeners(channel);
|
||||
});
|
||||
|
||||
socket.on('sendToIpcRenderer', (browserWindow, channel, ...data) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
|
||||
if (window) {
|
||||
window.webContents.send(channel, ...data);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('sendToIpcRendererBrowserView', (id, channel, ...data) => {
|
||||
const browserViews: BrowserView[] = (global['browserViews'] = global['browserViews'] || []) as BrowserView[];
|
||||
let view: BrowserView = null;
|
||||
for (let i = 0; i < browserViews.length; i++) {
|
||||
if (browserViews[i]['id'] === id) {
|
||||
view = browserViews[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (view) {
|
||||
view.webContents.send(channel, ...data);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,60 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const contextMenuItems = (global['contextMenuItems'] = global['contextMenuItems'] || []);
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('menu-setContextMenu', (browserWindowId, menuItems) => {
|
||||
const menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addContextMenuItemClickConnector(menu.items, browserWindowId, (id, windowId) => {
|
||||
electronSocket.emit('contextMenuItemClicked', [id, windowId]);
|
||||
});
|
||||
const index = contextMenuItems.findIndex(contextMenu => contextMenu.browserWindowId === browserWindowId);
|
||||
const contextMenuItem = {
|
||||
menu: menu,
|
||||
browserWindowId: browserWindowId
|
||||
};
|
||||
if (index === -1) {
|
||||
contextMenuItems.push(contextMenuItem);
|
||||
}
|
||||
else {
|
||||
contextMenuItems[index] = contextMenuItem;
|
||||
}
|
||||
});
|
||||
function addContextMenuItemClickConnector(menuItems, browserWindowId, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addContextMenuItemClickConnector(item.submenu.items, browserWindowId, callback);
|
||||
}
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id, browserWindowId); };
|
||||
}
|
||||
});
|
||||
}
|
||||
socket.on('menu-contextMenuPopup', (browserWindowId) => {
|
||||
contextMenuItems.forEach(x => {
|
||||
if (x.browserWindowId === browserWindowId) {
|
||||
const browserWindow = electron_1.BrowserWindow.fromId(browserWindowId);
|
||||
x.menu.popup(browserWindow);
|
||||
}
|
||||
});
|
||||
});
|
||||
socket.on('menu-setApplicationMenu', (menuItems) => {
|
||||
const menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('menuItemClicked', id);
|
||||
});
|
||||
electron_1.Menu.setApplicationMenu(menu);
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};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IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC3D;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC"}
|
||||
@@ -1,71 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { Menu, BrowserWindow } from 'electron';
|
||||
const contextMenuItems = (global['contextMenuItems'] = global['contextMenuItems'] || []);
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('menu-setContextMenu', (browserWindowId, menuItems) => {
|
||||
const menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addContextMenuItemClickConnector(menu.items, browserWindowId, (id, windowId) => {
|
||||
electronSocket.emit('contextMenuItemClicked', [id, windowId]);
|
||||
});
|
||||
|
||||
const index = contextMenuItems.findIndex(contextMenu => contextMenu.browserWindowId === browserWindowId);
|
||||
|
||||
const contextMenuItem = {
|
||||
menu: menu,
|
||||
browserWindowId: browserWindowId
|
||||
};
|
||||
|
||||
if (index === -1) {
|
||||
contextMenuItems.push(contextMenuItem);
|
||||
} else {
|
||||
contextMenuItems[index] = contextMenuItem;
|
||||
}
|
||||
});
|
||||
|
||||
function addContextMenuItemClickConnector(menuItems, browserWindowId, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addContextMenuItemClickConnector(item.submenu.items, browserWindowId, callback);
|
||||
}
|
||||
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id, browserWindowId); };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
socket.on('menu-contextMenuPopup', (browserWindowId) => {
|
||||
contextMenuItems.forEach(x => {
|
||||
if (x.browserWindowId === browserWindowId) {
|
||||
const browserWindow = BrowserWindow.fromId(browserWindowId);
|
||||
x.menu.popup(browserWindow);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('menu-setApplicationMenu', (menuItems) => {
|
||||
const menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('menuItemClicked', id);
|
||||
});
|
||||
|
||||
Menu.setApplicationMenu(menu);
|
||||
});
|
||||
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('nativeTheme-shouldUseDarkColors', () => {
|
||||
const shouldUseDarkColors = electron_1.nativeTheme.shouldUseDarkColors;
|
||||
electronSocket.emit('nativeTheme-shouldUseDarkColors-completed', shouldUseDarkColors);
|
||||
});
|
||||
socket.on('nativeTheme-shouldUseHighContrastColors', () => {
|
||||
const shouldUseHighContrastColors = electron_1.nativeTheme.shouldUseHighContrastColors;
|
||||
electronSocket.emit('nativeTheme-shouldUseHighContrastColors-completed', shouldUseHighContrastColors);
|
||||
});
|
||||
socket.on('nativeTheme-shouldUseInvertedColorScheme', () => {
|
||||
const shouldUseInvertedColorScheme = electron_1.nativeTheme.shouldUseInvertedColorScheme;
|
||||
electronSocket.emit('nativeTheme-shouldUseInvertedColorScheme-completed', shouldUseInvertedColorScheme);
|
||||
});
|
||||
socket.on('nativeTheme-themeSource-get', () => {
|
||||
const themeSource = electron_1.nativeTheme.themeSource;
|
||||
electronSocket.emit('nativeTheme-themeSource-getCompleted', themeSource);
|
||||
});
|
||||
socket.on('nativeTheme-themeSource', (themeSource) => {
|
||||
electron_1.nativeTheme.themeSource = themeSource;
|
||||
});
|
||||
socket.on('register-nativeTheme-updated-event', (id) => {
|
||||
electron_1.nativeTheme.on('updated', () => {
|
||||
electronSocket.emit('nativeTheme-updated' + id);
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=nativeTheme.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"nativeTheme.js","sourceRoot":"","sources":["nativeTheme.ts"],"names":[],"mappings":";AACA,uCAAuC;AACvC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC9C,MAAM,mBAAmB,GAAG,sBAAW,CAAC,mBAAmB,CAAC;QAE5D,cAAc,CAAC,IAAI,CAAC,2CAA2C,EAAE,mBAAmB,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACtD,MAAM,2BAA2B,GAAG,sBAAW,CAAC,2BAA2B,CAAC;QAE5E,cAAc,CAAC,IAAI,CAAC,mDAAmD,EAAE,2BAA2B,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACvD,MAAM,4BAA4B,GAAG,sBAAW,CAAC,4BAA4B,CAAC;QAE9E,cAAc,CAAC,IAAI,CAAC,oDAAoD,EAAE,4BAA4B,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,WAAW,GAAG,sBAAW,CAAC,WAAW,CAAC;QAE5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,WAAW,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,WAAW,EAAE,EAAE;QACjD,sBAAW,CAAC,WAAW,GAAG,WAAW,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oCAAoC,EAAE,CAAC,EAAE,EAAE,EAAE;QACnD,sBAAW,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,41 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { nativeTheme } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('nativeTheme-shouldUseDarkColors', () => {
|
||||
const shouldUseDarkColors = nativeTheme.shouldUseDarkColors;
|
||||
|
||||
electronSocket.emit('nativeTheme-shouldUseDarkColors-completed', shouldUseDarkColors);
|
||||
});
|
||||
|
||||
socket.on('nativeTheme-shouldUseHighContrastColors', () => {
|
||||
const shouldUseHighContrastColors = nativeTheme.shouldUseHighContrastColors;
|
||||
|
||||
electronSocket.emit('nativeTheme-shouldUseHighContrastColors-completed', shouldUseHighContrastColors);
|
||||
});
|
||||
|
||||
socket.on('nativeTheme-shouldUseInvertedColorScheme', () => {
|
||||
const shouldUseInvertedColorScheme = nativeTheme.shouldUseInvertedColorScheme;
|
||||
|
||||
electronSocket.emit('nativeTheme-shouldUseInvertedColorScheme-completed', shouldUseInvertedColorScheme);
|
||||
});
|
||||
|
||||
socket.on('nativeTheme-themeSource-get', () => {
|
||||
const themeSource = nativeTheme.themeSource;
|
||||
|
||||
electronSocket.emit('nativeTheme-themeSource-getCompleted', themeSource);
|
||||
});
|
||||
|
||||
socket.on('nativeTheme-themeSource', (themeSource) => {
|
||||
nativeTheme.themeSource = themeSource;
|
||||
});
|
||||
|
||||
socket.on('register-nativeTheme-updated-event', (id) => {
|
||||
nativeTheme.on('updated', () => {
|
||||
electronSocket.emit('nativeTheme-updated' + id);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,50 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const notifications = (global['notifications'] = global['notifications'] || []);
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('createNotification', (options) => {
|
||||
const notification = new electron_1.Notification(options);
|
||||
let haveEvent = false;
|
||||
if (options.showID) {
|
||||
haveEvent = true;
|
||||
notification.on('show', () => {
|
||||
electronSocket.emit('NotificationEventShow', options.showID);
|
||||
});
|
||||
}
|
||||
if (options.clickID) {
|
||||
haveEvent = true;
|
||||
notification.on('click', () => {
|
||||
electronSocket.emit('NotificationEventClick', options.clickID);
|
||||
});
|
||||
}
|
||||
if (options.closeID) {
|
||||
haveEvent = true;
|
||||
notification.on('close', () => {
|
||||
electronSocket.emit('NotificationEventClose', options.closeID);
|
||||
});
|
||||
}
|
||||
if (options.replyID) {
|
||||
haveEvent = true;
|
||||
notification.on('reply', (event, value) => {
|
||||
electronSocket.emit('NotificationEventReply', [options.replyID, value]);
|
||||
});
|
||||
}
|
||||
if (options.actionID) {
|
||||
haveEvent = true;
|
||||
notification.on('action', (event, value) => {
|
||||
electronSocket.emit('NotificationEventAction', [options.actionID, value]);
|
||||
});
|
||||
}
|
||||
if (haveEvent) {
|
||||
notifications.push(notification);
|
||||
}
|
||||
notification.show();
|
||||
});
|
||||
socket.on('notificationIsSupported', () => {
|
||||
const isSupported = electron_1.Notification.isSupported;
|
||||
electronSocket.emit('notificationIsSupportedComplete', isSupported);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=notification.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"notification.js","sourceRoot":"","sources":["notification.ts"],"names":[],"mappings":";AACA,uCAAwC;AACxC,MAAM,aAAa,GAA4B,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,CAA4B,CAAC;AACpI,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,OAAO,EAAE,EAAE;QACxC,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,SAAS,GAAG,KAAK,CAAC;QAEtB,IAAI,OAAO,CAAC,MAAM,EAAE;YAChB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;gBACzB,cAAc,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACjE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACtC,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5E,CAAC,CAAC,CAAC;SACN;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE;YAClB,SAAS,GAAG,IAAI,CAAC;YACjB,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBACvC,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;SACN;QAED,IAAI,SAAS,EAAE;YACX,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;SACpC;QAED,YAAY,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,WAAW,GAAG,uBAAY,CAAC,WAAW,CAAC;QAC7C,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,WAAW,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,58 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { Notification } from 'electron';
|
||||
const notifications: Electron.Notification[] = (global['notifications'] = global['notifications'] || []) as Electron.Notification[];
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('createNotification', (options) => {
|
||||
const notification = new Notification(options);
|
||||
let haveEvent = false;
|
||||
|
||||
if (options.showID) {
|
||||
haveEvent = true;
|
||||
notification.on('show', () => {
|
||||
electronSocket.emit('NotificationEventShow', options.showID);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.clickID) {
|
||||
haveEvent = true;
|
||||
notification.on('click', () => {
|
||||
electronSocket.emit('NotificationEventClick', options.clickID);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.closeID) {
|
||||
haveEvent = true;
|
||||
notification.on('close', () => {
|
||||
electronSocket.emit('NotificationEventClose', options.closeID);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.replyID) {
|
||||
haveEvent = true;
|
||||
notification.on('reply', (event, value) => {
|
||||
electronSocket.emit('NotificationEventReply', [options.replyID, value]);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.actionID) {
|
||||
haveEvent = true;
|
||||
notification.on('action', (event, value) => {
|
||||
electronSocket.emit('NotificationEventAction', [options.actionID, value]);
|
||||
});
|
||||
}
|
||||
|
||||
if (haveEvent) {
|
||||
notifications.push(notification);
|
||||
}
|
||||
|
||||
notification.show();
|
||||
});
|
||||
|
||||
socket.on('notificationIsSupported', () => {
|
||||
const isSupported = Notification.isSupported;
|
||||
electronSocket.emit('notificationIsSupportedComplete', isSupported);
|
||||
});
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-pm-lock-screen', () => {
|
||||
electron_1.powerMonitor.on('lock-screen', () => {
|
||||
electronSocket.emit('pm-lock-screen');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-unlock-screen', () => {
|
||||
electron_1.powerMonitor.on('unlock-screen', () => {
|
||||
electronSocket.emit('pm-unlock-screen');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-suspend', () => {
|
||||
electron_1.powerMonitor.on('suspend', () => {
|
||||
electronSocket.emit('pm-suspend');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-resume', () => {
|
||||
electron_1.powerMonitor.on('resume', () => {
|
||||
electronSocket.emit('pm-resume');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-on-ac', () => {
|
||||
electron_1.powerMonitor.on('on-ac', () => {
|
||||
electronSocket.emit('pm-on-ac');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-on-battery', () => {
|
||||
electron_1.powerMonitor.on('on-battery', () => {
|
||||
electronSocket.emit('pm-on-battery');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-shutdown', () => {
|
||||
electron_1.powerMonitor.on('shutdown', () => {
|
||||
electronSocket.emit('pm-shutdown');
|
||||
});
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=powerMonitor.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"powerMonitor.js","sourceRoot":"","sources":["powerMonitor.ts"],"names":[],"mappings":";AACA,uCAAwC;AACxC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,uBAAY,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YAChC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACxC,uBAAY,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;YAClC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAClC,uBAAY,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;YAC5B,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,GAAG,EAAE;QACjC,uBAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAC3B,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAChC,uBAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC1B,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,uBAAY,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YAC/B,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACnC,uBAAY,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;YAC7B,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,42 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { powerMonitor } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-pm-lock-screen', () => {
|
||||
powerMonitor.on('lock-screen', () => {
|
||||
electronSocket.emit('pm-lock-screen');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-unlock-screen', () => {
|
||||
powerMonitor.on('unlock-screen', () => {
|
||||
electronSocket.emit('pm-unlock-screen');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-suspend', () => {
|
||||
powerMonitor.on('suspend', () => {
|
||||
electronSocket.emit('pm-suspend');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-resume', () => {
|
||||
powerMonitor.on('resume', () => {
|
||||
electronSocket.emit('pm-resume');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-on-ac', () => {
|
||||
powerMonitor.on('on-ac', () => {
|
||||
electronSocket.emit('pm-on-ac');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-on-battery', () => {
|
||||
powerMonitor.on('on-battery', () => {
|
||||
electronSocket.emit('pm-on-battery');
|
||||
});
|
||||
});
|
||||
socket.on('register-pm-shutdown', () => {
|
||||
powerMonitor.on('shutdown', () => {
|
||||
electronSocket.emit('pm-shutdown');
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
electron_1.screen.on('display-added', (event, display) => {
|
||||
electronSocket.emit('screen-display-added-event' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
electron_1.screen.on('display-removed', (event, display) => {
|
||||
electronSocket.emit('screen-display-removed-event' + id, display);
|
||||
});
|
||||
});
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
electron_1.screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
socket.on('screen-getCursorScreenPoint', () => {
|
||||
const point = electron_1.screen.getCursorScreenPoint();
|
||||
electronSocket.emit('screen-getCursorScreenPointCompleted', point);
|
||||
});
|
||||
socket.on('screen-getMenuBarHeight', () => {
|
||||
const height = electron_1.screen.getPrimaryDisplay().workArea;
|
||||
electronSocket.emit('screen-getMenuBarHeightCompleted', height);
|
||||
});
|
||||
socket.on('screen-getPrimaryDisplay', () => {
|
||||
const display = electron_1.screen.getPrimaryDisplay();
|
||||
electronSocket.emit('screen-getPrimaryDisplayCompleted', display);
|
||||
});
|
||||
socket.on('screen-getAllDisplays', () => {
|
||||
const display = electron_1.screen.getAllDisplays();
|
||||
electronSocket.emit('screen-getAllDisplaysCompleted', display);
|
||||
});
|
||||
socket.on('screen-getDisplayNearestPoint', (point) => {
|
||||
const display = electron_1.screen.getDisplayNearestPoint(point);
|
||||
electronSocket.emit('screen-getDisplayNearestPointCompleted', display);
|
||||
});
|
||||
socket.on('screen-getDisplayMatching', (rectangle) => {
|
||||
const display = electron_1.screen.getDisplayMatching(rectangle);
|
||||
electronSocket.emit('screen-getDisplayMatchingCompleted', display);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=screen.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"screen.js","sourceRoot":"","sources":["screen.ts"],"names":[],"mappings":";AACA,uCAAkC;AAClC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC9C,iBAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1C,cAAc,CAAC,IAAI,CAAC,4BAA4B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iCAAiC,EAAE,CAAC,EAAE,EAAE,EAAE;QAChD,iBAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAC5C,cAAc,CAAC,IAAI,CAAC,8BAA8B,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yCAAyC,EAAE,CAAC,EAAE,EAAE,EAAE;QACxD,iBAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK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,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,SAAS,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,54 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { screen } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-screen-display-added', (id) => {
|
||||
screen.on('display-added', (event, display) => {
|
||||
electronSocket.emit('screen-display-added-event' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-removed', (id) => {
|
||||
screen.on('display-removed', (event, display) => {
|
||||
electronSocket.emit('screen-display-removed-event' + id, display);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-screen-display-metrics-changed', (id) => {
|
||||
screen.on('display-metrics-changed', (event, display, changedMetrics) => {
|
||||
electronSocket.emit('screen-display-metrics-changed-event' + id, [display, changedMetrics]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('screen-getCursorScreenPoint', () => {
|
||||
const point = screen.getCursorScreenPoint();
|
||||
electronSocket.emit('screen-getCursorScreenPointCompleted', point);
|
||||
});
|
||||
|
||||
socket.on('screen-getMenuBarHeight', () => {
|
||||
const height = screen.getPrimaryDisplay().workArea;
|
||||
electronSocket.emit('screen-getMenuBarHeightCompleted', height);
|
||||
});
|
||||
|
||||
socket.on('screen-getPrimaryDisplay', () => {
|
||||
const display = screen.getPrimaryDisplay();
|
||||
electronSocket.emit('screen-getPrimaryDisplayCompleted', display);
|
||||
});
|
||||
|
||||
socket.on('screen-getAllDisplays', () => {
|
||||
const display = screen.getAllDisplays();
|
||||
electronSocket.emit('screen-getAllDisplaysCompleted', display);
|
||||
});
|
||||
|
||||
socket.on('screen-getDisplayNearestPoint', (point) => {
|
||||
const display = screen.getDisplayNearestPoint(point);
|
||||
electronSocket.emit('screen-getDisplayNearestPointCompleted', display);
|
||||
});
|
||||
|
||||
socket.on('screen-getDisplayMatching', (rectangle) => {
|
||||
const display = screen.getDisplayMatching(rectangle);
|
||||
electronSocket.emit('screen-getDisplayMatchingCompleted', display);
|
||||
});
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('shell-showItemInFolder', (fullPath) => {
|
||||
electron_1.shell.showItemInFolder(fullPath);
|
||||
electronSocket.emit('shell-showItemInFolderCompleted');
|
||||
});
|
||||
socket.on('shell-openPath', async (path) => {
|
||||
const errorMessage = await electron_1.shell.openPath(path);
|
||||
electronSocket.emit('shell-openPathCompleted', errorMessage);
|
||||
});
|
||||
socket.on('shell-openExternal', async (url, options) => {
|
||||
let result = '';
|
||||
if (options) {
|
||||
await electron_1.shell.openExternal(url, options).catch(e => {
|
||||
result = e.message;
|
||||
});
|
||||
}
|
||||
else {
|
||||
await electron_1.shell.openExternal(url).catch((e) => {
|
||||
result = e.message;
|
||||
});
|
||||
}
|
||||
electronSocket.emit('shell-openExternalCompleted', result);
|
||||
});
|
||||
socket.on('shell-trashItem', async (fullPath, deleteOnFail) => {
|
||||
let success = false;
|
||||
try {
|
||||
await electron_1.shell.trashItem(fullPath);
|
||||
success = true;
|
||||
}
|
||||
catch (error) {
|
||||
success = false;
|
||||
}
|
||||
electronSocket.emit('shell-trashItem-completed', success);
|
||||
});
|
||||
socket.on('shell-beep', () => {
|
||||
electron_1.shell.beep();
|
||||
});
|
||||
socket.on('shell-writeShortcutLink', (shortcutPath, operation, options) => {
|
||||
const success = electron_1.shell.writeShortcutLink(shortcutPath, operation, options);
|
||||
electronSocket.emit('shell-writeShortcutLinkCompleted', success);
|
||||
});
|
||||
socket.on('shell-readShortcutLink', (shortcutPath) => {
|
||||
const shortcutDetails = electron_1.shell.readShortcutLink(shortcutPath);
|
||||
electronSocket.emit('shell-readShortcutLinkCompleted', shortcutDetails);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=shell.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";AACA,uCAAiC;AACjC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAc,EAAE,EAAE;IACxB,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC7C,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjC,cAAc,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,YAAY,GAAG,MAAM,gBAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAEhD,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE;QACnD,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,IAAI,OAAO,EAAE;YACT,MAAM,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;gBAC7C,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;YACvB,CAAC,CAAC,CAAC;SACN;aAAM;YACH,MAAM,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;gBACtC,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;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ket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('shell-showItemInFolder', (fullPath) => {
|
||||
shell.showItemInFolder(fullPath);
|
||||
|
||||
electronSocket.emit('shell-showItemInFolderCompleted');
|
||||
});
|
||||
|
||||
socket.on('shell-openPath', async (path) => {
|
||||
const errorMessage = await shell.openPath(path);
|
||||
|
||||
electronSocket.emit('shell-openPathCompleted', errorMessage);
|
||||
});
|
||||
|
||||
socket.on('shell-openExternal', async (url, options) => {
|
||||
let result = '';
|
||||
|
||||
if (options) {
|
||||
await shell.openExternal(url, options).catch(e => {
|
||||
result = e.message;
|
||||
});
|
||||
} else {
|
||||
await shell.openExternal(url).catch((e) => {
|
||||
result = e.message;
|
||||
});
|
||||
}
|
||||
|
||||
electronSocket.emit('shell-openExternalCompleted', result);
|
||||
});
|
||||
|
||||
socket.on('shell-trashItem', async (fullPath, deleteOnFail) => {
|
||||
let success = false;
|
||||
|
||||
try {
|
||||
await shell.trashItem(fullPath);
|
||||
success = true;
|
||||
} catch (error) {
|
||||
success = false;
|
||||
}
|
||||
|
||||
electronSocket.emit('shell-trashItem-completed', success);
|
||||
});
|
||||
|
||||
socket.on('shell-beep', () => {
|
||||
shell.beep();
|
||||
});
|
||||
|
||||
socket.on('shell-writeShortcutLink', (shortcutPath, operation, options) => {
|
||||
const success = shell.writeShortcutLink(shortcutPath, operation, options);
|
||||
|
||||
electronSocket.emit('shell-writeShortcutLinkCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-readShortcutLink', (shortcutPath) => {
|
||||
const shortcutDetails = shell.readShortcutLink(shortcutPath);
|
||||
|
||||
electronSocket.emit('shell-readShortcutLinkCompleted', shortcutDetails);
|
||||
});
|
||||
};
|
||||
@@ -1,132 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let tray = (global['$tray'] = global['tray'] || { value: null });
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('create-tray', (image, menuItems) => {
|
||||
const trayIcon = electron_1.nativeImage.createFromPath(image);
|
||||
tray.value = new electron_1.Tray(trayIcon);
|
||||
if (menuItems) {
|
||||
const menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('trayMenuItemClicked', id);
|
||||
});
|
||||
tray.value.setContextMenu(menu);
|
||||
}
|
||||
});
|
||||
socket.on('tray-destroy', () => {
|
||||
if (tray.value) {
|
||||
tray.value.destroy();
|
||||
}
|
||||
});
|
||||
socket.on('tray-setImage', (image) => {
|
||||
if (tray.value) {
|
||||
tray.value.setImage(image);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setPressedImage', (image) => {
|
||||
if (tray.value) {
|
||||
const img = electron_1.nativeImage.createFromPath(image);
|
||||
tray.value.setPressedImage(img);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setToolTip', (toolTip) => {
|
||||
if (tray.value) {
|
||||
tray.value.setToolTip(toolTip);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setTitle', (title) => {
|
||||
if (tray.value) {
|
||||
tray.value.setTitle(title);
|
||||
}
|
||||
});
|
||||
socket.on('tray-displayBalloon', (options) => {
|
||||
if (tray.value) {
|
||||
tray.value.displayBalloon(options);
|
||||
}
|
||||
});
|
||||
socket.on('tray-isDestroyed', () => {
|
||||
if (tray.value) {
|
||||
const isDestroyed = tray.value.isDestroyed();
|
||||
electronSocket.emit('tray-isDestroyedCompleted', isDestroyed);
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-on-event', (eventName, listenerName) => {
|
||||
if (tray.value) {
|
||||
tray.value.on(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
}
|
||||
else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-once-event', (eventName, listenerName) => {
|
||||
if (tray.value) {
|
||||
tray.value.once(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
}
|
||||
else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=tray.js.map
|
||||
@@ -1 +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nC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;oBACjB,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;iBAC9C;qBAAM;oBACH,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBACrC;YACL,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,SAAS,yBAAyB,CAAC,SAAS,EAAE,QAAQ;QAClD,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC/C,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;aAC3D;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7C;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC"}
|
||||
@@ -1,150 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { Menu, Tray, nativeImage } from 'electron';
|
||||
let tray: { value: Electron.Tray } = (global['$tray'] = global['tray'] || { value: null });
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray.value) {
|
||||
tray.value.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('create-tray', (image, menuItems) => {
|
||||
const trayIcon = nativeImage.createFromPath(image);
|
||||
|
||||
tray.value = new Tray(trayIcon);
|
||||
|
||||
if (menuItems) {
|
||||
const menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('trayMenuItemClicked', id);
|
||||
});
|
||||
tray.value.setContextMenu(menu);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-destroy', () => {
|
||||
if (tray.value) {
|
||||
tray.value.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setImage', (image) => {
|
||||
if (tray.value) {
|
||||
tray.value.setImage(image);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setPressedImage', (image) => {
|
||||
if (tray.value) {
|
||||
const img = nativeImage.createFromPath(image);
|
||||
tray.value.setPressedImage(img);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setToolTip', (toolTip) => {
|
||||
if (tray.value) {
|
||||
tray.value.setToolTip(toolTip);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setTitle', (title) => {
|
||||
if (tray.value) {
|
||||
tray.value.setTitle(title);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-displayBalloon', (options) => {
|
||||
if (tray.value) {
|
||||
tray.value.displayBalloon(options);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-isDestroyed', () => {
|
||||
if (tray.value) {
|
||||
const isDestroyed = tray.value.isDestroyed();
|
||||
electronSocket.emit('tray-isDestroyedCompleted', isDestroyed);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-on-event', (eventName, listenerName) => {
|
||||
if (tray.value){
|
||||
tray.value.on(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
} else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-once-event', (eventName, listenerName) => {
|
||||
if (tray.value){
|
||||
tray.value.once(eventName, (...args) => {
|
||||
if (args.length > 1) {
|
||||
electronSocket.emit(listenerName, args[1]);
|
||||
} else {
|
||||
electronSocket.emit(listenerName);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function addMenuItemClickConnector(menuItems, callback) {
|
||||
menuItems.forEach((item) => {
|
||||
if (item.submenu && item.submenu.items.length > 0) {
|
||||
addMenuItemClickConnector(item.submenu.items, callback);
|
||||
}
|
||||
|
||||
if ('id' in item && item.id) {
|
||||
item.click = () => { callback(item.id); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,234 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const browserView_1 = require("./browserView");
|
||||
const fs = require('fs');
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-webContents-crashed', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners('crashed');
|
||||
browserWindow.webContents.on('crashed', (event, killed) => {
|
||||
electronSocket.emit('webContents-crashed' + id, killed);
|
||||
});
|
||||
});
|
||||
socket.on('register-webContents-didFinishLoad', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners('did-finish-load');
|
||||
browserWindow.webContents.on('did-finish-load', () => {
|
||||
electronSocket.emit('webContents-didFinishLoad' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-webContents-input-event', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners('input-event');
|
||||
browserWindow.webContents.on('input-event', (_, eventArgs) => {
|
||||
if (eventArgs.type !== 'char') {
|
||||
electronSocket.emit('webContents-input-event' + id, eventArgs);
|
||||
}
|
||||
});
|
||||
});
|
||||
socket.on('webContentsOpenDevTools', (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
}
|
||||
else {
|
||||
getWindowById(id).webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
socket.on('webContents-getPrinters', async (id) => {
|
||||
const printers = await getWindowById(id).webContents.getPrintersAsync();
|
||||
electronSocket.emit('webContents-getPrinters-completed', printers);
|
||||
});
|
||||
socket.on('webContents-print', async (id, options = {}) => {
|
||||
await getWindowById(id).webContents.print(options);
|
||||
electronSocket.emit('webContents-print-completed', true);
|
||||
});
|
||||
socket.on('webContents-printToPDF', async (id, options = {}, path) => {
|
||||
const buffer = await getWindowById(id).webContents.printToPDF(options);
|
||||
fs.writeFile(path, buffer, (error) => {
|
||||
if (error) {
|
||||
electronSocket.emit('webContents-printToPDF-completed', false);
|
||||
}
|
||||
else {
|
||||
electronSocket.emit('webContents-printToPDF-completed', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
socket.on('webContents-getUrl', function (id) {
|
||||
const browserWindow = getWindowById(id);
|
||||
electronSocket.emit('webContents-getUrl' + id, browserWindow.webContents.getURL());
|
||||
});
|
||||
socket.on('webContents-session-allowNTLMCredentialsForDomains', (id, domains) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.allowNTLMCredentialsForDomains(domains);
|
||||
});
|
||||
socket.on('webContents-session-clearAuthCache', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearAuthCache();
|
||||
electronSocket.emit('webContents-session-clearAuthCache-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-clearCache', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearCache();
|
||||
electronSocket.emit('webContents-session-clearCache-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-clearHostResolverCache', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearHostResolverCache();
|
||||
electronSocket.emit('webContents-session-clearHostResolverCache-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-clearStorageData', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearStorageData({});
|
||||
electronSocket.emit('webContents-session-clearStorageData-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-clearStorageData-options', async (id, options, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearStorageData(options);
|
||||
electronSocket.emit('webContents-session-clearStorageData-options-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-createInterruptedDownload', (id, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.createInterruptedDownload(options);
|
||||
});
|
||||
socket.on('webContents-session-disableNetworkEmulation', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.disableNetworkEmulation();
|
||||
});
|
||||
socket.on('webContents-session-enableNetworkEmulation', (id, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.enableNetworkEmulation(options);
|
||||
});
|
||||
socket.on('webContents-session-flushStorageData', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.flushStorageData();
|
||||
});
|
||||
socket.on('webContents-session-getBlobData', async (id, identifier, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const buffer = await browserWindow.webContents.session.getBlobData(identifier);
|
||||
electronSocket.emit('webContents-session-getBlobData-completed' + guid, buffer.buffer);
|
||||
});
|
||||
socket.on('webContents-session-getCacheSize', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const size = await browserWindow.webContents.session.getCacheSize();
|
||||
electronSocket.emit('webContents-session-getCacheSize-completed' + guid, size);
|
||||
});
|
||||
socket.on('webContents-session-getPreloads', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const preloads = browserWindow.webContents.session.getPreloads();
|
||||
electronSocket.emit('webContents-session-getPreloads-completed' + guid, preloads);
|
||||
});
|
||||
socket.on('webContents-session-getUserAgent', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const userAgent = browserWindow.webContents.session.getUserAgent();
|
||||
electronSocket.emit('webContents-session-getUserAgent-completed' + guid, userAgent);
|
||||
});
|
||||
socket.on('webContents-session-resolveProxy', async (id, url, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const proxy = await browserWindow.webContents.session.resolveProxy(url);
|
||||
electronSocket.emit('webContents-session-resolveProxy-completed' + guid, proxy);
|
||||
});
|
||||
socket.on('webContents-session-setDownloadPath', (id, path) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.setDownloadPath(path);
|
||||
});
|
||||
socket.on('webContents-session-setPreloads', (id, preloads) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.setPreloads(preloads);
|
||||
});
|
||||
socket.on('webContents-session-setProxy', async (id, configuration, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.setProxy(configuration);
|
||||
electronSocket.emit('webContents-session-setProxy-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-setUserAgent', (id, userAgent, acceptLanguages) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.setUserAgent(userAgent, acceptLanguages);
|
||||
});
|
||||
socket.on('register-webContents-session-cookies-changed', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.cookies.removeAllListeners('changed');
|
||||
browserWindow.webContents.session.cookies.on('changed', (event, cookie, cause, removed) => {
|
||||
electronSocket.emit('webContents-session-cookies-changed' + id, [cookie, cause, removed]);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-session-cookies-get', async (id, filter, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const cookies = await browserWindow.webContents.session.cookies.get(filter);
|
||||
electronSocket.emit('webContents-session-cookies-get-completed' + guid, cookies);
|
||||
});
|
||||
socket.on('webContents-session-cookies-set', async (id, details, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.cookies.set(details);
|
||||
electronSocket.emit('webContents-session-cookies-set-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-cookies-remove', async (id, url, name, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.cookies.remove(url, name);
|
||||
electronSocket.emit('webContents-session-cookies-remove-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-session-cookies-flushStore', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.cookies.flushStore();
|
||||
electronSocket.emit('webContents-session-cookies-flushStore-completed' + guid);
|
||||
});
|
||||
socket.on('webContents-loadURL', (id, url, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents
|
||||
.loadURL(url, options)
|
||||
.then(() => {
|
||||
electronSocket.emit('webContents-loadURL-complete' + id);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
electronSocket.emit('webContents-loadURL-error' + id, error);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-insertCSS', (id, isBrowserWindow, path) => {
|
||||
if (isBrowserWindow) {
|
||||
const browserWindow = getWindowById(id);
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.insertCSS(fs.readFileSync(path, 'utf8'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
const browserViews = (global['browserViews'] = global['browserViews'] || []);
|
||||
let view = null;
|
||||
for (let i = 0; i < browserViews.length; i++) {
|
||||
if (browserViews[i]['id'] + 1000 === id) {
|
||||
view = browserViews[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (view) {
|
||||
view.webContents.insertCSS(fs.readFileSync(path, 'utf8'));
|
||||
}
|
||||
}
|
||||
});
|
||||
socket.on('webContents-session-getAllExtensions', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const extensionsList = browserWindow.webContents.session.getAllExtensions();
|
||||
const chromeExtensionInfo = [];
|
||||
Object.keys(extensionsList).forEach((key) => {
|
||||
chromeExtensionInfo.push(extensionsList[key]);
|
||||
});
|
||||
electronSocket.emit('webContents-session-getAllExtensions-completed', chromeExtensionInfo);
|
||||
});
|
||||
socket.on('webContents-session-removeExtension', (id, name) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.removeExtension(name);
|
||||
});
|
||||
socket.on('webContents-session-loadExtension', async (id, path, allowFileAccess = false) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const extension = await browserWindow.webContents.session.loadExtension(path, { allowFileAccess: allowFileAccess });
|
||||
electronSocket.emit('webContents-session-loadExtension-completed', extension);
|
||||
});
|
||||
function getWindowById(id) {
|
||||
if (id >= 1000) {
|
||||
return (0, browserView_1.browserViewMediateService)(id - 1000);
|
||||
}
|
||||
return electron_1.BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=webContents.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,292 +0,0 @@
|
||||
import { Socket } from 'net';
|
||||
import { BrowserWindow, BrowserView } from 'electron';
|
||||
import { browserViewMediateService } from './browserView';
|
||||
const fs = require('fs');
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-webContents-crashed', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners('crashed');
|
||||
browserWindow.webContents.on('crashed', (event, killed) => {
|
||||
electronSocket.emit('webContents-crashed' + id, killed);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-webContents-didFinishLoad', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners('did-finish-load');
|
||||
browserWindow.webContents.on('did-finish-load', () => {
|
||||
electronSocket.emit('webContents-didFinishLoad' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-webContents-input-event', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners('input-event');
|
||||
browserWindow.webContents.on('input-event', (_, eventArgs) => {
|
||||
if (eventArgs.type !== 'char') {
|
||||
electronSocket.emit('webContents-input-event' + id, eventArgs);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContentsOpenDevTools', (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
} else {
|
||||
getWindowById(id).webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('webContents-getPrinters', async (id) => {
|
||||
const printers = await getWindowById(id).webContents.getPrintersAsync();
|
||||
electronSocket.emit('webContents-getPrinters-completed', printers);
|
||||
});
|
||||
|
||||
socket.on('webContents-print', async (id, options = {}) => {
|
||||
await getWindowById(id).webContents.print(options);
|
||||
electronSocket.emit('webContents-print-completed', true);
|
||||
});
|
||||
|
||||
socket.on('webContents-printToPDF', async (id, options = {}, path) => {
|
||||
const buffer = await getWindowById(id).webContents.printToPDF(options);
|
||||
|
||||
fs.writeFile(path, buffer, (error) => {
|
||||
if (error) {
|
||||
electronSocket.emit('webContents-printToPDF-completed', false);
|
||||
} else {
|
||||
electronSocket.emit('webContents-printToPDF-completed', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-getUrl', function (id) {
|
||||
const browserWindow = getWindowById(id);
|
||||
electronSocket.emit('webContents-getUrl' + id, browserWindow.webContents.getURL());
|
||||
});
|
||||
|
||||
socket.on('webContents-session-allowNTLMCredentialsForDomains', (id, domains) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.allowNTLMCredentialsForDomains(domains);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearAuthCache', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearAuthCache();
|
||||
|
||||
electronSocket.emit('webContents-session-clearAuthCache-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearCache', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearCache();
|
||||
|
||||
electronSocket.emit('webContents-session-clearCache-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearHostResolverCache', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearHostResolverCache();
|
||||
|
||||
electronSocket.emit('webContents-session-clearHostResolverCache-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearStorageData', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearStorageData({});
|
||||
|
||||
electronSocket.emit('webContents-session-clearStorageData-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearStorageData-options', async (id, options, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.clearStorageData(options);
|
||||
|
||||
electronSocket.emit('webContents-session-clearStorageData-options-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-createInterruptedDownload', (id, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.createInterruptedDownload(options);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-disableNetworkEmulation', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.disableNetworkEmulation();
|
||||
});
|
||||
|
||||
socket.on('webContents-session-enableNetworkEmulation', (id, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.enableNetworkEmulation(options);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-flushStorageData', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.flushStorageData();
|
||||
});
|
||||
|
||||
socket.on('webContents-session-getBlobData', async (id, identifier, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const buffer = await browserWindow.webContents.session.getBlobData(identifier);
|
||||
|
||||
electronSocket.emit('webContents-session-getBlobData-completed' + guid, buffer.buffer);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-getCacheSize', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const size = await browserWindow.webContents.session.getCacheSize();
|
||||
|
||||
electronSocket.emit('webContents-session-getCacheSize-completed' + guid, size);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-getPreloads', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const preloads = browserWindow.webContents.session.getPreloads();
|
||||
|
||||
electronSocket.emit('webContents-session-getPreloads-completed' + guid, preloads);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-getUserAgent', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const userAgent = browserWindow.webContents.session.getUserAgent();
|
||||
|
||||
electronSocket.emit('webContents-session-getUserAgent-completed' + guid, userAgent);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-resolveProxy', async (id, url, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const proxy = await browserWindow.webContents.session.resolveProxy(url);
|
||||
|
||||
electronSocket.emit('webContents-session-resolveProxy-completed' + guid, proxy);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-setDownloadPath', (id, path) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.setDownloadPath(path);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-setPreloads', (id, preloads) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.setPreloads(preloads);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-setProxy', async (id, configuration, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.setProxy(configuration);
|
||||
|
||||
electronSocket.emit('webContents-session-setProxy-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-setUserAgent', (id, userAgent, acceptLanguages) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.setUserAgent(userAgent, acceptLanguages);
|
||||
});
|
||||
|
||||
socket.on('register-webContents-session-cookies-changed', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.session.cookies.removeAllListeners('changed');
|
||||
browserWindow.webContents.session.cookies.on('changed', (event, cookie, cause, removed) => {
|
||||
electronSocket.emit('webContents-session-cookies-changed' + id, [cookie, cause, removed]);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-session-cookies-get', async (id, filter, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const cookies = await browserWindow.webContents.session.cookies.get(filter);
|
||||
|
||||
electronSocket.emit('webContents-session-cookies-get-completed' + guid, cookies);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-cookies-set', async (id, details, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.cookies.set(details);
|
||||
|
||||
electronSocket.emit('webContents-session-cookies-set-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-cookies-remove', async (id, url, name, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.cookies.remove(url, name);
|
||||
|
||||
electronSocket.emit('webContents-session-cookies-remove-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-cookies-flushStore', async (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
await browserWindow.webContents.session.cookies.flushStore();
|
||||
|
||||
electronSocket.emit('webContents-session-cookies-flushStore-completed' + guid);
|
||||
});
|
||||
|
||||
socket.on('webContents-loadURL', (id, url, options) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents
|
||||
.loadURL(url, options)
|
||||
.then(() => {
|
||||
electronSocket.emit('webContents-loadURL-complete' + id);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
electronSocket.emit('webContents-loadURL-error' + id, error);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-insertCSS', (id, isBrowserWindow, path) => {
|
||||
if (isBrowserWindow) {
|
||||
const browserWindow = getWindowById(id);
|
||||
if (browserWindow) {
|
||||
browserWindow.webContents.insertCSS(fs.readFileSync(path, 'utf8'));
|
||||
}
|
||||
} else {
|
||||
const browserViews: BrowserView[] = (global['browserViews'] = global['browserViews'] || []) as BrowserView[];
|
||||
let view: BrowserView = null;
|
||||
for (let i = 0; i < browserViews.length; i++) {
|
||||
if (browserViews[i]['id'] + 1000 === id) {
|
||||
view = browserViews[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (view) {
|
||||
view.webContents.insertCSS(fs.readFileSync(path, 'utf8'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('webContents-session-getAllExtensions', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const extensionsList = browserWindow.webContents.session.getAllExtensions();
|
||||
const chromeExtensionInfo = [];
|
||||
|
||||
Object.keys(extensionsList).forEach((key) => {
|
||||
chromeExtensionInfo.push(extensionsList[key]);
|
||||
});
|
||||
|
||||
electronSocket.emit('webContents-session-getAllExtensions-completed', chromeExtensionInfo);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-removeExtension', (id, name) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.removeExtension(name);
|
||||
});
|
||||
|
||||
socket.on('webContents-session-loadExtension', async (id, path, allowFileAccess = false) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const extension = await browserWindow.webContents.session.loadExtension(path, { allowFileAccess: allowFileAccess });
|
||||
|
||||
electronSocket.emit('webContents-session-loadExtension-completed', extension);
|
||||
});
|
||||
|
||||
function getWindowById(id: number): Electron.BrowserWindow | Electron.BrowserView {
|
||||
if (id >= 1000) {
|
||||
return browserViewMediateService(id - 1000);
|
||||
}
|
||||
|
||||
return BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
@@ -1,53 +0,0 @@
|
||||
const manifestFileName = process.argv[2];
|
||||
// @ts-ignore
|
||||
const manifestFile = require('./bin/' + manifestFileName);
|
||||
const dasherize = require('dasherize');
|
||||
const fs = require('fs');
|
||||
|
||||
const builderConfiguration = { ...manifestFile.build };
|
||||
if(process.argv.length > 3) {
|
||||
builderConfiguration.buildVersion = process.argv[3];
|
||||
}
|
||||
if(builderConfiguration.hasOwnProperty('buildVersion')) {
|
||||
// @ts-ignore
|
||||
const packageJson = require('./package');
|
||||
packageJson.name = dasherize(manifestFile.name || 'electron-net');
|
||||
packageJson.author = manifestFile.author || '';
|
||||
packageJson.version = builderConfiguration.buildVersion;
|
||||
packageJson.description = manifestFile.description || '';
|
||||
|
||||
fs.writeFile('./package.json', JSON.stringify(packageJson), (error) => {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
const packageLockJson = require('./package-lock');
|
||||
packageLockJson.name = dasherize(manifestFile.name || 'electron-net');
|
||||
packageLockJson.author = manifestFile.author || '';
|
||||
packageLockJson.version = builderConfiguration.buildVersion;
|
||||
fs.writeFile('./package-lock.json', JSON.stringify(packageLockJson), (error) => {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore missing module
|
||||
}
|
||||
}
|
||||
|
||||
const builderConfigurationString = JSON.stringify(builderConfiguration);
|
||||
fs.writeFile('./bin/electron-builder.json', builderConfigurationString, (error) => {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
});
|
||||
|
||||
const manifestContent = JSON.stringify(manifestFile);
|
||||
fs.writeFile('./bin/electron.manifest.json', manifestContent, (error) => {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
});
|
||||
@@ -1,349 +0,0 @@
|
||||
const { app } = require('electron');
|
||||
const { BrowserWindow } = require('electron');
|
||||
const { protocol } = require('electron');
|
||||
const path = require('path');
|
||||
const cProcess = require('child_process').spawn;
|
||||
const portscanner = require('portscanner');
|
||||
const { imageSize } = require('image-size');
|
||||
let io, server, browserWindows, ipc, apiProcess, loadURL;
|
||||
let appApi, menu, dialogApi, notification, tray, webContents;
|
||||
let globalShortcut, shellApi, screen, clipboard, autoUpdater;
|
||||
let commandLine, browserView;
|
||||
let powerMonitor;
|
||||
let splashScreen, hostHook;
|
||||
let mainWindowId, nativeTheme;
|
||||
let dock;
|
||||
let launchFile;
|
||||
let launchUrl;
|
||||
|
||||
let manifestJsonFileName = 'electron.manifest.json';
|
||||
let watchable = false;
|
||||
if (app.commandLine.hasSwitch('manifest')) {
|
||||
manifestJsonFileName = app.commandLine.getSwitchValue('manifest');
|
||||
}
|
||||
|
||||
if (app.commandLine.hasSwitch('watch')) {
|
||||
watchable = true;
|
||||
}
|
||||
|
||||
let currentBinPath = path.join(__dirname.replace('app.asar', ''), 'bin');
|
||||
let manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
|
||||
|
||||
// if watch is enabled lets change the path
|
||||
if (watchable) {
|
||||
currentBinPath = path.join(__dirname, '../../'); // go to project directory
|
||||
manifestJsonFilePath = path.join(currentBinPath, manifestJsonFileName);
|
||||
}
|
||||
|
||||
// handle macOS events for opening the app with a file, etc
|
||||
app.on('will-finish-launching', () => {
|
||||
app.on('open-file', (evt, file) => {
|
||||
evt.preventDefault();
|
||||
launchFile = file;
|
||||
});
|
||||
app.on('open-url', (evt, url) => {
|
||||
evt.preventDefault();
|
||||
launchUrl = url;
|
||||
});
|
||||
});
|
||||
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
if (manifestJsonFile.singleInstance || manifestJsonFile.aspCoreBackendPort) {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', (events, args = []) => {
|
||||
args.forEach((parameter) => {
|
||||
const words = parameter.split('=');
|
||||
|
||||
if (words.length > 1) {
|
||||
app.commandLine.appendSwitch(words[0].replace('--', ''), words[1]);
|
||||
} else {
|
||||
app.commandLine.appendSwitch(words[0].replace('--', ''));
|
||||
}
|
||||
});
|
||||
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
if (windows.length) {
|
||||
if (windows[0].isMinimized()) {
|
||||
windows[0].restore();
|
||||
}
|
||||
windows[0].focus();
|
||||
}
|
||||
});
|
||||
|
||||
if (!mainInstance) {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
// Fix ERR_UNKNOWN_URL_SCHEME using file protocol
|
||||
// https://github.com/electron/electron/issues/23757
|
||||
protocol.registerFileProtocol('file', (request, callback) => {
|
||||
const pathname = request.url.replace('file:///', '');
|
||||
callback(pathname);
|
||||
});
|
||||
|
||||
if (isSplashScreenEnabled()) {
|
||||
startSplashScreen();
|
||||
}
|
||||
// Added default port as configurable for port restricted environments.
|
||||
let defaultElectronPort = 8000;
|
||||
if (manifestJsonFile.electronPort) {
|
||||
defaultElectronPort = manifestJsonFile.electronPort;
|
||||
}
|
||||
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(defaultElectronPort, 65535, 'localhost', function (error, port) {
|
||||
console.log('Electron Socket IO Port: ' + port);
|
||||
startSocketApiBridge(port);
|
||||
});
|
||||
});
|
||||
|
||||
app.on('quit', async (event, exitCode) => {
|
||||
await server.close();
|
||||
apiProcess.kill();
|
||||
});
|
||||
|
||||
function isSplashScreenEnabled() {
|
||||
if (manifestJsonFile.hasOwnProperty('splashscreen')) {
|
||||
if (manifestJsonFile.splashscreen.hasOwnProperty('imageFile')) {
|
||||
return Boolean(manifestJsonFile.splashscreen.imageFile);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function startSplashScreen() {
|
||||
let imageFile = path.join(currentBinPath, manifestJsonFile.splashscreen.imageFile);
|
||||
imageSize(imageFile, (error, dimensions) => {
|
||||
if (error) {
|
||||
console.log(`load splashscreen error:`);
|
||||
console.error(error);
|
||||
|
||||
throw new Error(error.message);
|
||||
}
|
||||
|
||||
splashScreen = new BrowserWindow({
|
||||
width: dimensions.width,
|
||||
height: dimensions.height,
|
||||
transparent: true,
|
||||
center: true,
|
||||
frame: false,
|
||||
closable: false,
|
||||
resizable: false,
|
||||
skipTaskbar: true,
|
||||
alwaysOnTop: true,
|
||||
show: true,
|
||||
});
|
||||
splashScreen.setIgnoreMouseEvents(true);
|
||||
|
||||
app.once('browser-window-created', () => {
|
||||
splashScreen.destroy();
|
||||
});
|
||||
|
||||
const loadSplashscreenUrl = path.join(__dirname, 'splashscreen', 'index.html') + '?imgPath=' + imageFile;
|
||||
splashScreen.loadURL('file://' + loadSplashscreenUrl);
|
||||
|
||||
splashScreen.once('closed', () => {
|
||||
splashScreen = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function startSocketApiBridge(port) {
|
||||
// instead of 'require('socket.io')(port);' we need to use this workaround
|
||||
// otherwise the Windows Firewall will be triggered
|
||||
server = require('http').createServer();
|
||||
const { Server } = require('socket.io');
|
||||
io = new Server({
|
||||
pingTimeout: 60000, // in ms, default is 5000
|
||||
pingInterval: 10000, // in ms, default is 25000
|
||||
});
|
||||
io.attach(server);
|
||||
|
||||
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
|
||||
if (watchable) {
|
||||
startAspCoreBackendWithWatch(port);
|
||||
} else {
|
||||
startAspCoreBackend(port);
|
||||
}
|
||||
});
|
||||
|
||||
// prototype
|
||||
app['mainWindowURL'] = '';
|
||||
app['mainWindow'] = null;
|
||||
|
||||
// @ts-ignore
|
||||
io.on('connection', (socket) => {
|
||||
socket.on('disconnect', function (reason) {
|
||||
console.log('Got disconnect! Reason: ' + reason);
|
||||
try {
|
||||
if (hostHook) {
|
||||
const hostHookScriptFilePath = path.join(__dirname, 'ElectronHostHook', 'index.js');
|
||||
delete require.cache[require.resolve(hostHookScriptFilePath)];
|
||||
hostHook = undefined;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
});
|
||||
|
||||
if (global['electronsocket'] === undefined) {
|
||||
global['electronsocket'] = socket;
|
||||
global['electronsocket'].setMaxListeners(0);
|
||||
}
|
||||
|
||||
console.log(
|
||||
'ASP.NET Core Application connected...',
|
||||
'global.electronsocket',
|
||||
global['electronsocket'].id,
|
||||
new Date()
|
||||
);
|
||||
|
||||
if (appApi === undefined) appApi = require('./api/app')(socket, app);
|
||||
if (browserWindows === undefined) browserWindows = require('./api/browserWindows')(socket, app);
|
||||
if (commandLine === undefined) commandLine = require('./api/commandLine')(socket, app);
|
||||
if (autoUpdater === undefined) autoUpdater = require('./api/autoUpdater')(socket);
|
||||
if (ipc === undefined) ipc = require('./api/ipc')(socket);
|
||||
if (menu === undefined) menu = require('./api/menu')(socket);
|
||||
if (dialogApi === undefined) dialogApi = require('./api/dialog')(socket);
|
||||
if (notification === undefined) notification = require('./api/notification')(socket);
|
||||
if (tray === undefined) tray = require('./api/tray')(socket);
|
||||
if (webContents === undefined) webContents = require('./api/webContents')(socket);
|
||||
if (globalShortcut === undefined) globalShortcut = require('./api/globalShortcut')(socket);
|
||||
if (shellApi === undefined) shellApi = require('./api/shell')(socket);
|
||||
if (screen === undefined) screen = require('./api/screen')(socket);
|
||||
if (clipboard === undefined) clipboard = require('./api/clipboard')(socket);
|
||||
if (browserView === undefined) browserView = require('./api/browserView').browserViewApi(socket);
|
||||
if (powerMonitor === undefined) powerMonitor = require('./api/powerMonitor')(socket);
|
||||
if (nativeTheme === undefined) nativeTheme = require('./api/nativeTheme')(socket);
|
||||
if (dock === undefined) dock = require('./api/dock')(socket);
|
||||
|
||||
socket.on('register-app-open-file-event', (id) => {
|
||||
global['electronsocket'] = socket;
|
||||
|
||||
app.on('open-file', (event, file) => {
|
||||
event.preventDefault();
|
||||
|
||||
global['electronsocket'].emit('app-open-file' + id, file);
|
||||
});
|
||||
|
||||
if (launchFile) {
|
||||
global['electronsocket'].emit('app-open-file' + id, launchFile);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-app-open-url-event', (id) => {
|
||||
global['electronsocket'] = socket;
|
||||
|
||||
app.on('open-url', (event, url) => {
|
||||
event.preventDefault();
|
||||
|
||||
global['electronsocket'].emit('app-open-url' + id, url);
|
||||
});
|
||||
|
||||
if (launchUrl) {
|
||||
global['electronsocket'].emit('app-open-url' + id, launchUrl);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
const hostHookScriptFilePath = path.join(__dirname, 'ElectronHostHook', 'index.js');
|
||||
|
||||
if (isModuleAvailable(hostHookScriptFilePath) && hostHook === undefined) {
|
||||
const { HookService } = require(hostHookScriptFilePath);
|
||||
hostHook = new HookService(socket, app);
|
||||
hostHook.onHostReady();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isModuleAvailable(name) {
|
||||
try {
|
||||
require.resolve(name);
|
||||
return true;
|
||||
} catch (e) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
function startAspCoreBackend(electronPort) {
|
||||
if (manifestJsonFile.aspCoreBackendPort) {
|
||||
startBackend(manifestJsonFile.aspCoreBackendPort);
|
||||
} else {
|
||||
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
|
||||
startBackend(electronWebPort);
|
||||
});
|
||||
}
|
||||
|
||||
function startBackend(aspCoreBackendPort) {
|
||||
console.log('ASP.NET Core Port: ' + aspCoreBackendPort);
|
||||
loadURL = `http://localhost:${aspCoreBackendPort}`;
|
||||
const parameters = [
|
||||
getEnvironmentParameter(),
|
||||
`/electronPort=${electronPort}`,
|
||||
`/electronWebPort=${aspCoreBackendPort}`,
|
||||
];
|
||||
let binaryFile = manifestJsonFile.executable;
|
||||
|
||||
const os = require('os');
|
||||
if (os.platform() === 'win32') {
|
||||
binaryFile = binaryFile + '.exe';
|
||||
}
|
||||
|
||||
let binFilePath = path.join(currentBinPath, binaryFile);
|
||||
var options = { cwd: currentBinPath };
|
||||
apiProcess = cProcess(binFilePath, parameters, options);
|
||||
|
||||
apiProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data.toString()}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function startAspCoreBackendWithWatch(electronPort) {
|
||||
if (manifestJsonFile.aspCoreBackendPort) {
|
||||
startBackend(manifestJsonFile.aspCoreBackendPort);
|
||||
} else {
|
||||
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(electronPort + 1, 65535, 'localhost', function (error, electronWebPort) {
|
||||
startBackend(electronWebPort);
|
||||
});
|
||||
}
|
||||
|
||||
function startBackend(aspCoreBackendPort) {
|
||||
console.log('ASP.NET Core Watch Port: ' + aspCoreBackendPort);
|
||||
loadURL = `http://localhost:${aspCoreBackendPort}`;
|
||||
const parameters = [
|
||||
'watch',
|
||||
'run',
|
||||
getEnvironmentParameter(),
|
||||
`/electronPort=${electronPort}`,
|
||||
`/electronWebPort=${aspCoreBackendPort}`,
|
||||
];
|
||||
|
||||
var options = {
|
||||
cwd: currentBinPath,
|
||||
env: process.env,
|
||||
};
|
||||
apiProcess = cProcess('dotnet', parameters, options);
|
||||
|
||||
apiProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data.toString()}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getEnvironmentParameter() {
|
||||
if (manifestJsonFile.environment) {
|
||||
return '--environment=' + manifestJsonFile.environment;
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
2834
ElectronNET.Host/package-lock.json
generated
2834
ElectronNET.Host/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "electron.net.host",
|
||||
"version": "1.0.0",
|
||||
"description": "Electron-Host for Electron.NET.",
|
||||
"repository": {
|
||||
"url": "https://github.com/ElectronNET/Electron.NET"
|
||||
},
|
||||
"main": "main.js",
|
||||
"author": "Gregor Biswanger, Florian Rappl",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "tsc -p ."
|
||||
},
|
||||
"dependencies": {
|
||||
"dasherize": "^2.0.0",
|
||||
"electron-updater": "^5.3.0",
|
||||
"image-size": "^1.0.2",
|
||||
"portscanner": "^2.2.0",
|
||||
"socket.io": "^4.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.15.5",
|
||||
"electron": "^23.2.0",
|
||||
"tslint": "^6.1.3",
|
||||
"typescript": "^5.0.2"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "ES2019",
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"ElectronHostHook"
|
||||
]
|
||||
}
|
||||
91
ElectronNET.WebApp/ElectronHostHook/.gitignore
vendored
91
ElectronNET.WebApp/ElectronHostHook/.gitignore
vendored
@@ -1,91 +0,0 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/node
|
||||
# Edit at https://www.gitignore.io/?templates=node
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# End of https://www.gitignore.io/api/node
|
||||
@@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Connector = void 0;
|
||||
class Connector {
|
||||
constructor(socket,
|
||||
// @ts-ignore
|
||||
app) {
|
||||
this.socket = socket;
|
||||
this.app = app;
|
||||
}
|
||||
on(key, javaScriptCode) {
|
||||
this.socket.on(key, (...args) => {
|
||||
const id = args.pop();
|
||||
try {
|
||||
javaScriptCode(...args, (data) => {
|
||||
if (data) {
|
||||
this.socket.emit(`${key}Complete${id}`, data);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Connector = Connector;
|
||||
//# sourceMappingURL=connector.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"connector.js","sourceRoot":"","sources":["connector.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAClB,YAAoB,MAAuB;IACvC,aAAa;IACN,GAAiB;QAFR,WAAM,GAAN,MAAM,CAAiB;QAEhC,QAAG,GAAH,GAAG,CAAc;IAAI,CAAC;IAEjC,EAAE,CAAC,GAAW,EAAE,cAAwB;QACpC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,IAAW,EAAE,EAAE;YACnC,MAAM,EAAE,GAAW,IAAI,CAAC,GAAG,EAAE,CAAC;YAE9B,IAAI;gBACA,cAAc,CAAC,GAAG,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;oBAC7B,IAAI,IAAI,EAAE;wBACN,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,WAAW,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;qBACjD;gBACL,CAAC,CAAC,CAAC;aACN;YAAC,OAAO,KAAK,EAAE;gBACZ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;aACtE;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApBD,8BAoBC"}
|
||||
@@ -1,21 +0,0 @@
|
||||
export class Connector {
|
||||
constructor(private socket: SocketIO.Socket,
|
||||
// @ts-ignore
|
||||
public app: Electron.App) { }
|
||||
|
||||
on(key: string, javaScriptCode: Function): void {
|
||||
this.socket.on(key, (...args: any[]) => {
|
||||
const id: string = args.pop();
|
||||
|
||||
try {
|
||||
javaScriptCode(...args, (data) => {
|
||||
if (data) {
|
||||
this.socket.emit(`${key}Complete${id}`, data);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
this.socket.emit(`${key}Error${id}`, `Host Hook Exception`, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ExcelCreator = void 0;
|
||||
const Excel = require("exceljs");
|
||||
class ExcelCreator {
|
||||
create(path) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const workbook = new Excel.Workbook();
|
||||
const worksheet = workbook.addWorksheet("My Sheet");
|
||||
worksheet.columns = [
|
||||
{ header: "Id", key: "id", width: 10 },
|
||||
{ header: "Name", key: "name", width: 32 },
|
||||
{ header: "Birthday", key: "birthday", width: 10, outlineLevel: 1 }
|
||||
];
|
||||
worksheet.addRow({ id: 1, name: "John Doe", birthday: new Date(1970, 1, 1) });
|
||||
worksheet.addRow({ id: 2, name: "Jane Doe", birthday: new Date(1965, 1, 7) });
|
||||
yield workbook.xlsx.writeFile(path + "\\sample.xlsx");
|
||||
return "Excel file created!";
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ExcelCreator = ExcelCreator;
|
||||
//# sourceMappingURL=excelCreator.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"excelCreator.js","sourceRoot":"","sources":["excelCreator.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AAGjC,MAAa,YAAY;IACf,MAAM,CAAC,IAAY;;YACrB,MAAM,QAAQ,GAAa,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChD,MAAM,SAAS,GAAc,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;YAC/D,SAAS,CAAC,OAAO,GAAG;gBAChB,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;gBACtC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;gBAC1C,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE;aACtE,CAAC;YACF,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAC9E,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YAE9E,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,eAAe,CAAC,CAAC;YAEtD,OAAO,qBAAqB,CAAC;QACjC,CAAC;KAAA;CACJ;AAhBD,oCAgBC"}
|
||||
@@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HookService = void 0;
|
||||
const connector_1 = require("./connector");
|
||||
const excelCreator_1 = require("./excelCreator");
|
||||
class HookService extends connector_1.Connector {
|
||||
constructor(socket, app) {
|
||||
super(socket, app);
|
||||
this.app = app;
|
||||
}
|
||||
onHostReady() {
|
||||
// execute your own JavaScript Host logic here
|
||||
this.on("create-excel-file", (path, done) => __awaiter(this, void 0, void 0, function* () {
|
||||
const excelCreator = new excelCreator_1.ExcelCreator();
|
||||
const result = yield excelCreator.create(path);
|
||||
done(result);
|
||||
}));
|
||||
}
|
||||
}
|
||||
exports.HookService = HookService;
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,2CAAwC;AACxC,iDAA8C;AAE9C,MAAa,WAAY,SAAQ,qBAAS;IACtC,YAAY,MAAuB,EAAS,GAAiB;QACzD,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QADqB,QAAG,GAAH,GAAG,CAAc;IAE7D,CAAC;IAED,WAAW;QACP,8CAA8C;QAC9C,IAAI,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAO,IAAI,EAAE,IAAI,EAAE,EAAE;YAC9C,MAAM,YAAY,GAAiB,IAAI,2BAAY,EAAE,CAAC;YACtD,MAAM,MAAM,GAAW,MAAM,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEvD,IAAI,CAAC,MAAM,CAAC,CAAC;QACjB,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AAdD,kCAcC"}
|
||||
@@ -1,21 +0,0 @@
|
||||
// @ts-ignore
|
||||
import * as Electron from "electron";
|
||||
import { Connector } from "./connector";
|
||||
import { ExcelCreator } from "./excelCreator";
|
||||
|
||||
export class HookService extends Connector {
|
||||
constructor(socket: SocketIO.Socket, public app: Electron.App) {
|
||||
super(socket, app);
|
||||
}
|
||||
|
||||
onHostReady(): void {
|
||||
// execute your own JavaScript Host logic here
|
||||
this.on("create-excel-file", async (path, done) => {
|
||||
const excelCreator: ExcelCreator = new ExcelCreator();
|
||||
const result: string = await excelCreator.create(path);
|
||||
|
||||
done(result);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
2089
ElectronNET.WebApp/ElectronHostHook/package-lock.json
generated
2089
ElectronNET.WebApp/ElectronHostHook/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "es2015"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Gregor Biswanger, Robert Mühsig
|
||||
Copyright (c) 2017-2023 Gregor Biswanger, Robert Mühsig
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
142
README.md
142
README.md
@@ -1,13 +1,6 @@
|
||||
[](https://github.com/ElectronNET/Electron.NET)
|
||||
[](https://github.com/ElectronNET/Electron.NET)
|
||||
|
||||
[](https://donorbox.org/electron-net)
|
||||
|
||||
|
||||
AppVeyor (Win/Linux): [](https://ci.appveyor.com/project/robertmuehsig/electron-net/branch/master)
|
||||
|
||||
* Checkout AppVeyor Artifacts: Contains the WebApp sample built for Windows & Linux!
|
||||
|
||||
Travis-CI (Win/macOS/Linux): [](https://travis-ci.org/ElectronNET/Electron.NET)
|
||||
[](https://donorbox.org/electron-net) [](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://github.com/ElectronNET/Electron.NET/actions/workflows/ci.yml)
|
||||
|
||||
Build cross platform desktop apps with .NET 6 and Blazor, ASP.NET Core (Razor Pages, MVC).
|
||||
|
||||
@@ -19,12 +12,11 @@ The CLI extensions hosts our toolset to build and start Electron.NET application
|
||||
|
||||
Well... there are lots of different approaches how to get a X-plat desktop app running. We thought it would be nice for .NET devs to use the ASP.NET Core environment and just embed it inside a pretty robust X-plat enviroment called Electron. Porting Electron to .NET is not a goal of this project, at least we don't have any clue how to do it. We just combine ASP.NET Core & Electron.
|
||||
|
||||
## 📦 NuGet:
|
||||
## 📦 NuGet
|
||||
|
||||
* API [](https://www.nuget.org/packages/ElectronNET.API/)
|
||||
* CLI [](https://www.nuget.org/packages/ElectronNET.CLI/)
|
||||
[ ElectronNET.API ](https://www.nuget.org/packages/ElectronNET.API/) | [ ElectronNET.CLI](https://www.nuget.org/packages/ElectronNET.CLI/)
|
||||
|
||||
## 🛠 Requirements to run:
|
||||
## 🛠 Requirements to Run
|
||||
|
||||
The current Electron.NET CLI builds Windows/macOS/Linux binaries. Our API uses .NET 6, so our minimum base OS is the same as [.NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md).
|
||||
|
||||
@@ -36,22 +28,22 @@ Also you should have installed:
|
||||
|
||||
[](https://gitter.im/ElectronNET/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
|
||||
## 🙏 Donate
|
||||
Besides the chat on Gitter and the issues [discussed here](https://github.com/ElectronNET/Electron.NET/issues) you can also use [StackOverflow](https://stackoverflow.com/questions/tagged/electron.net) with the tag `electron.net`.
|
||||
|
||||
We do this open source work in our free time. If you'd like us to invest more time on it, please [donate](https://donorbox.org/electron-net). Donation can be used to increase some issue priority. Thank you!
|
||||
|
||||
[](https://donorbox.org/electron-net)
|
||||
If you want to sponsor the further maintenance and development of this project [see the donate section](#-donate).
|
||||
|
||||
## 👩🏫 Usage
|
||||
|
||||
To activate and communicate with the "native" (sort of native...) Electron API include the [ElectronNET.API NuGet package](https://www.nuget.org/packages/ElectronNET.API/) in your ASP.NET Core app.
|
||||
|
||||
````
|
||||
```ps1
|
||||
PM> Install-Package ElectronNET.API
|
||||
````
|
||||
```
|
||||
|
||||
## Setup Using Minimal-API
|
||||
|
||||
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension and open the Electron Window:
|
||||
|
||||
## Minimal-API
|
||||
You start Electron.NET up with an `UseElectron` WebHostBuilder-Extension and open the Electron Window:
|
||||
### Program.cs
|
||||
|
||||
```csharp
|
||||
@@ -71,12 +63,12 @@ var app = builder.Build();
|
||||
await app.StartAsync();
|
||||
|
||||
// Open the Electron-Window here
|
||||
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
|
||||
await Electron.WindowManager.CreateWindowAsync();
|
||||
|
||||
app.WaitForShutdown();
|
||||
```
|
||||
|
||||
## Conventional
|
||||
## Setup using Normal-API
|
||||
|
||||
### Program.cs
|
||||
|
||||
@@ -94,76 +86,76 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
|
||||
### Startup.cs
|
||||
|
||||
Open the Electron Window in the Startup.cs file:
|
||||
Open the Electron Window in the *Startup.cs* file:
|
||||
|
||||
```csharp
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
...
|
||||
//...
|
||||
|
||||
// Open the Electron-Window here
|
||||
Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());
|
||||
Electron.WindowManager.CreateWindowAsync();
|
||||
}
|
||||
```
|
||||
|
||||
## 🚀 Start the Application
|
||||
## 🚀 Starting 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:
|
||||
|
||||
```
|
||||
```sh
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
```
|
||||
|
||||
At the first time, you need an Electron.NET project initialization. Type the following command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
```sh
|
||||
electronize init
|
||||
```
|
||||
|
||||
* Now a electronnet.manifest.json should appear in your ASP.NET Core project
|
||||
* Now run the following:
|
||||
|
||||
```
|
||||
```sh
|
||||
electronize start
|
||||
```
|
||||
|
||||
### Note
|
||||
> Only the first electronize start is slow. The next will go on faster.
|
||||
|
||||
> Only the first `electronize start` is slow. The next will go on faster.
|
||||
|
||||
## 🔭 Develop Electron.NET apps using a file watcher
|
||||
|
||||
The file watcher is included with version 8.31.1 of Electron.NET. For example, a file change can trigger compilation, test execution, or deployment. The Electron.NET window will automatically refresh and new code changes will be visible more quickly. The following Electron.NET CLI command is required:
|
||||
|
||||
```
|
||||
```sh
|
||||
electronize start /watch
|
||||
```
|
||||
|
||||
### Note
|
||||
> Only the first electronize start is slow. The next will go on faster.
|
||||
|
||||
## 🐞 Debug
|
||||
> Only the first `electronize start` is slow. The next will go on faster.
|
||||
|
||||
## 🐞 Debugging the Application
|
||||
|
||||
Start your Electron.NET application with the Electron.NET CLI command. In Visual Studio attach to your running application instance. Go in the __Debug__ Menu and click on __Attach to Process...__. Sort by your projectname on the right and select it on the list.
|
||||
|
||||
|
||||
## 📔 Usage of the Electron-API
|
||||
## 📔 Usage of the Electron API
|
||||
|
||||
A complete documentation will follow. Until then take a look in the source code of the sample application:
|
||||
[Electron.NET API Demos](https://github.com/ElectronNET/electron.net-api-demos)
|
||||
|
||||
In this YouTube video, we show you how you can create a new project, use the Electron.NET API, debug a application and build an executable desktop app for Windows: [Electron.NET - Getting Started](https://www.youtube.com/watch?v=nuM6AojRFHk)
|
||||
|
||||
## ⛏ Build
|
||||
## ⛏ Building Release Artifacts
|
||||
|
||||
Here you need the Electron.NET CLI as well. Type the following command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
```sh
|
||||
electronize build /target win
|
||||
```
|
||||
|
||||
There are additional platforms available:
|
||||
|
||||
```
|
||||
```sh
|
||||
electronize build /target win
|
||||
electronize build /target osx
|
||||
electronize build /target linux
|
||||
@@ -173,41 +165,47 @@ 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:
|
||||
|
||||
```
|
||||
```sh
|
||||
electronize build /target custom "win7-x86;win32" /electron-arch ia32
|
||||
```
|
||||
|
||||
The end result should be an electron app under your __/bin/desktop__ folder.
|
||||
|
||||
### Note
|
||||
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)). macOS builds can be produced on either Linux or macOS machines.
|
||||
|
||||
> macOS builds can't be created on Windows machines because they require symlinks that aren't supported on Windows (per [this Electron issue](https://github.com/electron-userland/electron-packager/issues/71)).
|
||||
|
||||
Consequently, macOS builds can be produced on either Linux or macOS machines.
|
||||
|
||||
## 🔄 Update
|
||||
|
||||
After an update to the latest Electron.API package, an update to the latest Electron.CLI is always required. In addition, always update the CLI via NuGet:
|
||||
After an update to the latest Electron.API package, an update to the latest Electron.CLI is always required.
|
||||
|
||||
```
|
||||
In addition, always update the CLI via NuGet:
|
||||
|
||||
```sh
|
||||
dotnet tool update ElectronNET.CLI -g
|
||||
```
|
||||
|
||||
## 👨💻 Authors
|
||||
|
||||
* **Gregor Biswanger** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
|
||||
* **Dr. Florian Rappl** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [Florian Rappl](https://florianrappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
|
||||
* **Robert Muehsig** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
|
||||
* **[Gregor Biswanger](https://github.com/GregorBiswanger)** - (Microsoft MVP, Intel Black Belt and Intel Software Innovator) is a freelance lecturer, consultant, trainer, author and speaker. He is a consultant for large and medium-sized companies, organizations and agencies for software architecture, web- and cross-platform development. You can find Gregor often on the road attending or speaking at international conferences. - [Cross-Platform-Blog](http://www.cross-platform-blog.com) - Twitter [@BFreakout](https://www.twitter.com/BFreakout)
|
||||
* **[Dr. Florian Rappl](https://github.com/FlorianRappl)** - Software Developer - from Munich, Germany. Microsoft MVP & Web Geek. - [The Art of Micro Frontends](https://microfrontends.art) - [Homepage](https://florian-rappl.de) - Twitter [@florianrappl](https://twitter.com/florianrappl)
|
||||
* **[Robert Muehsig](https://github.com/robertmuehsig)** - Software Developer - from Dresden, Germany, now living & working in Switzerland. Microsoft MVP & Web Geek. - [codeinside Blog](https://blog.codeinside.eu) - Twitter [@robert0muehsig](https://twitter.com/robert0muehsig)
|
||||
|
||||
See also the list of [contributors](https://github.com/ElectronNET/Electron.NET/graphs/contributors) who participated in this project.
|
||||
|
||||
|
||||
## 🙋♀️🙋♂ Contributing
|
||||
Feel free to submit a pull request if you find any bugs (to see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
|
||||
|
||||
Feel free to submit a pull request if you find any bugs. To see a list of active issues, visit the [Issues section](https://github.com/ElectronNET/Electron.NET/issues).
|
||||
|
||||
Please make sure all commits are properly documented.
|
||||
|
||||
## 🧪 Working with this Repo
|
||||
|
||||
This video provides an introduction to development for Electron.NET: [Electron.NET - Contributing Getting Started](https://youtu.be/Po-saU_Z6Ws)
|
||||
|
||||
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the buildAll scripts (.cmd for Windows, the other for macOS/Linux).
|
||||
This repository consists of the main parts (API & CLI) and it's own "playground" ASP.NET Core application. Both main parts produce local NuGet packages, that are versioned with 99.0.0. The first thing you will need is to run one of the build scripts (.cmd or .ps1 for Windows, the .sh for macOS/Linux).
|
||||
|
||||
If you look for pure __[demo projects](https://github.com/ElectronNET)__ checkout the other repositories.
|
||||
|
||||
@@ -219,12 +217,18 @@ We do this open source work in our free time. If you'd like us to invest more ti
|
||||
|
||||
[](https://donorbox.org/electron-net)
|
||||
|
||||
Alternatively, consider using a GitHub sponsorship for the core maintainers:
|
||||
|
||||
- [Gregor Biswanger](https://github.com/sponsors/GregorBiswanger)
|
||||
- [Florian Rappl](https://github.com/sponsors/FlorianRappl)
|
||||
|
||||
Any support appreciated! 🍻
|
||||
|
||||
## 🎉 License
|
||||
MIT-licensed
|
||||
|
||||
MIT-licensed. See [LICENSE](./LICENSE) for details.
|
||||
|
||||
**Enjoy!**
|
||||
|
||||
|
||||
|
||||
## 📝 Important notes
|
||||
|
||||
@@ -232,13 +236,15 @@ MIT-licensed
|
||||
|
||||
Make sure you also have the new Electron.NET API & CLI 9.31.2 version.
|
||||
|
||||
```
|
||||
```sh
|
||||
dotnet tool update ElectronNET.CLI -g
|
||||
```
|
||||
|
||||
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 (on the build part). In addition, own Electron.NET configurations are stored (on the root). Please make sure that your **electron.manifest.json** file has the following new structure:
|
||||
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 (on the build part). In addition, own Electron.NET configurations are stored (on the root).
|
||||
|
||||
```
|
||||
Please make sure that your **electron.manifest.json** file has the following new structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"executable": "{{executable}}",
|
||||
"splashscreen": {
|
||||
@@ -277,29 +283,29 @@ dotnet tool update ElectronNET.CLI -g
|
||||
|
||||
### 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:
|
||||
In the Version 0.0.9 the CLI was not a global tool and needed to be registered like this in the *.csproj*:
|
||||
|
||||
```
|
||||
```xml
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
|
||||
<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 following command in your ASP.NET Core folder:
|
||||
After you edited the *.csproj* file, you need to restore your NuGet packages within your Project. Run the following command in your ASP.NET Core folder:
|
||||
|
||||
```
|
||||
```sh
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
|
||||
If you still use this version you will need to invoke it like this:
|
||||
|
||||
```
|
||||
```sh
|
||||
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:
|
||||
### Node.js Integration
|
||||
|
||||
Electron.NET requires Node.js integration to be enabled for IPC to function. If you are not using the IPC functionality you can disable Node.js integration like so:
|
||||
|
||||
```csharp
|
||||
WebPreferences wp = new WebPreferences();
|
||||
@@ -307,19 +313,19 @@ wp.NodeIntegration = false;
|
||||
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
|
||||
{
|
||||
WebPreferences = wp
|
||||
}
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### Dependency Injection
|
||||
|
||||
ElectronNET.Api can be added to your DI container within the Startup class. All of the modules available in Electron will be added as Singletons.
|
||||
ElectronNET.API can be added to your DI container within the `Startup` class. All of the modules available in Electron will be added as Singletons.
|
||||
|
||||
```csharp
|
||||
using ElectronNET.API;
|
||||
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddElectron()
|
||||
services.AddElectron();
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
version: 1.0.{build}
|
||||
image: Visual Studio 2019
|
||||
build_script:
|
||||
- cmd: buildAll.cmd
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
artifacts:
|
||||
- path: ElectronNET.WebApp\bin\desktop
|
||||
name: Desktop
|
||||
0
artifacts/.gitkeep
Normal file
0
artifacts/.gitkeep
Normal file
@@ -1 +0,0 @@
|
||||
Dummy file to ensure this directory is available after cloning
|
||||
7
build.cmd
Normal file
7
build.cmd
Normal file
@@ -0,0 +1,7 @@
|
||||
:; set -eo pipefail
|
||||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
:; ${SCRIPT_DIR}/build.sh "$@"
|
||||
:; exit $?
|
||||
|
||||
@ECHO OFF
|
||||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
|
||||
69
build.ps1
Normal file
69
build.ps1
Normal file
@@ -0,0 +1,69 @@
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$BuildArguments
|
||||
)
|
||||
|
||||
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
|
||||
|
||||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
###########################################################################
|
||||
# CONFIGURATION
|
||||
###########################################################################
|
||||
|
||||
$BuildProjectFile = "$PSScriptRoot\nuke\_build.csproj"
|
||||
$TempDirectory = "$PSScriptRoot\\.nuke\temp"
|
||||
|
||||
$DotNetGlobalFile = "$PSScriptRoot\\global.json"
|
||||
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
|
||||
$DotNetChannel = "Current"
|
||||
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP = 0
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function ExecSafe([scriptblock] $cmd) {
|
||||
& $cmd
|
||||
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
# If dotnet CLI is installed globally and it matches requested version, use for execution
|
||||
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
|
||||
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
|
||||
$env:DOTNET_EXE = (Get-Command "dotnet").Path
|
||||
}
|
||||
else {
|
||||
# Download install script
|
||||
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
|
||||
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if (Test-Path $DotNetGlobalFile) {
|
||||
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
|
||||
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
|
||||
$DotNetVersion = $DotNetGlobal.sdk.version
|
||||
}
|
||||
}
|
||||
|
||||
# Install by channel or version
|
||||
$DotNetDirectory = "$TempDirectory\dotnet-win"
|
||||
if (!(Test-Path variable:DotNetVersion)) {
|
||||
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
|
||||
} else {
|
||||
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
|
||||
}
|
||||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
|
||||
}
|
||||
|
||||
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
|
||||
|
||||
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
|
||||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
|
||||
62
build.sh
Executable file
62
build.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
bash --version 2>&1 | head -n 1
|
||||
|
||||
set -eo pipefail
|
||||
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
|
||||
###########################################################################
|
||||
# CONFIGURATION
|
||||
###########################################################################
|
||||
|
||||
BUILD_PROJECT_FILE="$SCRIPT_DIR/nuke/_build.csproj"
|
||||
TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"
|
||||
|
||||
DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
|
||||
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
|
||||
DOTNET_CHANNEL="Current"
|
||||
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
export DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function FirstJsonValue {
|
||||
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
|
||||
}
|
||||
|
||||
# If dotnet CLI is installed globally and it matches requested version, use for execution
|
||||
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
|
||||
export DOTNET_EXE="$(command -v dotnet)"
|
||||
else
|
||||
# Download install script
|
||||
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
|
||||
mkdir -p "$TEMP_DIRECTORY"
|
||||
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
|
||||
chmod +x "$DOTNET_INSTALL_FILE"
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
|
||||
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
|
||||
if [[ "$DOTNET_VERSION" == "" ]]; then
|
||||
unset DOTNET_VERSION
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install by channel or version
|
||||
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
|
||||
if [[ -z ${DOTNET_VERSION+x} ]]; then
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
|
||||
else
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
|
||||
fi
|
||||
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
|
||||
fi
|
||||
|
||||
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
|
||||
|
||||
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
|
||||
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
|
||||
45
buildAll.cmd
45
buildAll.cmd
@@ -1,45 +0,0 @@
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
echo "Restore & Build CLI"
|
||||
cd ElectronNet.CLI
|
||||
dotnet restore
|
||||
dotnet build
|
||||
cd ..
|
||||
echo "Restore & Build WebApp Demo"
|
||||
cd ElectronNet.WebApp
|
||||
dotnet restore
|
||||
dotnet build
|
||||
|
||||
echo "Invoke electronize build in WebApp Demo"
|
||||
|
||||
echo "Install CLI"
|
||||
|
||||
dotnet tool uninstall ElectronNET.CLI -g
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
|
||||
echo "/target xxx (dev-build)"
|
||||
electronize build /target custom win7-x86;win /dotnet-configuration Debug /electron-arch ia32 /electron-params "--publish never"
|
||||
|
||||
echo "/target win (dev-build)"
|
||||
electronize build /target win /electron-params "--publish never"
|
||||
|
||||
echo "/target custom win7-x86;win (dev-build)"
|
||||
|
||||
electronize build /target custom win7-x86;win /electron-params "--publish never"
|
||||
|
||||
:: Be aware, that for non-electronnet-dev environments the correct
|
||||
:: invoke command would be dotnet electronize ...
|
||||
|
||||
:: Not supported on Windows Systems, because of SymLinks...
|
||||
:: echo "/target osx"
|
||||
:: dotnet electronize build /target osx
|
||||
|
||||
:: Linux and Mac is not supported on with this buildAll.cmd test file, because the electron bundler does some strange stuff
|
||||
:: Help welcome!
|
||||
:: echo "/target linux (dev-build)"
|
||||
:: electronize build /target linux /electron-params "--publish never"
|
||||
71
buildAll.sh
71
buildAll.sh
@@ -1,71 +0,0 @@
|
||||
# flag arguments to target specific builds are available.
|
||||
|
||||
# sh ./buildAll.sh
|
||||
# sh ./buildAll.sh -t osx
|
||||
# sh ./buildAll.sh -t win
|
||||
# sh ./buildAll.sh -t linux
|
||||
|
||||
target=default
|
||||
while getopts t: flag; do
|
||||
case "${flag}" in
|
||||
t) target=${OPTARG} ;;
|
||||
esac
|
||||
done
|
||||
|
||||
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
|
||||
echo "Build Electron Host"
|
||||
pushd $dir//ElectronNET.Host
|
||||
npm install
|
||||
npm run-script start
|
||||
popd
|
||||
|
||||
echo "Restore & Build API"
|
||||
pushd $dir/ElectronNET.API
|
||||
dotnet restore
|
||||
dotnet build
|
||||
popd
|
||||
|
||||
echo "Restore & Build CLI"
|
||||
pushd $dir/ElectronNET.CLI
|
||||
dotnet restore
|
||||
dotnet build
|
||||
popd
|
||||
|
||||
echo "Restore & Build WebApp Demo"
|
||||
pushd $dir/ElectronNET.WebApp
|
||||
dotnet restore
|
||||
dotnet build
|
||||
|
||||
echo "Install CLI as dotnet tool"
|
||||
|
||||
dotnet tool uninstall ElectronNET.CLI -g
|
||||
dotnet tool install ElectronNET.CLI -g
|
||||
|
||||
echo "Invoke electronize build in WebApp Demo"
|
||||
|
||||
if [[ "$target" != "default" ]]; then
|
||||
echo "/target $target (dev-build)"
|
||||
electronize build /target $target
|
||||
else
|
||||
echo "/target win (dev-build)"
|
||||
electronize build /target win
|
||||
|
||||
echo "/target linux (dev-build)"
|
||||
electronize build /target linux
|
||||
|
||||
# Cannot publish osx/win on windows due to:
|
||||
# NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture.
|
||||
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
|
||||
echo "/target osx (dev-build)"
|
||||
electronize build /target osx
|
||||
|
||||
echo "/target custom win7-x86;win (dev-build)"
|
||||
electronize build /target custom "win7-x86;win"
|
||||
fi
|
||||
fi
|
||||
popd
|
||||
|
||||
# Be aware, that for non-electronnet-dev environments the correct
|
||||
# invoke command would be dotnet electronize ...
|
||||
@@ -1,14 +0,0 @@
|
||||
set ENETVER=23.6.1
|
||||
echo "Start building Electron.NET dev stack..."
|
||||
echo "Restore & Build API"
|
||||
cd ElectronNet.API
|
||||
dotnet restore
|
||||
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=%ENETVER%
|
||||
dotnet pack /p:Version=%ENETVER% --configuration Release --force --output "%~dp0artifacts"
|
||||
cd ..
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user