mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 10:56:10 +01:00 
			
		
		
		
	Rearrange Clone Panel (#31142)
Rearrange the clone panel to use less horizontal space. The following changes have been made to achieve this: - Moved everything into the dropdown menu - Moved the HTTPS/SSH Switch to a separate line - Moved the "Clone in VS Code"-Button up and added a divider - Named the dropdown button "Code", added appropriate icon --------- Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		| @@ -13,3 +13,19 @@ export function isUrl(url: string): boolean { | ||||
|     return false; | ||||
|   } | ||||
| } | ||||
|  | ||||
| // Convert an absolute or relative URL to an absolute URL with the current origin. It only | ||||
| // processes absolute HTTP/HTTPS URLs or relative URLs like '/xxx' or '//host/xxx'. | ||||
| export function toOriginUrl(urlStr: string) { | ||||
|   try { | ||||
|     if (urlStr.startsWith('http://') || urlStr.startsWith('https://') || urlStr.startsWith('/')) { | ||||
|       const {origin, protocol, hostname, port} = window.location; | ||||
|       const url = new URL(urlStr, origin); | ||||
|       url.protocol = protocol; | ||||
|       url.hostname = hostname; | ||||
|       url.port = port || (protocol === 'https:' ? '443' : '80'); | ||||
|       return url.toString(); | ||||
|     } | ||||
|   } catch {} | ||||
|   return urlStr; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user