fixed reverse chronological ordering in a pair of FTs clogging the pipeline; added ActivityPub to project; new apps.ap for WebFinger, Actor, Outbox views; apps.lyric.models now contains ap_public_key, ap_private_key fields + ensure_keypair(); new apps.lyric migration accordingly; new in drama.models are to_activity() w. JoinGate, SelectRole, Create compat. & None verb support; new core.urls for /.well-known/webfinger + /ap/ included; cryptography installed, added to reqs.txt; 24 new green UTs & ITs; in sum, project is now read-only ActivityPub node
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -78,6 +78,35 @@ class GameEvent(models.Model):
|
||||
return "All roles assigned"
|
||||
return self.verb
|
||||
|
||||
def to_activity(self, base_url):
|
||||
"""Serialise this event as an AS2 Activity dict, or None if unsupported."""
|
||||
if not self.actor or not self.actor.username:
|
||||
return None
|
||||
actor_url = f"{base_url}/ap/users/{self.actor.username}/"
|
||||
room_url = f"{base_url}/gameboard/room/{self.room_id}/"
|
||||
if self.verb == self.SLOT_FILLED:
|
||||
return {
|
||||
"type": "earthman:JoinGate",
|
||||
"actor": actor_url,
|
||||
"object": room_url,
|
||||
"summary": self.to_prose(),
|
||||
}
|
||||
if self.verb == self.ROLE_SELECTED:
|
||||
return {
|
||||
"type": "earthman:SelectRole",
|
||||
"actor": actor_url,
|
||||
"object": room_url,
|
||||
"summary": self.to_prose(),
|
||||
}
|
||||
if self.verb == self.ROOM_CREATED:
|
||||
return {
|
||||
"type": "Create",
|
||||
"actor": actor_url,
|
||||
"object": room_url,
|
||||
"summary": self.to_prose(),
|
||||
}
|
||||
return None
|
||||
|
||||
def __str__(self):
|
||||
actor = self.actor.email if self.actor else "system"
|
||||
return f"[{self.timestamp:%Y-%m-%d %H:%M}] {actor} → {self.verb}"
|
||||
|
||||
Reference in New Issue
Block a user