Array
(
[message] => syntax error, unexpected token ","
[file] => /home/www/vvveb/www/plugins/activitypub/app/controller/base.php
[line_no] => 220
[line] => ], // <==
[lines] => Array
(
[0] => 'type' => 'Collection',
[1] => 'first' => [
[2] => 'type' => 'CollectionPage',
[3] => 'next' => "{$this->url}/posts/1_replies_more",
[4] => 'partOf' => "{$this->url}/posts/1_replies",
[5] => 'items' => [],
[6] => */],
[7] => ], // <==
[8] => ];
[9] => }
[10] =>
[11] => $response = [
[12] => '@context' => 'https://www.w3.org/ns/activitystreams',
[13] => 'id' => $this->url . '/outbox',
)
[trace] => #0 /home/www/vvveb/www/plugins/activitypub/app/controller/actors.php(25): Vvveb\System\Core\autoload()
#1 /home/www/vvveb/www/system/core/frontcontroller.php(144): include_once('...')
#2 /home/www/vvveb/www/system/core/frontcontroller.php(295): Vvveb\System\Core\FrontController::call()
#3 /home/www/vvveb/www/system/core/frontcontroller.php(368): Vvveb\System\Core\FrontController::redirect()
#4 /home/www/vvveb/www/system/core/startup.php(415): Vvveb\System\Core\FrontController::dispatch()
#5 /home/www/vvveb/www/index.php(102): Vvveb\System\Core\start()
#6 /home/www/vvveb/www/index.php(146): Vvveb\saveCache()
#7 /home/www/vvveb/www/public/index.php(28): include('...')
#8 {main}
[code] => Array
(
[0] =>
[2] => /**
[3] => * Vvveb
[4] => *
[5] => * Copyright (C) 2022 Ziadin Givan
[6] => *
[7] => * This program is free software: you can redistribute it and/or modify
[8] => * it under the terms of the GNU Affero General Public License as
[9] => * published by the Free Software Foundation, either version 3 of the
[10] => * License, or (at your option) any later version.
[11] => *
[12] => * This program is distributed in the hope that it will be useful,
[13] => * but WITHOUT ANY WARRANTY; without even the implied warranty of
[14] => * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[15] => * GNU Affero General Public License for more details.
[16] => *
[17] => * You should have received a copy of the GNU Affero General Public License
[18] => * along with this program. If not, see .
[19] => *
[20] => */
[21] =>
[22] => namespace Vvveb\Plugins\Activitypub\Controller;
[23] =>
[24] => use Vvveb\Controller\Base as AppBase;
[25] => use function Vvveb\siteSettings;
[26] => use Vvveb\Sql\PostSQL;
[27] => use Vvveb\System\Images;
[28] => use Vvveb\System\User\Admin;
[29] => use function Vvveb\url;
[30] =>
[31] => class Base extends AppBase {
[32] => protected $user;
[33] =>
[34] => function init() {
[35] => parent::init();
[36] => $this->user = $this->request->get['user'] ?? '';
[37] => $this->url = 'https://' . SITE_URL; //todo: add https
[38] => $this->response->setType('activityjson');
[39] => }
[40] =>
[41] => protected function error($type, $code = 404) {
[42] => $this->response->setType('json');
[43] =>
[44] => $response = [
[45] => 'type' => 'about:blank',
[46] => 'title' => 'activitypub_wrong_' . $type,
[47] => 'detail' => "Resource $type does not match blog $type",
[48] => 'status' => $code,
[49] => 'metadata' => [
[50] => 'code' => 'activitypub_wrong_' . $type,
[51] => 'message' => "Resource $type does not match blog $type",
[52] => 'data' => ['status' => $code],
[53] => ],
[54] => ];
[55] =>
[56] => $this->response->setStatus($code);
[57] => }
[58] =>
[59] => function index() {
[60] => $displayName = $user ?? '';
[61] => $bio = $user ?? '';
[62] =>
[63] => $this->response->setType('activityjson');
[64] =>
[65] => if ($this->user) {
[66] => $user = Admin::get(['username' => $this->user]);
[67] =>
[68] => if ($user) {
[69] => $url = $this->url . '/activitypub/' . $this->user;
[70] =>
[71] => $response = [
[72] => '@context' => [
[73] => 'https://www.w3.org/ns/activitystreams',
[74] => 'https://w3id.org/security/v1',
[75] => ],
[76] => 'id' => $url,
[77] => 'type' => 'Person',
[78] => 'following' => $url . '/following',
[79] => 'followers' => $url . '/followers',
[80] => 'featured' => $url . '/featured',
[81] => 'inbox' => $url . '/inbox',
[82] => 'outbox' => $url . '/outbox',
[83] => 'preferredUsername' => $user['username'],
[84] => 'name' => $user['display_name'], //$user['first_name'] . ' ' . $user['last_name'],
[85] => 'summary' => $user['bio'],
[86] => 'url' => "{$this->url}",
[87] => 'manuallyApprovesFollowers' => false,
[88] => 'discoverable' => true,
[89] => 'published' => date('c', strtotime($user['created_at'])),
[90] => 'icon' => [
[91] => 'type' => 'Image',
[92] => 'mediaType' => 'image/jpeg',
[93] => 'url' => $this->url . Images::image($user['avatar'], 'user'),
[94] => ],
[95] => 'image' => [
[96] => 'type' => 'Image',
[97] => 'mediaType' => 'image/jpeg',
[98] => 'url' => $this->url . Images::image($user['cover'], 'user'),
[99] => ],
[100] => ];
[101] => } else {
[102] => $this->error('user');
[103] => }
[104] => } else {
[105] => $site = siteSettings();
[106] =>
[107] => if ($site) {
[108] => $response = [
[109] => '@context' => [
[110] => 'https://www.w3.org/ns/activitystreams',
[111] => 'https://w3id.org/security/v1',
[112] => ],
[113] => 'id' => $this->url,
[114] => 'type' => 'Application',
[115] => 'following' => "{$this->url}/following",
[116] => 'followers' => "{$this->url}/followers",
[117] => 'featured' => "{$this->url}/featured",
[118] => 'inbox' => "{$this->url}/inbox",
[119] => 'outbox' => "{$this->url}/outbox",
[120] => 'preferredUsername' => $site['description'][$this->global['language_id']]['title'],
[121] => 'name' => $site['description'][$this->global['language_id']]['title'], //$user['first_name'] . ' ' . $user['last_name'],
[122] => 'summary' => $user['bio'],
[123] => 'url' => $this->url,
[124] => 'manuallyApprovesFollowers' => true,
[125] => 'discoverable' => true,
[126] => //'published' => date('Y-m-d\TH:i:sP', strtotime($site['created_at'])),
[127] => 'icon' => [
[128] => 'type' => 'Image',
[129] => 'mediaType' => 'image/jpeg',
[130] => 'url' => $site['logo'],
[131] => ],
[132] => 'image' => [
[133] => 'type' => 'Image',
[134] => 'mediaType' => 'image/jpeg',
[135] => 'url' => $site['webbanner'],
[136] => ],
[137] => ];
[138] => } else {
[139] => $this->error('host');
[140] => }
[141] => }
[142] =>
[143] => return $response;
[144] => }
[145] =>
[146] => function remoteFollow() {
[147] => return [];
[148] => }
[149] =>
[150] => function remoteReply() {
[151] => return [];
[152] => }
[153] =>
[154] => function inbox() {
[155] => return [
[156] => '@context' => ['https://www.w3.org/ns/activitystreams'],
[157] => 'id' => "{$this->url}/activitypub/{$this->user}/inbox",
[158] => 'type' => 'OrderedCollection',
[159] => 'totalItems' => 0,
[160] => 'orderedItems' => [],
[161] => ];
[162] => }
[163] =>
[164] => function outbox() {
[165] => if ($this->user) {
[166] => $user = Admin::get(['username' => $this->user]);
[167] =>
[168] => $this->response->setType('activityjson');
[169] =>
[170] => if ($user) {
[171] => $postModel = new PostSQL();
[172] => $posts = $postModel->getAll(['admin_id' => $user['admin_id']] + $this->global);
[173] =>
[174] => if ($posts) {
[175] => $items = [];
[176] =>
[177] => foreach ($posts['post'] as $post) {
[178] => $url = $this->url . '/' . $post['slug'];
[179] => $items[] = [/*
[180] => '@context' => [
[181] => 'https://www.w3.org/ns/activitystreams',
[182] => [
[183] => 'ostatus' => 'http://ostatus.org#',
[184] => 'atomUri' => 'ostatus:atomUri',
[185] => 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri',
[186] => 'conversation' => 'ostatus:conversation',
[187] => 'sensitive' => 'as:sensitive',
[188] => 'toot' => 'http://joinmastodon.org/ns#',
[189] => 'votersCount' => 'toot:votersCount',
[190] => ],
[191] => ],*/
[192] => 'id' => $url,
[193] => 'type' => 'Note',
[194] => 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
[195] => 'cc' => ["{$this->url}/{$this->user}/followers"],
[196] => 'id' => $url,
[197] => 'summary' => null,
[198] => 'inReplyTo' => null,
[199] => 'published' => date('c', strtotime($post['created_at'])),
[200] => 'updated' => date('c', strtotime($post['updated_at'])),
[201] => 'url' => $url,
[202] => 'attributedTo' => "{$this->url}/activitypub/{$this->user}",
[203] => 'sensitive' => false,
[204] => 'atomUri' => $url,
[205] => 'inReplyToAtomUri' => null,
[206] => 'conversation' => "tag:{$this->url}," . date('Y-m-d', strtotime($post['created_at'])) . ':objectId=' . $post['post_id'] . ':objectType=Conversation',
[207] => 'content' => $post['content'],
[208] => 'contentMap' => ['en' => $post['content']],
[209] => 'attachment' => [],
[210] => 'tag' => [],
[211] => 'replies' => [/*
[212] => 'id' => "{$this->url}/posts/1_replies",
[213] => 'type' => 'Collection',
[214] => 'first' => [
[215] => 'type' => 'CollectionPage',
[216] => 'next' => "{$this->url}/posts/1_replies_more",
[217] => 'partOf' => "{$this->url}/posts/1_replies",
[218] => 'items' => [],
[219] => */],
[220] => ], // <==
[221] => ];
[222] => }
[223] =>
[224] => $response = [
[225] => '@context' => 'https://www.w3.org/ns/activitystreams',
[226] => 'id' => $this->url . '/outbox',
[227] => 'actor' => "{$this->url}/activitypub/{$this->user}",
[228] => 'type' => 'OrderedCollection',
[229] => 'totalItems' => $posts['count'],
[230] => 'orderedItems' => $items,
[231] => //'first' => $this->global['site']['url'] . '/toots',
[232] => ];
[233] => }
[234] =>
[235] => return $response;
[236] => } else {
[237] => $this->error('user');
[238] => }
[239] => }
[240] => {
[241] => $this->error('user');
[242] => }
[243] => }
[244] =>
[245] => function followers() {
[246] => $response = [
[247] => '@context' => ['https://www.w3.org/ns/activitystreams'],
[248] => 'id' => "{$this->url}/activitypub/{$this->user}/followers",
[249] => 'type' => 'OrderedCollection',
[250] => 'totalItems' => 0,
[251] => 'orderedItems' => [],
[252] => ];
[253] =>
[254] => return $response;
[255] => }
[256] =>
[257] => function following() {
[258] => $response = [
[259] => '@context' => ['https://www.w3.org/ns/activitystreams'],
[260] => 'id' => "{$this->url}/activitypub/{$this->user}/following",
[261] => 'type' => 'OrderedCollection',
[262] => 'totalItems' => 0,
[263] => 'orderedItems' => [],
[264] => ];
[265] =>
[266] => return $response;
[267] => }
[268] =>
[269] => function collections() {
[270] => $response = [
[271] => '@context' => ['https://www.w3.org/ns/activitystreams'],
[272] => 'id' => "{$this->url}/activitypub/{$this->user}/collections",
[273] => 'type' => 'OrderedCollection',
[274] => 'totalItems' => 0,
[275] => 'orderedItems' => [],
[276] => ];
[277] =>
[278] => return $response;
[279] => }
[280] =>
[281] => function featured() {
[282] => $response = [
[283] => '@context' => ['https://www.w3.org/ns/activitystreams'],
[284] => 'id' => "{$this->url}/activitypub/{$this->user}/featured",
[285] => 'type' => 'OrderedCollection',
[286] => 'totalItems' => 0,
[287] => 'orderedItems' => [],
[288] => ];
[289] =>
[290] => return $response;
[291] => $response = [
[292] => 'id' => $this->global['site']['url'] . '/featured',
[293] => 'type' => 'OrderedCollection',
[294] => 'totalItems' => 1,
[295] => 'orderedItems' => [
[296] => [
[297] => 'id' => $this->global['site']['url'] . '/1',
[298] => 'type' => 'Note',
[299] => 'summary' => null,
[300] => 'inReplyTo' => null,
[301] => 'published' => '2022-04-26T00:11:17Z',
[302] => 'url' => $this->global['site']['url'] . '/1',
[303] => 'attributedTo' => $this->global['site']['url'] . '/' . $this->user,
[304] => 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
[305] => 'cc' => [$this->global['site']['url'] . '/followers'],
[306] => 'sensitive' => false,
[307] => 'atomUri' => $this->global['site']['url'] . '/1',
[308] => 'inReplyToAtomUri' => null,
[309] => 'conversation' => "tag:{$this->global['site']['url']},2022-04-26:objectId=288755344:objectType=Conversation",
[310] => 'content' => 'THIS IS PINNED
',
[311] => 'contentMap' => ['en' => 'THIS IS PINNED
'],
[312] => 'attachment' => [],
[313] => 'tag' => [],
[314] => 'replies' => [
[315] => 'id' => $this->global['site']['url'] . '/1_replies',
[316] => 'type' => 'Collection',
[317] => 'first' => [
[318] => 'type' => 'CollectionPage',
[319] => 'next' => $this->global['site']['url'] . '/1_replies_more',
[320] => 'partOf' => $this->global['site']['url'] . '/1_replies',
[321] => 'items' => [],
[322] => ],
[323] => ],
[324] => ],
[325] => ],
[326] => ];
[327] =>
[328] => return $response;
[329] => }
[330] =>
[331] => function posts() {
[332] => return [];
[333] => }
[334] =>
[335] => function toots() {
[336] => $response = [
[337] => 'id' => $this->global['site']['url'] . '/toots',
[338] => 'type' => 'OrderedCollectionPage',
[339] => 'next' => $this->global['site']['url'] . '/toots_more',
[340] => 'prev' => $this->global['site']['url'] . '/toots_less',
[341] => 'partOf' => $this->global['site']['url'] . '/toots',
[342] => 'orderedItems' => [
[343] => [
[344] => 'id' => $this->global['site']['url'] . '/posts/1',
[345] => 'type' => 'Create',
[346] => 'actor' => $this->global['site']['url'] . '/' . $this->user,
[347] => 'published' => '2022-04-26T00:11:17Z',
[348] => 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
[349] => 'object' => [
[350] => 'id' => $this->global['site']['url'] . '/posts/1',
[351] => 'type' => 'Note',
[352] => 'summary' => null,
[353] => 'inReplyTo' => null,
[354] => 'published' => '2022-04-26T00:11:17Z',
[355] => 'url' => $this->global['site']['url'] . '/posts/1',
[356] => 'attributedTo' => $this->global['site']['url'] . '/' . $this->user,
[357] => 'to' => ['https://www.w3.org/ns/activitystreams#Public'],
[358] => 'sensitive' => false,
[359] => 'atomUri' => $this->global['site']['url'] . '/posts/1',
[360] => 'inReplyToAtomUri' => null,
[361] => 'conversation' => "tag:{$this->global['site']['url']},2022-04-26:objectId=288755344:objectType=Conversation",
[362] => 'content' => 'It has been an interesting day.
',
[363] => 'contentMap' => [
[364] => 'en' => 'It has been an interesting day.
',
[365] => ],
[366] => 'attachment' => [],
[367] => 'tag' => [],
[368] => 'replies' => [
[369] => 'id' => $this->global['site']['url'] . '/posts/1_replies',
[370] => 'type' => 'Collection',
[371] => 'first' => [
[372] => 'type' => 'CollectionPage',
[373] => 'next' => $this->global['site']['url'] . '/posts/1_replies_more',
[374] => 'partOf' => $this->global['site']['url'] . '/posts/1_replies',
[375] => 'items' => [],
[376] => ],
[377] => ],
[378] => ],
[379] => ],
[380] => ],
[381] => ];
[382] =>
[383] => return $response;
[384] => }
[385] => }
)
)