mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-11 05:34:34 +00:00
Compare commits
376 Commits
5.22.13
...
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 | ||
|
|
a2514ed5bc | ||
|
|
b453278803 | ||
|
|
a244382383 | ||
|
|
a82e714ef8 | ||
|
|
b339485fdc | ||
|
|
551635867d | ||
|
|
941b8cf5c2 | ||
|
|
06b01f75da | ||
|
|
e4b1f6586e | ||
|
|
0657a274d4 | ||
|
|
e3acc79c4f | ||
|
|
73c1d1cd46 | ||
|
|
c2a8c627b9 | ||
|
|
1862094861 | ||
|
|
0ad89c7d22 | ||
|
|
0af664b8a6 | ||
|
|
afcd113675 | ||
|
|
0e22ee3fd3 | ||
|
|
ce0cdf39c6 | ||
|
|
305544ab42 | ||
|
|
78d9d601b1 | ||
|
|
fdd643ba48 | ||
|
|
29a257251f | ||
|
|
3676db89d3 | ||
|
|
29011189f8 | ||
|
|
9d7d859764 | ||
|
|
5cdda5595a | ||
|
|
62fe944ae3 | ||
|
|
617eb15df8 | ||
|
|
bff71dc86a | ||
|
|
f0280f420a | ||
|
|
9f7809810f | ||
|
|
e610c96550 | ||
|
|
f3bd3d07d5 | ||
|
|
0e8cfec689 | ||
|
|
c1b3d422d5 | ||
|
|
fc12363e11 | ||
|
|
02f2fd770c | ||
|
|
5ee1918bb4 | ||
|
|
2213c61746 | ||
|
|
3cdff747fe | ||
|
|
476cc9e505 | ||
|
|
fb8ca94e8e | ||
|
|
c94702fc60 | ||
|
|
cd9e06d5db | ||
|
|
613f0a05b3 | ||
|
|
de2ce85a5c | ||
|
|
e5d47e077b | ||
|
|
ac77ccce9f | ||
|
|
504cc59760 | ||
|
|
0ee7097f31 | ||
|
|
2d93d959f7 | ||
|
|
a4d261a4e7 | ||
|
|
3838fe8971 | ||
|
|
b5e69f5dda | ||
|
|
55a3f10d37 | ||
|
|
7e494518f3 | ||
|
|
4596492cd9 | ||
|
|
dd5bfd3961 | ||
|
|
5d907864d8 | ||
|
|
30941df39c | ||
|
|
3588a8696d | ||
|
|
876bb98d92 | ||
|
|
427b57a002 | ||
|
|
cc0b15c61e | ||
|
|
8a0276daf9 | ||
|
|
e94196504e | ||
|
|
6076c727d1 | ||
|
|
300dc49dde | ||
|
|
ce0f3fd61e | ||
|
|
12f5eae65c | ||
|
|
3ef44cf878 | ||
|
|
41fa8e9e74 | ||
|
|
49e21de465 | ||
|
|
d2f6308dd2 | ||
|
|
f06b95803f | ||
|
|
b9feff3436 | ||
|
|
335489d2d9 | ||
|
|
6fe0c6f085 | ||
|
|
f82d185865 | ||
|
|
550e2c2625 | ||
|
|
61f54ebd55 | ||
|
|
c8c818a77a | ||
|
|
fc590f55d8 | ||
|
|
5fbe01df30 | ||
|
|
dbf4d0f720 | ||
|
|
f996b3023e | ||
|
|
7f62e7299b | ||
|
|
b803e42a73 | ||
|
|
da1838db60 | ||
|
|
8af1f50b88 | ||
|
|
c4f2188c62 | ||
|
|
e73655bd68 | ||
|
|
758424d3ce | ||
|
|
7518acb3c2 | ||
|
|
5522addc0b | ||
|
|
7f204c2a42 | ||
|
|
de13f49bb6 | ||
|
|
bca37228d9 | ||
|
|
e17a36f7cb | ||
|
|
deccebb582 | ||
|
|
776ccc21e8 | ||
|
|
d0c92cac85 | ||
|
|
b525bf1a9a | ||
|
|
6337cac588 | ||
|
|
5d4509babe | ||
|
|
3eef85cddf | ||
|
|
3f582d6c4e | ||
|
|
18c5a65d6d | ||
|
|
f8bbb138d8 | ||
|
|
7880d56e4c | ||
|
|
c16a888699 | ||
|
|
814e046d5c | ||
|
|
d2457203bc | ||
|
|
a70304948a | ||
|
|
a49b2ce278 | ||
|
|
1577146187 | ||
|
|
d61f20dd67 | ||
|
|
f7217b417f | ||
|
|
e136ed4127 | ||
|
|
7489543c75 | ||
|
|
cbf3032617 | ||
|
|
68c54b9917 | ||
|
|
26d10fca38 | ||
|
|
bd15587079 | ||
|
|
42613f5b56 | ||
|
|
62117df108 | ||
|
|
f68ea25cba | ||
|
|
4e9de2abfa | ||
|
|
a08d274dc1 | ||
|
|
3dea16798b | ||
|
|
bf8c7c8fa1 | ||
|
|
06724f6eae | ||
|
|
83e579d44b | ||
|
|
ed67aa8072 | ||
|
|
f1ceaa208e | ||
|
|
5e005499ef | ||
|
|
975e4020dc | ||
|
|
15ce35a7d9 | ||
|
|
de1637672a | ||
|
|
6b75f63135 | ||
|
|
8f92d3986f | ||
|
|
ca7414b8e6 | ||
|
|
37ae869dcb | ||
|
|
3420ee2de4 | ||
|
|
0a76e951eb | ||
|
|
4db316eb15 | ||
|
|
a867f23220 | ||
|
|
490440c23a | ||
|
|
519fb53c00 | ||
|
|
12388541ab | ||
|
|
8c8115f3bd | ||
|
|
4286bc4f45 | ||
|
|
886f839482 | ||
|
|
96abbd161c | ||
|
|
9baf1528ac | ||
|
|
380441c2c8 | ||
|
|
a66375e37c | ||
|
|
606d00de5a | ||
|
|
b3266cd93f | ||
|
|
cb36e34dc3 | ||
|
|
db7a5ff868 | ||
|
|
a030e3cbe7 | ||
|
|
b98c570b9d | ||
|
|
d106c6b193 | ||
|
|
c95bbe7ab2 | ||
|
|
258710bc52 | ||
|
|
9ddb1b195e | ||
|
|
eee84d214e | ||
|
|
1ab48350e1 | ||
|
|
874bc8eb94 | ||
|
|
7aa2268a81 | ||
|
|
b08222bddc | ||
|
|
c5c822a028 | ||
|
|
ce4ef03636 | ||
|
|
641864b946 | ||
|
|
c6d67a9145 | ||
|
|
fabd25a89e | ||
|
|
029b077602 | ||
|
|
0329530815 | ||
|
|
58ab180c94 | ||
|
|
a03dc1d195 | ||
|
|
76dcdc4137 | ||
|
|
2b415e5b59 | ||
|
|
94055b985f | ||
|
|
596aa68c70 | ||
|
|
485bce08d7 | ||
|
|
2ba49dbd6a | ||
|
|
39c3e92128 | ||
|
|
c552a04347 | ||
|
|
1541553ed1 | ||
|
|
52b850092c | ||
|
|
cac9cfcec8 | ||
|
|
4ad39ba4c1 | ||
|
|
95acbd5dea | ||
|
|
95f9a59431 | ||
|
|
d409c3a0f9 | ||
|
|
6d0fbde5ad | ||
|
|
b113532a86 | ||
|
|
b043688f7f | ||
|
|
3b3e38f1bf | ||
|
|
9502eb787a | ||
|
|
4a9b6fa9c1 | ||
|
|
fb308ed1c6 | ||
|
|
d51a481e50 | ||
|
|
bb3d073fae | ||
|
|
8c250ae83e | ||
|
|
a5543bfe60 | ||
|
|
c40affb32e | ||
|
|
e9331728b4 | ||
|
|
92b0388300 | ||
|
|
f4ea6df204 | ||
|
|
b027ca7c66 | ||
|
|
0573e92ed5 | ||
|
|
672e3b86fd | ||
|
|
b7960eb772 | ||
|
|
bbab114c54 | ||
|
|
e77f48b2c5 | ||
|
|
8fe60bfcda | ||
|
|
09fa662ed1 | ||
|
|
7f2269c4bd | ||
|
|
05de4071d1 | ||
|
|
169abc2376 | ||
|
|
12a3f2689e | ||
|
|
14587463e7 | ||
|
|
6690b4a76e | ||
|
|
c8e51ef21b | ||
|
|
96a5189f14 | ||
|
|
13fcedc3a0 | ||
|
|
c12c26b491 | ||
|
|
6ddce85bdd | ||
|
|
68ee626d07 | ||
|
|
fd5801ffdc | ||
|
|
df02855471 | ||
|
|
b6417d0718 | ||
|
|
6f1f7cbc5e | ||
|
|
aec0da6075 | ||
|
|
c9f0c43bc9 | ||
|
|
b87d7f9899 | ||
|
|
fa51cdd72c | ||
|
|
9b270755d0 | ||
|
|
c5db735773 | ||
|
|
88f5995f40 | ||
|
|
042cd7e6cb | ||
|
|
cb096212f9 | ||
|
|
0363dc8924 | ||
|
|
8cf5053512 | ||
|
|
32046adfb5 | ||
|
|
003a9d0d35 | ||
|
|
db6bed43dc | ||
|
|
80d160a71c | ||
|
|
01d938fb1a | ||
|
|
00eb9869dc | ||
|
|
2987e3143d | ||
|
|
20ca72b794 | ||
|
|
a0e0cc3bbc | ||
|
|
e295558258 | ||
|
|
e67f6c500b | ||
|
|
23015a9f3d | ||
|
|
7daac2d04e | ||
|
|
71955b9181 | ||
|
|
a619b6e5c9 | ||
|
|
3ba3fa6414 | ||
|
|
11fbd6b259 | ||
|
|
073eb0e00d | ||
|
|
c0bf257b55 | ||
|
|
62b37d059f | ||
|
|
ca8f4c454c | ||
|
|
d660dff871 | ||
|
|
c17720a4d7 | ||
|
|
274552f52b | ||
|
|
1e3fe6183c | ||
|
|
88b04377a7 | ||
|
|
92356d3587 | ||
|
|
a3c452eea5 | ||
|
|
68288d9d73 | ||
|
|
022221307c | ||
|
|
ffc6353bf2 | ||
|
|
f4d8144a8b | ||
|
|
30d49ff6e8 | ||
|
|
db9d3b1484 | ||
|
|
a788d71530 | ||
|
|
f5e2abfdb4 | ||
|
|
42f09de7b5 | ||
|
|
72d1f4b2b9 | ||
|
|
d2b3c28f91 | ||
|
|
94c4cd82b0 | ||
|
|
600bc1a41b | ||
|
|
4e8e771293 | ||
|
|
4014ef7a4d | ||
|
|
364db7dc25 | ||
|
|
3dda18ac9a | ||
|
|
7f92ffa20e | ||
|
|
b69d4d23bf | ||
|
|
eb4144053d | ||
|
|
239d914747 | ||
|
|
5af8e489b9 | ||
|
|
b6fb1cb0bf | ||
|
|
aa98b85f18 | ||
|
|
af74d24f50 | ||
|
|
2240ffca82 | ||
|
|
f64b780a27 | ||
|
|
fbc5b93513 | ||
|
|
14d02706c0 | ||
|
|
2c14693430 | ||
|
|
54ff11acf5 | ||
|
|
b7e7ace6f3 | ||
|
|
1f7908a0f1 | ||
|
|
cafffde339 | ||
|
|
6fbba52edd | ||
|
|
8dd5d1561a | ||
|
|
25f35e34fe | ||
|
|
f1eaffb203 | ||
|
|
69ca5d6f9e | ||
|
|
5cd11a8110 | ||
|
|
c343b19a60 | ||
|
|
b3bb3ceb97 | ||
|
|
e25b89ff6a | ||
|
|
28be0dd209 | ||
|
|
8bf10c370c | ||
|
|
a32b50f86f | ||
|
|
a781234d05 | ||
|
|
8b66bdd7cb | ||
|
|
ba64639c1d | ||
|
|
5157561dc6 | ||
|
|
bbecd86cce | ||
|
|
bd99da560b | ||
|
|
9278402d65 | ||
|
|
9bc1b46810 | ||
|
|
d2956e6f2f | ||
|
|
da4e930478 | ||
|
|
8e9f7b016a | ||
|
|
10e95afa5c | ||
|
|
68505f8feb | ||
|
|
c91884a520 | ||
|
|
ccf0a4c73b | ||
|
|
660663d9c1 | ||
|
|
36ee9c4dd7 | ||
|
|
9f7c99db53 | ||
|
|
b9ba162a88 | ||
|
|
0a02b7140b | ||
|
|
f6ea0dd8dc | ||
|
|
dc73be0c81 | ||
|
|
43028afc02 | ||
|
|
8a3b9951fa | ||
|
|
552b4331b2 | ||
|
|
a2ada57292 | ||
|
|
6a7c60fdb5 |
12
.github/FUNDING.yml
vendored
Normal file
12
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [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
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://donorbox.org/electron-net
|
||||
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
|
||||
}
|
||||
8
.gitignore
vendored
8
.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
|
||||
@@ -260,3 +260,9 @@ paket-files/
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# 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,9 +0,0 @@
|
||||
language: csharp
|
||||
mono: none
|
||||
dist: xenial
|
||||
dotnet: 2.2
|
||||
before_script:
|
||||
- export PATH="$PATH:/home/travis/.dotnet/tools"
|
||||
- npm install electron-packager --global
|
||||
script:
|
||||
- ./buildAll.sh
|
||||
32
.vscode/tasks.json
vendored
32
.vscode/tasks.json
vendored
@@ -1,16 +1,18 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"command": "dotnet",
|
||||
"isShellCommand": true,
|
||||
"args": [],
|
||||
"tasks": [
|
||||
{
|
||||
"taskName": "build",
|
||||
"args": [
|
||||
"${workspaceRoot}/ElectronNET.CLI/ElectronNET.CLI.csproj"
|
||||
],
|
||||
"isBuildCommand": true,
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
"version": "2.0.0",
|
||||
"command": "dotnet",
|
||||
"args": [],
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "dotnet",
|
||||
"args": ["build", "${workspaceRoot}/ElectronNET.CLI/ElectronNET.CLI.csproj"],
|
||||
"problemMatcher": "$msCompile",
|
||||
"group": {
|
||||
"_id": "build",
|
||||
"isDefault": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
233
Changelog.md
233
Changelog.md
@@ -1,21 +1,242 @@
|
||||
# Not released
|
||||
# 23.6.2
|
||||
|
||||
## ElectronNET.API
|
||||
|
||||
# Released
|
||||
* Fixed escaping of URL (#735) @cosmo0
|
||||
* Changed `ZoomFactor` type from `int` to `double` (#754) @Yuvix25
|
||||
|
||||
# 5.22.13
|
||||
## 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
|
||||
|
||||
* New Feature: Upgrade to .NET 6 support
|
||||
|
||||
## 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
|
||||
* New Feature: Changed Web-Socket .NET Library to [SocketIOClient](https://github.com/doghappy/socket.io-client-csharp)
|
||||
* Breaking Changes: We removed deprecated API events/methods from ElectronNET.API [(More Details)](https://www.electronjs.org/docs/latest/breaking-changes)
|
||||
|
||||
# 13.5.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Using exit code instead of seek for the term 'error' (thanks [TSrgy](https://github.com/TSrgy)) [\#562](https://github.com/ElectronNET/Electron.NET/pull/562)
|
||||
* Fixed bug: Allow for property overrides to be passed in (thanks [danatcofo](https://github.com/danatcofo)) [\#531](https://github.com/ElectronNET/Electron.NET/pull/531)
|
||||
Use `/p:propertyName=value` or `/property:propertyName=value` to pass in property overrides. This is equivalent to the `-p:` option documented here: [https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish)
|
||||
* Fixed bug: Add ability to pass an argument for "Version" for both the "dotnet publish" and "electron-builder" commands (thanks [tub5](https://github.com/tub5)) [\#546](https://github.com/ElectronNET/Electron.NET/pull/546)
|
||||
* Fixed bug: Version flag not persisting with the referenced executable (thanks [tub5](https://github.com/tub5)) [\#585](https://github.com/ElectronNET/Electron.NET/pull/585)
|
||||
* Fixed bug: Changes PublishSingleFile default to false for NET5 compatibility (thanks [cristiangiagante](https://github.com/cristiangiagante)) [\#570](https://github.com/ElectronNET/Electron.NET/pull/570)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 13.1.5 support, but not all new features (we search contributors)
|
||||
* Breaking API Changes (from native Electron 13.1.5):
|
||||
- `Shell.MoveItemToTrashAsync` renamed with `Shell.TrashItemAsync`
|
||||
- The deprecated extension APIs have been removed: `BrowserWindow.GetAllExtensionsAsync()`, `BrowserWindow.RemoveExtension()`, `BrowserWindow.AddExtensionAsync()`. Use the session APIs instead: `Session.GetAllExtensionsAsync()`, `Session.RemoveExtension()`, `Session.LoadExtensionAsync()`.
|
||||
* New Feature: singleInstance handle command line arguments [\#520](https://github.com/ElectronNET/Electron.NET/issues/520)
|
||||
* New Feature: Add WebContents [insertCSS](https://www.electronjs.org/docs/api/web-contents#contentsinsertcsscss-options) functionality (thanks [nfichter](https://github.com/nfichter)) [\#559](https://github.com/ElectronNET/Electron.NET/pull/559)
|
||||
* New Feature: Allow IpcMain to send IPC messages to BrowserViews (thanks [nfichter](https://github.com/nfichter)) [\#560](https://github.com/ElectronNET/Electron.NET/pull/560)
|
||||
* New Feature: Add support for proxies that require basic username/password authentication (thanks [nfichter](https://github.com/nfichter)) [\#561](https://github.com/ElectronNET/Electron.NET/pull/561)
|
||||
* New Feature: Add PostData to LoadURLOptions to allow http-posts in LoadURL calls (thanks [Funkrusha](https://github.com/Funkrusha)) [\#547](https://github.com/ElectronNET/Electron.NET/pull/547)
|
||||
* Fixed bug: Fix splash screen interaction causing crashes, ghost dragging, and resizable behavior #540 (thanks [MiniguyBrendan](https://github.com/MiniguyBrendan)) [\#540](https://github.com/ElectronNET/Electron.NET/pull/540)
|
||||
* Fixed bug: Vibrancy serialization fix (thanks [tantumalice](https://github.com/tantumalice)) [\#573](https://github.com/ElectronNET/Electron.NET/pull/573)
|
||||
|
||||
# 11.5.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Added new build and start commandline options for single exe (thanks [nathanwienand](https://github.com/nathanwienand)) [\#506](https://github.com/ElectronNET/Electron.NET/pull/506)
|
||||
* New Feature: Set a description of the app in `electron.manifest.json` (thanks [BurtsevC](https://github.com/BurtsevC)) [\#433](https://github.com/ElectronNET/Electron.NET/pull/433)
|
||||
* New Feature: Set a target for the start command (thanks [gabecook](https://github.com/gabecook)) [\#463](https://github.com/ElectronNET/Electron.NET/pull/463)
|
||||
* New Feature: `electronize init` support for F# projects (thanks [kojo12228](https://github.com/kojo12228)) [\#457](https://github.com/ElectronNET/Electron.NET/pull/457)
|
||||
* New Feature: Linux support for the buildAll.sh (thanks [duncanawoods](https://github.com/duncanawoods)) [\#465](https://github.com/ElectronNET/Electron.NET/pull/465)
|
||||
* Fixed bug: ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol (thanks [duncanawoods](https://github.com/duncanawoods)) [\#467](https://github.com/ElectronNET/Electron.NET/pull/467)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 11.1.1 support, but not all new features (we search contributors)
|
||||
* Breaking API Changes (from native Electron 11.0): - Removed: BrowserView.{destroy, fromId, fromWebContents, getAllViews} and id property of BrowserView
|
||||
* New Feature: Upgrade to .NET 5 (thanks [scottkuhl](https://github.com/scottkuhl)) [\#509](https://github.com/ElectronNET/Electron.NET/pull/509)
|
||||
* New Feature: Extension Method for adding the Electron static class members to the standard MS DI Containers, this is a QOL issue only. `services.AddElectron()` (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
* New Feature: SetMenu completed for the Dock (MacOS) (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
|
||||
Example for the Dock Menu
|
||||
|
||||
`Electron.Dock.SetMenu(new [] {
|
||||
new MenuItem {
|
||||
Label = "Dock Menu Item",
|
||||
Click = () => {
|
||||
// do something
|
||||
}
|
||||
},
|
||||
});`
|
||||
|
||||
Example for consuming the activate event (MacOs only)
|
||||
|
||||
`Electron.App.On("activate", obj => {
|
||||
var hasWindows = (bool)obj;
|
||||
// do something
|
||||
});`
|
||||
|
||||
* New Feature: On and Once implementations for the App and Tray to cover the plethora of events that are not mapped explicitly in those two modules. (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
* New Feature: Adding the `EnableRemoteModule` property to the WebPreferences object. As of Electron 10, this property defaulted to false and without it exposed you can't use the remote module within a window. (thanks [danatcofo](https://github.com/danatcofo )) [\#528](https://github.com/ElectronNET/Electron.NET/pull/528)
|
||||
* New Feature: Adding a configurable default electron port. (thanks [aarong-av](https://github.com/aarong-av)) [\#505](https://github.com/ElectronNET/Electron.NET/pull/505)
|
||||
* New Feature: Added support for launching the application with a file on MacOS (thanks [dlitty](https://github.com/dlitty)) [\#478](https://github.com/ElectronNET/Electron.NET/pull/478)
|
||||
* Improved: Avoid Blocking Calls in App and AutoUpdater (thanks [freosc](https://github.com/freosc)) [\#474](https://github.com/ElectronNET/Electron.NET/pull/474)
|
||||
* Fixed bug: Maintain references between socket.io connection events (thanks [danatcofo](https://github.com/danatcofo )) [\#468](https://github.com/ElectronNET/Electron.NET/pull/486)
|
||||
* Fixed bug: Set default WebPreferences.DefaultFontSize (thanks [duncanawoods](https://github.com/duncanawoods)) [\#468](https://github.com/ElectronNET/Electron.NET/pull/468)
|
||||
|
||||
# 9.31.2
|
||||
|
||||
* Electron-Builder fixed for Windows builds.
|
||||
|
||||
# 9.31.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Added config parameter (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
|
||||
* New Feature: Set the configuration environment with the electron.manifest.json file.
|
||||
* Fixed bug: Custom user path removed and replaced by the correct directory with VS macro (When ElectronNET.CLI is the Startup Project, press F5 (Debug) and the ElectronNET.WebApp starts correctly without error!) (thanks [konstantingross](https://github.com/konstantingross)) [\#409](https://github.com/ElectronNET/Electron.NET/pull/409)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 9.0.3 support, but not all new features (we search contributors)
|
||||
* New Feature: PowerMonitor API Support (thanks [gustavo-lara-molina](https://github.com/gustavo-lara-molina)) [\#399](https://github.com/ElectronNET/Electron.NET/pull/399) [\#423](https://github.com/ElectronNET/Electron.NET/pull/423)
|
||||
* New Feature: NativeTheme API Support (thanks [konstantingross](https://github.com/konstantingross)) [\#402](https://github.com/ElectronNET/Electron.NET/pull/402)
|
||||
* New Feature: Cookie API Support (thanks [freosc](https://github.com/freosc)) [\#413](https://github.com/ElectronNET/Electron.NET/pull/413)
|
||||
* Changed Feature: Removed dock methods from App API and moved to Dock API (thanks [konstantingross](https://github.com/konstantingross)) [\#422](https://github.com/ElectronNET/Electron.NET/pull/422)
|
||||
* App-Api Enhancement: MenuItems with Submenus need an submenu type workaround [\#412](https://github.com/ElectronNET/Electron.NET/issues/412)
|
||||
* App-Api Enhancement: Added UserAgentFallback (thanks [Mandrakia](https://github.com/Mandrakia)) [\#406](https://github.com/ElectronNET/Electron.NET/pull/406)
|
||||
* App-Api Enhancement: Summaries rewritten, new App.IsReady / App.HasSingleInstanceLock property, App.Ready event, App.Focus with force parameter method, many parameters changes (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415) [\#422](https://github.com/ElectronNET/Electron.NET/pull/422)
|
||||
* App-Api Enhancement: New App.IsReady property and App.Ready event (thanks [konstantingross](https://github.com/konstantingross)) [\#415](https://github.com/ElectronNET/Electron.NET/pull/415)
|
||||
* Shell-Api Enhancement: API fixes for Electron 9.0.0 / Added missing parameters / Summaries rewritten (thanks [konstantingross](https://github.com/konstantingross)) [\#417](https://github.com/ElectronNET/Electron.NET/pull/417) [\#418](https://github.com/ElectronNET/Electron.NET/pull/418)
|
||||
* Notification-Api Enhancement: Added missing properties in Notifications (thanks [konstantingross](https://github.com/konstantingross)) [\#410](https://github.com/ElectronNET/Electron.NET/pull/410)
|
||||
* BrowserWindows-Api Enhancement: Add missing API call for SetProgressBar options (thanks [konstantingross](https://github.com/konstantingross)) [\#416](https://github.com/ElectronNET/Electron.NET/pull/416)
|
||||
* BrowserWindow Enhancement: Add BrowserWindow.GetNativeWindowHandle() (thanks [kdlslyv](https://github.com/kdlslyv)) [\#429](https://github.com/ElectronNET/Electron.NET/pull/429)
|
||||
* HostHook-Api Enhancement: HostHook.CallAsync should use TaskCompletionSource.SetException instead of throwing exception (thanks [Fre V](https://github.com/freosc)) [\#430](https://github.com/ElectronNET/Electron.NET/pull/430)
|
||||
* MacOS Enhancement: Application exit logic (thanks [dafergu2](https://github.com/dafergu2)) [\#405](https://github.com/ElectronNET/Electron.NET/pull/405)
|
||||
* Fixed bug: ElectronNET.API.Entities.WebPreferences.ContextIsolation [DefaultValue(true)] [\#411](https://github.com/ElectronNET/Electron.NET/issues/411)
|
||||
|
||||
ElectronNET.WebApp (internal use):
|
||||
* Improvement debugging and testing new API calls (without install ElectronNET.CLI) (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
|
||||
* Fixed bug: Cannot find modules in ElectronHostHook (thanks [konstantingross](https://github.com/konstantingross)) [\#425](https://github.com/ElectronNET/Electron.NET/pull/425)
|
||||
|
||||
Thank you for donation [Phil Seeman](https://github.com/mpnow) ❤
|
||||
|
||||
# 8.31.2
|
||||
|
||||
ElectronNET.CLI:
|
||||
* New Feature: Deactivate PublishReadyToRun for build or start [\#395](https://github.com/ElectronNET/Electron.NET/issues/395)
|
||||
|
||||
`electronize build /target win /PublishReadyToRun false`
|
||||
`electronize start /PublishReadyToRun false`
|
||||
* Fixed bug: Application window doesn't open after packaging [\#387](https://github.com/ElectronNET/Electron.NET/issues/387)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: NativeImage Support (thanks [ThrDev](https://github.com/ThrDev)) [\#394](https://github.com/ElectronNET/Electron.NET/pull/394)
|
||||
* New Feature: Update menu items for context menu and system tray on-the-fly. [\#270](https://github.com/ElectronNET/Electron.NET/pull/270)
|
||||
|
||||
|
||||
# 8.31.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
* New Feature: Set a name and author of the app in `electron.manifest.json` [\#348](https://github.com/ElectronNET/Electron.NET/issues/348#issuecomment-615977950) [\#310](https://github.com/ElectronNET/Electron.NET/issues/310#issuecomment-617361086)
|
||||
* New Feature: Live reload (thanks [syedadeel2](https://github.com/syedadeel2)) [\#390](https://github.com/ElectronNET/Electron.NET/pull/390)
|
||||
`electronize start /watch`
|
||||
* New Feature: Every new window will created with an clear cache [\#273](https://github.com/ElectronNET/Electron.NET/issues/273)
|
||||
`electronize start /clear-cache`
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Native Electron 8.2.3 support, but not all new features (we search contributors)
|
||||
* New Feature: We incease the startup time for ~25-36% [\#356](https://github.com/ElectronNET/Electron.NET/issues/356)
|
||||
* New Feature: Added print capability (thanks [x-xx-o](https://github.com/x-xx-o)) [\#355](https://github.com/ElectronNET/Electron.NET/pull/355)
|
||||
* New Feature: BrowserView API [\#371](https://github.com/ElectronNET/Electron.NET/issues/371)
|
||||
* Changed App.GetNameAsync and App.SetNameAsync to the App.Name Property [\#350](https://github.com/ElectronNET/Electron.NET/issues/350)
|
||||
* Fixed bug: Splash Screen disappearing on click [\#357](https://github.com/ElectronNET/Electron.NET/issues/357)
|
||||
* Fixed bug: Start MenuRole enum at 1 (thanks [jjuback](https://github.com/jjuback)) [\#369](https://github.com/ElectronNET/Electron.NET/pull/369)
|
||||
* Fixed bug: BridgeConnector not connected (spam console) [\#347](https://github.com/ElectronNET/Electron.NET/issues/347)
|
||||
* Fixed bug: BrowserWindowOptions is not setting Width and Height properly [\#373](https://github.com/ElectronNET/Electron.NET/issues/373)
|
||||
* Fixed bug: IpcMain.Once(string) is not one time use, is not removing listener [\#366](https://github.com/ElectronNET/Electron.NET/issues/366)
|
||||
* Fixed bug: IpcMain.RemoveAllListeners(string) is not removing the listeners [\#365](https://github.com/ElectronNET/Electron.NET/issues/365)
|
||||
* Fixed bug: GetLoginItemSettingsAsync does not work [\#352](https://github.com/ElectronNET/Electron.NET/issues/352)
|
||||
* Fixed bug: Using OnReadyToShow to display the main window in Blazor does not seem to work with Show set to false [\#361](https://github.com/ElectronNET/Electron.NET/issues/361)
|
||||
* Fixed bug: Unable to disable WebSecurity along with NodeIntegration enabled [\#389](https://github.com/ElectronNET/Electron.NET/issues/389)
|
||||
|
||||
# 7.30.2
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* New Feature: Different manifest file support [\#340](https://github.com/ElectronNET/Electron.NET/issues/340)
|
||||
* Create a additional manifest file: `electronize init /manifest test`
|
||||
* Start the app with your additional manifest file: `electronize start /manifest electron.manifest.test.json`
|
||||
* Build the app with your additional manifest file: `electronize build /target win /manifest electron.manifest.test.json`.
|
||||
|
||||
* New Feature: Command Line support [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
|
||||
* You can start the app with: `electronize start /args --dog=woof --test=true`
|
||||
* Or as binary: `myapp.exe /args --dog=woof --test=true`
|
||||
* Fixed bug: Start process with listen port 8000 error. [\#308](https://github.com/ElectronNET/Electron.NET/issues/308) (thanks [thecodejedi](https://github.com/thecodejedi))
|
||||
* Fixed bug: `electronize build` with no arguments would throw a `KeyNotFoundException`. (thanks [jamiebrynes7](https://github.com/jamiebrynes7))
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Electron 7.1.2 support, but not all new features (we search contributors) [\#341](https://github.com/ElectronNET/Electron.NET/issues/341)
|
||||
* New Feature: Electron.App.CommandLine API [\#337](https://github.com/ElectronNET/Electron.NET/issues/337)
|
||||
* New Feature: Support of BrowserWindow.AddExtension, BrowserWindow.RemoveExtension, BrowserWindow.GetExtensions (thanks [Daddoon](https://github.com/Daddoon))
|
||||
|
||||
Thank you for donation [robertmclaws](https://github.com/robertmclaws) ❤
|
||||
|
||||
# 5.30.1
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Move to .NET Core 3.0
|
||||
* Use npm npx instead of global installations (thanks [jimbuck](https://github.com/jimbuck))
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Move to .NET Core 3.0
|
||||
* New Feature: Add BrowserWindow.RemoveMenu() (thanks [hack2root](https://github.com/hack2root))
|
||||
|
||||
Thanks to [MaherJendoubi](https://github.com/MaherJendoubi), [kant2002](https://github.com/kant2002), [raz-canva](https://github.com/raz-canva) and [Daddoon](https://github.com/Daddoon) to give .NET Core 3.0 feedback!
|
||||
# 5.22.14
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
* Fixed bug: Build fails with latest electron-builder version [\#288](https://github.com/ElectronNET/Electron.NET/issues/288)
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* New Feature: Full support for Auto Updater [(Based on electron-updater - Version 4.0.6)](https://www.electron.build/auto-update)
|
||||
* New Feature: Support for set a custom static Port to ASP.NET Backend [\#155](https://github.com/ElectronNET/Electron.NET/issues/155)
|
||||
* Fixed bug: Electron tray icon TypeError ([Electron original issue](https://github.com/electron/electron/issues/7657)) (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
* Fixed bug: Wrong tray icon path in the application built via `electronize build` command (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
* Fixed bug: fix async issue where same port is considered open [\#261](https://github.com/ElectronNET/Electron.NET/issues/261) (thanks [netpoetica](https://github.com/netpoetica))
|
||||
|
||||
ElectronNET.WebApp:
|
||||
|
||||
* Fixed usage of the `Electron.Tray.Show` according fixed bugs in the ElectronNET.CLI (thanks [Tum4ik](https://github.com/Tum4ik))
|
||||
|
||||
# 5.22.13
|
||||
|
||||
ElectronNET.API:
|
||||
|
||||
* Fixed bug: Menu Item visibility [\#257](https://github.com/ElectronNET/Electron.NET/issues/257)
|
||||
* Fixed bug: electron.manifest.json - singleInstance not working [\#258](https://github.com/ElectronNET/Electron.NET/issues/258)
|
||||
* Fixed security issue: ASP.NET Core process is now bound to 127.0.0.1 instead of the broader localhost [\#258](https://github.com/ElectronNET/Electron.NET/pull/266)
|
||||
|
||||
ElectronNET.WebApp:
|
||||
|
||||
|
||||
# 5.22.12
|
||||
|
||||
ElectronNET.CLI:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,96 +0,0 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Enable apps to automatically update themselves. Based on electron-updater.
|
||||
/// </summary>
|
||||
public sealed class AutoUpdater
|
||||
{
|
||||
private static AutoUpdater _autoUpdater;
|
||||
private static object _syncRoot = new object();
|
||||
|
||||
internal AutoUpdater() { }
|
||||
|
||||
internal static AutoUpdater Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_autoUpdater == null)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_autoUpdater == null)
|
||||
{
|
||||
_autoUpdater = new AutoUpdater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _autoUpdater;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asks the server whether there is an update.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<UpdateCheckResult> CheckForUpdatesAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<UpdateCheckResult>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesComplete" + guid, (updateCheckResult) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesComplete" + guid);
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdates", guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asks the server whether there is an update.
|
||||
///
|
||||
/// This will immediately download an update, then install when the app quits.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<UpdateCheckResult>();
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
|
||||
BridgeConnector.Socket.On("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid, (updateCheckResult) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("autoUpdaterCheckForUpdatesAndNotifyComplete" + guid);
|
||||
taskCompletionSource.SetResult(JObject.Parse(updateCheckResult.ToString()).ToObject<UpdateCheckResult>());
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("autoUpdaterCheckForUpdatesAndNotify", guid);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restarts the app and installs the update after it has been downloaded.
|
||||
/// It should only be called after `update-downloaded` has been emitted.
|
||||
///
|
||||
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
|
||||
/// This is different from the normal quit event sequence.
|
||||
/// </summary>
|
||||
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
|
||||
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
|
||||
public void QuitAndInstall(bool isSilent = false, bool isForceRunAfter = false)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("autoUpdaterQuitAndInstall", isSilent, isForceRunAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using Quobject.SocketIoClientDotNet.Client;
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
internal static class BridgeConnector
|
||||
{
|
||||
private static Socket _socket;
|
||||
private static object _syncRoot = new object();
|
||||
|
||||
public static Socket Socket
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_socket == null && HybridSupport.IsElectronActive)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_socket == null && HybridSupport.IsElectronActive)
|
||||
{
|
||||
_socket = IO.Socket("http://localhost:" + BridgeSettings.SocketPort);
|
||||
_socket.On(Socket.EVENT_CONNECT, () =>
|
||||
{
|
||||
Console.WriteLine("BridgeConnector connected!");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(_socket == null && !HybridSupport.IsElectronActive)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_socket == null && !HybridSupport.IsElectronActive)
|
||||
{
|
||||
_socket = IO.Socket(new Uri("http://localhost"), new IO.Options { AutoConnect = false });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _socket;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum DockBounceType
|
||||
{
|
||||
/// <summary>
|
||||
/// The critical
|
||||
/// </summary>
|
||||
critical,
|
||||
|
||||
/// <summary>
|
||||
/// The informational
|
||||
/// </summary>
|
||||
informational
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class Error
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the stack.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The stack.
|
||||
/// </value>
|
||||
public string Stack { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum HighlightMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Highlight the tray icon when it is clicked and also when its context menu is open. This is the default.
|
||||
/// </summary>
|
||||
selection,
|
||||
|
||||
/// <summary>
|
||||
/// Always highlight the tray icon.
|
||||
/// </summary>
|
||||
always,
|
||||
|
||||
/// <summary>
|
||||
/// Never highlight the tray icon.
|
||||
/// </summary>
|
||||
never,
|
||||
|
||||
/// <summary>
|
||||
/// Activate highlight the tray icon.
|
||||
/// </summary>
|
||||
on,
|
||||
|
||||
/// <summary>
|
||||
/// Deactivate highlight the tray icon.
|
||||
/// </summary>
|
||||
off
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class LoginItemSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// true if the app is set to open at login.
|
||||
/// </summary>
|
||||
public bool OpenAtLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// true if the app is set to open as hidden at login. This setting is only
|
||||
/// supported on macOS.
|
||||
/// </summary>
|
||||
public bool OpenAsHidden { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// true if the app was opened at login automatically. This setting is only
|
||||
/// supported on macOS.
|
||||
/// </summary>
|
||||
public bool WasOpenedAtLogin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// true if the app was opened as a hidden login item. This indicates that the app
|
||||
/// should not open any windows at startup.This setting is only supported on macOS.
|
||||
/// </summary>
|
||||
public bool WasOpenedAsHidden { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// true if the app was opened as a login item that should restore the state from
|
||||
/// the previous session.This indicates that the app should restore the windows
|
||||
/// that were open the last time the app was closed.This setting is only supported
|
||||
/// on macOS.
|
||||
/// </summary>
|
||||
public bool RestoreState { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
// TODO: Need some of real code :)
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class NativeImage
|
||||
{
|
||||
// public static NativeImage CreateEmpty()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromBuffer(byte[] buffer)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromBuffer(byte[] buffer, CreateFromBufferOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromDataURL(string dataURL)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public static NativeImage CreateFromPath(string path)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public void AddRepresentation(AddRepresentationOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public NativeImage Crop(Rectangle rect)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public int GetAspectRatio()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] GetBitmap()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] GetBitmap(BitmapOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] GetNativeHandle()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public Size GetSize()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public bool IsEmpty()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public bool IsTemplateImage()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public NativeImage Resize(ResizeOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public void SetTemplateImage(bool option)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] ToBitmap(ToBitmapOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public string ToDataURL(ToDataURLOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] ToJPEG(int quality)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
|
||||
// public byte[] ToPNG(ToPNGOptions options)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class OpenExternalOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// true to bring the opened application to the foreground. The default is true.
|
||||
/// </summary>
|
||||
[DefaultValue(true)]
|
||||
public bool Activate { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class PrintToPDFOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the type of margins to use. Uses 0 for default margin, 1 for no
|
||||
/// margin, and 2 for minimum margin.
|
||||
/// </summary>
|
||||
public int MarginsType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specify page size of the generated PDF. Can be A3, A4, A5, Legal, Letter,
|
||||
/// Tabloid or an Object containing height and width in microns.
|
||||
/// </summary>
|
||||
public string PageSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to print CSS backgrounds.
|
||||
/// </summary>
|
||||
public bool PrintBackground { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to print selection only.
|
||||
/// </summary>
|
||||
public bool PrintSelectionOnly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// true for landscape, false for portrait.
|
||||
/// </summary>
|
||||
public bool Landscape { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ProcessMetric
|
||||
{
|
||||
/// <summary>
|
||||
/// CPU usage of the process.
|
||||
/// </summary>
|
||||
public CPUUsage Cpu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memory information for the process.
|
||||
/// </summary>
|
||||
public MemoryInfo Memory {get; set;}
|
||||
|
||||
/// <summary>
|
||||
/// Process id of the process.
|
||||
/// </summary>
|
||||
public int Pid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Process type (Browser or Tab or GPU etc).
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class RemoveClientCertificate
|
||||
{
|
||||
/// <summary>
|
||||
/// Origin of the server whose associated client certificate must be removed from
|
||||
/// the cache.
|
||||
/// </summary>
|
||||
public string Origin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// clientCertificate.
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="origin">Origin of the server whose associated client certificate
|
||||
/// must be removed from the cache.</param>
|
||||
/// <param name="type">clientCertificate.</param>
|
||||
public RemoveClientCertificate(string origin, string type)
|
||||
{
|
||||
Origin = origin;
|
||||
Type = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,251 +0,0 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Manage files and URLs using their default applications.
|
||||
/// </summary>
|
||||
public sealed class Shell
|
||||
{
|
||||
private static Shell _shell;
|
||||
private static object _syncRoot = new object();
|
||||
|
||||
internal Shell() { }
|
||||
|
||||
internal static Shell Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_shell == null)
|
||||
{
|
||||
lock (_syncRoot)
|
||||
{
|
||||
if (_shell == null)
|
||||
{
|
||||
_shell = new Shell();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _shell;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show the given file in a file manager. If possible, select the file.
|
||||
/// </summary>
|
||||
/// <param name="fullPath"></param>
|
||||
/// <returns>Whether the item was successfully shown.</returns>
|
||||
public Task<bool> ShowItemInFolderAsync(string fullPath)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-showItemInFolderCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-showItemInFolderCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-showItemInFolder", fullPath);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the given file in the desktop’s default manner.
|
||||
/// </summary>
|
||||
/// <param name="fullPath"></param>
|
||||
/// <returns>Whether the item was successfully opened.</returns>
|
||||
public Task<bool> OpenItemAsync(string fullPath)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-openItemCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-openItemCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-openItem", fullPath);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s default mail agent).
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns>Whether an application was available to open the URL.
|
||||
/// If callback is specified, always returns true.</returns>
|
||||
public Task<bool> OpenExternalAsync(string url)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-openExternalCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-openExternal", url);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s default mail agent).
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="options">macOS only</param>
|
||||
/// <returns>Whether an application was available to open the URL.
|
||||
/// If callback is specified, always returns true.</returns>
|
||||
public Task<bool> OpenExternalAsync(string url, OpenExternalOptions options)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-openExternalCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-openExternal", url, JObject.FromObject(options, _jsonSerializer));
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Open the given external protocol URL in the desktop’s default manner.
|
||||
/// (For example, mailto: URLs in the user’s default mail agent).
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="options">macOS only</param>
|
||||
/// <param name="errorAction">Action to get the error message.</param>
|
||||
/// <returns>Whether an application was available to open the URL.
|
||||
/// If callback is specified, always returns true.</returns>
|
||||
public Task<bool> OpenExternalAsync(string url, OpenExternalOptions options, Action<Error> errorAction)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-openExternalCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-openExternalCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Off("shell-openExternalCallback");
|
||||
BridgeConnector.Socket.On("shell-openExternalCallback", (args) => {
|
||||
var urlKey = ((JArray)args).First.ToString();
|
||||
var error = ((JArray)args).Last.ToObject<Error>();
|
||||
|
||||
if(_openExternalCallbacks.ContainsKey(urlKey))
|
||||
{
|
||||
_openExternalCallbacks[urlKey](error);
|
||||
}
|
||||
});
|
||||
|
||||
_openExternalCallbacks.Add(url, errorAction);
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-openExternal", url, JObject.FromObject(options, _jsonSerializer), true);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private Dictionary<string, Action<Error>> _openExternalCallbacks = new Dictionary<string, Action<Error>>();
|
||||
|
||||
/// <summary>
|
||||
/// Move the given file to trash and returns a boolean status for the operation.
|
||||
/// </summary>
|
||||
/// <param name="fullPath"></param>
|
||||
/// <returns> Whether the item was successfully moved to the trash.</returns>
|
||||
public Task<bool> MoveItemToTrashAsync(string fullPath)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-moveItemToTrashCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-moveItemToTrashCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-moveItemToTrash", fullPath);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Play the beep sound.
|
||||
/// </summary>
|
||||
public void Beep()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("shell-beep");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates or updates a shortcut link at shortcutPath.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath"></param>
|
||||
/// <param name="operation"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>Whether the shortcut was created successfully.</returns>
|
||||
public Task<bool> WriteShortcutLinkAsync(string shortcutPath, ShortcutLinkOperation operation, ShortcutDetails options)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-writeShortcutLinkCompleted", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-writeShortcutLinkCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-writeShortcutLink", shortcutPath, operation.ToString(), JObject.FromObject(options, _jsonSerializer));
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the shortcut link at shortcutPath.
|
||||
///
|
||||
/// An exception will be thrown when any error happens.
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ShortcutDetails> ReadShortcutLinkAsync(string shortcutPath)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<ShortcutDetails>();
|
||||
|
||||
BridgeConnector.Socket.On("shell-readShortcutLinkCompleted", (shortcutDetails) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("shell-readShortcutLinkCompleted");
|
||||
|
||||
taskCompletionSource.SetResult((ShortcutDetails)shortcutDetails);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("shell-readShortcutLink", shortcutPath);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Render and control web pages.
|
||||
/// </summary>
|
||||
public class WebContents
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the identifier.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The identifier.
|
||||
/// </value>
|
||||
public int Id { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Manage browser sessions, cookies, cache, proxy settings, etc.
|
||||
/// </summary>
|
||||
public Session Session { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the renderer process crashes or is killed.
|
||||
/// </summary>
|
||||
public event Action<bool> OnCrashed
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_crashed == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-crashed" + Id, (killed) =>
|
||||
{
|
||||
_crashed((bool)killed);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-crashed", Id);
|
||||
}
|
||||
_crashed += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_crashed -= value;
|
||||
|
||||
if (_crashed == null)
|
||||
BridgeConnector.Socket.Off("webContents-crashed" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action<bool> _crashed;
|
||||
|
||||
/// <summary>
|
||||
/// Emitted when the navigation is done, i.e. the spinner of the tab has
|
||||
/// stopped spinning, and the onload event was dispatched.
|
||||
/// </summary>
|
||||
public event Action OnDidFinishLoad
|
||||
{
|
||||
add
|
||||
{
|
||||
if (_didFinishLoad == null)
|
||||
{
|
||||
BridgeConnector.Socket.On("webContents-didFinishLoad" + Id, () =>
|
||||
{
|
||||
_didFinishLoad();
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("register-webContents-didFinishLoad", Id);
|
||||
}
|
||||
_didFinishLoad += value;
|
||||
}
|
||||
remove
|
||||
{
|
||||
_didFinishLoad -= value;
|
||||
|
||||
if (_didFinishLoad == null)
|
||||
BridgeConnector.Socket.Off("webContents-didFinishLoad" + Id);
|
||||
}
|
||||
}
|
||||
|
||||
private event Action _didFinishLoad;
|
||||
|
||||
internal WebContents(int id)
|
||||
{
|
||||
Id = id;
|
||||
Session = new Session(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools.
|
||||
/// </summary>
|
||||
public void OpenDevTools()
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the devtools.
|
||||
/// </summary>
|
||||
/// <param name="openDevToolsOptions"></param>
|
||||
public void OpenDevTools(OpenDevToolsOptions openDevToolsOptions)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContentsOpenDevTools", Id, JObject.FromObject(openDevToolsOptions, _jsonSerializer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints window's web page as PDF with Chromium's preview printing custom
|
||||
/// settings.The landscape will be ignored if @page CSS at-rule is used in the web page.
|
||||
/// By default, an empty options will be regarded as: Use page-break-before: always;
|
||||
/// CSS style to force to print to a new page.
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns>success</returns>
|
||||
public Task<bool> PrintToPDFAsync(string path, PrintToPDFOptions options = null)
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
|
||||
BridgeConnector.Socket.On("webContents-printToPDF-completed", (success) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off("webContents-printToPDF-completed");
|
||||
taskCompletionSource.SetResult((bool)success);
|
||||
});
|
||||
|
||||
if(options == null)
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, "", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
BridgeConnector.Socket.Emit("webContents-printToPDF", Id, JObject.FromObject(options, _jsonSerializer), path);
|
||||
}
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is used to get the Url of the loaded page.
|
||||
/// It's usefull if a web-server redirects you and you need to know where it redirects. For instance, It's useful in case of Implicit Authorization.
|
||||
/// </summary>
|
||||
/// <returns>URL of the loaded page</returns>
|
||||
public Task<string> GetUrl()
|
||||
{
|
||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||
|
||||
var eventString = "webContents-getUrl" + Id;
|
||||
BridgeConnector.Socket.On(eventString, (url) =>
|
||||
{
|
||||
BridgeConnector.Socket.Off(eventString);
|
||||
taskCompletionSource.SetResult((string)url);
|
||||
});
|
||||
|
||||
BridgeConnector.Socket.Emit("webContents-getUrl", Id);
|
||||
|
||||
return taskCompletionSource.Task;
|
||||
}
|
||||
|
||||
private JsonSerializer _jsonSerializer = new JsonSerializer()
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.API
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class WebHostBuilderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Use a Electron support for this .NET Core Project.
|
||||
/// </summary>
|
||||
/// <param name="builder">The builder.</param>
|
||||
/// <param name="args">The arguments.</param>
|
||||
/// <returns></returns>
|
||||
public static IWebHostBuilder UseElectron(this IWebHostBuilder builder, string[] args)
|
||||
{
|
||||
foreach (string argument in args)
|
||||
{
|
||||
if (argument.ToUpper().Contains("ELECTRONPORT"))
|
||||
{
|
||||
BridgeSettings.SocketPort = argument.ToUpper().Replace("/ELECTRONPORT=", "");
|
||||
Console.WriteLine("Use Electron Port: " + BridgeSettings.SocketPort);
|
||||
} else if(argument.ToUpper().Contains("ELECTRONWEBPORT"))
|
||||
{
|
||||
BridgeSettings.WebPort = argument.ToUpper().Replace("/ELECTRONWEBPORT=", "");
|
||||
}
|
||||
}
|
||||
|
||||
if(HybridSupport.IsElectronActive)
|
||||
{
|
||||
builder.UseContentRoot(AppDomain.CurrentDomain.BaseDirectory)
|
||||
.UseUrls("http://127.0.0.1:" + BridgeSettings.WebPort);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +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 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, "dialog.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.");
|
||||
|
||||
string splashscreenFolder = Path.Combine(tempPath, "splashscreen");
|
||||
if (Directory.Exists(splashscreenFolder) == false)
|
||||
{
|
||||
Directory.CreateDirectory(splashscreenFolder);
|
||||
}
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(splashscreenFolder, "index.html", "splashscreen.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ElectronNET.CLI.Commands
|
||||
{
|
||||
public class AddCommand : ICommand
|
||||
{
|
||||
public const string COMMAND_NAME = "add";
|
||||
public const string COMMAND_DESCRIPTION = "The add command needs to be invoked via 'add hosthook'. This creates a special folder for your custom npm package installation.";
|
||||
public const string COMMAND_ARGUMENTS = "hosthook";
|
||||
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
|
||||
|
||||
|
||||
private string[] _args;
|
||||
|
||||
public AddCommand(string[] args)
|
||||
{
|
||||
_args = args;
|
||||
}
|
||||
|
||||
private static string ElectronHostHookFolderName = "ElectronHostHook";
|
||||
|
||||
public Task<bool> ExecuteAsync()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if(_args.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Specify 'hosthook' to add custom npm packages.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(_args[0].ToLowerInvariant() != "hosthook")
|
||||
{
|
||||
Console.WriteLine("Specify 'hosthook' to add custom npm packages.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string aspCoreProjectPath = "";
|
||||
|
||||
// Maybe ToDo: Adding the possiblity to specify a path (like we did in the InitCommand, but this would require a better command args parser)
|
||||
aspCoreProjectPath = Directory.GetCurrentDirectory();
|
||||
|
||||
var currentDirectory = aspCoreProjectPath;
|
||||
|
||||
var targetFilePath = Path.Combine(currentDirectory, ElectronHostHookFolderName);
|
||||
|
||||
if(Directory.Exists(targetFilePath))
|
||||
{
|
||||
Console.WriteLine("ElectronHostHook directory already in place. If you want to start over, delete the folder and invoke this command again.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLine("Adding the ElectronHostHook folder to your project...");
|
||||
|
||||
Directory.CreateDirectory(targetFilePath);
|
||||
|
||||
// Deploy related files
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "index.ts", "ElectronHostHook.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "connector.ts", "ElectronHostHook.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "package.json", "ElectronHostHook.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, "tsconfig.json", "ElectronHostHook.");
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(targetFilePath, ".gitignore", "ElectronHostHook.");
|
||||
|
||||
// npm for typescript compiler etc.
|
||||
Console.WriteLine("Start npm install...");
|
||||
ProcessHelper.CmdExecute("npm install", targetFilePath);
|
||||
|
||||
// run typescript compiler
|
||||
string tscPath = Path.Combine(targetFilePath, "node_modules", ".bin");
|
||||
// ToDo: Not sure if this runs under linux/macos
|
||||
ProcessHelper.CmdExecute(@"tsc -p ../../", tscPath);
|
||||
|
||||
// search .csproj
|
||||
Console.WriteLine($"Search your .csproj to add configure CopyToPublishDirectory to 'Never'");
|
||||
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly).FirstOrDefault();
|
||||
|
||||
Console.WriteLine($"Found your .csproj: {projectFile} - check for existing CopyToPublishDirectory setting or update it.");
|
||||
|
||||
if (!EditCsProj(projectFile)) return false;
|
||||
|
||||
Console.WriteLine($"Everything done - happy electronizing with your custom npm packages!");
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
// ToDo: Cleanup this copy/past code.
|
||||
private static bool EditCsProj(string projectFile)
|
||||
{
|
||||
using (var stream = File.Open(projectFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||
{
|
||||
var xmlDocument = XDocument.Load(stream);
|
||||
|
||||
var projectElement = xmlDocument.Descendants("Project").FirstOrDefault();
|
||||
if (projectElement == null || projectElement.Attribute("Sdk")?.Value != "Microsoft.NET.Sdk.Web")
|
||||
{
|
||||
Console.WriteLine(
|
||||
$"Project file is not a compatible type of 'Microsoft.NET.Sdk.Web'. Your project: {projectElement?.Attribute("Sdk")?.Value}");
|
||||
return false;
|
||||
}
|
||||
|
||||
string itemGroupXmlString = "<ItemGroup>" +
|
||||
"<Content Update=\"ElectronHostHook\\**\\*.*\">" +
|
||||
"<CopyToPublishDirectory>Never</CopyToPublishDirectory>" +
|
||||
"</Content>" +
|
||||
"</ItemGroup>";
|
||||
|
||||
var newItemGroupForConfig = XElement.Parse(itemGroupXmlString);
|
||||
xmlDocument.Root.Add(newItemGroupForConfig);
|
||||
|
||||
stream.SetLength(0);
|
||||
stream.Position = 0;
|
||||
|
||||
var xws = new XmlWriterSettings
|
||||
{
|
||||
OmitXmlDeclaration = true,
|
||||
Indent = true
|
||||
};
|
||||
using (XmlWriter xw = XmlWriter.Create(stream, xws))
|
||||
{
|
||||
xmlDocument.Save(xw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine($"Publish setting added in csproj!");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace ElectronNET.CLI.Commands
|
||||
{
|
||||
public class InitCommand : ICommand
|
||||
{
|
||||
public const string COMMAND_NAME = "init";
|
||||
public const string COMMAND_DESCRIPTION = "Creates the needed Electron.NET config for your Electron Application.";
|
||||
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
|
||||
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
|
||||
|
||||
private const string ConfigName = "electron.manifest.json";
|
||||
|
||||
private string[] _args;
|
||||
|
||||
public InitCommand(string[] args)
|
||||
{
|
||||
_args = args;
|
||||
}
|
||||
|
||||
public Task<bool> ExecuteAsync()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
string aspCoreProjectPath = "";
|
||||
|
||||
if (_args.Length > 0)
|
||||
{
|
||||
if (Directory.Exists(_args[0]))
|
||||
{
|
||||
aspCoreProjectPath = _args[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aspCoreProjectPath = Directory.GetCurrentDirectory();
|
||||
}
|
||||
|
||||
var currentDirectory = aspCoreProjectPath;
|
||||
|
||||
Console.WriteLine("Adding our config file to your project...");
|
||||
|
||||
var targetFilePath = Path.Combine(currentDirectory, ConfigName);
|
||||
|
||||
if (File.Exists(targetFilePath))
|
||||
{
|
||||
Console.WriteLine("Config file already in your project.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Deploy config file
|
||||
EmbeddedFileHelper.DeployEmbeddedFile(currentDirectory, ConfigName);
|
||||
|
||||
// search .csproj
|
||||
Console.WriteLine($"Search your .csproj to add the needed {ConfigName}...");
|
||||
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly).FirstOrDefault();
|
||||
|
||||
// update config file with the name of the csproj
|
||||
// ToDo: If the csproj name != application name, this will fail
|
||||
string text = File.ReadAllText(targetFilePath);
|
||||
text = text.Replace("{{executable}}", Path.GetFileNameWithoutExtension(projectFile));
|
||||
File.WriteAllText(targetFilePath, text);
|
||||
|
||||
Console.WriteLine($"Found your .csproj: {projectFile} - check for existing config or update it.");
|
||||
|
||||
if (!EditCsProj(projectFile)) return false;
|
||||
|
||||
// search launchSettings.json
|
||||
Console.WriteLine($"Search your .launchSettings to add our electron debug profile...");
|
||||
|
||||
EditLaunchSettings(currentDirectory);
|
||||
|
||||
Console.WriteLine($"Everything done - happy electronizing!");
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private static void EditLaunchSettings(string currentDirectory)
|
||||
{
|
||||
// super stupid implementation, but because there is no nativ way to parse json
|
||||
// and cli extensions and other nuget packages are buggy
|
||||
// this is should solve the problem for 80% of the users
|
||||
// for the other 20% we might fail...
|
||||
var launchSettingFile = Path.Combine(currentDirectory, "Properties", "launchSettings.json");
|
||||
|
||||
if (File.Exists(launchSettingFile) == false)
|
||||
{
|
||||
Console.WriteLine("launchSettings.json not found - do nothing.");
|
||||
return;
|
||||
}
|
||||
|
||||
string launchSettingText = File.ReadAllText(launchSettingFile);
|
||||
|
||||
if (launchSettingText.Contains("\"executablePath\": \"electronize\"") == false)
|
||||
{
|
||||
StringBuilder debugProfileBuilder = new StringBuilder();
|
||||
debugProfileBuilder.AppendLine("profiles\": {");
|
||||
debugProfileBuilder.AppendLine(" \"Electron.NET App\": {");
|
||||
debugProfileBuilder.AppendLine(" \"commandName\": \"Executable\",");
|
||||
debugProfileBuilder.AppendLine(" \"executablePath\": \"electronize\",");
|
||||
debugProfileBuilder.AppendLine(" \"commandLineArgs\": \"start\",");
|
||||
debugProfileBuilder.AppendLine(" \"workingDirectory\": \".\"");
|
||||
debugProfileBuilder.AppendLine(" },");
|
||||
|
||||
launchSettingText = launchSettingText.Replace("profiles\": {", debugProfileBuilder.ToString());
|
||||
File.WriteAllText(launchSettingFile, launchSettingText);
|
||||
|
||||
Console.WriteLine($"Debug profile added!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Debug profile already existing");
|
||||
}
|
||||
}
|
||||
|
||||
private static bool EditCsProj(string projectFile)
|
||||
{
|
||||
using (var stream = File.Open(projectFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
||||
{
|
||||
var xmlDocument = XDocument.Load(stream);
|
||||
|
||||
var projectElement = xmlDocument.Descendants("Project").FirstOrDefault();
|
||||
if (projectElement == null || projectElement.Attribute("Sdk")?.Value != "Microsoft.NET.Sdk.Web")
|
||||
{
|
||||
Console.WriteLine(
|
||||
$"Project file is not a compatible type of 'Microsoft.NET.Sdk.Web'. Your project: {projectElement?.Attribute("Sdk")?.Value}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xmlDocument.ToString().Contains($"Content Update=\"{ConfigName}\""))
|
||||
{
|
||||
Console.WriteLine($"{ConfigName} already in csproj.");
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLine($"{ConfigName} will be added to csproj.");
|
||||
|
||||
string itemGroupXmlString = "<ItemGroup>" +
|
||||
"<Content Update=\"" + ConfigName + "\">" +
|
||||
"<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>" +
|
||||
"</Content>" +
|
||||
"</ItemGroup>";
|
||||
|
||||
var newItemGroupForConfig = XElement.Parse(itemGroupXmlString);
|
||||
xmlDocument.Root.Add(newItemGroupForConfig);
|
||||
|
||||
stream.SetLength(0);
|
||||
stream.Position = 0;
|
||||
|
||||
var xws = new XmlWriterSettings
|
||||
{
|
||||
OmitXmlDeclaration = true,
|
||||
Indent = true
|
||||
};
|
||||
using (XmlWriter xw = XmlWriter.Create(stream, xws))
|
||||
{
|
||||
xmlDocument.Save(xw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine($"{ConfigName} added in csproj!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using ElectronNET.CLI.Commands.Actions;
|
||||
|
||||
namespace ElectronNET.CLI.Commands
|
||||
{
|
||||
public class StartElectronCommand : ICommand
|
||||
{
|
||||
public const string COMMAND_NAME = "start";
|
||||
public const string COMMAND_DESCRIPTION = "Start your ASP.NET Core Application with Electron, without package it as a single exe. Faster for development.";
|
||||
public const string COMMAND_ARGUMENTS = "<Path> from ASP.NET Core Project.";
|
||||
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
|
||||
|
||||
private string[] _args;
|
||||
|
||||
public StartElectronCommand(string[] args)
|
||||
{
|
||||
_args = args;
|
||||
}
|
||||
|
||||
public Task<bool> ExecuteAsync()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
Console.WriteLine("Start Electron Desktop Application...");
|
||||
|
||||
string aspCoreProjectPath = "";
|
||||
|
||||
if (_args.Length > 0)
|
||||
{
|
||||
if (Directory.Exists(_args[0]))
|
||||
{
|
||||
aspCoreProjectPath = _args[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aspCoreProjectPath = Directory.GetCurrentDirectory();
|
||||
}
|
||||
|
||||
string tempPath = Path.Combine(aspCoreProjectPath, "obj", "Host");
|
||||
if (Directory.Exists(tempPath) == false)
|
||||
{
|
||||
Directory.CreateDirectory(tempPath);
|
||||
}
|
||||
|
||||
var platformInfo = GetTargetPlatformInformation.Do(string.Empty, string.Empty);
|
||||
|
||||
string tempBinPath = Path.Combine(tempPath, "bin");
|
||||
var resultCode = ProcessHelper.CmdExecute($"dotnet publish -r {platformInfo.NetCorePublishRid} --output \"{tempBinPath}\"", aspCoreProjectPath);
|
||||
|
||||
if (resultCode != 0)
|
||||
{
|
||||
Console.WriteLine("Error occurred during dotnet publish: " + resultCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
DeployEmbeddedElectronFiles.Do(tempPath);
|
||||
|
||||
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
|
||||
|
||||
Console.WriteLine("node_modules missing in: " + nodeModulesDirPath);
|
||||
|
||||
Console.WriteLine("Start npm install...");
|
||||
ProcessHelper.CmdExecute("npm install", tempPath);
|
||||
|
||||
Console.WriteLine("ElectronHostHook handling started...");
|
||||
|
||||
string electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook");
|
||||
|
||||
if (Directory.Exists(electronhosthookDir))
|
||||
{
|
||||
string hosthookDir = Path.Combine(tempPath, "ElectronHostHook");
|
||||
DirectoryCopy.Do(electronhosthookDir, hosthookDir, true, new List<string>() { "node_modules" });
|
||||
|
||||
Console.WriteLine("Start npm install for hosthooks...");
|
||||
ProcessHelper.CmdExecute("npm install", hosthookDir);
|
||||
|
||||
string tscPath = Path.Combine(tempPath, "node_modules", ".bin");
|
||||
// ToDo: Not sure if this runs under linux/macos
|
||||
ProcessHelper.CmdExecute(@"tsc -p ../../ElectronHostHook", tscPath);
|
||||
}
|
||||
|
||||
string path = Path.Combine(tempPath, "node_modules", ".bin");
|
||||
|
||||
|
||||
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
if (isWindows)
|
||||
{
|
||||
Console.WriteLine("Invoke electron.cmd - in dir: " + path);
|
||||
ProcessHelper.CmdExecute(@"electron.cmd ""..\..\main.js""", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invoke electron - in dir: " + path);
|
||||
ProcessHelper.CmdExecute(@"./electron ""../../main.js""", path);
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<AssemblyName>electronize</AssemblyName>
|
||||
|
||||
<PackageType>DotnetCliTool</PackageType>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
<PackageOutputPath>..\artifacts</PackageOutputPath>
|
||||
<PackageId>ElectronNET.CLI</PackageId>
|
||||
<Version>1.0.0.0</Version>
|
||||
<Authors>Gregor Biswanger, Robert Muehsig</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>
|
||||
<PackageIconUrl>https://raw.githubusercontent.com/ElectronNET/Electron.NET/master/assets/images/electron.net-logo-square.png</PackageIconUrl>
|
||||
<PackAsTool>true</PackAsTool>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="ElectronHost\package-lock.json" />
|
||||
<None Remove="ElectronHost\package.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DocumentationFile></DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\electron.manifest.json" Link="ElectronHost\electron.manifest.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\package.json" Link="ElectronHost\package.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\main.js" Link="ElectronHost\main.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\build-helper.js" Link="ElectronHost\build-helper.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\ipc.js" Link="ElectronHost\api\ipc.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\splashscreen\index.html" Link="ElectronHost\splashscreen\index.html" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\app.js" Link="ElectronHost\api\app.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\browserWindows.js" Link="ElectronHost\api\browserWindows.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\dialog.js" Link="ElectronHost\api\dialog.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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\clipboard.js" Link="ElectronHost\api\clipboard.js" />
|
||||
<EmbeddedResource Include="..\ElectronNET.Host\api\autoUpdater.js" Link="ElectronHost\api\autoUpdater.js" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</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>
|
||||
@@ -1,97 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ElectronNET.CLI
|
||||
{
|
||||
public class ProcessHelper
|
||||
{
|
||||
private readonly static Regex ErrorRegex = new Regex(@"\berror\b", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
public static int CmdExecute(string command, string workingDirectoryPath, bool output = true, bool waitForExit = true)
|
||||
{
|
||||
using (Process cmd = new Process())
|
||||
{
|
||||
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
|
||||
if (isWindows)
|
||||
{
|
||||
cmd.StartInfo.FileName = "cmd.exe";
|
||||
}
|
||||
else
|
||||
{
|
||||
// works for OSX and Linux (at least on Ubuntu)
|
||||
cmd.StartInfo.FileName = "bash";
|
||||
}
|
||||
|
||||
cmd.StartInfo.RedirectStandardInput = true;
|
||||
cmd.StartInfo.RedirectStandardOutput = true;
|
||||
cmd.StartInfo.RedirectStandardError = true;
|
||||
cmd.StartInfo.CreateNoWindow = true;
|
||||
cmd.StartInfo.UseShellExecute = false;
|
||||
cmd.StartInfo.WorkingDirectory = workingDirectoryPath;
|
||||
|
||||
int returnCode = 0;
|
||||
|
||||
if (output)
|
||||
{
|
||||
cmd.OutputDataReceived += (s, e) =>
|
||||
{
|
||||
// (sometimes error messages are only visbile here)
|
||||
// poor mans solution, we just seek for the term 'error'
|
||||
|
||||
// we can't just use cmd.ExitCode, because
|
||||
// we delegate it to cmd.exe, which runs fine
|
||||
// but we can catch any error here and return
|
||||
// 1 if something fails
|
||||
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
|
||||
{
|
||||
if (ErrorRegex.IsMatch(e.Data))
|
||||
{
|
||||
returnCode = 1;
|
||||
}
|
||||
|
||||
Console.WriteLine(e.Data);
|
||||
}
|
||||
|
||||
};
|
||||
cmd.ErrorDataReceived += (s, e) =>
|
||||
{
|
||||
// poor mans solution, we just seek for the term 'error'
|
||||
|
||||
// we can't just use cmd.ExitCode, because
|
||||
// we delegate it to cmd.exe, which runs fine
|
||||
// but we can catch any error here and return
|
||||
// 1 if something fails
|
||||
if (e != null && string.IsNullOrWhiteSpace(e.Data) == false)
|
||||
{
|
||||
if (ErrorRegex.IsMatch(e.Data))
|
||||
{
|
||||
returnCode = 1;
|
||||
}
|
||||
|
||||
Console.WriteLine(e.Data);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
cmd.Start();
|
||||
cmd.BeginOutputReadLine();
|
||||
cmd.BeginErrorReadLine();
|
||||
|
||||
cmd.StandardInput.WriteLine(command);
|
||||
cmd.StandardInput.Flush();
|
||||
cmd.StandardInput.Close();
|
||||
|
||||
if (waitForExit)
|
||||
{
|
||||
cmd.WaitForExit();
|
||||
}
|
||||
|
||||
return returnCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"profiles": {
|
||||
"ElectronNET.CLI": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "build \"C:\\Users\\Gregor\\Documents\\Visual Studio 2017\\Projects\\ElectronNET\\ElectronNET.WebApp\""
|
||||
}
|
||||
}
|
||||
}
|
||||
16
ElectronNET.Host/.vscode/launch.json
vendored
16
ElectronNET.Host/.vscode/launch.json
vendored
@@ -1,16 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Electron App",
|
||||
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
|
||||
"program": "${workspaceFolder}/main.js",
|
||||
"sourceMaps": true
|
||||
}
|
||||
]
|
||||
}
|
||||
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,27 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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 { Connector } from "./connector";
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "electron-host-hook",
|
||||
"version": "1.0.0",
|
||||
"description": "Connector for Electron.NET projects.",
|
||||
"repository": {
|
||||
"url": "https://github.com/ElectronNET/Electron.NET"
|
||||
},
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Gregor Biswanger",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/socket.io": "^2.1.2",
|
||||
"typescript": "^3.4.5"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "es2015"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -1,253 +0,0 @@
|
||||
"use strict";
|
||||
let isQuitWindowAllClosed = true, electronSocket;
|
||||
module.exports = (socket, app) => {
|
||||
electronSocket = socket;
|
||||
// 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();
|
||||
}
|
||||
});
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
app.on('window-all-closed', () => {
|
||||
electronSocket.emit('app-window-all-closed' + 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', () => {
|
||||
app.focus();
|
||||
});
|
||||
socket.on('appHide', () => {
|
||||
app.hide();
|
||||
});
|
||||
socket.on('appShow', () => {
|
||||
app.show();
|
||||
});
|
||||
socket.on('appGetAppPath', () => {
|
||||
const path = app.getAppPath();
|
||||
electronSocket.emit('appGetAppPathCompleted', path);
|
||||
});
|
||||
socket.on('appGetPath', (name) => {
|
||||
const path = app.getPath(name);
|
||||
electronSocket.emit('appGetPathCompleted', path);
|
||||
});
|
||||
// const nativeImages = {};
|
||||
// function addNativeImage(nativeImage: Electron.NativeImage) {
|
||||
// if(Object.keys(nativeImages).length === 0) {
|
||||
// nativeImage['1'] = nativeImage;
|
||||
// } else {
|
||||
// let indexCount = Object.keys(nativeImages).length + 1;
|
||||
// nativeImage[indexCount] = nativeImage;
|
||||
// }
|
||||
// }
|
||||
socket.on('appGetFileIcon', (path, options) => {
|
||||
if (options) {
|
||||
app.getFileIcon(path, options, (error, nativeImage) => {
|
||||
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
app.getFileIcon(path, (error, nativeImage) => {
|
||||
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', () => {
|
||||
const name = app.getName();
|
||||
electronSocket.emit('appGetNameCompleted', name);
|
||||
});
|
||||
socket.on('appSetName', (name) => {
|
||||
app.setName(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', () => {
|
||||
app.on('second-instance', (args, workingDirectory) => {
|
||||
electronSocket.emit('secondInstance', [args, workingDirectory]);
|
||||
});
|
||||
const success = app.requestSingleInstanceLock();
|
||||
electronSocket.emit('appRequestSingleInstanceLockCompleted', success);
|
||||
});
|
||||
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('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('appSetAboutPanelOptions', (options) => {
|
||||
app.setAboutPanelOptions(options);
|
||||
});
|
||||
socket.on('appCommandLineAppendSwitch', (theSwitch, value) => {
|
||||
app.commandLine.appendSwitch(theSwitch, value);
|
||||
});
|
||||
socket.on('appCommandLineAppendArgument', (value) => {
|
||||
app.commandLine.appendArgument(value);
|
||||
});
|
||||
socket.on('appDockBounce', (type) => {
|
||||
const id = app.dock.bounce(type);
|
||||
electronSocket.emit('appDockBounceCompleted', id);
|
||||
});
|
||||
socket.on('appDockCancelBounce', (id) => {
|
||||
app.dock.cancelBounce(id);
|
||||
});
|
||||
socket.on('appDockDownloadFinished', (filePath) => {
|
||||
app.dock.downloadFinished(filePath);
|
||||
});
|
||||
socket.on('appDockSetBadge', (text) => {
|
||||
app.dock.setBadge(text);
|
||||
});
|
||||
socket.on('appDockGetBadge', () => {
|
||||
const text = app.dock.getBadge();
|
||||
electronSocket.emit('appDockGetBadgeCompleted', text);
|
||||
});
|
||||
socket.on('appDockHide', () => {
|
||||
app.dock.hide();
|
||||
});
|
||||
socket.on('appDockShow', () => {
|
||||
app.dock.show();
|
||||
});
|
||||
socket.on('appDockIsVisible', () => {
|
||||
const isVisible = app.dock.isVisible();
|
||||
electronSocket.emit('appDockIsVisibleCompleted', isVisible);
|
||||
});
|
||||
// TODO: Menü Lösung muss noch implementiert werden
|
||||
socket.on('appDockSetMenu', (menu) => {
|
||||
app.dock.setMenu(menu);
|
||||
});
|
||||
socket.on('appDockSetIcon', (image) => {
|
||||
app.dock.setIcon(image);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=app.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,314 +0,0 @@
|
||||
let isQuitWindowAllClosed = true, electronSocket;
|
||||
export = (socket: SocketIO.Socket, app: Electron.App) => {
|
||||
electronSocket = socket;
|
||||
// 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();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('quit-app-window-all-closed-event', (quit) => {
|
||||
isQuitWindowAllClosed = quit;
|
||||
});
|
||||
|
||||
socket.on('register-app-window-all-closed-event', (id) => {
|
||||
app.on('window-all-closed', () => {
|
||||
electronSocket.emit('app-window-all-closed' + 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', () => {
|
||||
app.focus();
|
||||
});
|
||||
|
||||
socket.on('appHide', () => {
|
||||
app.hide();
|
||||
});
|
||||
|
||||
socket.on('appShow', () => {
|
||||
app.show();
|
||||
});
|
||||
|
||||
socket.on('appGetAppPath', () => {
|
||||
const path = app.getAppPath();
|
||||
electronSocket.emit('appGetAppPathCompleted', path);
|
||||
});
|
||||
|
||||
socket.on('appGetPath', (name) => {
|
||||
const path = app.getPath(name);
|
||||
electronSocket.emit('appGetPathCompleted', path);
|
||||
});
|
||||
|
||||
// const nativeImages = {};
|
||||
|
||||
// function addNativeImage(nativeImage: Electron.NativeImage) {
|
||||
|
||||
// if(Object.keys(nativeImages).length === 0) {
|
||||
// nativeImage['1'] = nativeImage;
|
||||
// } else {
|
||||
// let indexCount = Object.keys(nativeImages).length + 1;
|
||||
// nativeImage[indexCount] = nativeImage;
|
||||
// }
|
||||
// }
|
||||
|
||||
socket.on('appGetFileIcon', (path, options) => {
|
||||
if (options) {
|
||||
app.getFileIcon(path, options, (error, nativeImage) => {
|
||||
electronSocket.emit('appGetFileIconCompleted', [error, nativeImage]);
|
||||
});
|
||||
} else {
|
||||
app.getFileIcon(path, (error, nativeImage) => {
|
||||
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', () => {
|
||||
const name = app.getName();
|
||||
electronSocket.emit('appGetNameCompleted', name);
|
||||
});
|
||||
|
||||
socket.on('appSetName', (name) => {
|
||||
app.setName(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', () => {
|
||||
app.on('second-instance', (args, workingDirectory) => {
|
||||
electronSocket.emit('secondInstance', [args, workingDirectory]);
|
||||
});
|
||||
|
||||
const success = app.requestSingleInstanceLock();
|
||||
electronSocket.emit('appRequestSingleInstanceLockCompleted', success);
|
||||
});
|
||||
|
||||
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('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('appSetAboutPanelOptions', (options) => {
|
||||
app.setAboutPanelOptions(options);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineAppendSwitch', (theSwitch, value) => {
|
||||
app.commandLine.appendSwitch(theSwitch, value);
|
||||
});
|
||||
|
||||
socket.on('appCommandLineAppendArgument', (value) => {
|
||||
app.commandLine.appendArgument(value);
|
||||
});
|
||||
|
||||
socket.on('appDockBounce', (type) => {
|
||||
const id = app.dock.bounce(type);
|
||||
electronSocket.emit('appDockBounceCompleted', id);
|
||||
});
|
||||
|
||||
socket.on('appDockCancelBounce', (id) => {
|
||||
app.dock.cancelBounce(id);
|
||||
});
|
||||
|
||||
socket.on('appDockDownloadFinished', (filePath) => {
|
||||
app.dock.downloadFinished(filePath);
|
||||
});
|
||||
|
||||
socket.on('appDockSetBadge', (text) => {
|
||||
app.dock.setBadge(text);
|
||||
});
|
||||
|
||||
socket.on('appDockGetBadge', () => {
|
||||
const text = app.dock.getBadge();
|
||||
electronSocket.emit('appDockGetBadgeCompleted', text);
|
||||
});
|
||||
|
||||
socket.on('appDockHide', () => {
|
||||
app.dock.hide();
|
||||
});
|
||||
|
||||
socket.on('appDockShow', () => {
|
||||
app.dock.show();
|
||||
});
|
||||
|
||||
socket.on('appDockIsVisible', () => {
|
||||
const isVisible = app.dock.isVisible();
|
||||
electronSocket.emit('appDockIsVisibleCompleted', isVisible);
|
||||
});
|
||||
|
||||
// TODO: Menü Lösung muss noch implementiert werden
|
||||
socket.on('appDockSetMenu', (menu) => {
|
||||
app.dock.setMenu(menu);
|
||||
});
|
||||
|
||||
socket.on('appDockSetIcon', (image) => {
|
||||
app.dock.setIcon(image);
|
||||
});
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
const electron_updater_1 = require("electron-updater");
|
||||
const path = require('path');
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('autoUpdaterCheckForUpdatesAndNotify', (guid) => __awaiter(this, void 0, void 0, function* () {
|
||||
const updateCheckResult = yield electron_updater_1.autoUpdater.checkForUpdatesAndNotify();
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyComplete' + guid, updateCheckResult);
|
||||
}));
|
||||
socket.on('autoUpdaterCheckForUpdates', (guid) => __awaiter(this, void 0, void 0, function* () {
|
||||
// autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml');
|
||||
const updateCheckResult = yield electron_updater_1.autoUpdater.checkForUpdates();
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesComplete' + guid, updateCheckResult);
|
||||
}));
|
||||
socket.on('autoUpdaterQuitAndInstall', (isSilent, isForceRunAfter) => __awaiter(this, void 0, void 0, function* () {
|
||||
electron_updater_1.autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
|
||||
}));
|
||||
};
|
||||
//# sourceMappingURL=autoUpdater.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"autoUpdater.js","sourceRoot":"","sources":["autoUpdater.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uDAA+C;AAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IAExB,MAAM,CAAC,EAAE,CAAC,qCAAqC,EAAE,CAAO,IAAI,EAAE,EAAE;QAC5D,MAAM,iBAAiB,GAAG,MAAM,8BAAW,CAAC,wBAAwB,EAAE,CAAC;QACvE,cAAc,CAAC,IAAI,CAAC,6CAA6C,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACjG,CAAC,CAAA,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAO,IAAI,EAAE,EAAE;QACnD,6EAA6E;QAC7E,MAAM,iBAAiB,GAAG,MAAM,8BAAW,CAAC,eAAe,EAAE,CAAC;QAC9D,cAAc,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACxF,CAAC,CAAA,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAO,QAAQ,EAAE,eAAe,EAAE,EAAE;QACvE,8BAAW,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { autoUpdater } from 'electron-updater';
|
||||
const path = require('path');
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
socket.on('autoUpdaterCheckForUpdatesAndNotify', async (guid) => {
|
||||
const updateCheckResult = await autoUpdater.checkForUpdatesAndNotify();
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesAndNotifyComplete' + guid, updateCheckResult);
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterCheckForUpdates', async (guid) => {
|
||||
// autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml');
|
||||
const updateCheckResult = await autoUpdater.checkForUpdates();
|
||||
electronSocket.emit('autoUpdaterCheckForUpdatesComplete' + guid, updateCheckResult);
|
||||
});
|
||||
|
||||
socket.on('autoUpdaterQuitAndInstall', async (isSilent, isForceRunAfter) => {
|
||||
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
|
||||
});
|
||||
};
|
||||
@@ -1,547 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const path = require('path');
|
||||
const windows = [];
|
||||
let window, lastOptions, electronSocket;
|
||||
module.exports = (socket, app) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-browserWindow-ready-to-show', (id) => {
|
||||
getWindowById(id).on('ready-to-show', () => {
|
||||
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-scroll-touch-begin', (id) => {
|
||||
getWindowById(id).on('scroll-touch-begin', () => {
|
||||
electronSocket.emit('browserWindow-scroll-touch-begin' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-scroll-touch-end', (id) => {
|
||||
getWindowById(id).on('scroll-touch-end', () => {
|
||||
electronSocket.emit('browserWindow-scroll-touch-end' + id);
|
||||
});
|
||||
});
|
||||
socket.on('register-browserWindow-scroll-touch-edge', (id) => {
|
||||
getWindowById(id).on('scroll-touch-edge', () => {
|
||||
electronSocket.emit('browserWindow-scroll-touch-edge' + id);
|
||||
});
|
||||
});
|
||||
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);
|
||||
});
|
||||
});
|
||||
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;
|
||||
}
|
||||
socket.on('createBrowserWindow', (options, loadUrl) => {
|
||||
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
|
||||
options = Object.assign({}, options, { webPreferences: { nodeIntegration: true } });
|
||||
}
|
||||
window = new electron_1.BrowserWindow(options);
|
||||
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);
|
||||
}
|
||||
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('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);
|
||||
});
|
||||
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('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);
|
||||
});
|
||||
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,713 +0,0 @@
|
||||
import { BrowserWindow, Menu, nativeImage } from 'electron';
|
||||
const path = require('path');
|
||||
const windows: Electron.BrowserWindow[] = [];
|
||||
let window, lastOptions, electronSocket;
|
||||
|
||||
export = (socket: SocketIO.Socket, app: Electron.App) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-browserWindow-ready-to-show', (id) => {
|
||||
getWindowById(id).on('ready-to-show', () => {
|
||||
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-scroll-touch-begin', (id) => {
|
||||
getWindowById(id).on('scroll-touch-begin', () => {
|
||||
electronSocket.emit('browserWindow-scroll-touch-begin' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-scroll-touch-end', (id) => {
|
||||
getWindowById(id).on('scroll-touch-end', () => {
|
||||
electronSocket.emit('browserWindow-scroll-touch-end' + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-browserWindow-scroll-touch-edge', (id) => {
|
||||
getWindowById(id).on('scroll-touch-edge', () => {
|
||||
electronSocket.emit('browserWindow-scroll-touch-edge' + id);
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
socket.on('createBrowserWindow', (options, loadUrl) => {
|
||||
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true } };
|
||||
}
|
||||
|
||||
window = new BrowserWindow(options);
|
||||
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);
|
||||
}
|
||||
|
||||
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('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);
|
||||
});
|
||||
|
||||
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('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);
|
||||
});
|
||||
|
||||
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,52 +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);
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=clipboard.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["clipboard.ts"],"names":[],"mappings":";AAAA,uCAAqC;AACrC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC5C,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,oBAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,cAAc,CAAC,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QAC9C,oBAAS,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE;QACpC,MAAM,OAAO,GAAG,oBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QAC3C,oBAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,MAAM,QAAQ,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QAC1C,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACtD,oBAAS,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,MAAM,OAAO,GAAG,oBAAS,CAAC,YAAY,EAAE,CAAC;QACzC,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE;QAC1C,oBAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE;QAClC,oBAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,oBAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjD,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACxC,oBAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,63 +0,0 @@
|
||||
import { clipboard } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.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);
|
||||
});
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('showMessageBox', (browserWindow, options, guid) => {
|
||||
if ('id' in browserWindow) {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showMessageBox(window, options, (response, checkboxChecked) => {
|
||||
electronSocket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
const id = guid || options;
|
||||
electron_1.dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
|
||||
electronSocket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('showOpenDialog', (browserWindow, options, guid) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showOpenDialog(window, options, (filePaths) => {
|
||||
electronSocket.emit('showOpenDialogComplete' + guid, filePaths || []);
|
||||
});
|
||||
});
|
||||
socket.on('showSaveDialog', (browserWindow, options, guid) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
electron_1.dialog.showSaveDialog(window, options, (filename) => {
|
||||
electronSocket.emit('showSaveDialogComplete' + guid, filename || '');
|
||||
});
|
||||
});
|
||||
socket.on('showErrorBox', (title, content) => {
|
||||
electron_1.dialog.showErrorBox(title, content);
|
||||
});
|
||||
socket.on('showCertificateTrustDialog', (browserWindow, options, guid) => {
|
||||
const window = electron_1.BrowserWindow.fromId(browserWindow.id);
|
||||
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":";AAAA,uCAAiD;AACjD,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzD,IAAI,IAAI,IAAI,aAAa,EAAE;YACvB,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAEtD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;gBACjE,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YACtF,CAAC,CAAC,CAAC;SACN;aAAM;YACH,MAAM,EAAE,GAAG,IAAI,IAAI,OAAO,CAAC;YAC3B,iBAAM,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE;gBAC/D,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,SAAS,EAAE,EAAE;YACjD,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACzD,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,iBAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE;YAChD,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,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,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACrE,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACtD,iBAAM,CAAC,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE;YACpD,cAAc,CAAC,IAAI,CAAC,oCAAoC,GAAG,IAAI,CAAC,CAAC;QACrE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,45 +0,0 @@
|
||||
import { BrowserWindow, dialog } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('showMessageBox', (browserWindow, options, guid) => {
|
||||
if ('id' in browserWindow) {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
|
||||
dialog.showMessageBox(window, options, (response, checkboxChecked) => {
|
||||
electronSocket.emit('showMessageBoxComplete' + guid, [response, checkboxChecked]);
|
||||
});
|
||||
} else {
|
||||
const id = guid || options;
|
||||
dialog.showMessageBox(browserWindow, (response, checkboxChecked) => {
|
||||
electronSocket.emit('showMessageBoxComplete' + id, [response, checkboxChecked]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('showOpenDialog', (browserWindow, options, guid) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
dialog.showOpenDialog(window, options, (filePaths) => {
|
||||
electronSocket.emit('showOpenDialogComplete' + guid, filePaths || []);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('showSaveDialog', (browserWindow, options, guid) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
dialog.showSaveDialog(window, options, (filename) => {
|
||||
electronSocket.emit('showSaveDialogComplete' + guid, filename || '');
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('showErrorBox', (title, content) => {
|
||||
dialog.showErrorBox(title, content);
|
||||
});
|
||||
|
||||
socket.on('showCertificateTrustDialog', (browserWindow, options, guid) => {
|
||||
const window = BrowserWindow.fromId(browserWindow.id);
|
||||
dialog.showCertificateTrustDialog(window, options, () => {
|
||||
electronSocket.emit('showCertificateTrustDialogComplete' + guid);
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -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;AAC1C,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,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,27 +0,0 @@
|
||||
import { globalShortcut } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.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,36 +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);
|
||||
}
|
||||
});
|
||||
};
|
||||
//# sourceMappingURL=ipc.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":";AAAA,uCAAkD;AAClD,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;QAC5C,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAChC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,OAAO,EAAE,EAAE;QAChD,kBAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAChC,MAAM,CAAC,GAAQ,MAAM,CAAC;YACtB,CAAC,CAAC,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;YACvC,MAAM,CAAC,EAAE,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBACnC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,OAAO,EAAE,EAAE;QAChD,kBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAClC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kCAAkC,EAAE,CAAC,OAAO,EAAE,EAAE;QACtD,kBAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE;QAC/D,MAAM,MAAM,GAAG,wBAAa,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAEtD,IAAI,MAAM,EAAE;YACR,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;SAC7C;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,41 +0,0 @@
|
||||
import { ipcMain, BrowserWindow } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.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);
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -1,53 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const 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, browserWindowId) => {
|
||||
electronSocket.emit('contextMenuItemClicked', [id, browserWindowId]);
|
||||
});
|
||||
contextMenuItems.push({
|
||||
menu: menu,
|
||||
browserWindowId: browserWindowId
|
||||
});
|
||||
});
|
||||
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); };
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=menu.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"menu.js","sourceRoot":"","sources":["menu.ts"],"names":[],"mappings":";AAAA,uCAA+C;AAC/C,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,EAAE;QAC5D,MAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,gCAAgC,CAAC,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC,EAAE,EAAE,eAAe,EAAE,EAAE;YAClF,cAAc,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;QAEH,gBAAgB,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,IAAI;YACV,eAAe,EAAE,eAAe;SACnC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,SAAS,gCAAgC,CAAC,SAAS,EAAE,eAAe,EAAE,QAAQ;QAC1E,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,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;aACnF;YAED,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE;gBACzB,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9D;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,eAAe,EAAE,EAAE;QACnD,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACzB,IAAI,CAAC,CAAC,eAAe,KAAK,eAAe,EAAE;gBACvC,MAAM,aAAa,GAAG,wBAAa,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;gBAC5D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;aAC/B;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,SAAS,EAAE,EAAE;QAC/C,MAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE;YACzC,cAAc,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,eAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAClC,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,62 +0,0 @@
|
||||
import { Menu, BrowserWindow } from 'electron';
|
||||
const contextMenuItems = [];
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('menu-setContextMenu', (browserWindowId, menuItems) => {
|
||||
const menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addContextMenuItemClickConnector(menu.items, browserWindowId, (id, browserWindowId) => {
|
||||
electronSocket.emit('contextMenuItemClicked', [id, browserWindowId]);
|
||||
});
|
||||
|
||||
contextMenuItems.push({
|
||||
menu: menu,
|
||||
browserWindowId: browserWindowId
|
||||
});
|
||||
});
|
||||
|
||||
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,50 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const 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', (options) => {
|
||||
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":";AAAA,uCAAwC;AACxC,MAAM,aAAa,GAA4B,EAAE,CAAC;AAClD,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,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,CAAC,OAAO,EAAE,EAAE;QAC7C,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,57 +0,0 @@
|
||||
import { Notification } from 'electron';
|
||||
const notifications: Electron.Notification[] = [];
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.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', (options) => {
|
||||
const isSupported = Notification.isSupported;
|
||||
electronSocket.emit('notificationIsSupportedComplete', isSupported);
|
||||
});
|
||||
};
|
||||
@@ -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":";AAAA,uCAAkC;AAClC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,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,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE;YACpE,cAAc,CAAC,IAAI,CAAC,sCAAsC,GAAG,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;QAChG,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,iBAAM,CAAC,oBAAoB,EAAE,CAAC;QAC5C,cAAc,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC;QACnD,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACvC,MAAM,OAAO,GAAG,iBAAM,CAAC,iBAAiB,EAAE,CAAC;QAC3C,cAAc,CAAC,IAAI,CAAC,mCAAmC,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QACpC,MAAM,OAAO,GAAG,iBAAM,CAAC,cAAc,EAAE,CAAC;QACxC,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,+BAA+B,EAAE,CAAC,KAAK,EAAE,EAAE;QACjD,MAAM,OAAO,GAAG,iBAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACrD,cAAc,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,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,53 +0,0 @@
|
||||
import { screen } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.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,46 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('shell-showItemInFolder', (fullPath) => {
|
||||
const success = electron_1.shell.showItemInFolder(fullPath);
|
||||
electronSocket.emit('shell-showItemInFolderCompleted', success);
|
||||
});
|
||||
socket.on('shell-openItem', (fullPath) => {
|
||||
const success = electron_1.shell.openItem(fullPath);
|
||||
electronSocket.emit('shell-openItemCompleted', success);
|
||||
});
|
||||
socket.on('shell-openExternal', (url, options) => {
|
||||
let success = true;
|
||||
if (options) {
|
||||
electron_1.shell.openExternal(url, options).catch((error) => {
|
||||
success = false;
|
||||
electronSocket.emit('shell-openExternalCallback', [url, error]);
|
||||
});
|
||||
}
|
||||
else {
|
||||
electron_1.shell.openExternal(url).catch((error) => {
|
||||
success = false;
|
||||
electronSocket.emit('shell-openExternalCallback', [url, error]);
|
||||
});
|
||||
}
|
||||
electronSocket.emit('shell-openExternalCompleted', success);
|
||||
});
|
||||
socket.on('shell-moveItemToTrash', (fullPath) => {
|
||||
const success = electron_1.shell.moveItemToTrash(fullPath);
|
||||
electronSocket.emit('shell-moveItemToTrashCompleted', 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":";AAAA,uCAAiC;AACjC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,gBAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEjD,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,gBAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAEzC,cAAc,CAAC,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;QAC7C,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,IAAI,OAAO,EAAE;YACT,gBAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC7C,OAAO,GAAG,KAAK,CAAC;gBAChB,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;SACN;aAAM;YACH,gBAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACpC,OAAO,GAAG,KAAK,CAAC;gBAChB,cAAc,CAAC,IAAI,CAAC,4BAA4B,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACpE,CAAC,CAAC,CAAC;SACN;QAED,cAAc,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC5C,MAAM,OAAO,GAAG,gBAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEhD,cAAc,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QACzB,gBAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE;QACtE,MAAM,OAAO,GAAG,gBAAK,CAAC,iBAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAE1E,cAAc,CAAC,IAAI,CAAC,kCAAkC,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,CAAC,YAAY,EAAE,EAAE;QACjD,MAAM,eAAe,GAAG,gBAAK,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAE7D,cAAc,CAAC,IAAI,CAAC,iCAAiC,EAAE,eAAe,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
||||
@@ -1,57 +0,0 @@
|
||||
import { shell } from 'electron';
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('shell-showItemInFolder', (fullPath) => {
|
||||
const success = shell.showItemInFolder(fullPath);
|
||||
|
||||
electronSocket.emit('shell-showItemInFolderCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-openItem', (fullPath) => {
|
||||
const success = shell.openItem(fullPath);
|
||||
|
||||
electronSocket.emit('shell-openItemCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-openExternal', (url, options) => {
|
||||
let success = true;
|
||||
|
||||
if (options) {
|
||||
shell.openExternal(url, options).catch((error) => {
|
||||
success = false;
|
||||
electronSocket.emit('shell-openExternalCallback', [url, error]);
|
||||
});
|
||||
} else {
|
||||
shell.openExternal(url).catch((error) => {
|
||||
success = false;
|
||||
electronSocket.emit('shell-openExternalCallback', [url, error]);
|
||||
});
|
||||
}
|
||||
|
||||
electronSocket.emit('shell-openExternalCompleted', success);
|
||||
});
|
||||
|
||||
socket.on('shell-moveItemToTrash', (fullPath) => {
|
||||
const success = shell.moveItemToTrash(fullPath);
|
||||
|
||||
electronSocket.emit('shell-moveItemToTrashCompleted', 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,112 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
const path = require('path');
|
||||
let tray;
|
||||
let electronSocket;
|
||||
module.exports = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('right-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-right-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-double-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('double-click', (event, bounds) => {
|
||||
electronSocket.emit('tray-double-click-event' + id, [event.__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-show', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
socket.on('create-tray', (image, menuItems) => {
|
||||
const menu = electron_1.Menu.buildFromTemplate(menuItems);
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('trayMenuItemClicked', id);
|
||||
});
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
|
||||
tray = new electron_1.Tray(imagePath);
|
||||
tray.setContextMenu(menu);
|
||||
});
|
||||
socket.on('tray-destroy', () => {
|
||||
if (tray) {
|
||||
tray.destroy();
|
||||
}
|
||||
});
|
||||
socket.on('tray-setImage', (image) => {
|
||||
if (tray) {
|
||||
tray.setImage(image);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setPressedImage', (image) => {
|
||||
if (tray) {
|
||||
const img = electron_1.nativeImage.createFromPath(image);
|
||||
tray.setPressedImage(img);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setToolTip', (toolTip) => {
|
||||
if (tray) {
|
||||
tray.setToolTip(toolTip);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setTitle', (title) => {
|
||||
if (tray) {
|
||||
tray.setTitle(title);
|
||||
}
|
||||
});
|
||||
socket.on('tray-setHighlightMode', (mode) => {
|
||||
if (tray) {
|
||||
tray.setHighlightMode(mode);
|
||||
}
|
||||
});
|
||||
socket.on('tray-displayBalloon', (options) => {
|
||||
if (tray) {
|
||||
tray.displayBalloon(options);
|
||||
}
|
||||
});
|
||||
socket.on('tray-isDestroyed', () => {
|
||||
if (tray) {
|
||||
const isDestroyed = tray.isDestroyed();
|
||||
electronSocket.emit('tray-isDestroyedCompleted', isDestroyed);
|
||||
}
|
||||
});
|
||||
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 +0,0 @@
|
||||
{"version":3,"file":"tray.js","sourceRoot":"","sources":["tray.ts"],"names":[],"mappings":";AAAA,uCAAmD;AACnD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7B,IAAI,IAAmB,CAAC;AACxB,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,EAAE,EAAE,EAAE;QACpC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,kBAAkB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACnF,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC1C,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBACrC,cAAc,CAAC,IAAI,CAAC,wBAAwB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YACzF,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC3C,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBACtC,cAAc,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,EAAE,CAAO,KAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;YAC1F,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,4BAA4B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC3C,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;gBACzB,cAAc,CAAC,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,6BAA6B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC5C,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;gBAC1B,cAAc,CAAC,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;YACzD,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,8BAA8B,EAAE,CAAC,EAAE,EAAE,EAAE;QAC7C,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;gBAC3B,cAAc,CAAC,IAAI,CAAC,2BAA2B,GAAG,EAAE,CAAC,CAAC;YAC1D,CAAC,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QAC1C,MAAM,IAAI,GAAG,eAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAE/C,yBAAyB,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE;YACzC,cAAc,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAExE,IAAI,GAAG,IAAI,eAAI,CAAC,SAAS,CAAC,CAAC;QAC3B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;QAC3B,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,OAAO,EAAE,CAAC;SAClB;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;QACjC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,CAAC,KAAK,EAAE,EAAE;QACxC,IAAI,IAAI,EAAE;YACN,MAAM,GAAG,GAAG,sBAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;YAC9C,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;SAC7B;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,OAAO,EAAE,EAAE;QACrC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;SAC5B;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;QACjC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;SAC/B;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE;QACzC,IAAI,IAAI,EAAE;YACN,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;SAChC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,EAAE,CAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/B,IAAI,IAAI,EAAE;YACN,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACvC,cAAc,CAAC,IAAI,CAAC,2BAA2B,EAAE,WAAW,CAAC,CAAC;SACjE;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,130 +0,0 @@
|
||||
import { Menu, Tray, nativeImage } from 'electron';
|
||||
const path = require('path');
|
||||
let tray: Electron.Tray;
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.Socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('register-tray-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('click', (event, bounds) => {
|
||||
electronSocket.emit('tray-click-event' + id, [(<any>event).__proto__, bounds]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-right-click', (id) => {
|
||||
if (tray) {
|
||||
tray.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) {
|
||||
tray.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) {
|
||||
tray.on('balloon-show', () => {
|
||||
electronSocket.emit('tray-balloon-show-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-click', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-click', () => {
|
||||
electronSocket.emit('tray-balloon-click-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('register-tray-balloon-closed', (id) => {
|
||||
if (tray) {
|
||||
tray.on('balloon-closed', () => {
|
||||
electronSocket.emit('tray-balloon-closed-event' + id);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('create-tray', (image, menuItems) => {
|
||||
const menu = Menu.buildFromTemplate(menuItems);
|
||||
|
||||
addMenuItemClickConnector(menu.items, (id) => {
|
||||
electronSocket.emit('trayMenuItemClicked', id);
|
||||
});
|
||||
|
||||
const imagePath = path.join(__dirname.replace('api', ''), 'bin', image);
|
||||
|
||||
tray = new Tray(imagePath);
|
||||
tray.setContextMenu(menu);
|
||||
});
|
||||
|
||||
socket.on('tray-destroy', () => {
|
||||
if (tray) {
|
||||
tray.destroy();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setImage', (image) => {
|
||||
if (tray) {
|
||||
tray.setImage(image);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setPressedImage', (image) => {
|
||||
if (tray) {
|
||||
const img = nativeImage.createFromPath(image);
|
||||
tray.setPressedImage(img);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setToolTip', (toolTip) => {
|
||||
if (tray) {
|
||||
tray.setToolTip(toolTip);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setTitle', (title) => {
|
||||
if (tray) {
|
||||
tray.setTitle(title);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-setHighlightMode', (mode) => {
|
||||
if (tray) {
|
||||
tray.setHighlightMode(mode);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-displayBalloon', (options) => {
|
||||
if (tray) {
|
||||
tray.displayBalloon(options);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('tray-isDestroyed', () => {
|
||||
if (tray) {
|
||||
const isDestroyed = tray.isDestroyed();
|
||||
electronSocket.emit('tray-isDestroyedCompleted', isDestroyed);
|
||||
}
|
||||
});
|
||||
|
||||
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,148 +0,0 @@
|
||||
"use strict";
|
||||
const electron_1 = require("electron");
|
||||
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('webContentsOpenDevTools', (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
}
|
||||
else {
|
||||
getWindowById(id).webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
socket.on('webContents-printToPDF', (id, options, path) => {
|
||||
getWindowById(id).webContents.printToPDF(options || {}, (error, data) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
fs.writeFile(path, data, (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', (id, options, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearAuthCache(options, () => {
|
||||
electronSocket.emit('webContents-session-clearAuthCache-completed' + guid);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-session-clearCache', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearCache(() => {
|
||||
electronSocket.emit('webContents-session-clearCache-completed' + guid);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-session-clearHostResolverCache', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearHostResolverCache(() => {
|
||||
electronSocket.emit('webContents-session-clearHostResolverCache-completed' + guid);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-session-clearStorageData', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearStorageData({}, () => {
|
||||
electronSocket.emit('webContents-session-clearStorageData-completed' + guid);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-session-clearStorageData-options', (id, options, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
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', (id, identifier, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.getBlobData(identifier, (buffer) => {
|
||||
electronSocket.emit('webContents-session-getBlobData-completed' + guid, buffer.buffer);
|
||||
});
|
||||
});
|
||||
socket.on('webContents-session-getCacheSize', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.getCacheSize((size) => {
|
||||
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', (id, url, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.resolveProxy(url, (proxy) => {
|
||||
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', (id, configuration, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
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);
|
||||
});
|
||||
function getWindowById(id) {
|
||||
return electron_1.BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=webContents.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -1,174 +0,0 @@
|
||||
import { BrowserWindow } from 'electron';
|
||||
const fs = require('fs');
|
||||
let electronSocket;
|
||||
|
||||
export = (socket: SocketIO.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('webContentsOpenDevTools', (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
} else {
|
||||
getWindowById(id).webContents.openDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('webContents-printToPDF', (id, options, path) => {
|
||||
getWindowById(id).webContents.printToPDF(options || {}, (error, data) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
fs.writeFile(path, data, (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', (id, options, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearAuthCache(options, () => {
|
||||
electronSocket.emit('webContents-session-clearAuthCache-completed' + guid);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearCache', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearCache(() => {
|
||||
electronSocket.emit('webContents-session-clearCache-completed' + guid);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearHostResolverCache', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearHostResolverCache(() => {
|
||||
electronSocket.emit('webContents-session-clearHostResolverCache-completed' + guid);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearStorageData', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.clearStorageData({}, () => {
|
||||
electronSocket.emit('webContents-session-clearStorageData-completed' + guid);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-session-clearStorageData-options', (id, options, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
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', (id, identifier, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.getBlobData(identifier, (buffer) => {
|
||||
electronSocket.emit('webContents-session-getBlobData-completed' + guid, buffer.buffer);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('webContents-session-getCacheSize', (id, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.getCacheSize((size) => {
|
||||
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', (id, url, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.session.resolveProxy(url, (proxy) => {
|
||||
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', (id, configuration, guid) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
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);
|
||||
});
|
||||
|
||||
function getWindowById(id: number): Electron.BrowserWindow {
|
||||
return BrowserWindow.fromId(id);
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
// @ts-ignore
|
||||
const manifestFile = require('./bin/electron.manifest');
|
||||
const fs = require('fs');
|
||||
|
||||
const builderConfiguration = { ...manifestFile.build };
|
||||
if(builderConfiguration.hasOwnProperty('buildVersion')) {
|
||||
// @ts-ignore
|
||||
const packageJson = require('./package');
|
||||
packageJson.version = builderConfiguration.buildVersion;
|
||||
|
||||
fs.writeFile('./package.json', JSON.stringify(packageJson), (error) => {
|
||||
if(error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
// @ts-ignore
|
||||
const packageLockJson = require('./package-lock');
|
||||
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);
|
||||
}
|
||||
});
|
||||
@@ -1,169 +0,0 @@
|
||||
const { app } = require('electron');
|
||||
const { BrowserWindow } = require('electron');
|
||||
const path = require('path');
|
||||
const process = 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 splashScreen, hostHook;
|
||||
|
||||
const currentBinPath = path.join(__dirname.replace('app.asar', ''), 'bin');
|
||||
const manifestJsonFilePath = path.join(currentBinPath, 'electron.manifest.json');
|
||||
const manifestJsonFile = require(manifestJsonFilePath);
|
||||
if (manifestJsonFile.singleInstance) {
|
||||
const mainInstance = app.requestSingleInstanceLock();
|
||||
app.on('second-instance', () => {
|
||||
const windows = BrowserWindow.getAllWindows();
|
||||
if (windows.length) {
|
||||
if (windows[0].isMinimized()) {
|
||||
windows[0].restore();
|
||||
}
|
||||
windows[0].focus();
|
||||
}
|
||||
});
|
||||
|
||||
if (!mainInstance) {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
app.on('ready', () => {
|
||||
if (isSplashScreenEnabled()) {
|
||||
startSplashScreen();
|
||||
}
|
||||
|
||||
// hostname needs to belocalhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(8000, 65535, 'localhost', function (error, port) {
|
||||
console.log('Electron Socket IO Port: ' + port);
|
||||
startSocketApiBridge(port);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
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.log(error);
|
||||
|
||||
throw new Error(error.message);
|
||||
}
|
||||
|
||||
splashScreen = new BrowserWindow({
|
||||
width: dimensions.width,
|
||||
height: dimensions.height,
|
||||
transparent: true,
|
||||
center: true,
|
||||
frame: false,
|
||||
alwaysOnTop: true,
|
||||
skipTaskbar: true,
|
||||
show: true
|
||||
});
|
||||
|
||||
app.once('browser-window-focus', () => {
|
||||
app.once('browser-window-focus', () => {
|
||||
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();
|
||||
io = require('socket.io')();
|
||||
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);
|
||||
});
|
||||
|
||||
startAspCoreBackend(port);
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
global['electronsocket'] = socket;
|
||||
global['electronsocket'].setMaxListeners(0);
|
||||
console.log('ASP.NET Core Application connected...', 'global.electronsocket', global['electronsocket'].id, new Date());
|
||||
|
||||
appApi = require('./api/app')(socket, app);
|
||||
browserWindows = require('./api/browserWindows')(socket, app);
|
||||
autoUpdater = require('./api/autoUpdater')(socket);
|
||||
ipc = require('./api/ipc')(socket);
|
||||
menu = require('./api/menu')(socket);
|
||||
dialogApi = require('./api/dialog')(socket);
|
||||
notification = require('./api/notification')(socket);
|
||||
tray = require('./api/tray')(socket);
|
||||
webContents = require('./api/webContents')(socket);
|
||||
globalShortcut = require('./api/globalShortcut')(socket);
|
||||
shellApi = require('./api/shell')(socket);
|
||||
screen = require('./api/screen')(socket);
|
||||
clipboard = require('./api/clipboard')(socket);
|
||||
|
||||
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.log(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isModuleAvailable(name) {
|
||||
try {
|
||||
require.resolve(name);
|
||||
return true;
|
||||
} catch (e) { }
|
||||
return false;
|
||||
}
|
||||
|
||||
function startAspCoreBackend(electronPort) {
|
||||
|
||||
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
|
||||
portscanner.findAPortNotInUse(8000, 65535, 'localhost', function (error, electronWebPort) {
|
||||
console.log('ASP.NET Core Port: ' + electronWebPort);
|
||||
loadURL = `http://localhost:${electronWebPort}`;
|
||||
const parameters = [`/electronPort=${electronPort}`, `/electronWebPort=${electronWebPort}`];
|
||||
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 = process(binFilePath, parameters, options);
|
||||
|
||||
apiProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data.toString()}`);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "electron.net.host",
|
||||
"version": "1.0.2",
|
||||
"description": "Electron-Host for Electron.NET.",
|
||||
"repository": {
|
||||
"url": "https://github.com/ElectronNET/Electron.NET"
|
||||
},
|
||||
"main": "main.js",
|
||||
"author": "Gregor Biswanger",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "tsc -p ."
|
||||
},
|
||||
"dependencies": {
|
||||
"electron-updater": "^4.0.6",
|
||||
"image-size": "^0.7.4",
|
||||
"portscanner": "^2.2.0",
|
||||
"socket.io": "^2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^10.14.4",
|
||||
"@types/socket.io": "^2.1.2",
|
||||
"tslint": "^5.12.0",
|
||||
"typescript": "^3.2.2",
|
||||
"electron": "^5.0.1"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2015",
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Linq;
|
||||
using ElectronNET.API;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class UpdateController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
if (HybridSupport.IsElectronActive)
|
||||
{
|
||||
Electron.IpcMain.On("auto-update", async (args) =>
|
||||
{
|
||||
// Electron.NET CLI Command for deploy:
|
||||
// electronize build /target win /electron-params --publish=always
|
||||
|
||||
var currentVersion = await Electron.App.GetVersionAsync();
|
||||
var updateCheckResult = await Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();
|
||||
var availableVersion = updateCheckResult.UpdateInfo.Version;
|
||||
string information = $"Current version: {currentVersion} - available version: {availableVersion}";
|
||||
|
||||
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
||||
Electron.IpcMain.Send(mainWindow, "auto-update-reply", information);
|
||||
});
|
||||
}
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
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,27 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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,30 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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,28 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"sourceMap": true,
|
||||
"skipLibCheck": true,
|
||||
"target": "es2015"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace ElectronNET.WebApp
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public Startup(IConfiguration configuration)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole();
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
|
||||
|
||||
|
||||
if(HybridSupport.IsElectronActive)
|
||||
{
|
||||
ElectronBootstrap();
|
||||
}
|
||||
}
|
||||
|
||||
public async void ElectronBootstrap()
|
||||
{
|
||||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
|
||||
{
|
||||
Width = 1152,
|
||||
Height = 940,
|
||||
Show = false
|
||||
});
|
||||
|
||||
await browserWindow.WebContents.Session.ClearCacheAsync();
|
||||
|
||||
browserWindow.OnReadyToShow += () => browserWindow.Show();
|
||||
browserWindow.SetTitle(Configuration["DemoTitleInSettings"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
<template class="task-template">
|
||||
<section id="clipboard-section" class="section js-section u-category-system">
|
||||
<header class="section-header">
|
||||
<div class="section-wrapper">
|
||||
<h1>
|
||||
<svg class="section-icon"><use xlink:href="assets/img/icons.svg#icon-system"></use></svg>
|
||||
Clipboard
|
||||
</h1>
|
||||
<h3>The <code>Electron.Clipboard</code> provides methods to perform copy and paste operations.</h3>
|
||||
<p>This module also has methods for copying text as markup (HTML) to the clipboard.</p>
|
||||
|
||||
<p>You find the sample source code in <code>Controllers\ClipboardController.cs</code>.</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="demo">
|
||||
<div class="demo-wrapper">
|
||||
<button id="copy-to-demo-toggle" class="js-container-target demo-toggle-button">
|
||||
Copy
|
||||
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
|
||||
</button>
|
||||
<div class="demo-box">
|
||||
<div class="demo-controls">
|
||||
<button class="demo-button" id="copy-to">Copy</button>
|
||||
<input class="demo-input" id="copy-to-input" aria-label="Click copy" placeholder="Click copy."></input>
|
||||
</div>
|
||||
<p>In this example we copy a phrase to the clipboard. After clicking 'Copy' use the text area to paste (CMD + V or CTRL + V) the phrase from the clipboard.</p>
|
||||
<h5>Main Process (C#)</h5>
|
||||
<pre><code class="csharp">Electron.IpcMain.On("copy-to", (text) =>
|
||||
{
|
||||
Electron.Clipboard.WriteText(text.ToString());
|
||||
});</code></pre>
|
||||
<div class="demo-protip">
|
||||
<h2>ProTip</h2>
|
||||
<strong>Electron.js Support in Electron.NET.</strong>
|
||||
<p>The <code>clipboard</code> module is built into Electron.js (therefore you can use this in the renderer processes).</p>
|
||||
<pre><code class="language-js">const clipboard = require('electron').clipboard;
|
||||
|
||||
const copyBtn = document.getElementById('copy-to');
|
||||
const copyInput = document.getElementById('copy-to-input');
|
||||
|
||||
copyBtn.addEventListener('click', () => {
|
||||
if (copyInput.value !== '') copyInput.value = '';
|
||||
copyInput.placeholder = 'Copied! Paste here to see.';
|
||||
clipboard.writeText('Electron Demo!');
|
||||
})</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo">
|
||||
<div class="demo-wrapper">
|
||||
<button id="paste-to-demo-toggle" class="js-container-target demo-toggle-button">
|
||||
Paste
|
||||
<div class="demo-meta u-avoid-clicks">Supports: Win, macOS, Linux <span class="demo-meta-divider">|</span> Process: Both</div>
|
||||
</button>
|
||||
<div class="demo-box">
|
||||
<div class="demo-controls">
|
||||
<button class="demo-button" id="paste-to">Paste</button>
|
||||
<span class="demo-response" id="paste-from"></span>
|
||||
</div>
|
||||
<p>In this example we copy a string to the clipboard and then paste the results into a message above.</p>
|
||||
|
||||
<h5>Main Process (C#)</h5>
|
||||
<pre><code class="csharp">Electron.IpcMain.On("paste-to", async (text) =>
|
||||
{
|
||||
Electron.Clipboard.WriteText(text.ToString());
|
||||
string pasteText = await Electron.Clipboard.ReadTextAsync();
|
||||
|
||||
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
||||
Electron.IpcMain.Send(mainWindow, "paste-from", pasteText);
|
||||
});</code></pre>
|
||||
|
||||
<div class="demo-protip">
|
||||
<h2>ProTip</h2>
|
||||
<strong>Electron.js Support in Electron.NET.</strong>
|
||||
<p>The <code>clipboard</code> module is built into Electron.js (therefore you can use this in the renderer processes).</p>
|
||||
<pre><code class="language-js">const clipboard = require('electron').clipboard;
|
||||
|
||||
const pasteBtn = document.getElementById('paste-to');
|
||||
|
||||
pasteBtn.addEventListener('click', () => {
|
||||
clipboard.writeText('What a demo!');
|
||||
const message = `Clipboard contents: ${clipboard.readText()}`;
|
||||
document.getElementById('paste-from').innerHTML = message;
|
||||
})</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function(){
|
||||
const { ipcRenderer } = require("electron");
|
||||
|
||||
document.getElementById("copy-to").addEventListener("click", () => {
|
||||
document.getElementById('copy-to-input').placeholder = 'Copied! Paste here to see.';
|
||||
ipcRenderer.send("copy-to", "Electron.NET Demo!");
|
||||
});
|
||||
|
||||
document.getElementById("paste-to").addEventListener("click", () => {
|
||||
ipcRenderer.send("paste-to", "What a demo!");
|
||||
});
|
||||
|
||||
ipcRenderer.on("paste-from", (sender, text) => {
|
||||
const message = `Clipboard contents: ${text}`;
|
||||
document.getElementById("paste-from").innerText = message;
|
||||
});
|
||||
|
||||
}());
|
||||
</script>
|
||||
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,11 +0,0 @@
|
||||
const demoBtns = document.querySelectorAll('.js-container-target');
|
||||
|
||||
// Listen for demo button clicks
|
||||
Array.prototype.forEach.call(demoBtns, function (btn) {
|
||||
btn.addEventListener('click', function (event) {
|
||||
const parent = event.target.parentElement;
|
||||
|
||||
// Toggles the "is-open" class on the demo's parent element.
|
||||
parent.classList.toggle('is-open');
|
||||
})
|
||||
})
|
||||
@@ -1,12 +0,0 @@
|
||||
const links = document.querySelectorAll('link[rel="import"]')
|
||||
|
||||
// Import and add each page to the DOM
|
||||
Array.prototype.forEach.call(links, function (link) {
|
||||
let template = link.import.querySelector('.task-template')
|
||||
let clone = document.importNode(template.content, true)
|
||||
if (link.href.match('about.html')) {
|
||||
document.querySelector('body').appendChild(clone)
|
||||
} else {
|
||||
document.querySelector('.content').appendChild(clone)
|
||||
}
|
||||
})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user