<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** #49325 # Checklist for submitter - [x] Timeouts are implemented and retries are limited to avoid infinite loops ## Testing - [x] Added/updated automated tests - [x] QA'd all new/changed functionality manually ## fleetd/orbit/Fleet Desktop - [x] If the change applies to only one platform, confirmed that `runtime.GOOS` is used as needed to isolate changes macOS-only by construction — this is the native macOS app, which has no other platform build. No changes file: this app ships on its own release channel (fleet-desktop-macos-v* → download.fleetdm.com), not the Fleet server changelog, matching every previous PR to apps/fleet-desktop-macos/. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added macOS notification support through the `notify` command. * Notifications appear as bottom-right toast messages with loading, dismissal, timeout, and error handling. * Added URL validation, clear usage guidance, and meaningful command-line exit statuses. * Notification commands can run without opening the main app. * **Bug Fixes** * Improved single-instance handling for background notification processes. * Improved detection of Fleet-rendered error pages. * **Tests** * Added developer tools for notification smoke testing and local invocation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
41 lines
1.0 KiB
Bash
Executable File
41 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build (if needed) and show a toast, then print the exit code.
|
|
#
|
|
# Execs the binary directly rather than going through `open`, because `open`
|
|
# returns its own status rather than the app's — which is the whole point of the
|
|
# exit code here.
|
|
#
|
|
# Usage:
|
|
# ./dev-notify.sh [--url] <https url>
|
|
#
|
|
# Pass a real device page URL, or any page implementing the fleetDesktop bridge (see
|
|
# ToastWindow.swift for the message contract).
|
|
|
|
# Note: no `set -e`. Observing a non-zero exit code is the point.
|
|
set -uo pipefail
|
|
|
|
cd "$(dirname "$0")" || exit 1
|
|
|
|
# Accept both `dev-notify.sh <url>` and `dev-notify.sh --url <url>`. The flag is what
|
|
# the binary takes, so typing it here is the natural thing to do.
|
|
if [ "${1:-}" = "--url" ]; then
|
|
shift
|
|
fi
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
echo "usage: $0 [--url] <https url>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
BIN="build/Fleet Desktop.app/Contents/MacOS/FleetDesktop"
|
|
if [ ! -x "$BIN" ]; then
|
|
./build.sh
|
|
fi
|
|
|
|
URL="$1"
|
|
shift
|
|
|
|
# Remaining arguments pass straight through to notify.
|
|
"$BIN" notify --url "$URL" "$@"
|
|
echo "exit=$?"
|