@patodo/localapp 0.2.1 → 0.2.5
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/.localapp-artifact.json +109 -109
- package/README.md +12 -2
- package/bin/localapp.mjs +645 -184
- package/package.json +1 -1
- package/runtime/native/adapter-manifest.json +10 -10
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/MacOS/LocalAppBridge +0 -0
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/Resources/localapp-native-ipc-client.mjs +57 -5
- package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/MacOS/LocalAppBridge +0 -0
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/Resources/localapp-native-ipc-client.mjs +57 -5
- package/runtime/native/darwin-x64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources +2 -2
- package/runtime/native/linux-x64/localapp-native-ipc-client.mjs +57 -5
- package/runtime/native/linux-x64/localapp-notifications +0 -0
- package/runtime/native/win32-x64/localapp-native-ipc-client.mjs +57 -5
- package/runtime/native/win32-x64/localapp-native.exe +0 -0
- package/runtime/server/.localapp-server-runtime.json +59 -59
- package/runtime/server/bin/worker.cjs +110 -2
- package/runtime/server/web/404.html +1 -1
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/page-3252f21360e42fa1.js +1 -0
- package/runtime/server/web/_next/static/css/b8973d29c0d3fd9b.css +3 -0
- package/runtime/server/web/inbox.html +1 -1
- package/runtime/server/web/inbox.txt +2 -2
- package/runtime/server/web/index.html +1 -1
- package/runtime/server/web/index.txt +3 -3
- package/runtime/server/web/my/analytics.html +1 -1
- package/runtime/server/web/my/analytics.txt +2 -2
- package/runtime/server/web/my/apps/placeholder/settings.html +1 -1
- package/runtime/server/web/my/apps/placeholder/settings.txt +2 -2
- package/runtime/server/web/my/apps.html +1 -1
- package/runtime/server/web/my/apps.txt +2 -2
- package/runtime/server/web/my/dashboard.html +1 -1
- package/runtime/server/web/my/dashboard.txt +2 -2
- package/runtime/server/web/my/device-actions.html +1 -1
- package/runtime/server/web/my/device-actions.txt +2 -2
- package/runtime/server/web/my/device-notifications.html +1 -1
- package/runtime/server/web/my/device-notifications.txt +2 -2
- package/runtime/server/web/my/favorites.html +1 -1
- package/runtime/server/web/my/favorites.txt +2 -2
- package/runtime/server/web/my/groups.html +1 -1
- package/runtime/server/web/my/groups.txt +2 -2
- package/runtime/server/web/my/info.html +1 -1
- package/runtime/server/web/my/info.txt +2 -2
- package/runtime/server/web/my/keys.html +1 -1
- package/runtime/server/web/my/keys.txt +2 -2
- package/runtime/server/web/my/orgs.html +1 -1
- package/runtime/server/web/my/orgs.txt +2 -2
- package/runtime/server/web/my/pages.html +1 -1
- package/runtime/server/web/my/pages.txt +2 -2
- package/runtime/server/web/my/peers.html +1 -1
- package/runtime/server/web/my/peers.txt +2 -2
- package/runtime/server/web/my/recent.html +1 -1
- package/runtime/server/web/my/recent.txt +2 -2
- package/runtime/server/web/my/settings.html +1 -1
- package/runtime/server/web/my/settings.txt +2 -2
- package/runtime/server/web/my/studio.html +1 -1
- package/runtime/server/web/my/studio.txt +2 -2
- package/runtime/server/web/my/subscriptions.html +1 -1
- package/runtime/server/web/my/subscriptions.txt +2 -2
- package/runtime/server/web/my/system.html +1 -1
- package/runtime/server/web/my/system.txt +2 -2
- package/runtime/server/web/my/tasks.html +1 -1
- package/runtime/server/web/my/tasks.txt +2 -2
- package/runtime/server/web/my/users.html +1 -1
- package/runtime/server/web/my/users.txt +2 -2
- package/runtime/server/web/my.html +1 -1
- package/runtime/server/web/my.txt +2 -2
- package/runtime/server/web/platform-shell/placeholder/placeholder.html +1 -1
- package/runtime/server/web/platform-shell/placeholder/placeholder.txt +2 -2
- package/runtime/server/web/platform-shell-preview.html +1 -1
- package/runtime/server/web/platform-shell-preview.txt +2 -2
- package/runtime/server/web/setup.html +1 -1
- package/runtime/server/web/setup.txt +2 -2
- package/template/runtime/version.json +1 -1
- package/runtime/server/web/_next/static/chunks/app/(dashboard)/page-f4641be7b88818a2.js +0 -1
- package/runtime/server/web/_next/static/css/7618766dbe836b27.css +0 -3
- /package/runtime/server/web/_next/static/{GyUKT-hZbRN2iexOBXTTr → xssdbCxur5ZBKtk-0DVhn}/_buildManifest.js +0 -0
- /package/runtime/server/web/_next/static/{GyUKT-hZbRN2iexOBXTTr → xssdbCxur5ZBKtk-0DVhn}/_ssgManifest.js +0 -0
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"assets": [
|
|
10
10
|
{
|
|
11
11
|
"path": "darwin-arm64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources",
|
|
12
|
-
"sha256": "
|
|
12
|
+
"sha256": "01fa9ac20186a8fc747c341e9c876c3b3895713d225a8f53b7daa75aab4a9edc"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "darwin-arm64/LocalAppBridge.app/Contents/Info.plist",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "darwin-arm64/LocalAppBridge.app/Contents/MacOS/LocalAppBridge",
|
|
20
|
-
"sha256": "
|
|
20
|
+
"sha256": "b264efd88bc7226972fcafcb8f83131832e44a1570166d7f639a29ace2150ef8"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"path": "darwin-arm64/LocalAppBridge.app/Contents/Resources/localapp-native-ipc-client.mjs",
|
|
24
|
-
"sha256": "
|
|
24
|
+
"sha256": "2ee2af9298de9352a7794970aade709bcd73e53f43731ec7750193b2ff670341"
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
27
|
},
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"assets": [
|
|
34
34
|
{
|
|
35
35
|
"path": "darwin-x64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources",
|
|
36
|
-
"sha256": "
|
|
36
|
+
"sha256": "01fa9ac20186a8fc747c341e9c876c3b3895713d225a8f53b7daa75aab4a9edc"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"path": "darwin-x64/LocalAppBridge.app/Contents/Info.plist",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"path": "darwin-x64/LocalAppBridge.app/Contents/MacOS/LocalAppBridge",
|
|
44
|
-
"sha256": "
|
|
44
|
+
"sha256": "25396c080397979b9da88e3582ac1e3cfffc1a2a9a3e14582c662a363d448b31"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"path": "darwin-x64/LocalAppBridge.app/Contents/Resources/localapp-native-ipc-client.mjs",
|
|
48
|
-
"sha256": "
|
|
48
|
+
"sha256": "2ee2af9298de9352a7794970aade709bcd73e53f43731ec7750193b2ff670341"
|
|
49
49
|
}
|
|
50
50
|
]
|
|
51
51
|
},
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"assets": [
|
|
58
58
|
{
|
|
59
59
|
"path": "linux-x64/localapp-native-ipc-client.mjs",
|
|
60
|
-
"sha256": "
|
|
60
|
+
"sha256": "2ee2af9298de9352a7794970aade709bcd73e53f43731ec7750193b2ff670341"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"path": "linux-x64/localapp-notifications",
|
|
64
|
-
"sha256": "
|
|
64
|
+
"sha256": "eb725b966be0302924402096278992dd449ca8707cdfdee086ba191eeadb3d2f"
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
67
|
},
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
"assets": [
|
|
74
74
|
{
|
|
75
75
|
"path": "win32-x64/localapp-native-ipc-client.mjs",
|
|
76
|
-
"sha256": "
|
|
76
|
+
"sha256": "2ee2af9298de9352a7794970aade709bcd73e53f43731ec7750193b2ff670341"
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
"path": "win32-x64/localapp-native.exe",
|
|
80
|
-
"sha256": "
|
|
80
|
+
"sha256": "50105ea8865b52710329803cdad583467091467c268f9b6e7233496f312bd1cc"
|
|
81
81
|
}
|
|
82
82
|
]
|
|
83
83
|
}
|
|
Binary file
|
|
@@ -586,7 +586,7 @@ function createLinuxSystemdUserService(options) {
|
|
|
586
586
|
return { mode: "service", installed };
|
|
587
587
|
},
|
|
588
588
|
async start(signal) {
|
|
589
|
-
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "
|
|
589
|
+
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "restart", UNIT_NAME] }, signal));
|
|
590
590
|
},
|
|
591
591
|
async stop() {
|
|
592
592
|
const result = await options.run({ command: systemctl, args: ["--user", "stop", UNIT_NAME] });
|
|
@@ -627,8 +627,8 @@ Type=simple
|
|
|
627
627
|
ExecStart=${systemdQuote(options.nodePath)} ${systemdQuote(options.layout.launcherPath)}
|
|
628
628
|
Restart=on-failure
|
|
629
629
|
RestartSec=2
|
|
630
|
-
StandardOutput=append:${
|
|
631
|
-
StandardError=append:${
|
|
630
|
+
StandardOutput=append:${options.layout.daemonLogPath}
|
|
631
|
+
StandardError=append:${options.layout.daemonLogPath}
|
|
632
632
|
${environment ? `${environment}
|
|
633
633
|
` : ""}
|
|
634
634
|
[Install]
|
|
@@ -763,18 +763,25 @@ function createWindowsUserTask(options) {
|
|
|
763
763
|
registrationPath,
|
|
764
764
|
async install() {
|
|
765
765
|
const installed = await writeServiceFile(registrationPath, metadata);
|
|
766
|
+
const definitionPath = path5.join(path5.dirname(registrationPath), "windows-user-task.xml");
|
|
767
|
+
await fs4.mkdir(path5.dirname(definitionPath), { recursive: true });
|
|
768
|
+
await fs4.writeFile(definitionPath, taskDefinition(options.nodePath, options.layout.launcherPath));
|
|
766
769
|
await runServiceCommand(options.run, {
|
|
767
770
|
command: scheduler,
|
|
768
|
-
args: ["/Create", "/TN", TASK_NAME, "/
|
|
771
|
+
args: ["/Create", "/TN", TASK_NAME, "/XML", definitionPath, "/F"]
|
|
769
772
|
});
|
|
770
773
|
return { mode: "service", installed };
|
|
771
774
|
},
|
|
772
775
|
async start(signal) {
|
|
776
|
+
const ended = await options.run(withAbortSignal({ command: scheduler, args: ["/End", "/TN", TASK_NAME] }, signal));
|
|
777
|
+
if (ended.code !== 0 && !isNotRunningTask(ended.stderr)) {
|
|
778
|
+
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
|
+
}
|
|
773
780
|
await runServiceCommand(options.run, withAbortSignal({ command: scheduler, args: ["/Run", "/TN", TASK_NAME] }, signal));
|
|
774
781
|
},
|
|
775
782
|
async stop() {
|
|
776
783
|
const result = await options.run({ command: scheduler, args: ["/End", "/TN", TASK_NAME] });
|
|
777
|
-
if (result.code !== 0 &&
|
|
784
|
+
if (result.code !== 0 && !isNotRunningTask(result.stderr)) {
|
|
778
785
|
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
786
|
}
|
|
780
787
|
},
|
|
@@ -795,6 +802,51 @@ function createWindowsUserTask(options) {
|
|
|
795
802
|
}
|
|
796
803
|
};
|
|
797
804
|
}
|
|
805
|
+
function isNotRunningTask(stderr) {
|
|
806
|
+
return /cannot find|does not exist|not currently running/i.test(stderr);
|
|
807
|
+
}
|
|
808
|
+
function taskDefinition(nodePath, launcherPath) {
|
|
809
|
+
const xml = `<?xml version="1.0" encoding="UTF-16"?>
|
|
810
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
811
|
+
<RegistrationInfo>
|
|
812
|
+
<Description>LocalApp per-user daemon</Description>
|
|
813
|
+
</RegistrationInfo>
|
|
814
|
+
<Triggers>
|
|
815
|
+
<LogonTrigger>
|
|
816
|
+
<Enabled>true</Enabled>
|
|
817
|
+
</LogonTrigger>
|
|
818
|
+
</Triggers>
|
|
819
|
+
<Principals>
|
|
820
|
+
<Principal id="Author">
|
|
821
|
+
<LogonType>S4U</LogonType>
|
|
822
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
823
|
+
</Principal>
|
|
824
|
+
</Principals>
|
|
825
|
+
<Settings>
|
|
826
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
827
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
828
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
829
|
+
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
830
|
+
<Enabled>true</Enabled>
|
|
831
|
+
<Hidden>false</Hidden>
|
|
832
|
+
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
833
|
+
<WakeToRun>false</WakeToRun>
|
|
834
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
835
|
+
<Priority>7</Priority>
|
|
836
|
+
</Settings>
|
|
837
|
+
<Actions Context="Author">
|
|
838
|
+
<Exec>
|
|
839
|
+
<Command>${xmlEscape2(nodePath)}</Command>
|
|
840
|
+
<Arguments>${xmlEscape2(launcherPath)}</Arguments>
|
|
841
|
+
</Exec>
|
|
842
|
+
</Actions>
|
|
843
|
+
</Task>
|
|
844
|
+
`;
|
|
845
|
+
return Buffer.concat([Buffer.from([255, 254]), Buffer.from(xml, "utf16le")]);
|
|
846
|
+
}
|
|
847
|
+
function xmlEscape2(value) {
|
|
848
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
849
|
+
}
|
|
798
850
|
function quoteWindowsArgument(value) {
|
|
799
851
|
if (value.includes("\0") || /[\r\n]/.test(value)) {
|
|
800
852
|
throw lifecycleError("user_service_configuration_invalid", "The Windows service command path is invalid");
|
package/runtime/native/darwin-arm64/LocalAppBridge.app/Contents/_CodeSignature/CodeResources
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Resources/localapp-native-ipc-client.mjs</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
DmAfkEEntnb0fXa0JHIpTWswgHo=
|
|
10
10
|
</data>
|
|
11
11
|
</dict>
|
|
12
12
|
<key>files2</key>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<dict>
|
|
16
16
|
<key>hash2</key>
|
|
17
17
|
<data>
|
|
18
|
-
|
|
18
|
+
LuKvkpjek1KneUlwqt5wm81z5T9Dcx7HdQGTsv9nA0E=
|
|
19
19
|
</data>
|
|
20
20
|
</dict>
|
|
21
21
|
</dict>
|
|
Binary file
|
|
@@ -586,7 +586,7 @@ function createLinuxSystemdUserService(options) {
|
|
|
586
586
|
return { mode: "service", installed };
|
|
587
587
|
},
|
|
588
588
|
async start(signal) {
|
|
589
|
-
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "
|
|
589
|
+
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "restart", UNIT_NAME] }, signal));
|
|
590
590
|
},
|
|
591
591
|
async stop() {
|
|
592
592
|
const result = await options.run({ command: systemctl, args: ["--user", "stop", UNIT_NAME] });
|
|
@@ -627,8 +627,8 @@ Type=simple
|
|
|
627
627
|
ExecStart=${systemdQuote(options.nodePath)} ${systemdQuote(options.layout.launcherPath)}
|
|
628
628
|
Restart=on-failure
|
|
629
629
|
RestartSec=2
|
|
630
|
-
StandardOutput=append:${
|
|
631
|
-
StandardError=append:${
|
|
630
|
+
StandardOutput=append:${options.layout.daemonLogPath}
|
|
631
|
+
StandardError=append:${options.layout.daemonLogPath}
|
|
632
632
|
${environment ? `${environment}
|
|
633
633
|
` : ""}
|
|
634
634
|
[Install]
|
|
@@ -763,18 +763,25 @@ function createWindowsUserTask(options) {
|
|
|
763
763
|
registrationPath,
|
|
764
764
|
async install() {
|
|
765
765
|
const installed = await writeServiceFile(registrationPath, metadata);
|
|
766
|
+
const definitionPath = path5.join(path5.dirname(registrationPath), "windows-user-task.xml");
|
|
767
|
+
await fs4.mkdir(path5.dirname(definitionPath), { recursive: true });
|
|
768
|
+
await fs4.writeFile(definitionPath, taskDefinition(options.nodePath, options.layout.launcherPath));
|
|
766
769
|
await runServiceCommand(options.run, {
|
|
767
770
|
command: scheduler,
|
|
768
|
-
args: ["/Create", "/TN", TASK_NAME, "/
|
|
771
|
+
args: ["/Create", "/TN", TASK_NAME, "/XML", definitionPath, "/F"]
|
|
769
772
|
});
|
|
770
773
|
return { mode: "service", installed };
|
|
771
774
|
},
|
|
772
775
|
async start(signal) {
|
|
776
|
+
const ended = await options.run(withAbortSignal({ command: scheduler, args: ["/End", "/TN", TASK_NAME] }, signal));
|
|
777
|
+
if (ended.code !== 0 && !isNotRunningTask(ended.stderr)) {
|
|
778
|
+
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
|
+
}
|
|
773
780
|
await runServiceCommand(options.run, withAbortSignal({ command: scheduler, args: ["/Run", "/TN", TASK_NAME] }, signal));
|
|
774
781
|
},
|
|
775
782
|
async stop() {
|
|
776
783
|
const result = await options.run({ command: scheduler, args: ["/End", "/TN", TASK_NAME] });
|
|
777
|
-
if (result.code !== 0 &&
|
|
784
|
+
if (result.code !== 0 && !isNotRunningTask(result.stderr)) {
|
|
778
785
|
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
786
|
}
|
|
780
787
|
},
|
|
@@ -795,6 +802,51 @@ function createWindowsUserTask(options) {
|
|
|
795
802
|
}
|
|
796
803
|
};
|
|
797
804
|
}
|
|
805
|
+
function isNotRunningTask(stderr) {
|
|
806
|
+
return /cannot find|does not exist|not currently running/i.test(stderr);
|
|
807
|
+
}
|
|
808
|
+
function taskDefinition(nodePath, launcherPath) {
|
|
809
|
+
const xml = `<?xml version="1.0" encoding="UTF-16"?>
|
|
810
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
811
|
+
<RegistrationInfo>
|
|
812
|
+
<Description>LocalApp per-user daemon</Description>
|
|
813
|
+
</RegistrationInfo>
|
|
814
|
+
<Triggers>
|
|
815
|
+
<LogonTrigger>
|
|
816
|
+
<Enabled>true</Enabled>
|
|
817
|
+
</LogonTrigger>
|
|
818
|
+
</Triggers>
|
|
819
|
+
<Principals>
|
|
820
|
+
<Principal id="Author">
|
|
821
|
+
<LogonType>S4U</LogonType>
|
|
822
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
823
|
+
</Principal>
|
|
824
|
+
</Principals>
|
|
825
|
+
<Settings>
|
|
826
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
827
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
828
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
829
|
+
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
830
|
+
<Enabled>true</Enabled>
|
|
831
|
+
<Hidden>false</Hidden>
|
|
832
|
+
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
833
|
+
<WakeToRun>false</WakeToRun>
|
|
834
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
835
|
+
<Priority>7</Priority>
|
|
836
|
+
</Settings>
|
|
837
|
+
<Actions Context="Author">
|
|
838
|
+
<Exec>
|
|
839
|
+
<Command>${xmlEscape2(nodePath)}</Command>
|
|
840
|
+
<Arguments>${xmlEscape2(launcherPath)}</Arguments>
|
|
841
|
+
</Exec>
|
|
842
|
+
</Actions>
|
|
843
|
+
</Task>
|
|
844
|
+
`;
|
|
845
|
+
return Buffer.concat([Buffer.from([255, 254]), Buffer.from(xml, "utf16le")]);
|
|
846
|
+
}
|
|
847
|
+
function xmlEscape2(value) {
|
|
848
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
849
|
+
}
|
|
798
850
|
function quoteWindowsArgument(value) {
|
|
799
851
|
if (value.includes("\0") || /[\r\n]/.test(value)) {
|
|
800
852
|
throw lifecycleError("user_service_configuration_invalid", "The Windows service command path is invalid");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Resources/localapp-native-ipc-client.mjs</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
DmAfkEEntnb0fXa0JHIpTWswgHo=
|
|
10
10
|
</data>
|
|
11
11
|
</dict>
|
|
12
12
|
<key>files2</key>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<dict>
|
|
16
16
|
<key>hash2</key>
|
|
17
17
|
<data>
|
|
18
|
-
|
|
18
|
+
LuKvkpjek1KneUlwqt5wm81z5T9Dcx7HdQGTsv9nA0E=
|
|
19
19
|
</data>
|
|
20
20
|
</dict>
|
|
21
21
|
</dict>
|
|
@@ -586,7 +586,7 @@ function createLinuxSystemdUserService(options) {
|
|
|
586
586
|
return { mode: "service", installed };
|
|
587
587
|
},
|
|
588
588
|
async start(signal) {
|
|
589
|
-
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "
|
|
589
|
+
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "restart", UNIT_NAME] }, signal));
|
|
590
590
|
},
|
|
591
591
|
async stop() {
|
|
592
592
|
const result = await options.run({ command: systemctl, args: ["--user", "stop", UNIT_NAME] });
|
|
@@ -627,8 +627,8 @@ Type=simple
|
|
|
627
627
|
ExecStart=${systemdQuote(options.nodePath)} ${systemdQuote(options.layout.launcherPath)}
|
|
628
628
|
Restart=on-failure
|
|
629
629
|
RestartSec=2
|
|
630
|
-
StandardOutput=append:${
|
|
631
|
-
StandardError=append:${
|
|
630
|
+
StandardOutput=append:${options.layout.daemonLogPath}
|
|
631
|
+
StandardError=append:${options.layout.daemonLogPath}
|
|
632
632
|
${environment ? `${environment}
|
|
633
633
|
` : ""}
|
|
634
634
|
[Install]
|
|
@@ -763,18 +763,25 @@ function createWindowsUserTask(options) {
|
|
|
763
763
|
registrationPath,
|
|
764
764
|
async install() {
|
|
765
765
|
const installed = await writeServiceFile(registrationPath, metadata);
|
|
766
|
+
const definitionPath = path5.join(path5.dirname(registrationPath), "windows-user-task.xml");
|
|
767
|
+
await fs4.mkdir(path5.dirname(definitionPath), { recursive: true });
|
|
768
|
+
await fs4.writeFile(definitionPath, taskDefinition(options.nodePath, options.layout.launcherPath));
|
|
766
769
|
await runServiceCommand(options.run, {
|
|
767
770
|
command: scheduler,
|
|
768
|
-
args: ["/Create", "/TN", TASK_NAME, "/
|
|
771
|
+
args: ["/Create", "/TN", TASK_NAME, "/XML", definitionPath, "/F"]
|
|
769
772
|
});
|
|
770
773
|
return { mode: "service", installed };
|
|
771
774
|
},
|
|
772
775
|
async start(signal) {
|
|
776
|
+
const ended = await options.run(withAbortSignal({ command: scheduler, args: ["/End", "/TN", TASK_NAME] }, signal));
|
|
777
|
+
if (ended.code !== 0 && !isNotRunningTask(ended.stderr)) {
|
|
778
|
+
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
|
+
}
|
|
773
780
|
await runServiceCommand(options.run, withAbortSignal({ command: scheduler, args: ["/Run", "/TN", TASK_NAME] }, signal));
|
|
774
781
|
},
|
|
775
782
|
async stop() {
|
|
776
783
|
const result = await options.run({ command: scheduler, args: ["/End", "/TN", TASK_NAME] });
|
|
777
|
-
if (result.code !== 0 &&
|
|
784
|
+
if (result.code !== 0 && !isNotRunningTask(result.stderr)) {
|
|
778
785
|
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
786
|
}
|
|
780
787
|
},
|
|
@@ -795,6 +802,51 @@ function createWindowsUserTask(options) {
|
|
|
795
802
|
}
|
|
796
803
|
};
|
|
797
804
|
}
|
|
805
|
+
function isNotRunningTask(stderr) {
|
|
806
|
+
return /cannot find|does not exist|not currently running/i.test(stderr);
|
|
807
|
+
}
|
|
808
|
+
function taskDefinition(nodePath, launcherPath) {
|
|
809
|
+
const xml = `<?xml version="1.0" encoding="UTF-16"?>
|
|
810
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
811
|
+
<RegistrationInfo>
|
|
812
|
+
<Description>LocalApp per-user daemon</Description>
|
|
813
|
+
</RegistrationInfo>
|
|
814
|
+
<Triggers>
|
|
815
|
+
<LogonTrigger>
|
|
816
|
+
<Enabled>true</Enabled>
|
|
817
|
+
</LogonTrigger>
|
|
818
|
+
</Triggers>
|
|
819
|
+
<Principals>
|
|
820
|
+
<Principal id="Author">
|
|
821
|
+
<LogonType>S4U</LogonType>
|
|
822
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
823
|
+
</Principal>
|
|
824
|
+
</Principals>
|
|
825
|
+
<Settings>
|
|
826
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
827
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
828
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
829
|
+
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
830
|
+
<Enabled>true</Enabled>
|
|
831
|
+
<Hidden>false</Hidden>
|
|
832
|
+
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
833
|
+
<WakeToRun>false</WakeToRun>
|
|
834
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
835
|
+
<Priority>7</Priority>
|
|
836
|
+
</Settings>
|
|
837
|
+
<Actions Context="Author">
|
|
838
|
+
<Exec>
|
|
839
|
+
<Command>${xmlEscape2(nodePath)}</Command>
|
|
840
|
+
<Arguments>${xmlEscape2(launcherPath)}</Arguments>
|
|
841
|
+
</Exec>
|
|
842
|
+
</Actions>
|
|
843
|
+
</Task>
|
|
844
|
+
`;
|
|
845
|
+
return Buffer.concat([Buffer.from([255, 254]), Buffer.from(xml, "utf16le")]);
|
|
846
|
+
}
|
|
847
|
+
function xmlEscape2(value) {
|
|
848
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
849
|
+
}
|
|
798
850
|
function quoteWindowsArgument(value) {
|
|
799
851
|
if (value.includes("\0") || /[\r\n]/.test(value)) {
|
|
800
852
|
throw lifecycleError("user_service_configuration_invalid", "The Windows service command path is invalid");
|
|
Binary file
|
|
@@ -586,7 +586,7 @@ function createLinuxSystemdUserService(options) {
|
|
|
586
586
|
return { mode: "service", installed };
|
|
587
587
|
},
|
|
588
588
|
async start(signal) {
|
|
589
|
-
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "
|
|
589
|
+
await runServiceCommand(options.run, withAbortSignal({ command: systemctl, args: ["--user", "restart", UNIT_NAME] }, signal));
|
|
590
590
|
},
|
|
591
591
|
async stop() {
|
|
592
592
|
const result = await options.run({ command: systemctl, args: ["--user", "stop", UNIT_NAME] });
|
|
@@ -627,8 +627,8 @@ Type=simple
|
|
|
627
627
|
ExecStart=${systemdQuote(options.nodePath)} ${systemdQuote(options.layout.launcherPath)}
|
|
628
628
|
Restart=on-failure
|
|
629
629
|
RestartSec=2
|
|
630
|
-
StandardOutput=append:${
|
|
631
|
-
StandardError=append:${
|
|
630
|
+
StandardOutput=append:${options.layout.daemonLogPath}
|
|
631
|
+
StandardError=append:${options.layout.daemonLogPath}
|
|
632
632
|
${environment ? `${environment}
|
|
633
633
|
` : ""}
|
|
634
634
|
[Install]
|
|
@@ -763,18 +763,25 @@ function createWindowsUserTask(options) {
|
|
|
763
763
|
registrationPath,
|
|
764
764
|
async install() {
|
|
765
765
|
const installed = await writeServiceFile(registrationPath, metadata);
|
|
766
|
+
const definitionPath = path5.join(path5.dirname(registrationPath), "windows-user-task.xml");
|
|
767
|
+
await fs4.mkdir(path5.dirname(definitionPath), { recursive: true });
|
|
768
|
+
await fs4.writeFile(definitionPath, taskDefinition(options.nodePath, options.layout.launcherPath));
|
|
766
769
|
await runServiceCommand(options.run, {
|
|
767
770
|
command: scheduler,
|
|
768
|
-
args: ["/Create", "/TN", TASK_NAME, "/
|
|
771
|
+
args: ["/Create", "/TN", TASK_NAME, "/XML", definitionPath, "/F"]
|
|
769
772
|
});
|
|
770
773
|
return { mode: "service", installed };
|
|
771
774
|
},
|
|
772
775
|
async start(signal) {
|
|
776
|
+
const ended = await options.run(withAbortSignal({ command: scheduler, args: ["/End", "/TN", TASK_NAME] }, signal));
|
|
777
|
+
if (ended.code !== 0 && !isNotRunningTask(ended.stderr)) {
|
|
778
|
+
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
|
+
}
|
|
773
780
|
await runServiceCommand(options.run, withAbortSignal({ command: scheduler, args: ["/Run", "/TN", TASK_NAME] }, signal));
|
|
774
781
|
},
|
|
775
782
|
async stop() {
|
|
776
783
|
const result = await options.run({ command: scheduler, args: ["/End", "/TN", TASK_NAME] });
|
|
777
|
-
if (result.code !== 0 &&
|
|
784
|
+
if (result.code !== 0 && !isNotRunningTask(result.stderr)) {
|
|
778
785
|
throw lifecycleError("user_service_command_failed", "The Windows user task could not be stopped");
|
|
779
786
|
}
|
|
780
787
|
},
|
|
@@ -795,6 +802,51 @@ function createWindowsUserTask(options) {
|
|
|
795
802
|
}
|
|
796
803
|
};
|
|
797
804
|
}
|
|
805
|
+
function isNotRunningTask(stderr) {
|
|
806
|
+
return /cannot find|does not exist|not currently running/i.test(stderr);
|
|
807
|
+
}
|
|
808
|
+
function taskDefinition(nodePath, launcherPath) {
|
|
809
|
+
const xml = `<?xml version="1.0" encoding="UTF-16"?>
|
|
810
|
+
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
811
|
+
<RegistrationInfo>
|
|
812
|
+
<Description>LocalApp per-user daemon</Description>
|
|
813
|
+
</RegistrationInfo>
|
|
814
|
+
<Triggers>
|
|
815
|
+
<LogonTrigger>
|
|
816
|
+
<Enabled>true</Enabled>
|
|
817
|
+
</LogonTrigger>
|
|
818
|
+
</Triggers>
|
|
819
|
+
<Principals>
|
|
820
|
+
<Principal id="Author">
|
|
821
|
+
<LogonType>S4U</LogonType>
|
|
822
|
+
<RunLevel>LeastPrivilege</RunLevel>
|
|
823
|
+
</Principal>
|
|
824
|
+
</Principals>
|
|
825
|
+
<Settings>
|
|
826
|
+
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
|
827
|
+
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
|
828
|
+
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
|
829
|
+
<AllowStartOnDemand>true</AllowStartOnDemand>
|
|
830
|
+
<Enabled>true</Enabled>
|
|
831
|
+
<Hidden>false</Hidden>
|
|
832
|
+
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
|
833
|
+
<WakeToRun>false</WakeToRun>
|
|
834
|
+
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
|
835
|
+
<Priority>7</Priority>
|
|
836
|
+
</Settings>
|
|
837
|
+
<Actions Context="Author">
|
|
838
|
+
<Exec>
|
|
839
|
+
<Command>${xmlEscape2(nodePath)}</Command>
|
|
840
|
+
<Arguments>${xmlEscape2(launcherPath)}</Arguments>
|
|
841
|
+
</Exec>
|
|
842
|
+
</Actions>
|
|
843
|
+
</Task>
|
|
844
|
+
`;
|
|
845
|
+
return Buffer.concat([Buffer.from([255, 254]), Buffer.from(xml, "utf16le")]);
|
|
846
|
+
}
|
|
847
|
+
function xmlEscape2(value) {
|
|
848
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'");
|
|
849
|
+
}
|
|
798
850
|
function quoteWindowsArgument(value) {
|
|
799
851
|
if (value.includes("\0") || /[\r\n]/.test(value)) {
|
|
800
852
|
throw lifecycleError("user_service_configuration_invalid", "The Windows service command path is invalid");
|
|
Binary file
|