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
sad
whey.party
3 months ago
c5534a06
a0eff28b
+16
-12
1 changed file
expand all
collapse all
unified
split
main.go
+16
-12
main.go
···
73
73
// spacedust is type definitions only
74
74
// jetstream types is probably available from jetstream/pkg/models
75
75
76
76
-
router := gin.Default()
76
76
+
router := gin.New()
77
77
+
router.Use(gin.Logger())
78
78
+
router.Use(gin.Recovery())
79
79
+
router.Use(cors.Default())
77
80
78
81
router.GET("/.well-known/did.json", GetWellKnownDID)
79
82
···
81
84
100_000,
82
85
time.Hour*12,
83
86
5,
84
84
-
serviceWebDID,
87
87
+
serviceWebDID+"#bsky_appview",
85
88
)
86
89
if err != nil {
87
90
log.Fatalf("Failed to create Auth: %v", err)
88
91
}
89
92
90
93
router.Use(auther.AuthenticateGinRequestViaJWT)
91
91
-
router.Use(cors.New(cors.Config{
92
92
-
AllowAllOrigins: true,
93
93
-
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"},
94
94
-
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization"},
95
95
-
ExposeHeaders: []string{"Content-Length"},
96
96
-
AllowCredentials: true,
97
97
-
MaxAge: 12 * 3600,
98
98
-
}))
99
94
100
95
responsewow, err := agnostic.RepoGetRecord(ctx, sl, "", "app.bsky.actor.profile", "did:web:did12.whey.party", "self")
101
96
if err != nil {
···
122
117
123
118
kv := store.NewKV()
124
119
120
120
+
// sad attempt to get putpref working. tldr it wont work without a client fork
121
121
+
// https://bsky.app/profile/did:web:did12.whey.party/post/3m75xtomd722n
122
122
+
router.GET("/xrpc/app.bsky.actor.putPreferences", func(c *gin.Context) {
123
123
+
c.Status(200)
124
124
+
})
125
125
router.PUT("/xrpc/app.bsky.actor.putPreferences", func(c *gin.Context) {
126
126
+
c.Status(200)
127
127
+
})
128
128
+
router.POST("/xrpc/app.bsky.actor.putPreferences", func(c *gin.Context) {
129
129
+
c.Status(200)
130
130
+
126
131
userDID := c.GetString("user_did")
127
132
body, err := io.ReadAll(c.Request.Body)
128
133
if err != nil {
···
131
136
}
132
137
133
138
kv.Set(userDID, body)
134
134
-
c.Status(200)
135
139
136
140
})
137
141
···
211
215
log.Println(fmt.Errorf("error parsing serviceDID: %w", err))
212
216
return
213
217
}
214
214
-
serviceID, err := did.ParseDID("#bsky_fg")
218
218
+
serviceID, err := did.ParseDID("#bsky_appview")
215
219
if err != nil {
216
220
panic(err)
217
221
}