forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

appview/pages: Strip HTTP port from SSH clone URLs

Signed-off-by: Evan Jarrett <evan@evanjarrett.com>

evan.jarrett.net 53d3e583 35ada393

verified
Changed files
+9 -3
appview
pages
templates
+6
appview/pages/funcmap.go
··· 38 38 "contains": func(s string, target string) bool { 39 39 return strings.Contains(s, target) 40 40 }, 41 + "stripPort": func(hostname string) string { 42 + if strings.Contains(hostname, ":") { 43 + return strings.Split(hostname, ":")[0] 44 + } 45 + return hostname 46 + }, 41 47 "mapContains": func(m any, key any) bool { 42 48 mapValue := reflect.ValueOf(m) 43 49 if mapValue.Kind() != reflect.Map {
+1 -1
appview/pages/templates/repo/empty.html
··· 35 35 36 36 <p><span class="{{$bullet}}">1</span>First, generate a new <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key" class="underline">SSH key pair</a>.</p> 37 37 <p><span class="{{$bullet}}">2</span>Then add the public key to your account from the <a href="/settings" class="underline">settings</a> page.</p> 38 - <p><span class="{{$bullet}}">3</span>Configure your remote to <code>git@{{ $knot }}:{{ .RepoInfo.OwnerHandle }}/{{ .RepoInfo.Name }}</code></p> 38 + <p><span class="{{$bullet}}">3</span>Configure your remote to <code>git@{{ $knot | stripPort }}:{{ .RepoInfo.OwnerHandle }}/{{ .RepoInfo.Name }}</code></p> 39 39 <p><span class="{{$bullet}}">4</span>Push!</p> 40 40 </div> 41 41 </div>
+2 -2
appview/pages/templates/repo/fragments/cloneDropdown.html
··· 48 48 <code 49 49 class="flex-1 px-3 py-2 text-sm bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-gray-100 rounded-l select-all cursor-pointer whitespace-nowrap overflow-x-auto" 50 50 onclick="window.getSelection().selectAllChildren(this)" 51 - data-url="git@{{ $knot }}:{{ .RepoInfo.OwnerHandle }}/{{ .RepoInfo.Name }}" 52 - >git@{{ $knot }}:{{ .RepoInfo.OwnerHandle }}/{{ .RepoInfo.Name }}</code> 51 + data-url="git@{{ $knot | stripPort }}:{{ .RepoInfo.OwnerHandle }}/{{ .RepoInfo.Name }}" 52 + >git@{{ $knot | stripPort }}:{{ .RepoInfo.OwnerHandle }}/{{ .RepoInfo.Name }}</code> 53 53 <button 54 54 onclick="copyToClipboard(this, this.previousElementSibling.getAttribute('data-url'))" 55 55 class="px-3 py-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 border-l border-gray-300 dark:border-gray-600"