@pipelab/asset-electron 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/package.json +18 -0
- package/template/config.cjs +45 -0
- package/template/forge.config.cjs +70 -0
- package/template/package.json +62 -0
- package/template/pipelab-plugin.cjs +160 -0
- package/template/src/custom-main.js +1 -0
- package/template/src/handlers/dialog/folder.js +25 -0
- package/template/src/handlers/dialog/open.js +25 -0
- package/template/src/handlers/dialog/save.js +24 -0
- package/template/src/handlers/discord/set-activity.js +68 -0
- package/template/src/handlers/fs/copy.js +29 -0
- package/template/src/handlers/fs/delete.js +23 -0
- package/template/src/handlers/fs/exist.js +37 -0
- package/template/src/handlers/fs/file-size.js +24 -0
- package/template/src/handlers/fs/folder-create.js +25 -0
- package/template/src/handlers/fs/list.js +61 -0
- package/template/src/handlers/fs/move.js +30 -0
- package/template/src/handlers/fs/read-binary.js +24 -0
- package/template/src/handlers/fs/read.js +42 -0
- package/template/src/handlers/fs/write-base64.js +32 -0
- package/template/src/handlers/fs/write.js +30 -0
- package/template/src/handlers/general/engine.js +17 -0
- package/template/src/handlers/general/exit.js +20 -0
- package/template/src/handlers/general/infos.js +23 -0
- package/template/src/handlers/general/open-in-explorer.js +21 -0
- package/template/src/handlers/general/open.js +21 -0
- package/template/src/handlers/general/run.js +27 -0
- package/template/src/handlers/steam/deleteItem.js +26 -0
- package/template/src/handlers/steam/download.js +26 -0
- package/template/src/handlers/steam/downloadInfo.js +26 -0
- package/template/src/handlers/steam/downloadScore.js +28 -0
- package/template/src/handlers/steam/getItem.js +28 -0
- package/template/src/handlers/steam/getItems.js +28 -0
- package/template/src/handlers/steam/installInfo.js +26 -0
- package/template/src/handlers/steam/raw.js +42 -0
- package/template/src/handlers/steam/saveScreenshot.js +66 -0
- package/template/src/handlers/steam/state.js +26 -0
- package/template/src/handlers/steam/subscribe.js +26 -0
- package/template/src/handlers/steam/unsubscribe.js +26 -0
- package/template/src/handlers/steam/updateItem.js +26 -0
- package/template/src/handlers/steam/uploadScore.js +27 -0
- package/template/src/handlers/steam/utils.js +78 -0
- package/template/src/handlers/user/folder.js +71 -0
- package/template/src/handlers/window/maximize.js +20 -0
- package/template/src/handlers/window/minimize.js +20 -0
- package/template/src/handlers/window/request-attention.js +20 -0
- package/template/src/handlers/window/restore.js +20 -0
- package/template/src/handlers/window/set-always-on-top.js +20 -0
- package/template/src/handlers/window/set-fullscreen.js +26 -0
- package/template/src/handlers/window/set-height.js +21 -0
- package/template/src/handlers/window/set-ignore-mouse-events.js +36 -0
- package/template/src/handlers/window/set-maximum-size.js +20 -0
- package/template/src/handlers/window/set-minimum-size.js +20 -0
- package/template/src/handlers/window/set-resizable.js +20 -0
- package/template/src/handlers/window/set-title.js +20 -0
- package/template/src/handlers/window/set-width.js +21 -0
- package/template/src/handlers/window/set-x.js +21 -0
- package/template/src/handlers/window/set-y.js +21 -0
- package/template/src/handlers/window/show-dev-tools.js +24 -0
- package/template/src/handlers/window/unmaximize.js +20 -0
- package/template/src/index.js +958 -0
- package/template/src/preload.js +27 -0
- package/template/src/utils.js +18 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 CynToolkit
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipelab/asset-electron",
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
|
+
"description": "Electron assets for pipelab",
|
|
5
|
+
"license": "FSL-1.1-MIT",
|
|
6
|
+
"author": "CynToolkit",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/CynToolkit/pipelab.git",
|
|
10
|
+
"directory": "assets/asset-electron"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"template"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// THIS IS STUB DEFINITION
|
|
2
|
+
// WILL BE REPLACED ON BUILD
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
5
|
+
/// <reference path="../../../../src/definitions.d.ts" />
|
|
6
|
+
|
|
7
|
+
// @ts-check
|
|
8
|
+
|
|
9
|
+
/** @type {DesktopApp.Electron} */
|
|
10
|
+
const config = {
|
|
11
|
+
alwaysOnTop: false,
|
|
12
|
+
appBundleId: "com.pipelab.app",
|
|
13
|
+
appCategoryType: "",
|
|
14
|
+
appCopyright: "Copyright © 2024 Pipelab",
|
|
15
|
+
appVersion: "1.0.0",
|
|
16
|
+
author: "Pipelab",
|
|
17
|
+
customMainCode: "",
|
|
18
|
+
description: "A simple Electron application",
|
|
19
|
+
electronVersion: "",
|
|
20
|
+
disableAsarPackaging: true,
|
|
21
|
+
forceHighPerformanceGpu: false,
|
|
22
|
+
enableExtraLogging: false,
|
|
23
|
+
clearServiceWorkerOnBoot: false,
|
|
24
|
+
enableDisableRendererBackgrounding: false,
|
|
25
|
+
enableInProcessGPU: false,
|
|
26
|
+
openDevtoolsOnStart: false,
|
|
27
|
+
frame: true,
|
|
28
|
+
fullscreen: false,
|
|
29
|
+
icon: "",
|
|
30
|
+
height: 600,
|
|
31
|
+
name: "Pipelab",
|
|
32
|
+
toolbar: true,
|
|
33
|
+
transparent: false,
|
|
34
|
+
width: 800,
|
|
35
|
+
enableSteamSupport: false,
|
|
36
|
+
steamGameId: 480,
|
|
37
|
+
enableDiscordSupport: false,
|
|
38
|
+
discordAppId: "",
|
|
39
|
+
enableDoctor: false,
|
|
40
|
+
ignore: [],
|
|
41
|
+
serverMode: "default",
|
|
42
|
+
backgroundColor: "#FFF",
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = config;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
const { FusesPlugin } = require("@electron-forge/plugin-fuses");
|
|
4
|
+
const { FuseV1Options, FuseVersion } = require("@electron/fuses");
|
|
5
|
+
const { join } = require("path");
|
|
6
|
+
|
|
7
|
+
const PipelabPlugin = require("./pipelab-plugin.cjs");
|
|
8
|
+
|
|
9
|
+
const config = require("./config.cjs");
|
|
10
|
+
|
|
11
|
+
// Include all files in the dist directory regardless of OS (to support unpacking .so when built on windows)
|
|
12
|
+
const unpackFilter = join("**", "steamworks.js", "dist", "**", "*");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @type {import('@electron-forge/shared-types').ForgeConfig}
|
|
16
|
+
*/
|
|
17
|
+
module.exports = {
|
|
18
|
+
outDir: "./out",
|
|
19
|
+
packagerConfig: {
|
|
20
|
+
asar: config.disableAsarPackaging
|
|
21
|
+
? false
|
|
22
|
+
: {
|
|
23
|
+
unpack: unpackFilter,
|
|
24
|
+
},
|
|
25
|
+
name: config.name,
|
|
26
|
+
appBundleId: config.appBundleId,
|
|
27
|
+
appCopyright: config.appCopyright,
|
|
28
|
+
appVersion: config.appVersion,
|
|
29
|
+
// icon: './assets/icon', // file extension is ommited (auto completed by platform: darwin: icns, linux, win32)
|
|
30
|
+
win32metadata: {
|
|
31
|
+
CompanyName: config.author,
|
|
32
|
+
FileDescription: config.description,
|
|
33
|
+
},
|
|
34
|
+
appCategoryType: config.appCategoryType,
|
|
35
|
+
icon: config.icon,
|
|
36
|
+
ignore: config.ignore,
|
|
37
|
+
},
|
|
38
|
+
rebuildConfig: {},
|
|
39
|
+
makers: [
|
|
40
|
+
{
|
|
41
|
+
name: "@electron-forge/maker-dmg",
|
|
42
|
+
config: {},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "@electron-forge/maker-squirrel",
|
|
46
|
+
config: {},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "@electron-forge/maker-zip",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
plugins: [
|
|
53
|
+
// {
|
|
54
|
+
// name: '@electron-forge/plugin-auto-unpack-natives',
|
|
55
|
+
// config: {
|
|
56
|
+
// }
|
|
57
|
+
// },
|
|
58
|
+
new FusesPlugin({
|
|
59
|
+
version: FuseVersion.V1,
|
|
60
|
+
[FuseV1Options.RunAsNode]: false,
|
|
61
|
+
[FuseV1Options.EnableCookieEncryption]: true,
|
|
62
|
+
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
|
|
63
|
+
[FuseV1Options.EnableNodeCliInspectArguments]: false,
|
|
64
|
+
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]:
|
|
65
|
+
config.disableAsarPackaging === true ? false : true,
|
|
66
|
+
[FuseV1Options.OnlyLoadAppFromAsar]: config.disableAsarPackaging === true ? false : true,
|
|
67
|
+
}),
|
|
68
|
+
new PipelabPlugin(),
|
|
69
|
+
],
|
|
70
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "app",
|
|
3
|
+
"version": "0.9.9",
|
|
4
|
+
"description": "My Electron application description",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "[NAME]",
|
|
9
|
+
"email": "[EMAIL_ADDRESS]"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "src/index.js",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "electron-forge start",
|
|
15
|
+
"package": "electron-forge package",
|
|
16
|
+
"make": "electron-forge make",
|
|
17
|
+
"publish": "electron-forge publish",
|
|
18
|
+
"lint": "echo \"No linting configured\""
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@electron-forge/plugin-base": "7.11.1",
|
|
22
|
+
"@electron/asar": "3.2.13",
|
|
23
|
+
"@pipelab/steamworks.js": "^0.11.1",
|
|
24
|
+
"discord-rpc": "^4.0.1",
|
|
25
|
+
"electron-serve": "^2.1.1",
|
|
26
|
+
"electron-squirrel-startup": "1.0.1",
|
|
27
|
+
"execa": "^9.4.0",
|
|
28
|
+
"mime-types": "^3.0.2",
|
|
29
|
+
"move-file": "^3.1.0",
|
|
30
|
+
"mri": "1.2.0",
|
|
31
|
+
"semver": "^7.7.2",
|
|
32
|
+
"serve-handler": "^6.1.6",
|
|
33
|
+
"slash": "^5.1.0",
|
|
34
|
+
"ws": "^8.18.1"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@electron-forge/cli": "7.11.1",
|
|
38
|
+
"@electron-forge/maker-deb": "7.11.1",
|
|
39
|
+
"@electron-forge/maker-dmg": "7.11.1",
|
|
40
|
+
"@electron-forge/maker-rpm": "7.11.1",
|
|
41
|
+
"@electron-forge/maker-squirrel": "7.11.1",
|
|
42
|
+
"@electron-forge/maker-zip": "7.11.1",
|
|
43
|
+
"@electron-forge/plugin-auto-unpack-natives": "7.11.1",
|
|
44
|
+
"@electron-forge/plugin-fuses": "7.11.1",
|
|
45
|
+
"@electron/fuses": "1.8.0",
|
|
46
|
+
"@pipelab/core": "1.4.9",
|
|
47
|
+
"@types/mime-types": "^3.0.1",
|
|
48
|
+
"electron": "39.2.3"
|
|
49
|
+
},
|
|
50
|
+
"pnpm": {
|
|
51
|
+
"overrides": {
|
|
52
|
+
"discord-rpc>register-scheme": "-"
|
|
53
|
+
},
|
|
54
|
+
"onlyBuiltDependencies": [
|
|
55
|
+
"electron",
|
|
56
|
+
"electron-winstaller",
|
|
57
|
+
"fs-xattr",
|
|
58
|
+
"macos-alias"
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"productName": "app"
|
|
62
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const { PluginBase } = require("@electron-forge/plugin-base");
|
|
2
|
+
|
|
3
|
+
module.exports = class PipelabPlugin extends PluginBase {
|
|
4
|
+
getHooks() {
|
|
5
|
+
return {
|
|
6
|
+
prePackage: [this.prePackage],
|
|
7
|
+
generateAssets: [this.generateAssets],
|
|
8
|
+
postStart: [this.postStart],
|
|
9
|
+
packageAfterCopy: [this.packageAfterCopy],
|
|
10
|
+
packageAfterPrune: [this.packageAfterPrune],
|
|
11
|
+
packageAfterExtract: [this.packageAfterExtract],
|
|
12
|
+
postPackage: [this.postPackage],
|
|
13
|
+
preMake: [this.preMake],
|
|
14
|
+
postMake: [this.postMake],
|
|
15
|
+
readPackageJson: [this.readPackageJson],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
prePackage() {
|
|
20
|
+
// console.log('running prePackage hook')
|
|
21
|
+
}
|
|
22
|
+
generateAssets() {
|
|
23
|
+
// console.log('running generateAssets hook')
|
|
24
|
+
}
|
|
25
|
+
postStart() {
|
|
26
|
+
// console.log('running postStart hook')
|
|
27
|
+
}
|
|
28
|
+
async packageAfterCopy(config, buildPath, electronVersion, platform, arch) {
|
|
29
|
+
console.log(`Platform: ${platform}`);
|
|
30
|
+
console.log(`Architecture: ${arch}`);
|
|
31
|
+
console.log(`Build path: ${buildPath}`);
|
|
32
|
+
console.log(`Config: ${JSON.stringify(config)}`);
|
|
33
|
+
console.log(`Electron version: ${electronVersion}`);
|
|
34
|
+
const fs = require("fs").promises;
|
|
35
|
+
const path = require("path");
|
|
36
|
+
const pkg = require("./package.json");
|
|
37
|
+
|
|
38
|
+
console.log("config", config);
|
|
39
|
+
|
|
40
|
+
const outputFolder = path.resolve(buildPath, "..", "..");
|
|
41
|
+
|
|
42
|
+
// Runtime JSON file
|
|
43
|
+
|
|
44
|
+
const pipelabJsonPath = path.join(outputFolder, "pipelab.json");
|
|
45
|
+
|
|
46
|
+
await fs.writeFile(
|
|
47
|
+
pipelabJsonPath,
|
|
48
|
+
JSON.stringify(
|
|
49
|
+
{
|
|
50
|
+
name: config.name || pkg.productName || pkg.name,
|
|
51
|
+
version: config.appVersion || pkg.version,
|
|
52
|
+
description: config.description || pkg.description,
|
|
53
|
+
author: config.author || (typeof pkg.author === "object" ? pkg.author.name : pkg.author),
|
|
54
|
+
homepage: pkg.homepage,
|
|
55
|
+
engine: "Pipelab",
|
|
56
|
+
runtimeVersion: pkg.devDependencies["@pipelab/core"],
|
|
57
|
+
buildDate: new Date().toISOString(),
|
|
58
|
+
platform: platform,
|
|
59
|
+
arch: arch,
|
|
60
|
+
electron: electronVersion,
|
|
61
|
+
},
|
|
62
|
+
null,
|
|
63
|
+
2,
|
|
64
|
+
),
|
|
65
|
+
"utf8",
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
packageAfterPrune() {
|
|
69
|
+
// console.log('running packageAfterPrune hook')
|
|
70
|
+
}
|
|
71
|
+
packageAfterExtract() {
|
|
72
|
+
// console.log('running packageAfterExtract hook')
|
|
73
|
+
}
|
|
74
|
+
async postPackage(config, result) {
|
|
75
|
+
const fs = require("fs").promises;
|
|
76
|
+
const path = require("path");
|
|
77
|
+
const appConfig = require("./config.cjs");
|
|
78
|
+
|
|
79
|
+
const outputFolder = result.outputPaths[0];
|
|
80
|
+
|
|
81
|
+
// Doctor
|
|
82
|
+
if (result.platform === "win32" && appConfig.enableDoctor) {
|
|
83
|
+
const appName = config.packagerConfig.name;
|
|
84
|
+
console.log("appName", appName);
|
|
85
|
+
const doctorBatContent = `@echo off
|
|
86
|
+
pushd "%~dp0"
|
|
87
|
+
|
|
88
|
+
echo ${appName} Doctor - Checking prerequisites...
|
|
89
|
+
echo.
|
|
90
|
+
|
|
91
|
+
echo 1. Checking Windows version...
|
|
92
|
+
ver | find "10." >nul
|
|
93
|
+
if %errorlevel% neq 0 (
|
|
94
|
+
echo ERROR: Windows 10 or later required.
|
|
95
|
+
goto end
|
|
96
|
+
)
|
|
97
|
+
echo OK: Windows 10 or later detected.
|
|
98
|
+
echo.
|
|
99
|
+
|
|
100
|
+
echo 2. Checking Microsoft Visual C++ Redistributable...
|
|
101
|
+
reg query "HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x64" /v Installed >nul 2>&1
|
|
102
|
+
if %errorlevel% neq 0 (
|
|
103
|
+
echo ERROR: Microsoft Visual C++ Redistributable 2015-2022 not found.
|
|
104
|
+
goto end
|
|
105
|
+
)
|
|
106
|
+
echo OK: VC++ Redistributable found.
|
|
107
|
+
echo.
|
|
108
|
+
|
|
109
|
+
echo 3. Checking DirectX version...
|
|
110
|
+
reg query "HKLM\\SOFTWARE\\Microsoft\\DirectX" /v Version >nul 2>&1
|
|
111
|
+
if %errorlevel%==0 (
|
|
112
|
+
echo OK: DirectX detected.
|
|
113
|
+
) else (
|
|
114
|
+
echo ERROR: DirectX registry key not found.
|
|
115
|
+
)
|
|
116
|
+
echo.
|
|
117
|
+
|
|
118
|
+
echo 4. Checking Vulkan...
|
|
119
|
+
if exist "%SystemRoot%\\System32\\vulkan-1.dll" (
|
|
120
|
+
echo OK: Vulkan installed.
|
|
121
|
+
) else (
|
|
122
|
+
echo WARNING: Vulkan not found.
|
|
123
|
+
)
|
|
124
|
+
echo.
|
|
125
|
+
|
|
126
|
+
echo 5. GPU Information:
|
|
127
|
+
echo All GPUs:
|
|
128
|
+
powershell -NoProfile -Command "Get-CimInstance Win32_VideoController | Select-Object Name, AdapterRAM, DriverVersion | Format-Table -AutoSize"
|
|
129
|
+
echo.
|
|
130
|
+
|
|
131
|
+
echo All prerequisites met. Starting ${appName}...
|
|
132
|
+
echo Logs will be displayed and saved to ${appName.toLowerCase()}-debug.log
|
|
133
|
+
echo.
|
|
134
|
+
|
|
135
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "cmd /c '${appName}.exe --enable-logging 2>&1' | Tee-Object -FilePath '${appName.toLowerCase()}}-debug.log'"
|
|
136
|
+
|
|
137
|
+
echo.
|
|
138
|
+
if %ERRORLEVEL% NEQ 0 (
|
|
139
|
+
echo [ERROR] ${appName} exited with error code: %ERRORLEVEL%
|
|
140
|
+
) else (
|
|
141
|
+
echo ${appName} has exited. Logs saved to ${appName.toLowerCase()}}-debug.log
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
:end
|
|
145
|
+
popd
|
|
146
|
+
pause`;
|
|
147
|
+
const doctorBatPath = path.join(outputFolder, "doctor.bat");
|
|
148
|
+
await fs.writeFile(doctorBatPath, doctorBatContent, "utf8");
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
preMake() {
|
|
152
|
+
// console.log('running preMake hook')
|
|
153
|
+
}
|
|
154
|
+
postMake() {
|
|
155
|
+
// console.log('running postMake hook')
|
|
156
|
+
}
|
|
157
|
+
readPackageJson() {
|
|
158
|
+
// console.log('running readPackageJson hook')
|
|
159
|
+
}
|
|
160
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// THIS FILE WILL BE REPLACED
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dialog } from "electron";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageShowFolderDialog, 'input'>} json
|
|
5
|
+
* @param {import('ws').WebSocket} ws
|
|
6
|
+
*/
|
|
7
|
+
export default async (json, ws) => {
|
|
8
|
+
const openFolderDialogResponse = await dialog.showOpenDialog({
|
|
9
|
+
properties: ["openDirectory", "createDirectory"],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageShowFolderDialog, 'output'>}
|
|
14
|
+
*/
|
|
15
|
+
const dialogOpenResult = {
|
|
16
|
+
correlationId: json.correlationId,
|
|
17
|
+
url: json.url,
|
|
18
|
+
body: {
|
|
19
|
+
success: true,
|
|
20
|
+
canceled: openFolderDialogResponse.canceled,
|
|
21
|
+
paths: openFolderDialogResponse.filePaths,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
ws.send(JSON.stringify(dialogOpenResult));
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dialog } from "electron";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageShowOpenDialog, 'input'>} json
|
|
5
|
+
* @param {import('ws').WebSocket} ws
|
|
6
|
+
*/
|
|
7
|
+
export default async (json, ws) => {
|
|
8
|
+
const openDialogResponse = await dialog.showOpenDialog({
|
|
9
|
+
properties: ["openFile"],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageShowOpenDialog, 'output'>}
|
|
14
|
+
*/
|
|
15
|
+
const dialogOpenResult = {
|
|
16
|
+
correlationId: json.correlationId,
|
|
17
|
+
url: json.url,
|
|
18
|
+
body: {
|
|
19
|
+
success: true,
|
|
20
|
+
canceled: openDialogResponse.canceled,
|
|
21
|
+
paths: openDialogResponse.filePaths,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
ws.send(JSON.stringify(dialogOpenResult));
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { dialog } from "electron";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageShowSaveDialog, 'input'>} json
|
|
5
|
+
* @param {import('ws').WebSocket} ws
|
|
6
|
+
*/
|
|
7
|
+
export default async (json, ws) => {
|
|
8
|
+
const saveDialogResponse = await dialog.showSaveDialog({
|
|
9
|
+
properties: [],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageShowSaveDialog, 'output'>}
|
|
14
|
+
*/
|
|
15
|
+
const dialogOpenResult = {
|
|
16
|
+
correlationId: json.correlationId,
|
|
17
|
+
url: json.url,
|
|
18
|
+
body: {
|
|
19
|
+
success: true,
|
|
20
|
+
path: saveDialogResponse.filePath,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
ws.send(JSON.stringify(dialogOpenResult));
|
|
24
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').DiscordSetActivity, 'input'>} json
|
|
3
|
+
* @param {import('ws').WebSocket} ws
|
|
4
|
+
* @param {import('electron').BrowserWindow} mainWindow
|
|
5
|
+
* @param {import('discord-rpc').Client} rpc
|
|
6
|
+
*/
|
|
7
|
+
export default async (json, ws, mainWindow, rpc) => {
|
|
8
|
+
console.log("json", json);
|
|
9
|
+
|
|
10
|
+
const { body } = json;
|
|
11
|
+
const {
|
|
12
|
+
details,
|
|
13
|
+
largeImageKey,
|
|
14
|
+
largeImageText,
|
|
15
|
+
smallImageKey,
|
|
16
|
+
smallImageText,
|
|
17
|
+
startTimestamp,
|
|
18
|
+
state,
|
|
19
|
+
} = body;
|
|
20
|
+
|
|
21
|
+
if (!rpc || !mainWindow) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const startTimestampAsNumber = Number.parseInt(startTimestamp);
|
|
26
|
+
|
|
27
|
+
const payload = {
|
|
28
|
+
instance: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (details) payload.details = details;
|
|
32
|
+
if (state) payload.state = state;
|
|
33
|
+
if (largeImageKey) payload.largeImageKey = largeImageKey;
|
|
34
|
+
if (largeImageText) payload.largeImageText = largeImageText;
|
|
35
|
+
if (smallImageKey) payload.smallImageKey = smallImageKey;
|
|
36
|
+
if (smallImageText) payload.smallImageText = smallImageText;
|
|
37
|
+
if (!Number.isNaN(startTimestampAsNumber)) payload.startTimestamp = startTimestampAsNumber;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
await rpc.setActivity(payload);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').DiscordSetActivity, 'output'>}
|
|
44
|
+
*/
|
|
45
|
+
const result = {
|
|
46
|
+
url: json.url,
|
|
47
|
+
correlationId: json.correlationId,
|
|
48
|
+
body: {
|
|
49
|
+
success: true,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
ws.send(JSON.stringify(result));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error("e", e);
|
|
55
|
+
/**
|
|
56
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').DiscordSetActivity, 'output'>}
|
|
57
|
+
*/
|
|
58
|
+
const result = {
|
|
59
|
+
url: json.url,
|
|
60
|
+
correlationId: json.correlationId,
|
|
61
|
+
body: {
|
|
62
|
+
success: false,
|
|
63
|
+
error: e.message,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
ws.send(JSON.stringify(result));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { cp, mkdir } from "node:fs/promises";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageCopyFile, 'input'>} json
|
|
8
|
+
* @param {import('ws').WebSocket} ws
|
|
9
|
+
*/
|
|
10
|
+
export default async (json, ws) => {
|
|
11
|
+
const destDirName = dirname(json.body.destination);
|
|
12
|
+
await mkdir(destDirName, { recursive: true });
|
|
13
|
+
|
|
14
|
+
await cp(json.body.source, json.body.destination, {
|
|
15
|
+
force: json.body.overwrite,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageCopyFile, 'output'>}
|
|
20
|
+
*/
|
|
21
|
+
const readFileResult = {
|
|
22
|
+
correlationId: json.correlationId,
|
|
23
|
+
url: json.url,
|
|
24
|
+
body: {
|
|
25
|
+
success: true,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
ws.send(JSON.stringify(readFileResult));
|
|
29
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import { unlink } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageDelete, 'input'>} json
|
|
7
|
+
* @param {import('ws').WebSocket} ws
|
|
8
|
+
*/
|
|
9
|
+
export default async (json, ws) => {
|
|
10
|
+
await unlink(json.body.path);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {import('@pipelab/core').MakeInputOutput<import('@pipelab/core').MessageDelete, 'output'>}
|
|
14
|
+
*/
|
|
15
|
+
const readFileResult = {
|
|
16
|
+
correlationId: json.correlationId,
|
|
17
|
+
url: json.url,
|
|
18
|
+
body: {
|
|
19
|
+
success: true,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
ws.send(JSON.stringify(readFileResult));
|
|
23
|
+
};
|