oh-my-opencode 2.1.1 → 2.1.2
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/dist/index.js +23 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4070,18 +4070,34 @@ function getDefaultSoundPath(p) {
|
|
|
4070
4070
|
}
|
|
4071
4071
|
}
|
|
4072
4072
|
async function sendNotification(ctx, p, title, message) {
|
|
4073
|
-
const escapedTitle = title.replace(/"/g, "\\\"").replace(/'/g, "\\'");
|
|
4074
|
-
const escapedMessage = message.replace(/"/g, "\\\"").replace(/'/g, "\\'");
|
|
4075
4073
|
switch (p) {
|
|
4076
|
-
case "darwin":
|
|
4077
|
-
|
|
4074
|
+
case "darwin": {
|
|
4075
|
+
const esTitle = title.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
4076
|
+
const esMessage = message.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
4077
|
+
await ctx.$`osascript -e ${'display notification "' + esMessage + '" with title "' + esTitle + '"'}`;
|
|
4078
4078
|
break;
|
|
4079
|
+
}
|
|
4079
4080
|
case "linux":
|
|
4080
|
-
await ctx.$`notify-send ${
|
|
4081
|
+
await ctx.$`notify-send ${title} ${message} 2>/dev/null`.catch(() => {});
|
|
4081
4082
|
break;
|
|
4082
|
-
case "win32":
|
|
4083
|
-
|
|
4083
|
+
case "win32": {
|
|
4084
|
+
const psTitle = title.replace(/'/g, "''");
|
|
4085
|
+
const psMessage = message.replace(/'/g, "''");
|
|
4086
|
+
const toastScript = `
|
|
4087
|
+
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
|
|
4088
|
+
$Template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText02)
|
|
4089
|
+
$RawXml = [xml] $Template.GetXml()
|
|
4090
|
+
($RawXml.toast.visual.binding.text | Where-Object {$_.id -eq '1'}).AppendChild($RawXml.CreateTextNode('${psTitle}')) | Out-Null
|
|
4091
|
+
($RawXml.toast.visual.binding.text | Where-Object {$_.id -eq '2'}).AppendChild($RawXml.CreateTextNode('${psMessage}')) | Out-Null
|
|
4092
|
+
$SerializedXml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
|
4093
|
+
$SerializedXml.LoadXml($RawXml.OuterXml)
|
|
4094
|
+
$Toast = [Windows.UI.Notifications.ToastNotification]::new($SerializedXml)
|
|
4095
|
+
$Notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('OpenCode')
|
|
4096
|
+
$Notifier.Show($Toast)
|
|
4097
|
+
`.trim().replace(/\n/g, "; ");
|
|
4098
|
+
await ctx.$`powershell -Command ${toastScript}`.catch(() => {});
|
|
4084
4099
|
break;
|
|
4100
|
+
}
|
|
4085
4101
|
}
|
|
4086
4102
|
}
|
|
4087
4103
|
async function playSound(ctx, p, soundPath) {
|