[COMPONENT][FreeNetwork] Iterate documentation
This commit is contained in:
parent
778cb57d83
commit
9506909e7a
@ -61,6 +61,9 @@ class Webfinger extends XrdController
|
|||||||
return parent::handle($request);
|
return parent::handle($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures $this->xrd which will later be printed.
|
||||||
|
*/
|
||||||
protected function setXRD()
|
protected function setXRD()
|
||||||
{
|
{
|
||||||
$this->xrd->subject = $this->resource;
|
$this->xrd->subject = $this->resource;
|
||||||
|
@ -25,6 +25,12 @@ use App\Core\Event;
|
|||||||
use App\Core\GSFile;
|
use App\Core\GSFile;
|
||||||
use App\Core\HTTPClient;
|
use App\Core\HTTPClient;
|
||||||
use App\Entity\Activity;
|
use App\Entity\Activity;
|
||||||
|
use App\Util\Exception\NicknameEmptyException;
|
||||||
|
use App\Util\Exception\NicknameException;
|
||||||
|
use App\Util\Exception\NicknameInvalidException;
|
||||||
|
use App\Util\Exception\NicknameNotAllowedException;
|
||||||
|
use App\Util\Exception\NicknameTakenException;
|
||||||
|
use App\Util\Exception\NicknameTooLongException;
|
||||||
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
use Plugin\ActivityPub\Entity\ActivitypubActor;
|
||||||
use XML_XRD;
|
use XML_XRD;
|
||||||
use function App\Core\I18n\_m;
|
use function App\Core\I18n\_m;
|
||||||
@ -49,7 +55,7 @@ use Component\FreeNetwork\Util\WebfingerResource\WebfingerResourceActor;
|
|||||||
use Component\FreeNetwork\Util\WebfingerResource\WebfingerResourceNote;
|
use Component\FreeNetwork\Util\WebfingerResource\WebfingerResourceNote;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Plugin\ActivityPub\Entity\ActivitypubActivity;
|
use Plugin\ActivityPub\Entity\ActivitypubActivity;
|
||||||
use Plugin\ActivityPub\Util\Response\TypeResponse;
|
use Plugin\ActivityPub\Util\TypeResponse;
|
||||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use XML_XRD_Element_Link;
|
use XML_XRD_Element_Link;
|
||||||
@ -107,7 +113,23 @@ class FreeNetwork extends Component
|
|||||||
return Event::stop;
|
return Event::stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onEndGetWebFingerResource($resource, ?WebfingerResource &$target = null, array $args = [])
|
/**
|
||||||
|
* Last attempts getting a WebFingerResource object
|
||||||
|
*
|
||||||
|
* @param string $resource String that contains the requested URI
|
||||||
|
* @param WebfingerResource|null $target WebFingerResource extended object goes here
|
||||||
|
* @param array $args Array which may contains arguments such as 'rel' filtering values
|
||||||
|
* @return bool
|
||||||
|
* @throws NoSuchActorException
|
||||||
|
* @throws ServerException
|
||||||
|
* @throws NicknameEmptyException
|
||||||
|
* @throws NicknameException
|
||||||
|
* @throws NicknameInvalidException
|
||||||
|
* @throws NicknameNotAllowedException
|
||||||
|
* @throws NicknameTakenException
|
||||||
|
* @throws NicknameTooLongException
|
||||||
|
*/
|
||||||
|
public function onEndGetWebFingerResource(string $resource, ?WebfingerResource &$target = null, array $args = []): bool
|
||||||
{
|
{
|
||||||
// * Either we didn't find the profile, then we want to make
|
// * Either we didn't find the profile, then we want to make
|
||||||
// the $profile variable null for clarity.
|
// the $profile variable null for clarity.
|
||||||
|
@ -204,7 +204,7 @@ class Discovery
|
|||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isAcct($uri): bool
|
public static function isAcct(string $uri): bool
|
||||||
{
|
{
|
||||||
return mb_strtolower(mb_substr($uri, 0, 5)) == 'acct:';
|
return mb_strtolower(mb_substr($uri, 0, 5)) == 'acct:';
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,12 @@ abstract class WebfingerResource
|
|||||||
return $this->object;
|
return $this->object;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAliases()
|
/**
|
||||||
|
* List of alternative IDs of a certain Actor
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAliases(): array
|
||||||
{
|
{
|
||||||
$aliases = $this->object->getAliasesWithIDs();
|
$aliases = $this->object->getAliasesWithIDs();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class WebfingerResourceActor extends WebFingerResource
|
|||||||
parent::__construct($object);
|
parent::__construct($object);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAliases()
|
public function getAliases(): array
|
||||||
{
|
{
|
||||||
$aliases = [];
|
$aliases = [];
|
||||||
|
|
||||||
@ -46,6 +46,12 @@ class WebfingerResourceActor extends WebFingerResource
|
|||||||
return array_merge($aliases, parent::getAliases());
|
return array_merge($aliases, parent::getAliases());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reconstruct WebFinger acct: from object
|
||||||
|
*
|
||||||
|
* @return array|false|mixed|string|string[]|null
|
||||||
|
* @throws WebfingerReconstructionException
|
||||||
|
*/
|
||||||
public function reconstructAcct()
|
public function reconstructAcct()
|
||||||
{
|
{
|
||||||
$acct = null;
|
$acct = null;
|
||||||
|
@ -28,6 +28,11 @@ class WebfingerResourceNote extends WebfingerResource
|
|||||||
parent::__construct($object);
|
parent::__construct($object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update given XRD with self's data
|
||||||
|
*
|
||||||
|
* @param XML_XRD $xrd
|
||||||
|
*/
|
||||||
public function updateXRD(XML_XRD $xrd)
|
public function updateXRD(XML_XRD $xrd)
|
||||||
{
|
{
|
||||||
if (Event::handle('StartWebFingerNoticeLinks', [$xrd, $this->object])) {
|
if (Event::handle('StartWebFingerNoticeLinks', [$xrd, $this->object])) {
|
||||||
|
@ -42,6 +42,15 @@ class Notification extends Component
|
|||||||
return Event::next;
|
return Event::next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bring given Activity to Targets's attention
|
||||||
|
*
|
||||||
|
* @param Actor $sender
|
||||||
|
* @param Activity $activity
|
||||||
|
* @param array $targets
|
||||||
|
* @param string|null $reason
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function notify(Actor $sender, Activity $activity, array $targets, ?string $reason = null): bool
|
public function notify(Actor $sender, Activity $activity, array $targets, ?string $reason = null): bool
|
||||||
{
|
{
|
||||||
$remote_targets = [];
|
$remote_targets = [];
|
||||||
|
Loading…
Reference in New Issue
Block a user