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.

nodeinfo.py 1.2KB

123456789101112131415161718192021222324252627282930313233
  1. from flask import Blueprint, current_app, jsonify, Response, g
  2. from models import db, Config, User, Sound
  3. bp_nodeinfo = Blueprint("bp_nodeinfo", __name__, url_prefix="/nodeinfo")
  4. @bp_nodeinfo.route("/2.0", methods=["GET"])
  5. def nodeinfo():
  6. _config = Config.query.one()
  7. if not _config:
  8. return Response("", status=500, content_type="application/jrd+json; charset=utf-8")
  9. resp = {
  10. "version": "2.0",
  11. "software": {"name": "reel2bits", "version": g.cfg["REEL2BITS_VERSION_VER"]},
  12. "services": {"inbound": [], "outbound": []},
  13. "protocols": ["activitypub"],
  14. "openRegistrations": current_app.config["SECURITY_REGISTERABLE"],
  15. "usage": {
  16. "localPosts": db.session.query(Sound.id).count(),
  17. "users": {"total": db.session.query(User.id).count()},
  18. },
  19. "metadata": {
  20. "nodeName": _config.app_name,
  21. "nodeDescription": _config.app_description,
  22. "taxonomy": {"postsName": "Tracks"},
  23. },
  24. }
  25. response = jsonify(resp)
  26. response.mimetype = "application/json; charset=utf-8; profile=" '"http://nodeinfo.diaspora.software/ns/schema/2.0#"'
  27. return response