Bluesky feed server - NSFW Likes
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wip: Remove the old stuff

+4 -281
-281
app/src/main/kotlin/Application.kt
··· 91 91 // Store the new/updated record in the repo. 92 92 api.putFeedGeneratorRecord(repo, rkey, feedGeneratorRecord) 93 93 } 94 - 95 - //@Serializable 96 - //data class DidDoc( 97 - // val id: String, 98 - // val service: List<Service>, 99 - //) { 100 - // @Serializable 101 - // data class Service( 102 - // val id: String, 103 - // val type: String, 104 - // val serviceEndpoint: String, 105 - // ) 106 - //} 107 - // 108 - //@Serializable 109 - //data class FeedSkeleton( 110 - // val cursor: String? = null, 111 - // val feed: List<FeedObject>, 112 - //) { 113 - // @Serializable 114 - // data class FeedObject( 115 - // val post: String, 116 - // val reason: ReasonRepost? = null, 117 - // val feedContext: String? = null, 118 - // ) { 119 - // @Serializable 120 - // data class ReasonRepost( 121 - // val repost: String, 122 - // ) 123 - // } 124 - //} 125 - // 126 - //@Serializable 127 - //data class AppBskyFeedGenerator( 128 - // val did: String, 129 - // @SerialName("\$type") 130 - // val type: String? = null, 131 - // val displayName: String? = null, 132 - // val createdAt: String? = null, 133 - //) 134 - // 135 - //fun main() { 136 - // val hostname = "" 137 - // val ownerPds = "" 138 - // val ownerDid = "" 139 - // val ownerAppPassword = "" 140 - // val feedRecordKey = "" 141 - // 142 - // val client = HttpClient(CIO) { 143 - // install(io.ktor.client.plugins.contentnegotiation.ContentNegotiation) { 144 - // json( 145 - // Json { 146 - // explicitNulls = false 147 - // ignoreUnknownKeys = true 148 - // } 149 - // ) 150 - // } 151 - // } 152 - // 153 - // runBlocking { 154 - // val getRecordResponse = client.get("https://$ownerPds/xrpc/com.atproto.repo.getRecord") { 155 - // url { 156 - // parameters.append("repo", ownerDid) 157 - // parameters.append("collection", "app.bsky.feed.generator") 158 - // parameters.append("rkey", feedRecordKey) 159 - // } 160 - // } 161 - // 162 - // @Serializable 163 - // data class GetRecordResponse( 164 - // val uri: String, 165 - // val cid: String?, 166 - // val value: AppBskyFeedGenerator, 167 - // ) 168 - // 169 - //// val appBskyFeedGeneratorRecord: GetRecordResponse = getRecordResponse.body() 170 - // 171 - // val appBskyFeedGeneratorRecord: GetRecordResponse? = if (getRecordResponse.status == HttpStatusCode.OK) { 172 - // getRecordResponse.body() 173 - // } else { 174 - // null 175 - // } 176 - // 177 - // if (appBskyFeedGeneratorRecord?.value?.did?.contains(hostname) == true) { 178 - // return@runBlocking 179 - // } 180 - // 181 - // println("Updating app.bsky.feed.record did with new hostname $hostname") 182 - // 183 - // @Serializable 184 - // data class CreateSessionRequest( 185 - // val identifier: String, 186 - // val password: String, 187 - // ) 188 - // 189 - // @Serializable 190 - // data class CreateSessionResponse( 191 - // val accessJwt: String, 192 - // val refreshJwt: String, 193 - // val did: String, 194 - // ) 195 - // 196 - // val sessionTokens: CreateSessionResponse = 197 - // client.post("https://$ownerPds/xrpc/com.atproto.server.createSession") { 198 - // contentType(ContentType.Application.Json) 199 - // setBody( 200 - // CreateSessionRequest( 201 - // identifier = ownerDid, 202 - // password = ownerAppPassword, 203 - // ) 204 - // ) 205 - // }.body() 206 - // 207 - // 208 - // if (sessionTokens.did != ownerDid) { 209 - // println("How is this possible!? :O") 210 - // return@runBlocking 211 - // } 212 - // 213 - // @Serializable 214 - // data class PutRecordRequest( 215 - // val repo: String, 216 - // val collection: String, 217 - // val rkey: String, 218 - // val validate: Boolean? = null, 219 - // val record: AppBskyFeedGenerator, 220 - // val swapRecord: String? = null, 221 - // val swapCommit: String? = null, 222 - // ) 223 - // 224 - // val putRecordResponse = client.post("https://$ownerPds/xrpc/com.atproto.repo.putRecord") { 225 - // header("Authorization", "Bearer ${sessionTokens.accessJwt}") 226 - // contentType(ContentType.Application.Json) 227 - // setBody( 228 - // PutRecordRequest( 229 - // repo = ownerDid, 230 - // collection = "app.bsky.feed.generator", 231 - // rkey = feedRecordKey, 232 - // record = AppBskyFeedGenerator( 233 - // did = "did:web:$hostname", 234 - // displayName = "DarkFeed", 235 - // createdAt = "2024-11-04T15:58:05.074Z", 236 - // ) 237 - // ) 238 - // ) 239 - // } 240 - // 241 - // if (putRecordResponse.status != HttpStatusCode.OK) { 242 - // println("Failed to update hostname in feed generator record: ${putRecordResponse.bodyAsText()}") 243 - // } 244 - // } 245 - // 246 - // // Run DarkFeed server. 247 - // embeddedServer(Netty, port = 8080) { 248 - // install(ContentNegotiation) { 249 - // json(Json { explicitNulls = false }) 250 - // } 251 - // 252 - // routing { 253 - // get("/.well-known/did.json") { 254 - // call.respond( 255 - // DidDoc( 256 - // id = "did:web:$hostname", 257 - // service = listOf( 258 - // DidDoc.Service( 259 - // id = "#bsky_fg", 260 - // type = "BskyFeedGenerator", 261 - // serviceEndpoint = "https://$hostname", 262 - // ) 263 - // ) 264 - // ) 265 - // ) 266 - // } 267 - // 268 - // get("/xrpc/app.bsky.feed.getFeedSkeleton") { 269 - // call.respond(buildFeedSkeleton(actor = ownerDid)) 270 - // } 271 - // } 272 - // }.start(wait = true) 273 - //} 274 - // 275 - //// SOOOOO 276 - //// I NEED TO CHECK THE SELF LABEL (at://did:plc:vwivwqztbf6pmkgss3nv2scy/app.bsky.feed.post/3la5sxh4ica2r) 277 - //// AND THE MODERATION.BSKY.APP LABEL (at://did:plc:ujrpupcjf22a4riwjbupdv42/app.bsky.feed.post/3la5qntezsu2v) 278 - //suspend fun buildFeedSkeleton(actor: String) = FeedSkeleton( 279 - // feed = getActorLikes(actor = actor) 280 - // .map { FeedSkeleton.FeedObject(post = it) } 281 - //) 282 - // 283 - //suspend fun getPostLabels(uris: List<String>): Unit { 284 - // val client = HttpClient(CIO) { 285 - // install(io.ktor.client.plugins.contentnegotiation.ContentNegotiation) { 286 - // json( 287 - // Json { 288 - // explicitNulls = false 289 - // ignoreUnknownKeys = true 290 - // } 291 - // ) 292 - // } 293 - // } 294 - // 295 - // @Serializable 296 - // data class GetPostsRequest( 297 - // val uris: List<String>, 298 - // ) 299 - // 300 - // @Serializable 301 - // data class Label( 302 - // val ver: Int, 303 - // val src: String, 304 - // val uri: String, 305 - // val cid: String, 306 - // @SerialName("val") 307 - // val _val: String, 308 - // val cts: String, 309 - // ) 310 - // 311 - // @Serializable 312 - // data class HydratedPostView( 313 - // val uri: String, 314 - // val cid: String, 315 - // val labels: List<Label>, 316 - // ) 317 - // 318 - // @Serializable 319 - // data class GetPostsResponse( 320 - // val posts: List<HydratedPostView>, 321 - // ) 322 - // 323 - // val getPostsResponse = client.get("https://bsky.social/xrpc/app.bsky.geed.getPosts") { 324 - // parameters { 325 - // uris.forEach { uri -> parameter("uris", uri) } 326 - // } 327 - // } 328 - // 329 - // println(getPostsResponse.bodyAsText()) 330 - // 331 - // val posts: GetPostsResponse = getPostsResponse.body() 332 - // 333 - // println(getPostsResponse) 334 - //} 335 - // 336 - //suspend fun getActorLikes(actor: String, cursor: String? = null): List<String> { 337 - // val client = HttpClient(CIO) { 338 - // install(io.ktor.client.plugins.contentnegotiation.ContentNegotiation) { 339 - // json( 340 - // Json { 341 - // explicitNulls = false 342 - // ignoreUnknownKeys = true 343 - // } 344 - // ) 345 - // } 346 - // } 347 - // 348 - // @Serializable 349 - // data class RefRecord( 350 - // val uri: String, 351 - // val cid: String, 352 - // val value: Like, 353 - // ) 354 - // 355 - // @Serializable 356 - // data class ListRecordsResponse( 357 - // val cursor: String?, 358 - // val records: List<RefRecord>, 359 - // ) 360 - // 361 - // val response = client.get("https://bsky.social/xrpc/com.atproto.repo.listRecords") { 362 - // parameters { 363 - // parameter("repo", actor) 364 - // parameter("collection", "app.bsky.feed.like") 365 - // parameter("limit", 100) 366 - // if (cursor != null) parameter("cursor", cursor) 367 - // } 368 - // } 369 - // 370 - // return response.body<ListRecordsResponse>() 371 - // .records 372 - // .map { it.value.subject.uri } 373 - // .toList() 374 - //}
+4
app/src/main/kotlin/DarkFeedApi.kt
··· 68 68 ) 69 69 } 70 70 71 + // SOOOOO 72 + // I NEED TO CHECK THE SELF LABEL (at://did:plc:vwivwqztbf6pmkgss3nv2scy/app.bsky.feed.post/3la5sxh4ica2r) 73 + // AND THE MODERATION.BSKY.APP LABEL (at://did:plc:ujrpupcjf22a4riwjbupdv42/app.bsky.feed.post/3la5qntezsu2v) 74 + 71 75 private suspend fun handleGetFeedSkeleton(call: RoutingCall) { 72 76 // TODO: Get requestor's DID from Authorization header. 73 77 call.respond(buildFeedSkeleton("did:plc:zhxv5pxpmojhnvaqy4mwailv"))