[READ ONLY MIRROR] Spark Social AppView Server github.com/sprksocial/server
atproto deno hono lexicon
1
fork

Configure Feed

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

refactor: rename so.sprk.embed.post to so.sprk.embed.record

+51 -51
+1 -1
hydration/index.ts
··· 637 637 embed && 638 638 typeof embed === "object" && 639 639 "$type" in embed && 640 - (embed as { $type?: string }).$type === "so.sprk.embed.post" 640 + (embed as { $type?: string }).$type === "so.sprk.embed.record" 641 641 ) { 642 642 const postUri = (embed as { post?: { uri?: string } }).post?.uri; 643 643 if (postUri) {
+33 -33
lex/lexicons.ts
··· 16292 16292 "type": "union", 16293 16293 "refs": [ 16294 16294 "lex:so.sprk.embed.mention", 16295 - "lex:so.sprk.embed.post", 16295 + "lex:so.sprk.embed.record", 16296 16296 ], 16297 16297 }, 16298 16298 }, ··· 16302 16302 "type": "union", 16303 16303 "refs": [ 16304 16304 "lex:so.sprk.embed.mention#view", 16305 - "lex:so.sprk.embed.post#view", 16305 + "lex:so.sprk.embed.record#view", 16306 16306 ], 16307 16307 }, 16308 16308 }, ··· 16382 16382 }, 16383 16383 }, 16384 16384 }, 16385 - "SoSprkEmbedMention": { 16385 + "SoSprkEmbedRecord": { 16386 16386 "lexicon": 1, 16387 - "id": "so.sprk.embed.mention", 16388 - "description": "Interactive mention embed.", 16387 + "id": "so.sprk.embed.record", 16388 + "description": "Interactive record embed.", 16389 16389 "defs": { 16390 16390 "main": { 16391 16391 "type": "object", 16392 16392 "required": [ 16393 16393 "placement", 16394 - "did", 16394 + "post", 16395 16395 ], 16396 16396 "properties": { 16397 16397 "placement": { 16398 16398 "type": "ref", 16399 16399 "ref": "lex:so.sprk.embed.defs#placement", 16400 16400 }, 16401 - "did": { 16402 - "type": "string", 16403 - "format": "did", 16401 + "post": { 16402 + "type": "ref", 16403 + "ref": "lex:com.atproto.repo.strongRef", 16404 16404 }, 16405 16405 }, 16406 16406 }, ··· 16408 16408 "type": "object", 16409 16409 "required": [ 16410 16410 "placement", 16411 - "did", 16411 + "post", 16412 16412 ], 16413 16413 "properties": { 16414 16414 "placement": { 16415 16415 "type": "ref", 16416 16416 "ref": "lex:so.sprk.embed.defs#placement", 16417 16417 }, 16418 - "did": { 16419 - "type": "string", 16420 - "format": "did", 16421 - }, 16422 - "actor": { 16423 - "type": "ref", 16424 - "ref": "lex:so.sprk.actor.defs#profileViewBasic", 16418 + "post": { 16419 + "type": "union", 16420 + "refs": [ 16421 + "lex:so.sprk.feed.defs#postView", 16422 + "lex:so.sprk.feed.defs#notFoundPost", 16423 + "lex:so.sprk.feed.defs#blockedPost", 16424 + ], 16425 16425 }, 16426 16426 }, 16427 16427 }, 16428 16428 }, 16429 16429 }, 16430 - "SoSprkEmbedPost": { 16430 + "SoSprkEmbedMention": { 16431 16431 "lexicon": 1, 16432 - "id": "so.sprk.embed.post", 16433 - "description": "Interactive post embed.", 16432 + "id": "so.sprk.embed.mention", 16433 + "description": "Interactive mention embed.", 16434 16434 "defs": { 16435 16435 "main": { 16436 16436 "type": "object", 16437 16437 "required": [ 16438 16438 "placement", 16439 - "post", 16439 + "did", 16440 16440 ], 16441 16441 "properties": { 16442 16442 "placement": { 16443 16443 "type": "ref", 16444 16444 "ref": "lex:so.sprk.embed.defs#placement", 16445 16445 }, 16446 - "post": { 16447 - "type": "ref", 16448 - "ref": "lex:com.atproto.repo.strongRef", 16446 + "did": { 16447 + "type": "string", 16448 + "format": "did", 16449 16449 }, 16450 16450 }, 16451 16451 }, ··· 16453 16453 "type": "object", 16454 16454 "required": [ 16455 16455 "placement", 16456 - "post", 16456 + "did", 16457 16457 ], 16458 16458 "properties": { 16459 16459 "placement": { 16460 16460 "type": "ref", 16461 16461 "ref": "lex:so.sprk.embed.defs#placement", 16462 16462 }, 16463 - "post": { 16464 - "type": "union", 16465 - "refs": [ 16466 - "lex:so.sprk.feed.defs#postView", 16467 - "lex:so.sprk.feed.defs#notFoundPost", 16468 - "lex:so.sprk.feed.defs#blockedPost", 16469 - ], 16463 + "did": { 16464 + "type": "string", 16465 + "format": "did", 16466 + }, 16467 + "actor": { 16468 + "type": "ref", 16469 + "ref": "lex:so.sprk.actor.defs#profileViewBasic", 16470 16470 }, 16471 16471 }, 16472 16472 }, ··· 27081 27081 SoSprkVideoGetJobStatus: "so.sprk.video.getJobStatus", 27082 27082 SoSprkVideoGetUploadLimits: "so.sprk.video.getUploadLimits", 27083 27083 SoSprkEmbedDefs: "so.sprk.embed.defs", 27084 + SoSprkEmbedRecord: "so.sprk.embed.record", 27084 27085 SoSprkEmbedMention: "so.sprk.embed.mention", 27085 - SoSprkEmbedPost: "so.sprk.embed.post", 27086 27086 SoSprkNotificationRegisterPush: "so.sprk.notification.registerPush", 27087 27087 SoSprkNotificationPutPreferences: "so.sprk.notification.putPreferences", 27088 27088 SoSprkNotificationUpdateSeen: "so.sprk.notification.updateSeen",
+3 -3
lex/types/so/sprk/embed/defs.ts
··· 4 4 import { validate as _validate } from "../../../../lexicons.ts"; 5 5 import { type $Typed, is$typed as _is$typed } from "../../../../util.ts"; 6 6 import type * as SoSprkEmbedMention from "./mention.ts"; 7 - import type * as SoSprkEmbedPost from "./post.ts"; 7 + import type * as SoSprkEmbedRecord from "./record.ts"; 8 8 9 9 const is$typed = _is$typed, validate = _validate; 10 10 const id = "so.sprk.embed.defs"; 11 11 12 12 export type Embeds = 13 - ($Typed<SoSprkEmbedMention.Main> | $Typed<SoSprkEmbedPost.Main> | { 13 + ($Typed<SoSprkEmbedMention.Main> | $Typed<SoSprkEmbedRecord.Main> | { 14 14 $type: string; 15 15 })[]; 16 16 export type Views = 17 - ($Typed<SoSprkEmbedMention.View> | $Typed<SoSprkEmbedPost.View> | { 17 + ($Typed<SoSprkEmbedMention.View> | $Typed<SoSprkEmbedRecord.View> | { 18 18 $type: string; 19 19 })[]; 20 20
+3 -3
lex/types/so/sprk/embed/post.ts lex/types/so/sprk/embed/record.ts
··· 8 8 import type * as SoSprkFeedDefs from "../feed/defs.ts"; 9 9 10 10 const is$typed = _is$typed, validate = _validate; 11 - const id = "so.sprk.embed.post"; 11 + const id = "so.sprk.embed.record"; 12 12 13 13 export interface Main { 14 - $type?: "so.sprk.embed.post"; 14 + $type?: "so.sprk.embed.record"; 15 15 placement: SoSprkEmbedDefs.Placement; 16 16 post: ComAtprotoRepoStrongRef.Main; 17 17 } ··· 27 27 } 28 28 29 29 export interface View { 30 - $type?: "so.sprk.embed.post#view"; 30 + $type?: "so.sprk.embed.record#view"; 31 31 placement: SoSprkEmbedDefs.Placement; 32 32 post: 33 33 | $Typed<SoSprkFeedDefs.PostView>
+2 -2
lexicons/so/sprk/embed/defs.json
··· 7 7 "type": "array", 8 8 "items": { 9 9 "type": "union", 10 - "refs": ["so.sprk.embed.mention", "so.sprk.embed.post"] 10 + "refs": ["so.sprk.embed.mention", "so.sprk.embed.record"] 11 11 } 12 12 }, 13 13 "views": { 14 14 "type": "array", 15 15 "items": { 16 16 "type": "union", 17 - "refs": ["so.sprk.embed.mention#view", "so.sprk.embed.post#view"] 17 + "refs": ["so.sprk.embed.mention#view", "so.sprk.embed.record#view"] 18 18 } 19 19 }, 20 20 "placement": {
+2 -2
lexicons/so/sprk/embed/post.json lexicons/so/sprk/embed/record.json
··· 1 1 { 2 2 "lexicon": 1, 3 - "id": "so.sprk.embed.post", 4 - "description": "Interactive post embed.", 3 + "id": "so.sprk.embed.record", 4 + "description": "Interactive record embed.", 5 5 "defs": { 6 6 "main": { 7 7 "type": "object",
+5 -5
tests/stories_test.ts
··· 283 283 }, 284 284 embeds: [ 285 285 { 286 - $type: "so.sprk.embed.post", 286 + $type: "so.sprk.embed.record", 287 287 placement: { 288 288 frame: { x: 1000, y: 1000, w: 7000, h: 2500 }, 289 289 }, ··· 422 422 did: mentionDid, 423 423 }, 424 424 { 425 - $type: "so.sprk.embed.post", 425 + $type: "so.sprk.embed.record", 426 426 placement: { 427 427 frame: { x: 800, y: 5000, w: 8400, h: 3000 }, 428 428 }, ··· 518 518 $type: string; 519 519 post: { $type?: string; uri: string }; 520 520 }; 521 - assertEquals(postView.$type, "so.sprk.embed.post#view"); 521 + assertEquals(postView.$type, "so.sprk.embed.record#view"); 522 522 assertEquals(postView.post.$type, "so.sprk.feed.defs#postView"); 523 523 assertEquals(postView.post.uri, postUri); 524 524 }, ··· 547 547 }, 548 548 embeds: [ 549 549 { 550 - $type: "so.sprk.embed.post", 550 + $type: "so.sprk.embed.record", 551 551 placement: { 552 552 frame: { x: 800, y: 5000, w: 8400, h: 3000 }, 553 553 }, ··· 682 682 did: mentionDid, 683 683 }, 684 684 { 685 - $type: "so.sprk.embed.post", 685 + $type: "so.sprk.embed.record", 686 686 // placement is intentionally absent 687 687 post: { 688 688 uri: postUri,
+2 -2
views/index.ts
··· 451 451 if (!embed || typeof embed !== "object") return false; 452 452 const e = embed as Record<string, unknown>; 453 453 const post = e["post"] as Record<string, unknown> | undefined; 454 - return e["$type"] === "so.sprk.embed.post" && 454 + return e["$type"] === "so.sprk.embed.record" && 455 455 typeof post?.["uri"] === "string" && 456 456 !!e["placement"] && 457 457 typeof e["placement"] === "object" && ··· 480 480 if (this.isPostEmbedRecord(embed)) { 481 481 const embedded = this.maybePost(embed.post.uri, state); 482 482 return { 483 - $type: "so.sprk.embed.post#view", 483 + $type: "so.sprk.embed.record#view", 484 484 placement: embed.placement, 485 485 post: isReplyView(embedded) 486 486 ? this.notFoundPost(embed.post.uri)