A container registry that uses the AT Protocol for manifest storage and S3 for blob storage. atcr.io
docker container atproto go
73
fork

Configure Feed

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

at 97d1b3cdd50e4727e5db3c498f4e8bb73851fd39 33 lines 1.3 kB view raw
1package appview 2 3import "strings" 4 5// ResolveHoldURL converts a hold identifier (DID or URL) to an HTTP/HTTPS URL 6// Handles both formats for backward compatibility: 7// - DID format: did:web:hold01.atcr.io → https://hold01.atcr.io 8// - DID with port: did:web:172.28.0.3:8080 → http://172.28.0.3:8080 9// - URL format: https://hold.example.com → https://hold.example.com (passthrough) 10func ResolveHoldURL(holdIdentifier string) string { 11 // If it's already a URL (has scheme), return as-is 12 if strings.HasPrefix(holdIdentifier, "http://") || strings.HasPrefix(holdIdentifier, "https://") { 13 return holdIdentifier 14 } 15 16 // If it's a DID, convert to URL 17 if strings.HasPrefix(holdIdentifier, "did:web:") { 18 hostname := strings.TrimPrefix(holdIdentifier, "did:web:") 19 20 // Use HTTP for localhost/IP addresses with ports, HTTPS for domains 21 if strings.Contains(hostname, ":") || 22 strings.Contains(hostname, "127.0.0.1") || 23 strings.Contains(hostname, "localhost") || 24 // Check if it's an IP address (contains only digits and dots in first part) 25 (len(hostname) > 0 && hostname[0] >= '0' && hostname[0] <= '9') { 26 return "http://" + hostname 27 } 28 return "https://" + hostname 29 } 30 31 // Fallback: assume it's a hostname and use HTTPS 32 return "https://" + holdIdentifier 33}