1// Copyright 2023 The Forgejo Authors. All rights reserved.
2// SPDX-License-Identifier: MIT
3
4package forgefed
5
6import (
7 "fmt"
8)
9
10func (id ActorID) AsWellKnownNodeInfoURI() string {
11 wellKnownPath := ".well-known/nodeinfo"
12 var result string
13 if id.Port == "" {
14 result = fmt.Sprintf("%s://%s/%s", id.Schema, id.Host, wellKnownPath)
15 } else {
16 result = fmt.Sprintf("%s://%s:%s/%s", id.Schema, id.Host, id.Port, wellKnownPath)
17 }
18 return result
19}