1
0
Fork 0

Separates incoming and outgoing api actions

This commit is contained in:
Mouse Reeve 2020-01-28 01:01:33 -08:00
parent ae248f6fdc
commit 17468177dd
8 changed files with 430 additions and 424 deletions

15
fedireads/api.py Normal file
View file

@ -0,0 +1,15 @@
def get_or_create_remote_user(actor):
''' wow, a foreigner '''
try:
user = models.User.objects.get(actor=actor)
except models.User.DoesNotExist:
# TODO: how do you actually correctly learn this?
username = '%s@%s' % (actor.split('/')[-1], actor.split('/')[2])
user = models.User.objects.create_user(
username,
'', '',
actor=actor,
local=False
)
return user