tangled
alpha
login
or
join now
whey.party
/
red-dwarf-server
13
fork
atom
collection of golang services under the Red Dwarf umbrella
server.reddwarf.app
bluesky
reddwarf
microcosm
appview
13
fork
atom
overview
issues
pulls
pipelines
getProfiles
whey.party
3 months ago
36c46532
c5534a06
+42
-4
3 changed files
expand all
collapse all
unified
split
auth
auth.go
main.go
shims
lex
app
bsky
actor
defs
profileview.go
+1
-1
auth/auth.go
···
200
200
}
201
201
202
202
if claims.Audience != auth.ServiceDID {
203
203
-
c.JSON(http.StatusUnauthorized, gin.H{"error": fmt.Sprintf("Invalid audience (expected %s)", auth.ServiceDID)})
203
203
+
c.JSON(http.StatusUnauthorized, gin.H{"error": fmt.Sprintf("Invalid audience (found '%s', expected '%s')", claims.Audience, auth.ServiceDID)})
204
204
c.Abort()
205
205
return
206
206
}
+40
-2
main.go
···
21
21
22
22
// "github.com/bluesky-social/indigo/atproto/atclient"
23
23
// comatproto "github.com/bluesky-social/indigo/api/atproto"
24
24
-
// appbsky "github.com/bluesky-social/indigo/api/bsky"
24
24
+
appbsky "github.com/bluesky-social/indigo/api/bsky"
25
25
// "github.com/bluesky-social/indigo/atproto/atclient"
26
26
// "github.com/bluesky-social/indigo/atproto/identity"
27
27
// "github.com/bluesky-social/indigo/atproto/syntax"
···
84
84
100_000,
85
85
time.Hour*12,
86
86
5,
87
87
-
serviceWebDID+"#bsky_appview",
87
87
+
serviceWebDID, //+"#bsky_appview",
88
88
)
89
89
if err != nil {
90
90
log.Fatalf("Failed to create Auth: %v", err)
···
160
160
panic(err)
161
161
}
162
162
fmt.Println(string(data))
163
163
+
164
164
+
router.GET("/xrpc/app.bsky.actor.getProfiles",
165
165
+
func(c *gin.Context) {
166
166
+
actors := c.QueryArray("actors")
167
167
+
168
168
+
profiles := make([]*appbsky.ActorDefs_ProfileViewDetailed, 0, len(actors))
169
169
+
170
170
+
for _, v := range actors {
171
171
+
did, err := utils.NewDID(v)
172
172
+
if err != nil {
173
173
+
continue
174
174
+
}
175
175
+
profile, _, _ := appbskyactordefs.ProfileViewDetailed(ctx, did, sl, cs, BSKYIMAGECDN_URL)
176
176
+
profiles = append(profiles, profile)
177
177
+
}
178
178
+
179
179
+
c.JSON(http.StatusOK, &appbsky.ActorGetProfiles_Output{
180
180
+
Profiles: profiles,
181
181
+
})
182
182
+
})
183
183
+
184
184
+
router.GET("/xrpc/app.bsky.actor.getProfile",
185
185
+
func(c *gin.Context) {
186
186
+
actor := c.Query("actor")
187
187
+
did, err := utils.NewDID(actor)
188
188
+
if err != nil {
189
189
+
c.JSON(http.StatusBadRequest, nil)
190
190
+
return
191
191
+
}
192
192
+
profile, _, _ := appbskyactordefs.ProfileViewDetailed(ctx, did, sl, cs, BSKYIMAGECDN_URL)
193
193
+
c.JSON(http.StatusOK, profile)
194
194
+
})
195
195
+
196
196
+
// really bad actually
197
197
+
router.GET("/xrpc/app.bsky.notification.listNotifications",
198
198
+
func(c *gin.Context) {
199
199
+
c.JSON(http.StatusOK, nil)
200
200
+
})
163
201
164
202
router.GET("/", func(c *gin.Context) {
165
203
log.Println("hello worldio !")
+1
-1
shims/lex/app/bsky/actor/defs/profileview.go
···
94
94
}
95
95
followerCount := int64(followerCount_Out.Total)
96
96
97
97
-
banner := utils.MakeImageCDN(did, imgcdn, "banner", profile.Avatar.Ref.String())
97
97
+
banner := utils.MakeImageCDN(did, imgcdn, "banner", profile.Banner.Ref.String())
98
98
99
99
nilCount := int64(-1)
100
100