summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--l10n/bg.js49
-rw-r--r--l10n/bg.json47
-rw-r--r--l10n/cs.js2
-rw-r--r--l10n/cs.json2
-rw-r--r--l10n/eu.js18
-rw-r--r--l10n/eu.json16
-rw-r--r--l10n/hu.js26
-rw-r--r--l10n/hu.json24
-rw-r--r--lib/Controller/ActivityPubController.php35
-rw-r--r--lib/Interfaces/Activity/DeleteInterface.php23
-rw-r--r--lib/Interfaces/Actor/PersonInterface.php15
-rw-r--r--lib/Interfaces/IActivityPubInterface.php3
-rw-r--r--lib/Interfaces/Object/NoteInterface.php16
-rw-r--r--lib/Migration/Version0001Date20181219000002.php4
-rw-r--r--lib/Migration/Version0001Date20181219000004.php2
-rw-r--r--lib/Service/ActivityService.php5
-rw-r--r--lib/Service/SignatureService.php8
-rw-r--r--lib/webfinger.php11
-rw-r--r--package-lock.json30
-rw-r--r--package.json4
20 files changed, 285 insertions, 55 deletions
diff --git a/l10n/bg.js b/l10n/bg.js
new file mode 100644
index 00000000..5fd2060f
--- /dev/null
+++ b/l10n/bg.js
@@ -0,0 +1,49 @@
+OC.L10N.register(
+ "social",
+ {
+ "Social" : "Social",
+ "🎉 Nextcloud becomes part of the federated social networks!" : "🎉 Nextcloud е вече част от федерираните социални мрежи!",
+ "** Disclaimer: this is an ALPHA version **\n\n**🎉 Nextcloud becomes part of the federated social networks!**\n\n**🙋 Find your friends:** No matter if they use Nextcloud, 🐘 Mastodon, 🇫 Friendica, and soon ✱ Diaspora, 👹 MediaGoblin and more – you can follow them!\n\n**📜 Profile info:** No need to fill out more profiles – your info from Nextcloud will be used and extended.\n\n**👐 Own your posts:** Everything you post stays on your Nextcloud!\n\n**🕸 Open standards:** We use the established ActivityPub standard!" : "** Внимание: това е ALPHA версия **\n\n**🎉 Nextcloud става част от федерираните социални мрежи!**\n\n**🙋 Намери своите приятели:** Без значение дали те използват Nextcloud, 🐘 Mastodon, 🇫 Friendica, и скоро ✱ Diaspora, 👹 MediaGoblin и други – ти ще можеш да ги последваш !\n\n**📜 Профилна информация :** Не е нужно да регистрираш още профили – информацията от твоят Nextcloud профил може да бъде използвана и допълнена.\n\n**👐 Бъди собственик на твоите публикации:** Всичко което публикуваш се съхранява в твоят Nextcloud!\n\n**🕸 Отворени стандарти:** Ние използвамем утвърденият стандарт ActivityPub!",
+ "Open documentation" : "Отвори документацията",
+ "Social app setup" : "Social инсталация на апликацията",
+ "ActivityPub requires a fixed URL to make entries unique. Note that this can not be changed later without resetting the Social app." : "ActivityPub изисква постояннен URL, за да може да генерира еднозначни имена. Ако желаете да промените постоянният URL е нужно след това да нулирате апликацията Social.",
+ "ActivityPub URL base" : "ActivityPub URL base",
+ "Finish setup" : "Завърши инсталацията.",
+ "The Social app needs to be set up by the server administrator." : "Апликацията Social е нужно да бъде инсталирана от администратора на сървъра.",
+ "Home" : "Начало",
+ "Direct messages" : "Директни съобщения",
+ "Profile" : "Профил",
+ "Local timeline" : "Локален таймлайн",
+ "Global timeline" : "Глобален таимлайн",
+ "Post publicly" : "Публикувай ",
+ "Post to followers" : "Публикувай за последователите ти",
+ "Post to recipients" : "Публикувах за получателите",
+ "Direct" : "Директно",
+ "Post to mentioned users only" : "Публикувай само към споменатите потребители",
+ "Followers" : "Последователи",
+ "Post to followers only" : "Публикувай само за последователите ти",
+ "Public" : "Публично",
+ "Unfollow" : "Не следвай",
+ "Following" : "Последователи",
+ "Follow" : "Последвай",
+ "posts" : "Публикации",
+ "following" : "последователи",
+ "followers" : "Последователи",
+ "No accounts found" : "Не е открит профил",
+ "Searching for" : "Търсене за",
+ "No posts found" : "Не са открити публикации",
+ "Posts from people you follow will show up here" : "Публикации от хора, които следваш ще откриеш тук",
+ "No direct messages found" : "Не са открите директни съобщения",
+ "Posts directed to you will show up here" : "Публикации директно за теб, ще бъдат публикувани тук.",
+ "No local posts found" : "Не са открите локални публикации",
+ "Posts from other people on this instance will show up here" : "Публикации от други хора на тази инстанция ще откриеш тук.",
+ "No global posts found" : "Не са открити глобални публикации",
+ "Posts from federated instances will show up here" : "Публикации от федерирани инстанции могат да бъдат открити тук",
+ "User not found" : "Потребителят не е открит",
+ "Sorry, we could not find the account of {userId}" : "Профилът на \"{userId}\" не може да бъде намерен",
+ "Nextcloud becomes part of the federated social networks!" : "Nextcloud е вече част от федерираните социални мрежи!",
+ "We automatically created a Social account for you. Your Social ID is the same as your federated cloud ID:" : "За вас създадохме, автоматично, социален профил. Вашият Social ID идентичен с Federated Cloud ID:",
+ "Since you are new to Social, start by following the official Nextcloud account so you don't miss any news" : "Понеже си нов потребител в Social, последвай официялният акаунт на Nextcloud account, за да не пропуснеш новини от развитието на проекта",
+ "Follow Nextcloud on mastodon.xyz" : "Следвайте Nextcloud в mastodon.xyz"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/l10n/bg.json b/l10n/bg.json
new file mode 100644
index 00000000..645c00e6
--- /dev/null
+++ b/l10n/bg.json
@@ -0,0 +1,47 @@
+{ "translations": {
+ "Social" : "Social",
+ "🎉 Nextcloud becomes part of the federated social networks!" : "🎉 Nextcloud е вече част от федерираните социални мрежи!",
+ "** Disclaimer: this is an ALPHA version **\n\n**🎉 Nextcloud becomes part of the federated social networks!**\n\n**🙋 Find your friends:** No matter if they use Nextcloud, 🐘 Mastodon, 🇫 Friendica, and soon ✱ Diaspora, 👹 MediaGoblin and more – you can follow them!\n\n**📜 Profile info:** No need to fill out more profiles – your info from Nextcloud will be used and extended.\n\n**👐 Own your posts:** Everything you post stays on your Nextcloud!\n\n**🕸 Open standards:** We use the established ActivityPub standard!" : "** Внимание: това е ALPHA версия **\n\n**🎉 Nextcloud става част от федерираните социални мрежи!**\n\n**🙋 Намери своите приятели:** Без значение дали те използват Nextcloud, 🐘 Mastodon, 🇫 Friendica, и скоро ✱ Diaspora, 👹 MediaGoblin и други – ти ще можеш да ги последваш !\n\n**📜 Профилна информация :** Не е нужно да регистрираш още профили – информацията от твоят Nextcloud профил може да бъде използвана и допълнена.\n\n**👐 Бъди собственик на твоите публикации:** Всичко което публикуваш се съхранява в твоят Nextcloud!\n\n**🕸 Отворени стандарти:** Ние използвамем утвърденият стандарт ActivityPub!",
+ "Open documentation" : "Отвори документацията",
+ "Social app setup" : "Social инсталация на апликацията",
+ "ActivityPub requires a fixed URL to make entries unique. Note that this can not be changed later without resetting the Social app." : "ActivityPub изисква постояннен URL, за да може да генерира еднозначни имена. Ако желаете да промените постоянният URL е нужно след това да нулирате апликацията Social.",
+ "ActivityPub URL base" : "ActivityPub URL base",
+ "Finish setup" : "Завърши инсталацията.",
+ "The Social app needs to be set up by the server administrator." : "Апликацията Social е нужно да бъде инсталирана от администратора на сървъра.",
+ "Home" : "Начало",
+ "Direct messages" : "Директни съобщения",
+ "Profile" : "Профил",
+ "Local timeline" : "Локален таймлайн",
+ "Global timeline" : "Глобален таимлайн",
+ "Post publicly" : "Публикувай ",
+ "Post to followers" : "Публикувай за последователите ти",
+ "Post to recipients" : "Публикувах за получателите",
+ "Direct" : "Директно",
+ "Post to mentioned users only" : "Публикувай само към споменатите потребители",
+ "Followers" : "Последователи",
+ "Post to followers only" : "Публикувай само за последователите ти",
+ "Public" : "Публично",
+ "Unfollow" : "Не следвай",
+ "Following" : "Последователи",
+ "Follow" : "Последвай",
+ "posts" : "Публикации",
+ "following" : "последователи",
+ "followers" : "Последователи",
+ "No accounts found" : "Не е открит профил",
+ "Searching for" : "Търсене за",
+ "No posts found" : "Не са открити публикации",
+ "Posts from people you follow will show up here" : "Публикации от хора, които следваш ще откриеш тук",
+ "No direct messages found" : "Не са открите директни съобщения",
+ "Posts directed to you will show up here" : "Публикации директно за теб, ще бъдат публикувани тук.",
+ "No local posts found" : "Не са открите локални публикации",
+ "Posts from other people on this instance will show up here" : "Публикации от други хора на тази инстанция ще откриеш тук.",
+ "No global posts found" : "Не са открити глобални публикации",
+ "Posts from federated instances will show up here" : "Публикации от федерирани инстанции могат да бъдат открити тук",
+ "User not found" : "Потребителят не е открит",
+ "Sorry, we could not find the account of {userId}" : "Профилът на \"{userId}\" не може да бъде намерен",
+ "Nextcloud becomes part of the federated social networks!" : "Nextcloud е вече част от федерираните социални мрежи!",
+ "We automatically created a Social account for you. Your Social ID is the same as your federated cloud ID:" : "За вас създадохме, автоматично, социален профил. Вашият Social ID идентичен с Federated Cloud ID:",
+ "Since you are new to Social, start by following the official Nextcloud account so you don't miss any news" : "Понеже си нов потребител в Social, последвай официялният акаунт на Nextcloud account, за да не пропуснеш новини от развитието на проекта",
+ "Follow Nextcloud on mastodon.xyz" : "Следвайте Nextcloud в mastodon.xyz"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/l10n/cs.js b/l10n/cs.js
index f2a13bc8..76a62af4 100644
--- a/l10n/cs.js
+++ b/l10n/cs.js
@@ -5,8 +5,10 @@ OC.L10N.register(
"🎉 Nextcloud becomes part of the federated social networks!" : "🎉 Nextcloud se stává součástí federovaných sociálních sítí!",
"** Disclaimer: this is an ALPHA version **\n\n**🎉 Nextcloud becomes part of the federated social networks!**\n\n**🙋 Find your friends:** No matter if they use Nextcloud, 🐘 Mastodon, 🇫 Friendica, and soon ✱ Diaspora, 👹 MediaGoblin and more – you can follow them!\n\n**📜 Profile info:** No need to fill out more profiles – your info from Nextcloud will be used and extended.\n\n**👐 Own your posts:** Everything you post stays on your Nextcloud!\n\n**🕸 Open standards:** We use the established ActivityPub standard!" : "** Odmítnutí odpovědnosti: toto je raná vývojová verze (alpha) **\n\n**🎉 Nextcloud se stává součástí federovaných sociálních sítí!**\n\n**🙋 Najděte své přátele:** Ať už používají Nextcloud, služby 🐘 Mastodon, 🇫 Friendica, a brzy ✱ Diaspora, 👹 MediaGoblin a další – můžete je následovat!\n\n**📜 Informace o profilu:** Není třeba vyplňovat více profilů – bude použit a rozšířen ten váš v Nextcloud.\n\n**👐 Vlastněte své příspěvky:** Vše co zveřejníte zůstane na vašem Nextcloud!\n\n**🕸 Otevřené standardy:** Je používán zavedený standard ActivityPub!",
".well-known/webfinger isn't properly set up!" : ".well-known/webfinger není nastaveno správně!",
+ "Social needs the .well-known automatic discovery to be properly set up. If Nextcloud is not installed in the root of the domain, it is often the case that Nextcloud can't configure this automatically. To use Social, the admin of this Nextcloud instance needs to manually configure the .well-known redirects: " : "Společenské potřebuje, aby bylo správně nastavené automatické objevování .well-known. Pokud Nextcloud není nainstalováno v kořeni domény, je častý případ, že toto nemůže nastavit automaticky. Pro použití Společenské, správce této instance Nextcloud potřebuje ručně nastavit přesměrování .well-known:",
"Open documentation" : "Otevřít dokumentaci",
"Social app setup" : "Nastavení aplikace Společenské",
+ "ActivityPub URL base" : "Základ URL adresy ActivityPub",
"Finish setup" : "Dokončit nastavení",
"The Social app needs to be set up by the server administrator." : "Je třeba, aby správce aplikaci Společenské nejprve nastavil.",
"Home" : "Domů",
diff --git a/l10n/cs.json b/l10n/cs.json
index 211391c8..bc1cda3a 100644
--- a/l10n/cs.json
+++ b/l10n/cs.json
@@ -3,8 +3,10 @@
"🎉 Nextcloud becomes part of the federated social networks!" : "🎉 Nextcloud se stává součástí federovaných sociálních sítí!",
"** Disclaimer: this is an ALPHA version **\n\n**🎉 Nextcloud becomes part of the federated social networks!**\n\n**🙋 Find your friends:** No matter if they use Nextcloud, 🐘 Mastodon, 🇫 Friendica, and soon ✱ Diaspora, 👹 MediaGoblin and more – you can follow them!\n\n**📜 Profile info:** No need to fill out more profiles – your info from Nextcloud will be used and extended.\n\n**👐 Own your posts:** Everything you post stays on your Nextcloud!\n\n**🕸 Open standards:** We use the established ActivityPub standard!" : "** Odmítnutí odpovědnosti: toto je raná vývojová verze (alpha) **\n\n**🎉 Nextcloud se stává součástí federovaných sociálních sítí!**\n\n**🙋 Najděte své přátele:** Ať už používají Nextcloud, služby 🐘 Mastodon, 🇫 Friendica, a brzy ✱ Diaspora, 👹 MediaGoblin a další – můžete je následovat!\n\n**📜 Informace o profilu:** Není třeba vyplňovat více profilů – bude použit a rozšířen ten váš v Nextcloud.\n\n**👐 Vlastněte své příspěvky:** Vše co zveřejníte zůstane na vašem Nextcloud!\n\n**🕸 Otevřené standardy:** Je používán zavedený standard ActivityPub!",
".well-known/webfinger isn't properly set up!" : ".well-known/webfinger není nastaveno správně!",
+ "Social needs the .well-known automatic discovery to be properly set up. If Nextcloud is not installed in the root of the domain, it is often the case that Nextcloud can't configure this automatically. To use Social, the admin of this Nextcloud instance needs to manually configure the .well-known redirects: " : "Společenské potřebuje, aby bylo správně nastavené automatické objevování .well-known. Pokud Nextcloud není nainstalováno v kořeni domény, je častý případ, že toto nemůže nastavit automaticky. Pro použití Společenské, správce této instance Nextcloud potřebuje ručně nastavit přesměrování .well-known:",
"Open documentation" : "Otevřít dokumentaci",
"Social app setup" : "Nastavení aplikace Společenské",
+ "ActivityPub URL base" : "Základ URL adresy ActivityPub",
"Finish setup" : "Dokončit nastavení",
"The Social app needs to be set up by the server administrator." : "Je třeba, aby správce aplikaci Společenské nejprve nastavil.",
"Home" : "Domů",
diff --git a/l10n/eu.js b/l10n/eu.js
new file mode 100644
index 00000000..13b38f2f
--- /dev/null
+++ b/l10n/eu.js
@@ -0,0 +1,18 @@
+OC.L10N.register(
+ "social",
+ {
+ "Open documentation" : "Ireki dokumentazioa",
+ "Finish setup" : "Amaitu ezarpena",
+ "Home" : "Hasiera",
+ "Direct messages" : "Mezu zuzenak",
+ "Profile" : "Profila",
+ "Direct" : "Zuzena",
+ "Followers" : "Jarraitzaileak",
+ "Public" : "Publikoa",
+ "Following" : "Jarraitzen",
+ "Follow" : "Jarraitu",
+ "following" : "jarraitzen",
+ "No accounts found" : "Ez da konturik aurkitu",
+ "User not found" : "Ez da erabiltzailea aurkitu"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/l10n/eu.json b/l10n/eu.json
new file mode 100644
index 00000000..87f0ca02
--- /dev/null
+++ b/l10n/eu.json
@@ -0,0 +1,16 @@
+{ "translations": {
+ "Open documentation" : "Ireki dokumentazioa",
+ "Finish setup" : "Amaitu ezarpena",
+ "Home" : "Hasiera",
+ "Direct messages" : "Mezu zuzenak",
+ "Profile" : "Profila",
+ "Direct" : "Zuzena",
+ "Followers" : "Jarraitzaileak",
+ "Public" : "Publikoa",
+ "Following" : "Jarraitzen",
+ "Follow" : "Jarraitu",
+ "following" : "jarraitzen",
+ "No accounts found" : "Ez da konturik aurkitu",
+ "User not found" : "Ez da erabiltzailea aurkitu"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/l10n/hu.js b/l10n/hu.js
new file mode 100644
index 00000000..314a2c72
--- /dev/null
+++ b/l10n/hu.js
@@ -0,0 +1,26 @@
+OC.L10N.register(
+ "social",
+ {
+ "Social" : "Közösségi",
+ "Open documentation" : "Dokumentáció megnyitása",
+ "Finish setup" : "Beállítások befejezése",
+ "Home" : "Kezdőlap",
+ "Direct messages" : "Közvetlen üzenetek",
+ "Profile" : "Profil",
+ "Local timeline" : "Helyi idővonal",
+ "Global timeline" : "Globális idővonal",
+ "Direct" : "Közvetlen",
+ "Unlisted" : "Titkos",
+ "Followers" : "Követők",
+ "Public" : "Nyilvános",
+ "Following" : "További",
+ "Follow" : "Követ",
+ "posts" : "Küldések",
+ "following" : "további",
+ "No accounts found" : "Nincsenek ilyen felhasználói fiókok",
+ "Searching for" : "Keress",
+ "No posts found" : "Nem található hozzászólás",
+ "No direct messages found" : "Nem található közvetlen üzenet",
+ "Follow Nextcloud on mastodon.xyz" : "Kövesd a Nextcloudot a mastodon.xyz-on"
+},
+"nplurals=2; plural=(n != 1);");
diff --git a/l10n/hu.json b/l10n/hu.json
new file mode 100644
index 00000000..b74720e0
--- /dev/null
+++ b/l10n/hu.json
@@ -0,0 +1,24 @@
+{ "translations": {
+ "Social" : "Közösségi",
+ "Open documentation" : "Dokumentáció megnyitása",
+ "Finish setup" : "Beállítások befejezése",
+ "Home" : "Kezdőlap",
+ "Direct messages" : "Közvetlen üzenetek",
+ "Profile" : "Profil",
+ "Local timeline" : "Helyi idővonal",
+ "Global timeline" : "Globális idővonal",
+ "Direct" : "Közvetlen",
+ "Unlisted" : "Titkos",
+ "Followers" : "Követők",
+ "Public" : "Nyilvános",
+ "Following" : "További",
+ "Follow" : "Követ",
+ "posts" : "Küldések",
+ "following" : "további",
+ "No accounts found" : "Nincsenek ilyen felhasználói fiókok",
+ "Searching for" : "Keress",
+ "No posts found" : "Nem található hozzászólás",
+ "No direct messages found" : "Nem található közvetlen üzenet",
+ "Follow Nextcloud on mastodon.xyz" : "Kövesd a Nextcloudot a mastodon.xyz-on"
+},"pluralForm" :"nplurals=2; plural=(n != 1);"
+} \ No newline at end of file
diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php
index 517b60cd..dd8b57bc 100644
--- a/lib/Controller/ActivityPubController.php
+++ b/lib/Controller/ActivityPubController.php
@@ -321,26 +321,33 @@ class ActivityPubController extends Controller {
* @return bool
*/
private function checkSourceActivityStreams(): bool {
+ $accepted = [
+ 'application/ld+json',
+ 'application/activity+json'
+ ];
- // uncomment this line to display the result that would be return to an ActivityPub service (TEST)
- // return true;
+ $accepts = explode(',', $this->request->getHeader('Accept'));
+ $accepts = array_map([$this, 'trimHeader'], $accepts);
- // TODO - cleaner to being able to parse:
- // - 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
- // - 'application/activity+json, application/ld+json'
- $accept = explode(',', $this->request->getHeader('Accept'));
- $accept = array_map('trim', $accept);
-
- if (in_array('application/ld+json', $accept)) {
- return true;
+ foreach ($accepts as $accept) {
+ if (in_array($accept, $accepted)) {
+ return true;
+ }
}
- if ($this->request->getHeader('Accept')
- === 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"') {
- return true;
+ return false;
+ }
+
+
+ private function trimHeader(string $header) {
+ $header = trim($header);
+
+ $pos = strpos($header, ';');
+ if ($pos === false) {
+ return $header;
}
- return false;
+ return substr($header, 0, $pos);
}
}
diff --git a/lib/Interfaces/Activity/DeleteInterface.php b/lib/Interfaces/Activity/DeleteInterface.php
index 0ce63141..ce963115 100644
--- a/lib/Interfaces/Activity/DeleteInterface.php
+++ b/lib/Interfaces/Activity/DeleteInterface.php
@@ -32,6 +32,7 @@ namespace OCA\Social\Interfaces\Activity;
use OCA\Social\AP;
+use OCA\Social\Exceptions\InvalidOriginException;
use OCA\Social\Exceptions\ItemNotFoundException;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Interfaces\IActivityPubInterface;
@@ -58,15 +59,29 @@ class DeleteInterface implements IActivityPubInterface {
/**
* @param ACore $item
*
- * @throws \OCA\Social\Exceptions\InvalidOriginException
+ * @throws InvalidOriginException
*/
public function processIncomingRequest(ACore $item) {
$item->checkOrigin($item->getId());
if (!$item->gotObject()) {
-// // TODO - manage objectId (in case object is missing) -> find the right object and delete it
-// if ($item->getObjectId() !== '') {
-// }
+
+ if ($item->getObjectId() !== '') {
+ $item->checkOrigin($item->getObjectId());
+
+ $types = ['Note', 'Person'];
+ foreach ($types as $type) {
+ try {
+ $interface = AP::$activityPub->getInterfaceForItem($type);
+ $object = $interface->getItemById($item->getObjectId());
+ $interface->delete($object);
+
+ return;
+ } catch (UnknownItemException $e) {
+ } catch (ItemNotFoundException $e) {
+ }
+ }
+ }
return;
}
diff --git a/lib/Interfaces/Actor/PersonInterface.php b/lib/Interfaces/Actor/PersonInterface.php
index 5585ebdc..9dfe83cd 100644
--- a/lib/Interfaces/Actor/PersonInterface.php
+++ b/lib/Interfaces/Actor/PersonInterface.php
@@ -33,6 +33,8 @@ namespace OCA\Social\Interfaces\Actor;
use daita\MySmallPhpTools\Traits\TArrayTools;
use OCA\Social\Db\CacheActorsRequest;
+use OCA\Social\Exceptions\CacheActorDoesNotExistException;
+use OCA\Social\Exceptions\InvalidOriginException;
use OCA\Social\Exceptions\ItemNotFoundException;
use OCA\Social\Interfaces\IActivityPubInterface;
use OCA\Social\Model\ActivityPub\ACore;
@@ -107,7 +109,11 @@ class PersonInterface implements IActivityPubInterface {
* @throws ItemNotFoundException
*/
public function getItemById(string $id): ACore {
- throw new ItemNotFoundException();
+ try {
+ return $this->cacheActorsRequest->getFromId($id);
+ } catch (CacheActorDoesNotExistException $e) {
+ throw new ItemNotFoundException();
+ }
}
@@ -134,9 +140,16 @@ class PersonInterface implements IActivityPubInterface {
/**
* @param ACore $item
+ *
+ * @throws InvalidOriginException
*/
public function delete(ACore $item) {
+ $item->checkOrigin(($item->getId()));
+
+ /** @var Person $item */
+ $this->cacheActorsRequest->deleteFromId($item->getId());
}
+
}
diff --git a/lib/Interfaces/IActivityPubInterface.php b/lib/Interfaces/IActivityPubInterface.php
index c1599dbd..d0dcc4c1 100644
--- a/lib/Interfaces/IActivityPubInterface.php
+++ b/lib/Interfaces/IActivityPubInterface.php
@@ -31,6 +31,7 @@ declare(strict_types=1);
namespace OCA\Social\Interfaces;
+use OCA\Social\Exceptions\ItemNotFoundException;
use OCA\Social\Model\ActivityPub\ACore;
@@ -61,7 +62,7 @@ interface IActivityPubInterface {
/**
* @param string $id
*
- * @throw ItemNotFoundException
+ * @throws ItemNotFoundException
* @return ACore
*/
public function getItemById(string $id): ACore;
diff --git a/lib/Interfaces/Object/NoteInterface.php b/lib/Interfaces/Object/NoteInterface.php
index 6abf1f43..7c4b7ae7 100644
--- a/lib/Interfaces/Object/NoteInterface.php
+++ b/lib/Interfaces/Object/NoteInterface.php
@@ -101,7 +101,11 @@ class NoteInterface implements IActivityPubInterface {
* @throws ItemNotFoundException
*/
public function getItemById(string $id): ACore {
- throw new ItemNotFoundException();
+ try {
+ return $this->notesRequest->getNoteById($id);
+ } catch (NoteNotFoundException $e) {
+ throw new ItemNotFoundException();
+ }
}
@@ -134,20 +138,18 @@ class NoteInterface implements IActivityPubInterface {
$this->save($item);
}
- if ($activity->getType() === Update::TYPE) {
- $activity->checkOrigin($item->getId());
- $activity->checkOrigin($item->getAttributedTo());
- // TODO - check time and update.
-// $this->save($item);
- }
}
/**
* @param ACore $item
+ *
+ * @throws InvalidOriginException
*/
public function delete(ACore $item) {
+ $item->checkOrigin(($item->getId()));
+
/** @var Note $item */
$this->notesRequest->deleteNoteById($item->getId());
}
diff --git a/lib/Migration/Version0001Date20181219000002.php b/lib/Migration/Version0001Date20181219000002.php
index 182a12cd..949c5171 100644
--- a/lib/Migration/Version0001Date20181219000002.php
+++ b/lib/Migration/Version0001Date20181219000002.php
@@ -32,12 +32,8 @@ namespace OCA\Social\Migration;
use Closure;
-use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\SchemaException;
-use Doctrine\DBAL\Types\Type;
-use OCA\Social\Db\CoreRequestBuilder;
use OCP\DB\ISchemaWrapper;
-use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
diff --git a/lib/Migration/Version0001Date20181219000004.php b/lib/Migration/Version0001Date20181219000004.php
index 5af222a6..6d68343f 100644
--- a/lib/Migration/Version0001Date20181219000004.php
+++ b/lib/Migration/Version0001Date20181219000004.php
@@ -34,9 +34,7 @@ namespace OCA\Social\Migration;
use Closure;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\SchemaException;
-use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
-use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
diff --git a/lib/Service/ActivityService.php b/lib/Service/ActivityService.php
index bbf745d1..3ee7efcd 100644
--- a/lib/Service/ActivityService.php
+++ b/lib/Service/ActivityService.php
@@ -228,7 +228,10 @@ class ActivityService {
return '';
}
- $this->curlService->asyncWithToken($token);
+ $requests = $this->queueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY);
+ if (sizeof($requests) > 0) {
+ $this->curlService->asyncWithToken($token);
+ }
return $token;
}
diff --git a/lib/Service/SignatureService.php b/lib/Service/SignatureService.php
index 6a99c2f2..2b693b1b 100644
--- a/lib/Service/SignatureService.php
+++ b/lib/Service/SignatureService.php
@@ -293,6 +293,7 @@ class SignatureService {
* @param IRequest $request
*
* @return string
+ * @throws SocialAppConfigException
*/
private function generateEstimatedSignature(string $headers, IRequest $request): string {
$keys = explode(' ', $headers);
@@ -310,7 +311,12 @@ class SignatureService {
continue;
}
- $estimated .= "\n" . $key . ': ' . $request->getHeader($key);
+ $value = $request->getHeader($key);
+ if ($key === 'host') {
+ $value = $this->configService->getCloudAddress(true);
+ }
+
+ $estimated .= "\n" . $key . ': ' . $value;
}
return $estimated;
diff --git a/lib/webfinger.php b/lib/webfinger.php
index 0734d7c6..70a6f0fc 100644
--- a/lib/webfinger.php
+++ b/lib/webfinger.php
@@ -61,15 +61,20 @@ try {
exit;
}
+$href =
+ $urlGenerator->linkToRouteAbsolute('social.ActivityPub.actorAlias', ['username' =>