| .. | .. |
|---|
| 89 | 89 | VERSION="$(grep -E '^version:' pubspec.yaml | sed -E 's/version:[[:space:]]*//; s/\+.*//' | head -1)" |
|---|
| 90 | 90 | echo "" |
|---|
| 91 | 91 | echo "=== Publishing to aibroker-ota hub (Tailscale) ===" |
|---|
| 92 | | - resp="$(curl -sf -X POST http://127.0.0.1:8765/api/apps \ |
|---|
| 92 | + # 8767, not 8765. The AIBroker daemon's PAILot MQTT broker owns 8765, so this |
|---|
| 93 | + # POST went to an MQTT listener and curl came back with nothing. |
|---|
| 94 | + resp="$(curl -sf -X POST http://127.0.0.1:8767/api/apps \ |
|---|
| 93 | 95 | -F slug=pailot -F name=PAILot -F bundleId=com.tekmidian.pailot \ |
|---|
| 94 | 96 | -F "version=${VERSION:-1.0.0}" -F platform=ios -F "file=@${IPA}" 2>&1)" || { |
|---|
| 95 | 97 | echo "ERROR: publish failed — is the hub up? Run: aibroker ota up" >&2; exit 1; } |
|---|
| .. | .. |
|---|
| 97 | 99 | ts="tailscale"; command -v tailscale >/dev/null 2>&1 || ts="/Applications/Tailscale.app/Contents/MacOS/Tailscale" |
|---|
| 98 | 100 | host="$("$ts" status --json 2>/dev/null | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>{try{console.log(JSON.parse(s).Self.DNSName.replace(/\.$/,""))}catch{}})' 2>/dev/null || true)" |
|---|
| 99 | 101 | echo "" |
|---|
| 102 | + # The :8443 is not optional. `aibroker ota up` maps /install/ and /api/ under |
|---|
| 103 | + # the TAILNET-ONLY listener on 8443; port 443 on the same host is a Funnel |
|---|
| 104 | + # carrying the Todoist webhook and nothing else. Printing the URL without the |
|---|
| 105 | + # port sent you to that Funnel, which 404s — and it did so on the road, which |
|---|
| 106 | + # is the only place this command is ever used. |
|---|
| 100 | 107 | if [[ -n "$host" ]]; then |
|---|
| 101 | 108 | echo " Install on any tailnet device — open in Safari:" |
|---|
| 102 | | - echo " https://${host}/install/pailot/" |
|---|
| 109 | + echo " https://${host}:8443/install/pailot/" |
|---|
| 103 | 110 | else |
|---|
| 104 | 111 | echo " Published. Open the install page in Safari on a tailnet device:" |
|---|
| 105 | | - echo " https://<your-mac-tailnet-host>/install/pailot/" |
|---|
| 112 | + echo " https://<your-mac-tailnet-host>:8443/install/pailot/" |
|---|
| 106 | 113 | fi |
|---|
| 107 | 114 | echo "" |
|---|
| 108 | 115 | echo "=== Done (OTA). Tap Install in Safari, then force-quit & reopen PAILot. ===" |
|---|