Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

69 Zeilen
1.3KB

  1. <?php
  2. use Friendica\Core\Config;
  3. require_once("mod/hostxrd.php");
  4. require_once("mod/nodeinfo.php");
  5. function _well_known_init(App $a) {
  6. if ($a->argc > 1) {
  7. switch($a->argv[1]) {
  8. case "host-meta":
  9. hostxrd_init($a);
  10. break;
  11. case "x-social-relay":
  12. wk_social_relay($a);
  13. break;
  14. case "nodeinfo":
  15. nodeinfo_wellknown($a);
  16. break;
  17. }
  18. }
  19. http_status_exit(404);
  20. killme();
  21. }
  22. function wk_social_relay(App $a) {
  23. $subscribe = (bool)Config::get('system', 'relay_subscribe', false);
  24. if ($subscribe) {
  25. $scope = Config::get('system', 'relay_scope', SR_SCOPE_ALL);
  26. } else {
  27. $scope = SR_SCOPE_NONE;
  28. }
  29. $tags = array();
  30. if ($scope == SR_SCOPE_TAGS) {
  31. $server_tags = Config::get('system', 'relay_server_tags');
  32. $tagitems = explode(",", $server_tags);
  33. foreach($tagitems AS $tag) {
  34. $tags[trim($tag, "# ")] = trim($tag, "# ");
  35. }
  36. if (Config::get('system', 'relay_user_tags')) {
  37. $terms = q("SELECT DISTINCT(`term`) FROM `search`");
  38. foreach($terms AS $term) {
  39. $tag = trim($term["term"], "#");
  40. $tags[$tag] = $tag;
  41. }
  42. }
  43. }
  44. $taglist = array();
  45. foreach($tags AS $tag) {
  46. $taglist[] = $tag;
  47. }
  48. $relay = array("subscribe" => $subscribe,
  49. "scope" => $scope,
  50. "tags" => $taglist);
  51. header('Content-type: application/json; charset=utf-8');
  52. echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
  53. exit;
  54. }