summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-10-01 14:14:23 +0200
committerMaxence Lange <maxence@artificial-owl.com>2018-10-01 14:14:23 +0200
commit4dddda0dc6db5535f4d6427c7e0bb62832e942db (patch)
tree132719cb0c6178da10fca90b23d3bc92d7dc4c57
parent3e399899ed7d5d9a30e7ec60f7d5406b81299b7e (diff)
social is now an activitypub server
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--.gitignore2
-rw-r--r--appinfo/app.php1
-rw-r--r--appinfo/autoload.php38
-rw-r--r--appinfo/database.xml133
-rw-r--r--appinfo/info.xml2
-rw-r--r--appinfo/routes.php36
-rw-r--r--composer.json16
-rw-r--r--composer.lock422
-rw-r--r--js/test.js136
-rw-r--r--lib/Command/NoteCreate.php16
-rw-r--r--lib/Controller/AccountController.php10
-rw-r--r--lib/Controller/ActivityPubController.php74
-rw-r--r--lib/Controller/ActivityStreamsController.php153
-rw-r--r--lib/Controller/NavigationController.php4
-rw-r--r--lib/Controller/OAuth2Controller.php109
-rw-r--r--lib/Controller/ServiceAccountsController.php144
-rw-r--r--lib/Controller/SocialPubController.php30
-rw-r--r--lib/Db/ActorsRequest.php51
-rw-r--r--lib/Db/ActorsRequestBuilder.php8
-rw-r--r--lib/Db/CacheActorsRequest.php12
-rw-r--r--lib/Db/CacheActorsRequestBuilder.php11
-rw-r--r--lib/Db/CoreRequestBuilder.php51
-rw-r--r--lib/Db/NotesRequest.php6
-rw-r--r--lib/Db/NotesRequestBuilder.php8
-rw-r--r--lib/Db/ServiceAccountsRequest.php231
-rw-r--r--lib/Db/ServiceAccountsRequestBuilder.php131
-rw-r--r--lib/Db/ServicesRequest.php199
-rw-r--r--lib/Db/ServicesRequestBuilder.php120
-rw-r--r--lib/Exceptions/APIRequestException.php8
-rw-r--r--lib/Exceptions/AccountAlreadyExistsException.php8
-rw-r--r--lib/Exceptions/AccountDoesNotExistException.php8
-rw-r--r--lib/Exceptions/ActivityStreamsRequestException.php8
-rw-r--r--lib/Exceptions/ActorAlreadyExistsException.php8
-rw-r--r--lib/Exceptions/InvalidAccessTokenException.php8
-rw-r--r--lib/Exceptions/MissingStuffException.php8
-rw-r--r--lib/Exceptions/MovedPermanentlyException.php8
-rw-r--r--lib/Exceptions/RequestException.php8
-rw-r--r--lib/Exceptions/ServiceAccountDoesNotExistException.php8
-rw-r--r--lib/Exceptions/ServiceAccountException.php8
-rw-r--r--lib/Exceptions/ServiceDoesNotExistException.php8
-rw-r--r--lib/Exceptions/TokenGenerationException.php8
-rw-r--r--lib/Model/ActivityPub/Core.php60
-rw-r--r--lib/Model/Instance.php (renamed from lib/Model/APHosts.php)27
-rw-r--r--lib/Model/InstancePath.php (renamed from lib/Traits/TOAuth2.php)78
-rw-r--r--lib/Model/Service.php238
-rw-r--r--lib/Model/ServiceAccount.php348
-rw-r--r--lib/Service/ActivityPub/InboxService.php76
-rw-r--r--lib/Service/ActivityPub/NoteService.php50
-rw-r--r--lib/Service/ActivityPubService.php205
-rw-r--r--lib/Service/ActivityStreamsService.php175
-rw-r--r--lib/Service/ActorService.php63
-rw-r--r--lib/Service/ClientCurlService.php214
-rw-r--r--lib/Service/CurlService.php30
-rw-r--r--lib/Service/InstanceService.php (renamed from lib/Service/UriIdService.php)79
-rw-r--r--lib/Service/MiscService.php1
-rw-r--r--lib/Service/ServiceAccountsService.php201
-rw-r--r--lib/Service/ServicesService.php242
-rw-r--r--lib/Tools/Model/Request.php2
-rw-r--r--lib/Tools/Traits/TArrayTools.php8
-rw-r--r--lib/webfinger.php1
-rw-r--r--templates/main.php1
61 files changed, 528 insertions, 3829 deletions
diff --git a/.gitignore b/.gitignore
index 8878b94c..f6400d9c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,5 +2,3 @@
\.idea/
vendor/
-
-test\.json
diff --git a/appinfo/app.php b/appinfo/app.php
index bc36b6e8..b871207c 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -29,7 +29,6 @@ declare(strict_types=1);
namespace OCA\Social\AppInfo;
-require_once __DIR__ . '/autoload.php';
require_once(__DIR__ . '/../lib/autoload.php');
//$app = new Application();
diff --git a/appinfo/autoload.php b/appinfo/autoload.php
deleted file mode 100644
index 586cecf3..00000000
--- a/appinfo/autoload.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-declare(strict_types=1);
-
-
-/**
- * Nextcloud - Social Support
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Maxence Lange <maxence@artificial-owl.com>
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-
-namespace OCA\Social\AppInfo;
-
-$composerDir = __DIR__ . '/../vendor/';
-
-if (is_dir($composerDir) && file_exists($composerDir . 'autoload.php')) {
- require_once $composerDir . 'autoload.php';
-}
-
diff --git a/appinfo/database.xml b/appinfo/database.xml
index fe39af89..5d750abb 100644
--- a/appinfo/database.xml
+++ b/appinfo/database.xml
@@ -6,51 +6,6 @@
<charset>utf8</charset>
<table>
- <name>*dbprefix*social_services</name>
- <declaration>
- <field>
- <name>id</name>
- <type>integer</type>
- <length>7</length>
- <unsigned>true</unsigned>
- <notnull>true</notnull>
- <autoincrement>true</autoincrement>
- <primary>true</primary>
- </field>
-
- <field>
- <name>type</name>
- <type>text</type>
- <length>15</length>
- </field>
-
- <field>
- <name>address</name>
- <type>text</type>
- <length>128</length>
- </field>
-
- <field>
- <name>config</name>
- <type>text</type>
- <length>3000</length>
- </field>
-
- <field>
- <name>status</name>
- <type>integer</type>
- <length>1</length>
- </field>
-
- <field>
- <name>creation</name>
- <type>timestamp</type>
- </field>
-
- </declaration>
- </table>
-
- <table>
<name>*dbprefix*social_accounts</name>
<declaration>
@@ -64,14 +19,6 @@
<primary>true</primary>
</field>
- // @deprecated
- <field>
- <name>service_id</name>
- <type>integer</type>
- <length>7</length>
- <notnull>true</notnull>
- </field>
-
<field>
<name>user_id</name>
<type>text</type>
@@ -79,44 +26,9 @@
</field>
<field>
- <name>username</name>
- <type>text</type>
- <length>63</length>
- </field>
-
- // @deprecated
- <field>
<name>account</name>
<type>text</type>
- <length>127</length>
- </field>
-
- // @deprecated
- <field>
- <name>account_id</name>
- <type>integer</type>
- <length>7</length>
- </field>
-
- // @deprecated
- <field>
- <name>status</name>
- <type>integer</type>
- <length>1</length>
- </field>
-
- // @deprecated
- <field>
- <name>auth</name>
- <type>text</type>
- <length>2000</length>
- </field>
-
- // @deprecated
- <field>
- <name>config</name>
- <type>text</type>
- <length>2000</length>
+ <length>63</length>
</field>
<field>
@@ -340,48 +252,5 @@
</declaration>
</table>
- <table>
- <name>*dbprefix*social_cache_actors</name>
- <declaration>
-
- <field>
- <name>id</name>
- <type>integer</type>
- <length>8</length>
- <unsigned>true</unsigned>
- <notnull>true</notnull>
- <autoincrement>true</autoincrement>
- <primary>true</primary>
- </field>
-
- <field>
- <name>account</name>
- <type>text</type>
- <length>127</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>url</name>
- <type>text</type>
- <length>127</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>actor</name>
- <type>text</type>
- <length>8000</length>
- <notnull>true</notnull>
- </field>
-
- <field>
- <name>creation</name>
- <type>timestamp</type>
- </field>
-
- </declaration>
- </table>
-
</database>
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 058e8160..44c49921 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
<name>Social</name>
<summary>🎉 Nextcloud becomes part of the federated social networks!</summary>
<description><![CDATA[test]]></description>
- <version>0.0.17</version>
+ <version>0.0.18</version>
<licence>agpl</licence>
<author mail="maxence@artificial-owl.com">Maxence Lange</author>
<author mail="jus@bitgrid.net">Julius Härtl</author>
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 20642577..4a7ef39d 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -11,37 +11,7 @@ return [
'routes' => [
['name' => 'Navigation#navigate', 'url' => '/', 'verb' => 'GET'],
- [
- 'name' => 'ServiceAccounts#getAvailableAccounts', 'url' => '/user/accounts',
- 'verb' => 'GET'
- ],
- [
- 'name' => 'ServiceAccounts#create', 'url' => '/user/account',
- 'verb' => 'POST'
- ],
- [
- 'name' => 'ActivityStreams#test', 'url' => '/user/account/{accountId}/test',
- 'verb' => 'GET'
- ],
- [
- 'name' => 'ActivityStreams#statuses', 'url' => '/user/account/{accountId}/statuses',
- 'verb' => 'GET'
- ],
- [
- 'name' => 'ActivityStreams#follows', 'url' => '/user/account/{accountId}/follows',
- 'verb' => 'GET'
- ],
-
- // [
- // 'name' => 'OAuth2#getAuthUrl', 'url' => '/client/oauth2/auth/{serviceId}/',
- // 'verb' => 'GET'
- // ],
- [
- 'name' => 'OAuth2#setCode', 'url' => '/client/oauth2/redirect/{serviceId}/',
- 'verb' => 'GET'
- ],
-
- ['name' => 'Account#create', 'url' => '/local/account/{username}', 'verb' => 'POST'],
+ ['name' => 'Account#create', 'url' => '/local/account/{username}', 'verb' => 'GET'],
['name' => 'ActivityPub#sharedInbox', 'url' => '/inbox', 'verb' => 'POST'],
['name' => 'ActivityPub#actor', 'url' => '/users/{username}', 'verb' => 'GET'],
@@ -52,9 +22,9 @@ return [
['name' => 'ActivityPub#following', 'url' => '/@{username}/following', 'verb' => 'GET'],
['name' => 'SocialPub#displayPost', 'url' => '/@{username}/{postId}', 'verb' => 'GET']
-,
+ ,
['name' => 'ActivityPub#test', 'url' => '/inbox/{username}', 'verb' => 'POST'],
-]
+ ]
];
diff --git a/composer.json b/composer.json
deleted file mode 100644
index 4969f567..00000000
--- a/composer.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "name": "vendor_name/package_name",
- "description": "description_text",
- "minimum-stability": "stable",
- "license": "proprietary",
- "authors": [
- {
- "name": "author's name",
- "email": "email@example.com"
- }
- ],
- "require": {
- "league/oauth2-client": "2.3.0",
- "lrf141/oauth2-mastodon": "1.0.1"
- }
-}
diff --git a/composer.lock b/composer.lock
deleted file mode 100644
index 10217eb8..00000000
--- a/composer.lock
+++ /dev/null
@@ -1,422 +0,0 @@
-{
- "_readme": [
- "This file locks the dependencies of your project to a known state",
- "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
- "This file is @generated automatically"
- ],
- "content-hash": "61a7838c51e287d8fb6c226460fd4e2c",
- "packages": [
- {
- "name": "guzzlehttp/guzzle",
- "version": "6.3.3",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/guzzle.git",
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
- "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
- "shasum": ""
- },
- "require": {
- "guzzlehttp/promises": "^1.0",
- "guzzlehttp/psr7": "^1.4",
- "php": ">=5.5"
- },
- "require-dev": {
- "ext-curl": "*",
- "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
- "psr/log": "^1.0"
- },
- "suggest": {
- "psr/log": "Required for using the Log middleware"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "6.3-dev"
- }
- },
- "autoload": {
- "files": [
- "src/functions_include.php"
- ],
- "psr-4": {
- "GuzzleHttp\\": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
- }
- ],
- "description": "Guzzle is a PHP HTTP client library",
- "homepage": "http://guzzlephp.org/",
- "keywords": [
- "client",
- "curl",
- "framework",
- "http",
- "http client",
- "rest",
- "web service"
- ],
- "time": "2018-04-22T15:46:56+00:00"
- },
- {
- "name": "guzzlehttp/promises",
- "version": "v1.3.1",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/promises.git",
- "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
- "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.0"
- },
- "require-dev": {
- "phpunit/phpunit": "^4.0"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.4-dev"
- }
- },
- "autoload": {
- "psr-4": {
- "GuzzleHttp\\Promise\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
- }
- ],
- "description": "Guzzle promises library",
- "keywords": [
- "promise"
- ],
- "time": "2016-12-20T10:07:11+00:00"
- },
- {
- "name": "guzzlehttp/psr7",
- "version": "1.4.2",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/psr7.git",
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
- "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.4.0",
- "psr/http-message": "~1.0"
- },
- "provide": {
- "psr/http-message-implementation": "1.0"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "type": "library",
- "extra": {