MightyNetwork :: Plugin :: Helpers (source, CPAN)

CONTENTS

NAME

MightyNetwork::Plugin::Helpers - Provides helpers for MightyNetwork

METHODS

MightyNetwork::Plugin::Helpers inherits all methods from Mojolicious::Plugin and implements the following new ones.

dbi()

Returns a Mojo::Pg object to allow database querying.

Uses Mojolicious::Plugin::PgURLHelper.

my $dbi = $c->dbi;

wf_url($host, $account)

Returns the string of the WebFinger URL for searching $account on $host.

my $wf_url = $c->wf_url('framapiaf.org', 'framasky@framapiaf.org');

generate_uuid()

Returns an UUID by querying the PostgreSQL database.

my $uuid = $c->generate_uuid;

get_actor_url($url)

Fetches the URL of an ActivityPub actor (see MightyNetwork::DB::ActivityPub::Actor) from a WebFinger URL.

Returns an hash table:

{ actor_url => $actor_url, errors => \@errors }

$actor_url is the ActivityPub URL of the actor.

\@errors is an array reference containing encountered errors.

my $wf_url = $c->wf_url('framapiaf.org', 'framasky@framapiaf.org');
my $hash = $c->get_actor_url($wf_url);

get_actor_from_url($host, $username, $url)

Fetches ActivityPub actor (see MightyNetwork::DB::ActivityPub::Actor) informations.

Uses get_actor_url under the hood.

Returns an hash table:

{ actor => $actor, errors => \@errors }

$actor is a MightyNetwork::DB::ActivityPub::Actor object.

\@errors is an array reference containing encountered errors.

my $wf_url = $c->wf_url('framapiaf.org', 'framasky@framapiaf.org');
my $hash = $c->get_actor_from_url('framapiaf.org', 'framasky', $wf_url);

SEE ALSO

MightyNetwork, MightyNetwork::Plugin, Mojolicious::Plugin, Mojo::Pg, Mojolicious::Plugin::PgURLHelper, MightyNetwork::DB::ActivityPub::Actor