+21
-18
appview/pages/repoinfo/repoinfo.go
+21
-18
appview/pages/repoinfo/repoinfo.go
···
1
1
package repoinfo
2
2
3
3
import (
4
+
"fmt"
4
5
"path"
5
6
"slices"
6
7
7
8
"github.com/bluesky-social/indigo/atproto/syntax"
9
+
"tangled.org/core/api/tangled"
8
10
"tangled.org/core/appview/models"
9
11
"tangled.org/core/appview/state/userutil"
10
12
)
···
48
50
return tabs
49
51
}
50
52
53
+
func (r RepoInfo) RepoAt() syntax.ATURI {
54
+
return syntax.ATURI(fmt.Sprintf("at://%s/%s/%s", r.OwnerDid, tangled.RepoNSID, r.Rkey))
55
+
}
56
+
51
57
type RepoInfo struct {
52
-
Name string
53
-
Rkey string
54
-
OwnerDid string
55
-
OwnerHandle string
56
-
Description string
57
-
Website string
58
-
Topics []string
59
-
Knot string
60
-
Spindle string
61
-
RepoAt syntax.ATURI
62
-
IsStarred bool
63
-
Stats models.RepoStats
64
-
Roles RolesInRepo
65
-
Source *models.Repo
66
-
SourceHandle string
67
-
Ref string
68
-
DisableFork bool
69
-
CurrentDir string
58
+
Name string
59
+
Rkey string
60
+
OwnerDid string
61
+
OwnerHandle string
62
+
Description string
63
+
Website string
64
+
Topics []string
65
+
Knot string
66
+
Spindle string
67
+
IsStarred bool
68
+
Stats models.RepoStats
69
+
Roles RolesInRepo
70
+
Source *models.Repo
71
+
Ref string
72
+
CurrentDir string
70
73
}
71
74
72
75
// each tab on a repo could have some metadata:
-10
appview/reporesolver/resolver.go
-10
appview/reporesolver/resolver.go
···
147
147
}
148
148
}
149
149
150
-
var sourceHandle *identity.Identity
151
-
if sourceRepo != nil {
152
-
sourceHandle, err = f.rr.idResolver.ResolveIdent(context.Background(), sourceRepo.Did)
153
-
if err != nil {
154
-
log.Println("failed to resolve source repo", err)
155
-
}
156
-
}
157
-
158
150
knot := f.Knot
159
151
160
152
repoInfo := repoinfo.RepoInfo{
···
162
154
OwnerHandle: f.OwnerId.Handle.String(),
163
155
Name: f.Name,
164
156
Rkey: f.Rkey,
165
-
RepoAt: repoAt,
166
157
Description: f.Description,
167
158
Website: f.Website,
168
159
Topics: f.Topics,
···
181
172
182
173
if sourceRepo != nil {
183
174
repoInfo.Source = sourceRepo
184
-
repoInfo.SourceHandle = sourceHandle.Handle.String()
185
175
}
186
176
187
177
return repoInfo