App-ActivityPubClient
view release on metacpan or search on metacpan
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
"Exporter" : "0",
"Getopt::Std" : "0",
"HTTP::Request::Common" : "0",
"JSON" : "0",
"LWP::UserAgent" : "0",
"MIME::Base64" : "0",
"Scalar::Util" : "0"
}
},
"test" : {
"requires" : {
"Test::More" : "0",
"Test::Output" : "0"
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: App-ActivityPubClient
no_index:
directory:
- t
- inc
requires:
Exporter: '0'
Getopt::Std: '0'
HTTP::Request::Common: '0'
JSON: '0'
LWP::UserAgent: '0'
MIME::Base64: '0'
Scalar::Util: '0'
resources:
repository: https://hacktivis.me/git/ap-client.git/
version: v0.1.4
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
Makefile.PL view on Meta::CPAN
EXE_FILES =>
[ 'script/ap-fetch', 'script/ap-represent', 'script/ap-backup' ],
MAN1PODS => {
'script/ap-fetch' => 'blib/man1/ap-fetch.1',
'script/ap-represent' => 'blib/man1/ap-represent.1',
'script/ap-backup' => 'blib/man1/ap-backup.1',
},
PREREQ_PM => {
'Exporter' => 0,
'Getopt::Std' => 0,
'HTTP::Request::Common' => 0,
'JSON' => 0,
'LWP::UserAgent' => 0,
'MIME::Base64' => 0,
'Scalar::Util' => 0,
},
TEST_REQUIRES => {
'Test::More' => 0,
'Test::Output' => 0,
},
META_MERGE => {
script/ap-backup view on Meta::CPAN
open(my $fh, '>', $filename) or die "couldn't open", $filename;
print $fh encode_json($item);
close $fh;
}
}
sub apc2s_backup {
my ($url) = @_;
my $req = HTTP::Request->new(GET => $url);
$req->header('Accept' => 'application/activity+json');
$req->header('Authorization' => $auth);
my $res = $ua->request($req);
if ($res->is_success) {
print "Got $url\n";
my $content_type = $res->header("Content-Type");
my $content_match = /application\/([^+]*+)?json(; .*)?/;
if ($content_type =~ $content_match) {
script/ap-fetch view on Meta::CPAN
# AP-Client: CLI-based client / toolbox for ActivityPub
# Copyright © 2020-2023 AP-Client Authors <https://hacktivis.me/git/ap-client/>
# SPDX-License-Identifier: BSD-3-Clause
use strict;
use utf8;
use open ":std", ":encoding(UTF-8)";
our $VERSION = 'v0.1.4';
use Getopt::Std;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
use App::ActivityPubClient qw(print_object);
=head1 NAME
ap-fetch - Fetch ActivityStream object, optionally pretty printing it
=head1 SYNOPSIS
B<ap-fetch> [-r|-j|-u <user:pass>] <URI>
script/ap-fetch view on Meta::CPAN
print "usage: ap-fetch.pl [-r|-j|-u user:pass] <url>\n";
print " -j Pipe into jq(1)\n";
print " -r Raw output\n";
print " -u user:pass HTTP Basic Auth credentials\n";
print
"By default, when -j and -r are absent it pipes the data into ap-represent.pl.\n";
exit 1;
}
$ua->agent("AP-Client fetch <https://hacktivis.me/git/ap-client/>");
my $req = HTTP::Request->new(GET => $ARGV[0]);
$req->header('Accept' => 'application/activity+json');
if (defined $options{u}) {
my ($user, $password) = split(/:/, $options{u});
$req->authorization_basic($user, $password);
}
my $res = $ua->request($req);
if ($res->is_success) {
script/webfinger view on Meta::CPAN
#!/usr/bin/env perl
# AP-Client: CLI-based client / toolbox for ActivityPub
# Copyright © 2020-2023 AP-Client Authors <https://hacktivis.me/git/ap-client/>
# SPDX-License-Identifier: BSD-3-Clause
use strict;
use utf8;
our $VERSION = 'v0.1.4';
use LWP::UserAgent;
use HTTP::Request::Common;
=head1 NAME
webfinger - Fetch account over WebFinger
=head1 SYNOPSIS
B<webfinger> <user@host>
=cut
script/webfinger view on Meta::CPAN
$ua->agent("AP-Client fetch <https://hacktivis.me/git/ap-client/>");
if ($#ARGV != 0) {
print "usage: webfinger <user\@host>\n";
exit 1;
}
my ($user, $host) = ($ARGV[0] =~ m/^@?([^@]+)@([^@]+)$/)
or die 'Error: "' . $ARGV[0] . q{" Doesn't matches user@host};
my $req = HTTP::Request->new(
GET => "https://$host/.well-known/webfinger?resource=acct:$user\@$host");
$req->header('Accept' => 'application/json,application/xml');
my $res = $ua->request($req);
if ($res->is_success) {
print $res->content;
} else {
print STDERR "Got ", $res->status_line, " instead of 2xx\n";
exit 1;
( run in 1.133 second using v1.01-cache-2.11-cpan-de7293f3b23 )