package server import ( "fmt" "strings" ) func determinePlatform(author string) (platform, error) { if strings.HasPrefix(author, "did:") { return Bluesky, nil } if strings.HasPrefix(author, "npub") { return Nostr, nil } if strings.HasPrefix(author, "@") { if strings.Count(author, "@") > 1 { return ActivityPub, nil } if strings.Contains(author, ".") { return Bluesky, nil } return Twitter, nil } if len(author) == 64 { isHex := true for _, c := range author { if (c < '0' || c > '9') && (c < 'a' || c > 'f') && (c < 'A' || c > 'F') { isHex = false break } } if isHex { return Nostr, nil } } if strings.Contains(author, ".") { return Bluesky, nil } return -1, fmt.Errorf("unknown author format: %s", author) }