#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
URL="http://117.72.56.26/zsh-gamehub/mac-shell.html?site=config"
TITLE="泡泡科技 · 配置电脑"

open_chrome_app() {
  local app="$1"
  if [ -d "/Applications/$app.app" ]; then
    open -na "$app" --args --app="$URL" --new-window
    return 0
  fi
  return 1
}

# Prefer Chromium app-mode window (closest to a desktop client)
open_chrome_app "Google Chrome" \
  || open_chrome_app "Microsoft Edge" \
  || open_chrome_app "Chromium" \
  || open_chrome_app "Brave Browser" \
  || open -a Safari "$URL"

exit 0
