1
0

InstanceActorController.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\Models\InstanceActor;
  5. use Cache;
  6. class InstanceActorController extends Controller
  7. {
  8. public function profile()
  9. {
  10. $res = Cache::rememberForever(InstanceActor::PROFILE_KEY, function() {
  11. $res = (new InstanceActor())->first()->getActor();
  12. return json_encode($res, JSON_UNESCAPED_SLASHES);
  13. });
  14. return response($res)->header('Content-Type', 'application/activity+json');
  15. }
  16. public function inbox()
  17. {
  18. return;
  19. }
  20. public function outbox()
  21. {
  22. $res = json_encode([
  23. "@context" => [
  24. "https://www.w3.org/ns/activitystreams",
  25. "https://w3id.org/security/v1",
  26. [
  27. "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
  28. "toot" => "http://joinmastodon.org/ns#",
  29. "featured" => [
  30. "@id" => "toot:featured",
  31. "@type" => "@id"
  32. ],
  33. "featuredTags" => [
  34. "@id" => "toot:featuredTags",
  35. "@type" => "@id"
  36. ],
  37. "alsoKnownAs" => [
  38. "@id" => "as:alsoKnownAs",
  39. "@type" => "@id"
  40. ],
  41. "movedTo" => [
  42. "@id" => "as:movedTo",
  43. "@type" => "@id"
  44. ],
  45. "schema" => "http://schema.org#",
  46. "PropertyValue" => "schema:PropertyValue",
  47. "value" => "schema:value",
  48. "discoverable" => "toot:discoverable",
  49. "Device" => "toot:Device",
  50. "Ed25519Signature" => "toot:Ed25519Signature",
  51. "Ed25519Key" => "toot:Ed25519Key",
  52. "Curve25519Key" => "toot:Curve25519Key",
  53. "EncryptedMessage" => "toot:EncryptedMessage",
  54. "publicKeyBase64" => "toot:publicKeyBase64",
  55. "deviceId" => "toot:deviceId",
  56. "claim" => [
  57. "@type" => "@id",
  58. "@id" => "toot:claim"
  59. ],
  60. "fingerprintKey" => [
  61. "@type" => "@id",
  62. "@id" => "toot:fingerprintKey"
  63. ],
  64. "identityKey" => [
  65. "@type" => "@id",
  66. "@id" => "toot:identityKey"
  67. ],
  68. "devices" => [
  69. "@type" => "@id",
  70. "@id" => "toot:devices"
  71. ],
  72. "messageFranking" => "toot:messageFranking",
  73. "messageType" => "toot:messageType",
  74. "cipherText" => "toot:cipherText",
  75. "suspended" => "toot:suspended"
  76. ]
  77. ],
  78. 'id' => config('app.url') . '/i/actor/outbox',
  79. 'type' => 'OrderedCollection',
  80. 'totalItems' => 0,
  81. 'first' => config('app.url') . '/i/actor/outbox?page=true',
  82. 'last' => config('app.url') . '/i/actor/outbox?min_id=0page=true'
  83. ], JSON_UNESCAPED_SLASHES);
  84. return response($res)->header('Content-Type', 'application/activity+json');
  85. }
  86. }