tangled
alpha
login
or
join now
zenfyr.dev
/
xpost
2
fork
atom
social media crossposting tool. 3rd time's the charm
mastodon
misskey
crossposting
bluesky
2
fork
atom
overview
issues
1
pulls
pipelines
fix: quotes with media on bsky input
zenfyr.dev
3 weeks ago
a8918349
e0063dc5
verified
This commit was signed with the committer's
known signature
.
zenfyr.dev
SSH Key Fingerprint:
SHA256:TtcIcnTnoAB5mqHofsaOxIgiMzfVBxej1AXT7DQdrTE=
2/2
build-images.yml
success
3w ago
run-tests.yml
success
3w ago
+5
-7
1 changed file
expand all
collapse all
unified
split
bluesky
input.py
+5
-7
bluesky/input.py
···
90
90
)
91
91
92
92
embed: dict[str, Any] = record.get("embed", {})
93
93
+
attachments: list[Attachment] = []
94
94
+
blob_urls: list[tuple[str, str, str | None]] = []
93
95
94
96
def handle_embeds(
95
97
embed: dict[str, Any],
96
96
-
) -> Result[tuple[list[tuple[str, str, str | None]], list[Attachment]], str]:
97
97
-
attachments: list[Attachment] = []
98
98
-
blob_urls: list[tuple[str, str, str | None]] = []
99
99
-
98
98
+
) -> Result[None, str]:
100
99
if "$type" not in embed:
101
101
-
return Result.ok((blob_urls, attachments))
100
100
+
return Result.ok(None)
102
101
103
102
match cast(str, embed["$type"]):
104
103
case "app.bsky.embed.record" | "app.bsky.embed.recordWithMedia":
···
133
132
blob_urls.append((url, blob_cid, embed.get("alt")))
134
133
case _:
135
134
self.log.warning(f"unhandled embed type '{embed['$type']}'")
136
136
-
return Result.ok((blob_urls, attachments))
135
135
+
return Result.ok(None)
137
136
138
137
embeds = handle_embeds(embed)
139
138
if not embeds.is_ok():
140
139
self.log.info("Skipping '%s': %s", post_uri, embeds.error())
141
140
return
142
141
143
143
-
blob_urls, attachments = embeds.value()
144
142
for a in attachments:
145
143
post.attachments.put(a)
146
144