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 self-quotes to misskey and mastodon inputs
zenfyr.dev
5 months ago
bcd918f5
1bf4ab28
verified
This commit was signed with the committer's
known signature
.
zenfyr.dev
SSH Key Fingerprint:
SHA256:TtcIcnTnoAB5mqHofsaOxIgiMzfVBxej1AXT7DQdrTE=
+17
-7
3 changed files
expand all
collapse all
unified
split
cross
attachments.py
mastodon
input.py
misskey
input.py
+1
cross/attachments.py
reviewed
···
34
34
@dataclass(kw_only=True)
35
35
class QuoteAttachment(Attachment):
36
36
quoted_id: str
37
37
+
quoted_user: str
+8
-3
mastodon/input.py
reviewed
···
10
10
LabelsAttachment,
11
11
LanguagesAttachment,
12
12
MediaAttachment,
13
13
+
QuoteAttachment,
13
14
RemoteUrlAttachment,
14
15
SensitiveAttachment,
15
16
)
···
82
83
self.log.info("Skipping '%s'! Contains a poll..", status["id"])
83
84
return
84
85
85
85
-
if status.get("quote"):
86
86
-
self.log.info("Skipping '%s'! Quote..", status["id"])
87
87
-
return
86
86
+
quote: dict[str, Any] | None = status.get("quote")
87
87
+
if quote:
88
88
+
quote = quote['quoted_status'] if quote.get('quoted_status') else quote
89
89
+
if not quote or quote["account"]["id"] != self.user_id:
90
90
+
return
88
91
89
92
in_reply: str | None = status.get("in_reply_to_id")
90
93
in_reply_to: str | None = status.get("in_reply_to_account_id")
···
106
109
post = Post(id=status["id"], parent_id=in_reply, text=text)
107
110
post.fragments.extend(fragments)
108
111
112
112
+
if quote:
113
113
+
post.attachments.put(QuoteAttachment(quoted_id=quote['id'], quoted_user=self.user_id))
109
114
if status.get("url"):
110
115
post.attachments.put(RemoteUrlAttachment(url=status["url"]))
111
116
if status.get("sensitive"):
+8
-4
misskey/input.py
reviewed
···
10
10
from cross.attachments import (
11
11
LabelsAttachment,
12
12
MediaAttachment,
13
13
+
QuoteAttachment,
13
14
RemoteUrlAttachment,
14
15
SensitiveAttachment,
15
16
)
···
74
75
75
76
renote: dict[str, Any] | None = note.get("renote")
76
77
if renote:
77
77
-
if note.get("text") is not None:
78
78
-
self.log.info("Skipping '%s'! Quote..", note["id"])
78
78
+
if note.get("text") is None:
79
79
+
self._on_renote(note, renote)
80
80
+
return
81
81
+
82
82
+
if renote["userId"] != self.user_id:
79
83
return
80
80
-
self._on_renote(note, renote)
81
81
-
return
82
84
83
85
reply: dict[str, Any] | None = note.get("reply")
84
86
if reply:
···
101
103
post.fragments.extend(fragments)
102
104
103
105
post.attachments.put(RemoteUrlAttachment(url=self.url + "/notes/" + note["id"]))
106
106
+
if renote:
107
107
+
post.attachments.put(QuoteAttachment(quoted_id=renote['id'], quoted_user=self.user_id))
104
108
if any([a.get("isSensitive", False) for a in note.get("files", [])]):
105
109
post.attachments.put(SensitiveAttachment(sensitive=True))
106
110
if note.get("cw"):