Podwrapper v1.5.1 (...errr make that v1.5.2)

EDIT: I found a bug and fixed it with v1.5.2, the links below have been changed to point to the new version.

I released v1.5.1 v1.5.2 of my podwrapper script and until the WIP D* API is further along, I think this is where the script will be for a bit.

Since my last post concerning the script, I've done a little refactoring and streamlining along with adding a few more options.

If you have multiple D* accounts, you can now specify a config file with the -c flag.

Also, when initially setting up the script, you choose a default aspect that your posts will go. You can now override this with the -a flag. If when setting up the script you choose to post privately (i.e. 'All aspects') and you'd like to make a public post, you can add -a public when running the script. You can also override the default with a specific aspect however, at the moment, the API doesn't provide a way to pull your aspect names. You can still post to an aspect with the aspect id number. To get the number, navigate to your contacts page with your browser, select the aspect and note the URL. For example, if I wanted to post something to just my 'Friends' aspect, the URL for that aspect ends up being:

https://pod.jpope.org/contacts?a_id=2

So by adding -a 2 to the podwrapper command, the post will only go to my 'Friends'. And yes, this is a little convuluted at the moment but hey, the API is at v0 right now. :)

If you are on a pod that has the API enabled, you can head over to code.jpope.org and pull v1.5.1 v1.5.2 or grab the archive to give the script a try. If you do give it a spin and find an issue, let me know (if nothing else, hit up my contact form).

The README:

podwrapper

A bash script to post to Diaspora* via the WIP API. The API will need to be enabled on the pod you are attempting to post to.

See these posts:

https://kentshikama.com/posts/6c4b0ff01c090133da7b04015765ae01
https://kentshikama.com/posts/68f70c801c0d0133da7b04015765ae01
https://kentshikama.com/posts/65ba52c01f430133dab504015765ae01

Requirements

Most of these are fairly standard for any Linux install (although, I've seen curl not installed by default, which really confuses me...)

mktemp
sed
awk
curl
tr

Usage

Save the script somewhere in your $PATH and make sure it's executable.

Register:

You will first need to register the script as a client, to do so, run

podwrapper -r

and answer the few questions that pop up. Once this step completes, it will run the login step automatically.

You will be asked for your Diaspora* handle (i.e jpope@pod.jpope.org), whether or not your pod uses SSL and your preference on the posts being public or not (i.e posting to 'Public' or 'All aspects').

Post:

Posting a post can be done in two ways. You can use whatever editor you have set in your $EDITOR env variable (i.e export EDITOR=nano) and run:

podwrapper -p

Or, you can pipe input to podwrapper such as:

cat thisismypost.txt | podwrapper -p

Upon a successful post, the post URL will be returned.

(Re)Validate Token:

Tokens expire after a specified timeframe. Running

podwrapper -v

will check to see if the current tokens have expired and request new ones as needed. This generally doesn't need to be run on it's own but, is a good check to see if things are working properly. The post process above runs this step before it actually posts to verify that things are good.

Config:

The default config file is ~/.podwrapper however, you can specify what config file to use with the -c flag. At the moment, just be sure to run the -c flag before other flags as such:

podwrapper -c ~/.myconfigfile -r

Aspects:

One note concerning specific aspects, the API currently does not support querying aspect names (like "Acquaintances" for example). However, if you know the actual aspect id number, you can enter that in when asked about your preferred default aspect or when using the -a flag.


Have a response to this post? Please use this link.