Separates incoming and outgoing api actions
This commit is contained in:
parent
ae248f6fdc
commit
17468177dd
8 changed files with 430 additions and 424 deletions
15
fedireads/api.py
Normal file
15
fedireads/api.py
Normal 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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue