mdom / txtnix

Decentralised, minimalist microblogging service for hackers
Other
15 stars 1 forks source link
twtxt

=pod

=for HTML

=for HTML Coverage Status

=head1 WARNING

This project is currently unmaintained. It seems to work fine for now but be warned. If you're looking for a maintained twtxt client take a look at L<txtnish|https://github.com/mdom/txtnish>.

=head1 NAME

txtnix - Client for twtxt, the minimalist microblogging service for hackers

=head1 SYNOPSIS

$ txtnix --help

Command:
tweet       Append a new tweet to your twtxt file.
timeline    Retrieve your personal timeline.
view        Show feed of given source.
follow      Add a new source to your followings.
unfollow    Remove an existing source from your followings.
following   Return the list of sources you're following.
config      Get or set config item.
query       Query your registry.
register    Register at your registry.
search      Search twtxt.

Options:
  --help      Print a help message and exit.
  --config    Specify a custom config file location.

$ txtnix follow bob http://example.com/twtxt.txt $ txtnix tweet 'Hello twtxt world' $ txtnix timeline

=head1 DESCRIPTION

I is a client for the decentralised, minimalist microblogging service for hackers Lhttps://github.com/buckket/twtxt.

Instead of signing up at a closed and/or regulated microblogging platform, getting your status updates out with twtxt is as easy as putting them in a publicly accessible text file. The URL pointing to this file is your identity, your account. twtxt then tracks these text files, like a feedreader, and builds your unique timeline out of them, depending on which files you track. The format is simple, human readable, and integrates well with UNIX command line utilities.

All subcommand of I provides extensive help, so don't hesitate to call them with the I<--help> option.

=head1 INSTALLATION

You can check L<INSTALL|https://github.com/mdom/txtnix/blob/master/INSTALL.pod> to see all different ways to install txtnix but if want to use the fast and easy way, the following commands will install txtnix and all dependencies to ~/perl5 and add lines to your bashrc to adjust some environment variables.

$ curl -L http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib $ eval $(perl -I ~/perl5/lib/perl5 -Mlocal::lib=~/perl5) $ echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >> ~/.bashrc $ cpanm https://github.com/mdom/txtnix.git

=head1 CONFIGURATION FILE

twtxt uses a simple INI-like configuration file. It checks ~/.config/txtnix/config for its configuration, but you can overwrite it with the command line switch I<--config>.

Here's an example conf file, showing every currently supported option:

[twtxt] nick = bob twtfile = ~/twtxt.txt twturl = http://example.org/twtxt.txt use_pager = 0 use_cache = 1 disclose_identity = 0 limit_timeline = 20 timeout = 5 sorting = descending pre_tweet_hook = "scp buckket@example.org:~/public_html/twtxt.txt {twtfile}" post_tweet_hook = "scp {twtfile} buckket@example.org:~/public_html/twtxt.txt"

[following] alice = https://example.org/alice.txt charlie = https://example.org/charlie.txt

=head2 twtxt

=over 4

=item nick

Your nick, will be displayed in your timeline, expanded in your tweets and send in your user agent string if you set I to true. Defaults to your local username.

=item twtfile

Path to your local twtxt file. Defaults to I<~/twtxt.txt>.

=item twturl

URL to your public twtxt file. This is only needed in case you decide to disclose your identity.

=item use_pager

Use a pager (less) to display your timeline. Defaults to false. txtnix first tries to use the I environment variable and then checks a list of posible pagers until it finds one.

=item pager

Set pager program to use. It has no default value. This enables I if set.

=item use_cache

Cache remote twtxt files locally. This defaults to true as their usually is no reason not to do this. Every URL is checked with a I header, so you still get always the most up-to-date timeline.

=item ca_file

Path to TLS certificate authority file used to verify the peer certificate. Also activates hostname verification. Defaults to I</etc/ssl/certs/ca-certificates.crt>. The file does not have to exist to activate hostname verification. Setting this to an empty value disables hostname verification on a global basis which is definitely not recommended.

=item key_file

Path to TLS key file.

=item cert_file

Path to TLS cert file.

=item http_proxy

Use this proxy for http connections.

=item https_proxy

Use this proxy for https connections.

=item disclose_identity

Include nick and twturl in twtxt's user-agent. To respect your privacy this feature is disabled by default. But you may enable it to let other users discover that you follow them.

=item limit_timeline

Limit amount of tweets shown in your timeline. Defaults to 20.

=item timeout

Time a http request is allowed to take. Defaults to 5 seconds.

=item rewrite_urls

Rewrite urls you are following depending on their http response code. Addresses that return 301 (moved permanently) are rewritten to their new url. Return code 410 (gone) results in unfollowing that address. Defaults to true. You get a warning if a url is rewritten.

=item unfollow_codes

Comma sperated list of http return codes. txtnix unfollows every url that return one of these return codes. Defaults to 410.

=item embed_names

I expands the local names in your tweets to their urls. So I<@bob> becomes I<@Ehttp://example.com/twtxt.txtE>. With embed names you can also share your local nickname with your followers. If this is set to true mentions will be rewritten to I<@Ebob http://example.com/twtxt.txtE>. Defaults to true.

=item sorting

Order in which to sort the timeline. Can be either I or I. Defaults to I, so the newest tweets are on the top of the timeline.

=item time_format

How to format dates in your timeline. This should be a strftime-like format string. As special case you can set it to I to get relative dates like I<1 hour and 23 minutes ago>. Defaults to I<%F %H:%M>.

=item pre_tweet_hook

Command to be executed before tweeting.

=item post_tweet_hook

Command to be executed after tweeting.

=item write_metadata

Write metadata about who you followed or unfollowed in your twtfile. The twtxt file format does not specify any way to add metadata to your feed, so the current implementation to use a text starting with I<//> is a properiaty extension of txtnix. Use at your own risk. Defaults to false.

=item hide_metadata

Hide txtnix style metadata. Defaults to true.

=item use_colors

Use ANSI-colors for the I layout. Defaults to true.

=item template

In which format to display your timeline. I defines two different layout: I is a line oriented very basic layout. I looks less dense and supports ANSI colors and text wrapping. Defaults to I.

=item wrap_text

If to wrap text in pretty display. Defaults to true.

=item character_limit

Number of characters a remote tweet can have. Setting it to zero will disable this security precaution. Defaults to 1024.

=item expand_me

Expand I at the start of a tweet's text to nickname. Defaults to false.

=back

=head2 followings

This section holds all your followings as nick, URL pairs. You can edit this section manually or use the follow/unfollow commands of twtxt for greater comfort.

=head2 colors

In I mentions, hashtags, the nick and timestamp can be colorized with ANSI colors. You can set either I, I, I

[colors] nick = blue on_magenta time = grey09 hashtag = rgb515 mention = clear

Setting a value to I will disable coloring for that element.

=head1 Plugins

Plugins can provide functions that are called when events happen in I. See L for a complete documentation how to write plugins.

Plugins need to be enabled in the configuration file to handle events:

[MyPlugin] enabled = 1

I comes with three pre-installed plugins:

=over 4

=item * ShellExec

Works like the old hook system, but can run commands for all events:

[ShellExec] pre_follow = echo Another follower

This plugin is always enabled as it implements the functionality of the configuration options I and I.

=item * GistStore

Uploads your twtfile to Lhttps://gist.github.com. Needs your username and a access token or your password (but really, please use a access token):

[GistStore] enabled = 1 access_token = asdfasdfasdf user = bob

=item * FTP

Uploads your twtfil to a ftp server. The only required parameter is the hostname of the ftp server. You can supply a username and a password, both defaults to values in I<~/.netrc>. If you do not give a remote file name, the basename of your twtfile is used.

[FTP] enabled = 1 user = foo password = bar remote_file = twtxt.txt

=item * LinkBack

Any time you mention somebody in your tweet and LinkBack is enabled, it checks the mentioned users feed for a linkback command and posts your twturl as I parameter to that address. As there is currently no standard way to declare metadata, it checks for a tweet with I<// linkback $url>.

[LinkBack] enabled = 1

=back

=head1 Hooks

I and I are very useful if you want to push your twtxt file to a remote server. The following examples are just some ideas, basically the sky is the limit.

Transmit the the latest tweet via curl to an http endpoint:

post_tweet_hook = "tail -1 {twtfile} | curl -s -d @- -d 'name=foo' -d 'password=bar' http://example.com/feeds"

Publish your twtfile on aws s3:

post_tweet_hook = "aws s3 cp {twtfile} s3://mybucket.org/twtxt.txt --cache-control 'max-age=60,public'"

Update your git hosted twtfile before tweeting and push it afterwards:

pre_tweet_hook = "cd ~/git/website && git pull --rebase --prune" post_tweet_hook = "cd ~/git/website && git commit -m tweet twtxt.txt && git push"

=head1 Templates

If you're not happy with the included templates, I will parse user-supplied templates. Simple copy a template under I<$config_dir/templates/> (for example ~/.config/templates/myown.mt on Linux) and call I with I<--template myown>. Templates are written with L, you can find an example in the source package at I<templates/html.mt>.

=head1 COPYRIGHT AND LICENSE

Copyright 2015 Mario Domgoergen C<< mario@domgoergen.com >>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

=cut