summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--appinfo/routes.php76
-rw-r--r--lib/Migration/Version0002Date20190506000001.php68
-rw-r--r--lib/Service/CurlService.php2
-rw-r--r--package-lock.json38
-rw-r--r--package.json2
5 files changed, 125 insertions, 61 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 620d46c0..0b323cc3 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -37,65 +37,65 @@ use OCA\Social\Service\CurlService;
return [
'routes' => [
['name' => 'Navigation#navigate', 'url' => '/', 'verb' => 'GET'],
- ['name' => 'Navigation#test', 'url' => '/test', 'verb' => 'GET'],
+ ['name' => 'Navigation#test', 'url' => '/test/', 'verb' => 'GET'],
[
- 'name' => 'Navigation#timeline', 'url' => '/timeline/{path}', 'verb' => 'GET',
+ 'name' => 'Navigation#timeline', 'url' => '/timeline/{path}/', 'verb' => 'GET',
'requirements' => ['path' => '.+'],
'defaults' => ['path' => '']
],
- ['name' => 'Navigation#documentGet', 'url' => '/document/get', 'verb' => 'GET'],
- ['name' => 'Navigation#documentGetPublic', 'url' => '/document/public', 'verb' => 'GET'],
+ ['name' => 'Navigation#documentGet', 'url' => '/document/get/', 'verb' => 'GET'],
+ ['name' => 'Navigation#documentGetPublic', 'url' => '/document/public/', 'verb' => 'GET'],
- ['name' => 'ActivityPub#actor', 'url' => '/users/{username}', 'verb' => 'GET'],
+ ['name' => 'ActivityPub#actor', 'url' => '/users/{username}/', 'verb' => 'GET'],
['name' => 'ActivityPub#actorAlias', 'url' => '/@{username}/', 'verb' => 'GET'],
- ['name' => 'ActivityPub#inbox', 'url' => '/@{username}/inbox', 'verb' => 'POST'],
- ['name' => 'ActivityPub#sharedInbox', 'url' => '/inbox', 'verb' => 'POST'],
- ['name' => 'ActivityPub#outbox', 'url' => '/@{username}/outbox', 'verb' => 'POST'],
- ['name' => 'ActivityPub#followers', 'url' => '/@{username}/followers', 'verb' => 'GET'],
- ['name' => 'ActivityPub#following', 'url' => '/@{username}/following', 'verb' => 'GET'],
+ ['name' => 'ActivityPub#inbox', 'url' => '/@{username}/inbox/', 'verb' => 'POST'],
+ ['name' => 'ActivityPub#sharedInbox', 'url' => '/inbox/', 'verb' => 'POST'],
+ ['name' => 'ActivityPub#outbox', 'url' => '/@{username}/outbox/', 'verb' => 'POST'],
+ ['name' => 'ActivityPub#followers', 'url' => '/@{username}/followers/', 'verb' => 'GET'],
+ ['name' => 'ActivityPub#following', 'url' => '/@{username}/following/', 'verb' => 'GET'],
- ['name' => 'OStatus#subscribe', 'url' => '/ostatus/follow/{uri}', 'verb' => 'GET'],
- ['name' => 'OStatus#followRemote', 'url' => '/api/v1/ostatus/followRemote/{local}', 'verb' => 'GET'],
- ['name' => 'OStatus#getLink', 'url' => '/api/v1/ostatus/link/{local}/{account}', 'verb' => 'GET'],
+ ['name' => 'OStatus#subscribe', 'url' => '/ostatus/follow/{uri}/', 'verb' => 'GET'],
+ ['name' => 'OStatus#followRemote', 'url' => '/api/v1/ostatus/followRemote/{local}/', 'verb' => 'GET'],
+ ['name' => 'OStatus#getLink', 'url' => '/api/v1/ostatus/link/{local}/{account}/', 'verb' => 'GET'],
- ['name' => 'SocialPub#displayPost', 'url' => '/@{username}/{postId}', 'verb' => 'GET'],
+ ['name' => 'SocialPub#displayPost', 'url' => '/@{username}/{postId}/', 'verb' => 'GET'],
- ['name' => 'Local#streamHome', 'url' => '/api/v1/stream/home', 'verb' => 'GET'],
- ['name' => 'Local#streamNotifications', 'url' => '/api/v1/stream/notifications', 'verb' => 'GET'],
- ['name' => 'Local#streamTimeline', 'url' => '/api/v1/stream/timeline', 'verb' => 'GET'],
+ ['name' => 'Local#streamHome', 'url' => '/api/v1/stream/home/', 'verb' => 'GET'],
+ ['name' => 'Local#streamNotifications', 'url' => '/api/v1/stream/notifications/', 'verb' => 'GET'],
+ ['name' => 'Local#streamTimeline', 'url' => '/api/v1/stream/timeline/', 'verb' => 'GET'],
['name' => 'Local#streamTag', 'url' => '/api/v1/stream/tag/{hashtag}/', 'verb' => 'GET'],
- ['name' => 'Local#streamFederated', 'url' => '/api/v1/stream/federated', 'verb' => 'GET'],
- ['name' => 'Local#streamDirect', 'url' => '/api/v1/stream/direct', 'verb' => 'GET'],
- ['name' => 'Local#streamAccount', 'url' => '/api/v1/account/{username}/stream', 'verb' => 'GET'],
+ ['name' => 'Local#streamFederated', 'url' => '/api/v1/stream/federated/', 'verb' => 'GET'],
+ ['name' => 'Local#streamDirect', 'url' => '/api/v1/stream/direct/', 'verb' => 'GET'],
+ ['name' => 'Local#streamAccount', 'url' => '/api/v1/account/{username}/stream/', 'verb' => 'GET'],
- ['name' => 'Local#postCreate', 'url' => '/api/v1/post', 'verb' => 'POST'],
- ['name' => 'Local#postDelete', 'url' => '/api/v1/post', 'verb' => 'DELETE'],
+ ['name' => 'Local#postCreate', 'url' => '/api/v1/post/', 'verb' => 'POST'],
+ ['name' => 'Local#postDelete', 'url' => '/api/v1/post/', 'verb' => 'DELETE'],
- ['name' => 'Local#postBoost', 'url' => '/api/v1/post/boost', 'verb' => 'POST'],
- ['name' => 'Local#postUnboost', 'url' => '/api/v1/post/boost', 'verb' => 'DELETE'],
+ ['name' => 'Local#postBoost', 'url' => '/api/v1/post/boost/', 'verb' => 'POST'],
+ ['name' => 'Local#postUnboost', 'url' => '/api/v1/post/boost/', 'verb' => 'DELETE'],
- ['name' => 'Local#actionFollow', 'url' => '/api/v1/current/follow', 'verb' => 'PUT'],
- ['name' => 'Local#actionUnfollow', 'url' => '/api/v1/current/follow', 'verb' => 'DELETE'],
+ ['name' => 'Local#actionFollow', 'url' => '/api/v1/current/follow/', 'verb' => 'PUT'],
+ ['name' => 'Local#actionUnfollow', 'url' => '/api/v1/current/follow/', 'verb' => 'DELETE'],
- ['name' => 'Local#currentInfo', 'url' => '/api/v1/current/info', 'verb' => 'GET'],
- ['name' => 'Local#currentFollowers', 'url' => '/api/v1/current/followers', 'verb' => 'GET'],
- ['name' => 'Local#currentFollowing', 'url' => '/api/v1/current/following', 'verb' => 'GET'],
+ ['name' => 'Local#currentInfo', 'url' => '/api/v1/current/info/', 'verb' => 'GET'],
+ ['name' => 'Local#currentFollowers', 'url' => '/api/v1/current/followers/', 'verb' => 'GET'],
+ ['name' => 'Local#currentFollowing', 'url' => '/api/v1/current/following/', 'verb' => 'GET'],
- ['name' => 'Local#accountInfo', 'url' => '/api/v1/account/{username}/info', 'verb' => 'GET'],
- ['name' => 'Local#accountFollowers', 'url' => '/api/v1/account/{username}/followers', 'verb' => 'GET'],
- ['name' => 'Local#accountFollowing', 'url' => '/api/v1/account/{username}/following', 'verb' => 'GET'],
+ ['name' => 'Local#accountInfo', 'url' => '/api/v1/account/{username}/info/', 'verb' => 'GET'],
+ ['name' => 'Local#accountFollowers', 'url' => '/api/v1/account/{username}/followers/', 'verb' => 'GET'],
+ ['name' => 'Local#accountFollowing', 'url' => '/api/v1/account/{username}/following/', 'verb' => 'GET'],
- ['name' => 'Local#globalAccountInfo', 'url' => '/api/v1/global/account/info', 'verb' => 'GET'],
- ['name' => 'Local#globalActorInfo', 'url' => '/api/v1/global/actor/info', 'verb' => 'GET'],
- ['name' => 'Local#globalActorAvatar', 'url' => '/api/v1/global/actor/avatar', 'verb' => 'GET'],
- ['name' => 'Local#globalAccountsSearch', 'url' => '/api/v1/global/accounts/search', 'verb' => 'GET'],
+ ['name' => 'Local#globalAccountInfo', 'url' => '/api/v1/global/account/info/', 'verb' => 'GET'],
+ ['name' => 'Local#globalActorInfo', 'url' => '/api/v1/global/actor/info/', 'verb' => 'GET'],
+ ['name' => 'Local#globalActorAvatar', 'url' => '/api/v1/global/actor/avatar/', 'verb' => 'GET'],
+ ['name' => 'Local#globalAccountsSearch', 'url' => '/api/v1/global/accounts/search/', 'verb' => 'GET'],
// ['name' => 'Local#documentsCache', 'url' => '/api/v1/documents/cache', 'verb' => 'POST'],
- ['name' => 'Local#search', 'url' => '/api/v1/search', 'verb' => 'GET'],
+ ['name' => 'Local#search', 'url' => '/api/v1/search/', 'verb' => 'GET'],
['name' => 'Queue#asyncForRequest', 'url' => CurlService::ASYNC_REQUEST_TOKEN, 'verb' => 'POST'],
- ['name' => 'Config#setCloudAddress', 'url' => '/api/v1/config/cloudAddress', 'verb' => 'POST']
+ ['name' => 'Config#setCloudAddress', 'url' => '/api/v1/config/cloudAddress/', 'verb' => 'POST']
]
];
diff --git a/lib/Migration/Version0002Date20190506000001.php b/lib/Migration/Version0002Date20190506000001.php
index bf32139f..296f7b74 100644
--- a/lib/Migration/Version0002Date20190506000001.php
+++ b/lib/Migration/Version0002Date20190506000001.php
@@ -32,8 +32,8 @@ namespace OCA\Social\Migration;
use Closure;
-use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use DateTime;
+use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Types\Type;
use Exception;
use OCA\Social\Db\CoreRequestBuilder;
@@ -94,6 +94,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
+ *
+ * @throws Exception
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
@@ -331,24 +333,21 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
]
);
$table->addColumn(
- 'to_array', 'string',
+ 'to_array', Type::TEXT,
[
- 'notnull' => true,
- 'length' => 1000,
+ 'notnull' => true
]
);
$table->addColumn(
- 'cc', 'string',
+ 'cc', Type::TEXT,
[
- 'notnull' => true,
- 'length' => 1000,
+ 'notnull' => true
]
);
$table->addColumn(
- 'bcc', 'string',
+ 'bcc', Type::TEXT,
[
- 'notnull' => true,
- 'length' => 1000,
+ 'notnull' => true
]
);
$table->addColumn(
@@ -589,15 +588,13 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
$table->addColumn(
'source', Type::TEXT,
[
- 'notnull' => true,
- 'length' => 3000,
+ 'notnull' => true
]
);
$table->addColumn(
- 'details', 'string',
+ 'details', Type::TEXT,
[
- 'notnull' => false,
- 'length' => 3000,
+ 'notnull' => false
]
);
$table->addColumn(
@@ -899,6 +896,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillActors(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -921,6 +920,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillFollows(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -940,6 +941,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillHashtags(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -980,6 +983,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillStreams(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -1014,6 +1019,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillCacheActors(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -1045,6 +1052,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillCacheDocuments(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -1070,6 +1079,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
/**
* @param ISchemaWrapper $schema
+ *
+ * @throws Exception
*/
private function fillRequestQueue(ISchemaWrapper $schema) {
$this->duplicateTable(
@@ -1089,6 +1100,11 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
}
+ /**
+ * @param ISchemaWrapper $schema
+ *
+ * @throws Exception
+ */
private function fillStreamActions(ISchemaWrapper $schema) {
$this->duplicateTable(
$schema, 'social_stream_actions', CoreRequestBuilder::TABLE_STREAM_ACTIONS,
@@ -1102,6 +1118,11 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
}
+ /**
+ * @param ISchemaWrapper $schema
+ *
+ * @throws Exception
+ */
private function fillStreamQueue(ISchemaWrapper $schema) {
$this->duplicateTable(
$schema, 'social_queue_stream', CoreRequestBuilder::TABLE_STREAM_QUEUE,
@@ -1161,6 +1182,8 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
* @param string $source
* @param string $dest
* @param array $fields
+ *
+ * @throws Exception
*/
private function duplicateTable(
ISchemaWrapper $schema, string $source, string $dest, array $fields
@@ -1200,6 +1223,13 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
'published_time'
];
+ $booleanFields = [
+ 'local',
+ 'public',
+ 'accepted',
+ 'hidden_on_timeline'
+ ];
+
foreach ($fields as $field) {
$value = $this->get($field, $data, '');
if ($field === 'id_prim'
@@ -1207,19 +1237,23 @@ class Version0002Date20190506000001 extends SimpleMigrationStep {
&& $this->get('id', $data, '') !== '') {
$value = hash('sha512', $this->get('id', $data, ''));
}
-
+
if (in_array($field, $datetimeFields) && $value === '') {
$insert->setValue(
$field,
$insert->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
);
+ } else if (in_array($field, $booleanFields) && $value === '') {
+ $insert->setValue(
+ $field, $insert->createNamedParameter('0')
+ );
} else {
$insert->setValue(
$field, $insert->createNamedParameter($value)
);
}
}
-
+
try {
$insert->execute();
} catch (UniqueConstraintViolationException $e) {
diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php
index 01eabb30..5be2ed40 100644
--- a/lib/Service/CurlService.php
+++ b/lib/Service/CurlService.php
@@ -58,7 +58,7 @@ class CurlService {
use TPathTools;
- const ASYNC_REQUEST_TOKEN = '/async/request/{token}';
+ const ASYNC_REQUEST_TOKEN = '/async/request/{token}/';
const USER_AGENT = 'Nextcloud Social';
diff --git a/package-lock.json b/package-lock.json
index c06cdaf8..ae1ccc54 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8200,13 +8200,13 @@
}
},
"nextcloud-vue": {
- "version": "0.11.3",
- "resolved": "https://registry.npmjs.org/nextcloud-vue/-/nextcloud-vue-0.11.3.tgz",
- "integrity": "sha512-lVih3gUuRZf5B82+XjLuiw3qp2tvAITF512mTyhHLtAzBWEiBfWsidMP10Nntql4zAEoLTZvLaQ1izFglMUDmw==",
+ "version": "0.11.4",
+ "resolved": "https://registry.npmjs.org/nextcloud-vue/-/nextcloud-vue-0.11.4.tgz",
+ "integrity": "sha512-jW4LPLxsOM609Zp+qCXfKJPniXuuxFLF+IbYLwnQXVIc2I4NzOgADeS+uug3cuS1nkW5kOtG45XVGYH/1d2ozw==",
"requires": {
"hammerjs": "^2.0.8",
"md5": "^2.2.1",
- "nextcloud-axios": "^0.1.3",
+ "nextcloud-axios": "^0.2.0",
"v-tooltip": "^2.0.0-rc.33",
"vue": "^2.6.7",
"vue-click-outside": "^1.0.7",
@@ -8215,6 +8215,36 @@
"vue2-datepicker": "^2.10.0"
},
"dependencies": {
+ "axios": {
+ "version": "0.19.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz",
+ "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==",
+ "requires": {
+ "follow-redirects": "1.5.10",
+ "is-buffer": "^2.0.2"
+ }
+ },
+ "follow-redirects": {
+ "version": "1.5.10",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
+ "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
+ "requires": {
+ "debug": "=3.1.0"
+ }
+ },
+ "is-buffer": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
+ "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
+ },
+ "nextcloud-axios": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/nextcloud-axios/-/nextcloud-axios-0.2.0.tgz",
+ "integrity": "sha512-OLDeZfub4pMkIKeXAPGqtFyV/xBbuOO5CSRgLvkT1O+HD4XZKP8+ywhbzXNBxA0ywLnMax3VsmPfQ7lvgy1m0w==",
+ "requires": {
+ "axios": "^0.19.0"
+ }
+ },
"v-tooltip": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-2.0.2.tgz",
diff --git a/package.json b/package.json
index 2b82a893..ade58f3a 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"dependencies": {
"linkifyjs": "^2.1.8",
"nextcloud-axios": "^0.1.3",
- "nextcloud-vue": "^0.11.3",
+ "nextcloud-vue": "^0.11.4",
"tributejs": "^3.7.1",
"twemoji": "^12.0.1",
"uuid": "^3.3.2",