initial commit, log in to masto
This commit is contained in:
commit
f4eb471d79
|
@ -0,0 +1 @@
|
|||
state.json
|
|
@ -0,0 +1,8 @@
|
|||
# lobstertoot
|
||||
|
||||
## making it work
|
||||
```sh
|
||||
cpanm --installdeps . # get dependencies
|
||||
perl auth.pl > state.json # write config file
|
||||
perl lobstertoot.pl # run the thing, put it in crontab, whatever
|
||||
```
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env perl
|
||||
use 5.010;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Mastodon::Client;
|
||||
use YAML::Tiny;
|
||||
use IO::Prompt;
|
||||
use JSON::Tiny qw/encode_json/;
|
||||
|
||||
my $inst = prompt("Instance hostname (e.g. mastodon.social): ")->{value};
|
||||
|
||||
my $masto = new Mastodon::Client (
|
||||
instance => $inst,
|
||||
name => "lobstertoot",
|
||||
website => "https://git.fuwafuwa.moe/albino/lobstertoot",
|
||||
scopes => ["write"],
|
||||
coerce_entities => 1,
|
||||
);
|
||||
|
||||
$masto->register();
|
||||
|
||||
say STDERR "Authorize your mastodon account at " . $masto->authorization_url . " and enter the access code here.";
|
||||
my $acode = prompt("Access code: ")->{value};
|
||||
|
||||
$masto->authorize(
|
||||
access_code => $acode,
|
||||
);
|
||||
|
||||
say encode_json(
|
||||
{
|
||||
masto => {
|
||||
client_id => $masto->client_id,
|
||||
client_secret => $masto->client_secret,
|
||||
access_token => $masto->access_token,
|
||||
},
|
||||
lobsters => {
|
||||
url => "https://lobste.rs",
|
||||
},
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue