mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
6d94635631
✨ feat(bot): add iMessage Desktop bridge with Labs gate Desktop-side BlueBubbles bridge for the iMessage channel: - Bridge runtime (ImessageBridgeCtr/Srv) + gateway message_api_request routing; chat-adapter-imessage api lists all webhooks instead of the 500-prone url filter (first-time save no longer fails). - iMessage channel UI: desktopDeviceId + webhookSecret are auto-filled/generated (not user fields); a single "Save Configuration" persists both the cloud provider and the local bridge via a post-save extension point — no separate "Save Bridge" button. - Gated behind the `enableImessage` Labs preference (off → "Coming Soon"). - Group local-testing bot skills into per-channel folders + add iMessage bridge/outbound regression scripts. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
55 lines
2.0 KiB
Bash
Executable File
55 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# capture-app-window.sh — Capture a screenshot of a specific app window
|
|
#
|
|
# Uses CGWindowList via Swift to find the window by process name, then
|
|
# screencapture -l <windowID> to capture only that window.
|
|
# Falls back to full-screen capture if the window is not found.
|
|
#
|
|
# Usage:
|
|
# ./capture-app-window.sh <process_name> <output_path>
|
|
#
|
|
# Arguments:
|
|
# process_name — The process/owner name as shown in Activity Monitor
|
|
# (e.g., "Discord", "Slack", "Telegram", "WeChat", "QQ", "Lark")
|
|
# output_path — Path to save the screenshot (e.g., /tmp/screenshot.png)
|
|
#
|
|
# Examples:
|
|
# ./capture-app-window.sh "Discord" /tmp/discord.png
|
|
# ./capture-app-window.sh "Slack" /tmp/slack.png
|
|
# ./capture-app-window.sh "微信" /tmp/wechat.png
|
|
#
|
|
set -euo pipefail
|
|
|
|
PROCESS="${1:?Usage: capture-app-window.sh <process_name> <output_path>}"
|
|
OUTPUT="${2:?Usage: capture-app-window.sh <process_name> <output_path>}"
|
|
|
|
# Find the CGWindowID for the target process using Swift + CGWindowList
|
|
# Pass process name via environment variable (swift -e doesn't support -- args)
|
|
WINDOW_ID=$(TARGET_PROCESS="$PROCESS" swift -e '
|
|
import Cocoa
|
|
import Foundation
|
|
let target = ProcessInfo.processInfo.environment["TARGET_PROCESS"] ?? ""
|
|
let windowList = CGWindowListCopyWindowInfo([.optionAll], kCGNullWindowID) as! [[String: Any]]
|
|
for w in windowList {
|
|
let owner = w["kCGWindowOwnerName"] as? String ?? ""
|
|
let layer = w["kCGWindowLayer"] as? Int ?? -1
|
|
let bounds = w["kCGWindowBounds"] as? [String: Any] ?? [:]
|
|
let ww = bounds["Width"] as? Double ?? 0
|
|
let wh = bounds["Height"] as? Double ?? 0
|
|
let wid = w["kCGWindowNumber"] as? Int ?? 0
|
|
// Match process name, normal window layer (0), and reasonable size
|
|
if owner == target && layer == 0 && ww > 200 && wh > 200 {
|
|
print(wid)
|
|
break
|
|
}
|
|
}
|
|
' 2>/dev/null || true)
|
|
|
|
if [ -n "$WINDOW_ID" ]; then
|
|
screencapture -l "$WINDOW_ID" -x "$OUTPUT"
|
|
else
|
|
echo "[capture] Warning: Could not find window for '$PROCESS', falling back to full screen"
|
|
screencapture -x "$OUTPUT"
|
|
fi
|