kopia lustrzana https://github.com/tsileo/little-boxes
Add support for Listen activities
rodzic
4eb86c5a10
commit
2461bef182
|
@ -128,6 +128,9 @@ class ActivityType(Enum):
|
|||
READ = "Read"
|
||||
IGNORE = "Ignore"
|
||||
|
||||
# Pleroma uses Listen for media scrobbling
|
||||
LISTEN = "Listen"
|
||||
|
||||
|
||||
ACTOR_TYPES = [
|
||||
ActivityType.PERSON,
|
||||
|
@ -751,6 +754,20 @@ class Undo(BaseActivity):
|
|||
return list(set(recipients))
|
||||
|
||||
|
||||
class Listen(BaseActivity):
|
||||
ACTIVITY_TYPE = ActivityType.LISTEN
|
||||
ALLOWED_OBJECT_TYPES = [ActivityType.AUDIO]
|
||||
OBJECT_REQUIRED = True
|
||||
ACTOR_REQUIRED = True
|
||||
|
||||
def _recipients(self) -> List[str]:
|
||||
recipients = [self.get_object().get_actor().id]
|
||||
for field in ["to", "cc"]:
|
||||
if field in self._data:
|
||||
recipients.extend(_to_list(self._data[field]))
|
||||
return list(set(recipients))
|
||||
|
||||
|
||||
class Like(BaseActivity):
|
||||
ACTIVITY_TYPE = ActivityType.LIKE
|
||||
ALLOWED_OBJECT_TYPES = CREATE_TYPES
|
||||
|
|
Ładowanie…
Reference in New Issue