eleven / messenger Public

server: AASA names the Mac app too — universal links' server half (#1376) (#1383)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Paul Campbell 2cc2adadf6d5b4a31306e9a8ea1660764a161991 parent d2c4092
2 files changed, +13 −4
  • handlers_test.go +5 −1
  • main.go +8 −3
diff --git a/handlers_test.go b/handlers_test.go
index eae0193..38b21fb 100644
--- a/handlers_test.go
+++ b/handlers_test.go
@@ -1262,12 +1262,16 @@ func TestAppleAppSiteAssociation(t *testing.T) {
if err := json.Unmarshal(b, &doc); err != nil {
t.Fatalf("aasa not valid JSON: %v\n%s", err, b)
}
- if len(doc.Applinks.Details) != 1 || len(doc.Applinks.Details[0].AppIDs) != 1 {
+ if len(doc.Applinks.Details) != 1 || len(doc.Applinks.Details[0].AppIDs) != 2 {
t.Fatalf("aasa shape wrong: %s", b)
}
+ // iOS first, then the Mac app (universal links' server half — #1376).
if got := doc.Applinks.Details[0].AppIDs[0]; got != appleAppID {
t.Fatalf("aasa appID = %q, want %q", got, appleAppID)
}
+ if got := doc.Applinks.Details[0].AppIDs[1]; got != appleMacAppID {
+ t.Fatalf("aasa mac appID = %q, want %q", got, appleMacAppID)
+ }
if got := doc.Applinks.Details[0].Components[0]["/"]; got != "/join/*" {
t.Fatalf("aasa join pattern = %q", got)
}
diff --git a/main.go b/main.go
index a3c6ecf..66a9b12 100644
--- a/main.go
+++ b/main.go
@@ -838,9 +838,14 @@ func (s *Server) servePage(name string) http.HandlerFunc {
// unset. See the enrolment cross-origin contract (web/static/backup.js).
const defaultHomeOrigin = "https://home.elevenmessenger.com"
-// The iOS app this deployment's instances associate with (team + bundle id) —
-// public by definition (it ships in every AASA file and in the app itself).
+// The apps this deployment's instances associate with (team + bundle ids) —
+// public by definition (they ship in every AASA file and in the apps
+// themselves). The Mac id is the server half of Mac universal links
+// (docs/native-onboarding.md E.1/E.2, issue #1376): inert until the Mac app
+// ships its applinks entitlement (E.2), at which point /join links open the
+// app directly instead of riding the custom-scheme handoff.
const appleAppID = "J5NDF5PCD8.com.elevenmessenger.messenger"
+const appleMacAppID = "J5NDF5PCD8.com.elevenmessenger.messenger.mac"
// serveAASA answers Apple's app-site-association probe. Apple's CDN fetches it
// when the app installs/updates; matching /join/* links then open in the app
@@ -848,7 +853,7 @@ const appleAppID = "J5NDF5PCD8.com.elevenmessenger.messenger"
// unauthenticated, and identical on every instance by design.
func serveAASA(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
- fmt.Fprintf(w, `{"applinks":{"details":[{"appIDs":[%q],"components":[{"/":"/join/*"}]}]}}`, appleAppID)
+ fmt.Fprintf(w, `{"applinks":{"details":[{"appIDs":[%q,%q],"components":[{"/":"/join/*"}]}]}}`, appleAppID, appleMacAppID)
}
// frontendVersion is a short hash of the embedded frontend (web/), computed once at