klaudio 0.11.4 → 0.12.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/package.json +1 -1
- package/src/notify.js +3 -2
package/package.json
CHANGED
package/src/notify.js
CHANGED
|
@@ -65,6 +65,7 @@ function notifyWindows(title, body) {
|
|
|
65
65
|
const toastXml = `<toast${toastAttrs}><visual><binding template="ToastGeneric"><text>${safeTitle}</text><text>${safeBody}</text></binding></visual></toast>`;
|
|
66
66
|
|
|
67
67
|
// PowerShell script: show WinRT toast notification
|
|
68
|
+
// Use -EncodedCommand to avoid all escaping issues with special chars
|
|
68
69
|
const ps = `\
|
|
69
70
|
[void][Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
|
|
70
71
|
[void][Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom, ContentType = WindowsRuntime]
|
|
@@ -73,8 +74,8 @@ $x.LoadXml('${toastXml.replace(/'/g, "''")}')
|
|
|
73
74
|
$t = [Windows.UI.Notifications.ToastNotification]::new($x)
|
|
74
75
|
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('${appId}').Show($t)`;
|
|
75
76
|
|
|
76
|
-
|
|
77
|
-
const child = spawn("powershell.exe", ["-NoProfile", "-NonInteractive", "-
|
|
77
|
+
const encoded = Buffer.from(ps, "utf16le").toString("base64");
|
|
78
|
+
const child = spawn("powershell.exe", ["-NoProfile", "-NonInteractive", "-EncodedCommand", encoded], {
|
|
78
79
|
windowsHide: true,
|
|
79
80
|
detached: true,
|
|
80
81
|
stdio: "ignore",
|