1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package urls
import (
"fmt"
"net/url"
"path"
)
func UrlInbox(name, domain string) (*url.URL, error) {
u, err := url.Parse(path.Join("https://", domain, "actors", name, "inbox"))
if err != nil {
return nil, fmt.Errorf("could not build inbox url: %w", err)
}
return u, nil
}
func UrlOutbox(name, domain string) (*url.URL, error) {
u, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox"))
if err != nil {
return nil, fmt.Errorf("could not build outbox url: %w", err)
}
return u, nil
}
func UrlActivity(name, domain, id string) (*url.URL, error) {
u, err := url.Parse(path.Join(domain, "actors", name, "outbox", id, "activity"))
if err != nil {
panic(err)
return nil, fmt.Errorf("could not build activity url: %w", err)
}
return u, nil
}
func UrlNote(name, domain, id string) (*url.URL, error) {
u, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox", id, "note"))
if err != nil {
return nil, fmt.Errorf("could not build note url: %w", err)
}
return u, nil
}
func UrlOutboxPage(name, domain string) (*url.URL, error) {
u, err := UrlOutbox(name, domain)
if err != nil {
return nil, fmt.Errorf("could not build outbox page url: %w", err)
}
q := u.Query()
q.Set("page", "true")
u.RawQuery = q.Encode()
return u, nil
}
|