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
add chuckya mime types
zenfyr.dev
7 months ago
3014455c
b93de3de
verified
This commit was signed with the committer's
known signature
.
zenfyr.dev
SSH Key Fingerprint:
SHA256:TtcIcnTnoAB5mqHofsaOxIgiMzfVBxej1AXT7DQdrTE=
+17
-5
1 changed file
expand all
collapse all
unified
split
mastodon
output.py
+17
-5
mastodon/output.py
reviewed
···
17
17
'video/webm'
18
18
]
19
19
20
20
+
TEXT_MIMES = [
21
21
+
'text/x.misskeymarkdown',
22
22
+
'text/markdown',
23
23
+
'text/plain'
24
24
+
]
25
25
+
20
26
ALLOWED_POSTING_VISIBILITY = ['public', 'unlisted', 'private']
21
27
22
28
class MastodonOutputOptions():
···
81
87
self.image_size_limit: int = upload_limit
82
88
self.video_size_limit: int = upload_limit
83
89
90
90
+
# chuckya: supported text types
91
91
+
chuckya_text_mimes: list[str] = statuses_config.get('supported_mime_types', [])
92
92
+
self.text_format = next(
93
93
+
(mime for mime in TEXT_MIMES if mime in (chuckya_text_mimes)),
94
94
+
'text/plain'
95
95
+
)
96
96
+
84
97
# *oma ext: supported text types
85
85
-
self.text_format = 'text/plain'
86
98
pleroma = instance_info.get('pleroma')
87
99
if pleroma:
88
100
post_formats: list[str] = pleroma.get('metadata', {}).get('post_formats', [])
89
89
-
if 'text/x.misskeymarkdown' in post_formats:
90
90
-
self.text_format = 'text/x.misskeymarkdown'
91
91
-
elif 'text/markdown' in post_formats:
92
92
-
self.text_format = 'text/markdown'
101
101
+
self.text_format = next(
102
102
+
(mime for mime in TEXT_MIMES if mime in post_formats),
103
103
+
self.text_format
104
104
+
)
93
105
94
106
def upload_media(self, attachments: list[MediaInfo]) -> list[str] | None:
95
107
for a in attachments: