feat(cmd/relay-server): enhance lease link generation to support custom frontend patterns
Update convertLeaseEntriesToRows to use portalFrontendPattern for link URLs, falling back to portalHost. Supports wildcard patterns (*.domain) by replacing '*' with lease name, enabling flexible subdomain handling.
lemon-mint committed
Nov 17, 2025 at 17:02 UTC
51c3d33114d33346f0b766124d953b46816afe5e
1 file changed
+13
-1
cmd/relay-server/view.go
+13
-1
@@ -271,7 +271,19 @@ func convertLeaseEntriesToRows(serv *portal.RelayServer) []leaseRow {
271
dnsLabel = dnsLabel[:8] + "..."
272
}
273
274
- link := fmt.Sprintf("//%s.%s/", lease.Name, portalHost)
274
+ // Use frontend pattern if available, otherwise fall back to portalHost
275
+ var link string
276
+ if portalFrontendPattern != "" {
277
+ // For wildcard patterns like *.localhost:4017, replace * with lease name
278
+ if strings.HasPrefix(portalFrontendPattern, "*.") {
279
+ link = fmt.Sprintf("//%s%s", lease.Name, strings.TrimPrefix(portalFrontendPattern, "*"))
280
+ } else {
281
+ // For non-wildcard patterns, construct URL with lease name as subdomain
282
+ link = fmt.Sprintf("//%s.%s/", lease.Name, portalFrontendPattern)
283
+ }
284
+ } else {
285
+ link = fmt.Sprintf("//%s.%s/", lease.Name, portalHost)
286
+ }
287
288
row := leaseRow{
289
Peer: identityID,