Something something like soundcloud but not like soundcloud.
Log in, upload records, done.
Simple, easy, KISS.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

utils.py 864B

12345678910111213141516171819202122232425262728
  1. from flask import current_app
  2. def ap_url(klass, username):
  3. if klass == "url":
  4. return f"https://{current_app.config['AP_DOMAIN']}/user/{username}"
  5. elif klass == "shared_inbox":
  6. return f"https://{current_app.config['AP_DOMAIN']}/inbox"
  7. elif klass == "inbox":
  8. return f"https://{current_app.config['AP_DOMAIN']}" \
  9. f"/user/{username}/inbox"
  10. elif klass == "outbox":
  11. return f"https://{current_app.config['AP_DOMAIN']}" \
  12. f"/user/{username}/outbox"
  13. else:
  14. return None
  15. def full_url(path):
  16. if path.startswith("http://") or path.startswith("https://"):
  17. return path
  18. root = current_app.config['AP_DOMAIN']
  19. if path.startswith('/'):
  20. return root + path[1:]
  21. elif path.startswith('/'):
  22. return root + "/" + path
  23. else:
  24. return root + path