clikit-plugin 0.2.21 → 0.2.22
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-notification.d.ts","sourceRoot":"","sources":["../../src/hooks/session-notification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;CACzC;
|
|
1
|
+
{"version":3,"file":"session-notification.d.ts","sourceRoot":"","sources":["../../src/hooks/session-notification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;CACzC;AA4BD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAsBtE;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,mBAAmB,CAUrB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,OAAO,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,mBAAmB,CAerB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAIzF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-notification.test.d.ts","sourceRoot":"","sources":["../../src/hooks/session-notification.test.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -4499,15 +4499,17 @@ function escapeSingleQuotes(str2) {
|
|
|
4499
4499
|
}
|
|
4500
4500
|
function getNotifyCommand(payload) {
|
|
4501
4501
|
const { title, body, urgency } = payload;
|
|
4502
|
-
const
|
|
4503
|
-
const
|
|
4502
|
+
const safeTitle = typeof title === "string" ? title : "Notification";
|
|
4503
|
+
const safeBody = typeof body === "string" ? body : "";
|
|
4504
|
+
const escapedTitle = safeTitle.replace(/"/g, "\\\"");
|
|
4505
|
+
const escapedBody = safeBody.replace(/"/g, "\\\"");
|
|
4504
4506
|
switch (process.platform) {
|
|
4505
4507
|
case "linux":
|
|
4506
4508
|
return `notify-send "${escapedTitle}" "${escapedBody}" --urgency=${urgency || "normal"}`;
|
|
4507
4509
|
case "darwin":
|
|
4508
4510
|
return `osascript -e 'display notification "${escapedBody}" with title "${escapedTitle}"'`;
|
|
4509
4511
|
case "win32":
|
|
4510
|
-
return `powershell -command "[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $n = New-Object System.Windows.Forms.NotifyIcon; $n.Icon = [System.Drawing.SystemIcons]::Information; $n.Visible = $true; $n.ShowBalloonTip(5000, '${escapeSingleQuotes(
|
|
4512
|
+
return `powershell -command "[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $n = New-Object System.Windows.Forms.NotifyIcon; $n.Icon = [System.Drawing.SystemIcons]::Information; $n.Visible = $true; $n.ShowBalloonTip(5000, '${escapeSingleQuotes(safeTitle)}', '${escapeSingleQuotes(safeBody)}', [System.Windows.Forms.ToolTipIcon]::Info)"`;
|
|
4511
4513
|
default:
|
|
4512
4514
|
return null;
|
|
4513
4515
|
}
|
|
@@ -4522,8 +4524,8 @@ function sendNotification(payload) {
|
|
|
4522
4524
|
} catch {
|
|
4523
4525
|
if (process.platform === "linux") {
|
|
4524
4526
|
try {
|
|
4525
|
-
const wslTitle = escapeSingleQuotes(payload.title);
|
|
4526
|
-
const wslBody = escapeSingleQuotes(payload.body);
|
|
4527
|
+
const wslTitle = escapeSingleQuotes(typeof payload.title === "string" ? payload.title : "Notification");
|
|
4528
|
+
const wslBody = escapeSingleQuotes(typeof payload.body === "string" ? payload.body : "");
|
|
4527
4529
|
const wslCmd = `powershell.exe -command "[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); $n = New-Object System.Windows.Forms.NotifyIcon; $n.Icon = [System.Drawing.SystemIcons]::Information; $n.Visible = $true; $n.ShowBalloonTip(5000, '${wslTitle}', '${wslBody}', [System.Windows.Forms.ToolTipIcon]::Info)"`;
|
|
4528
4530
|
execSync4(wslCmd, { timeout: 5000, stdio: ["pipe", "pipe", "pipe"] });
|
|
4529
4531
|
return true;
|