Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Simplify tangled URL push handling

- Remove domain_from_handle (no longer guess knot from handles)
- For tangled URLs, default to git.recoil.org unless knot is provided
- Support both tangled.org and tangled.sh hosts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

+3 -25
+3 -25
lib/monopam.ml
··· 796 796 Log.app (fun m -> m "Updated CLAUDE.md") 797 797 end 798 798 799 - (** Extract domain from a handle (e.g., "anil.recoil.org" -> "recoil.org"). 800 - Requires at least 2 dots (user.domain.tld), otherwise returns the full handle. *) 801 - let domain_from_handle handle = 802 - match String.index_opt handle '.' with 803 - | None -> handle (* No dot, return as-is *) 804 - | Some first_dot -> 805 - let rest = String.sub handle (first_dot + 1) (String.length handle - first_dot - 1) in 806 - (* Check if rest has another dot (i.e., handle has at least 2 dots) *) 807 - if String.contains rest '.' then rest 808 - else handle (* Only one dot like "gazagnaire.org", return full handle *) 809 - 810 799 (** Check if a host is a tangled server *) 811 800 let is_tangled_host = function 812 801 | Some "tangled.org" | Some "tangled.sh" -> true ··· 816 805 - GitHub HTTPS URLs are converted to SSH format 817 806 - Tangled URLs (tangled.org/tangled.sh) are converted to SSH format using the knot server 818 807 - Other URLs are returned unchanged 819 - @param knot Optional git push server hostname. If not provided, derived from handle in URL. *) 808 + @param knot Git push server hostname. Defaults to git.recoil.org if not provided. *) 820 809 let url_to_push_url ?knot uri = 821 810 let scheme = Uri.scheme uri in 822 811 let host = Uri.host uri in ··· 849 838 String.sub path 0 (String.length path - 4) 850 839 else path 851 840 in 852 - (* Use provided knot or derive from handle in URL *) 853 - let knot_server = 854 - match knot with 855 - | Some k -> k 856 - | None -> 857 - (* Extract handle from path and derive knot *) 858 - let handle = 859 - match String.index_opt path '/' with 860 - | None -> path 861 - | Some i -> String.sub path 0 i 862 - in 863 - "git." ^ domain_from_handle handle 864 - in 841 + (* Use provided knot or default to git.recoil.org *) 842 + let knot_server = Option.value ~default:"git.recoil.org" knot in 865 843 Printf.sprintf "git@%s:%s" knot_server path 866 844 | _ -> 867 845 (* Return original URL for other cases *)