GNU Social now supports WebFinger (RFC7033)

So, (slightly more than) another week has passed and GNU Social has received a couple of stability and feature updates. Nothing very visible for the end-user, but administrators may appreciate it. Going chronologically through the shortlog:

First I did some minor fixes, mostly language and specifications to make more clear that we’re working in the GNU Social software. This includes removing some StatusNet names here and there, specifying our system requirements (PHP5.3) and preferring a local url shortener to a remotely hosted one (privacy issue). The “8 chars was too little” apprehends queue handlers which in the future may use longer frame-identifiers (more declarative names).

b62ac25 PHP 5.3 dependency declared in INSTALL file
f009499 minor fixes and cleanups in the scripts directory
4c6803a GNUSOCIAL is the new defined indicator
c906ab1 8 chars was too little, 32 should be enough.
c3001ff url shortening fixes for api config and not
792e1ae StatusNet_HTTPResponse now prefixed with GNUSocial_
a35344e instanceof instead of is_a is faster (thanks quix0r)

One goal I have with code updates are making better use of OOP, object oriented programming. It results in prettier code, which is easier to read and harder to get wrong (what with proper typing and all that). One part in this was clearing up a remnant of old times, the ‘subs.php’, and implement the same functions in the Subscription class.

There were small problems during the execution of this patch, but it was fixed in the following commits. Among these fixes were the introduction of Managed_DataObject::listFind, which instead of an array returns the actual multiple matches in an extended DB_DataObject class.

93e878d Make better use of Subscription class
39f21d6 New Managed_DataObject retrieval: listFind
6330608 Subscription "get by" functions now don't use ArrayWrappers

Proper exception handling is also a neat thing. So I introduced the ‘MethodNotFoundException’ which is thrown whenever a class hasnot implemented a function. Usually that’s handled through abstract classes and class interfaces, but abstract declarations are apparently not allowed for static functions. So instead they throw the mentioned exception. Then there was also some regression and neatness fixing to do, where the regression was related to javascript functionality.

50e611a Shouldn't define static classes as abstract.
f711f9e Fixed regression in bookmark.js that caused double-submits (jquery 2.x stuff)
5f1fea1 FavorAction upgraded to extend FormAction
e9f2a18 Wrong call signature used for Event::handle
4ca1c10 IMPORTANT: 'GNUSOCIAL' defined, or daemons wouldn't work
8205c56 Stylesheet event now removed of StatusNet-remnants
9d3abc3 $_PEAR now defined globally as new PEAR, so no static calls are made
4015a58 Sometimes there's no text content, so pad the array (thanks mrvdb)

We now support PHP5.5, at least after the following series of patches. 5.5 makes sure that PHP is not a _pure_ steaming pile of dung anymore. So I had to clear up some old programming mistakes that didn’t convert types and shut down data streams properly.

In the middle of all of this, I took the chance to update some PHP libraries too because stuff like OpenID wasn’t PHP 5.5 compatible.

1744fec Array to string conversion in queuemanager logger
1c6f9df PHP5.5 fix: Better use of startXML for Action classes (mostly AJAX)
f268c3f Completing extra-element-without-text patch from 4015a58d1cfaa257fcf2b01aa6b1c9daa268c997
f01c478 htmLawed extlib updated
49b7559 Updating Janrain OpenID auth library
f7719b5 phpseclib extlib updated from
64df40e Filling in missing endHTML calls for Action AJAX
3ffe0e4 Added queue daemon notice about disabled forking functions
e9cc87f Updated some of the INSTALL documentation

A problem regarding URL shortening I noticed – if allowed notice length is infinite, then we ALWAYS shorten links (because two config settings were compared, where ‘0’ meant entirely different things).

858d9cc maxNoticeLength test for url-shortening failed on maxContent==0

Some minor problems I managed to introduce earlier were fixed here. Also, I applied several patches by Joshua Judson Rosen (rozzin). Thank you for these (one year old) patches!

80c6af0 Uncaught exception when no subscribers/subscriptions in ProfileList
633191d Making sure scripts and tests check for GNUSOCIAL defined (instead of STATUSNET)
981295f Autocomplete action must exist on user registration
562d5bc Remove bad common_path() call in context of cssLink().
8e5d58f Make paging work correctly in the user-directory even with the default filter set (i.e.: `all' = `no filter', so intrepret `filter=all' as `no filter').
9844ec7 Make the ForceGroup plugin work consistently for notices from remote users.
9085880 Allow the hostmeta to indirect from one domain to another. e.g.: =>
8e53eb2 Correct a logic-inverting typo in handling of replies to group-posts. The typo causes a tautology, which makes replies to group-posts always (or almost-always) go to the group(s). cf.
44f7ad6 Correctly distribute notices from remote posters through local groups to remote group-members via OStatus. Allow the OStatus queue-handler to handle all posts, and give it the smarts required to make correct decisions about whether it should or shouldn't relay notices over OStatus. cf.

…and now to the big implementation of the week – WebFinger. GNU Social now properly supports, I believe, RFC7033. Plus of course the former RFC6415 (Web Host Metadata), which StatusNet supports (but only XRD format). GNU Social supports both with both JSON and XML resource descriptors (JRD and XRD). It was followed-up by some regression fixes which were caught rather quickly thanks to debugging with postblue who tracks the master branch.

What WebFinger does is simplify and standardise metadata retrieval for users, websites, devices etc. using unique URIs – such as or What we don’t do is make use of the ‘rel’ parameters. Yet.

This also removed the previously available StatusNet hack ‘xrd.php’, replacing it with the PEAR XML_XRD library. We could probably also use Net_WebFinger for lookups, but so far no one has contributed RFC7033-compatible changes to it. It means more lines of code, but less maintenance. Code reuse is awesome.

As a bonus, or rather instead of implementing Quitter’s API changes, I pushed some Avatar class fixes. These simplify a lot of the code, as can be seen in commit b0dfc70 which replaces multiple get-avatar-check-if-it-is-there-and-get-the-url-otherwise-get-the-default-avatar-url (+ I could get rid of Twitter-specific hacks that returned 73×73 sized avatars when they sometimes should’ve been 96×96 pixels).

a0e107f Implemented WebFinger and replaced our XRD with PEAR XML_XRD
a23c4aa Avatar resizing improvements and better code reuse
24e0535 Fix regression from WebFinger update for singleuser sites
cced063 Fixed regression in latest Avatar fixes
a7e7484 Fixed regression in OStatus sub from WebFinger/XML_XRD update
b0dfc70 Properly unlink all old avatars when deleting/uploading a new

Then I made some minor fixes to avoid filling up the avatar directory over time, and spamming the PHP error log with unnecessary notices.

1d46ca4 PHP Notice:  Undefined variable: logo
3e15bab PHP Notice:  Trying to get property of non-object

And lastly, I just now fixed a problem with a new behaviour in lib/plugin.php where all the Plugin extended classes (i.e. all plugins) automatically load files from their directory if they match desired class names. During WebFinger updates I introduced (for the LRDD methods) a snippet of code that replaces ‘_’ with ‘/’ so we can have a better directory structure for plugins which act like the LRDD plugin.

ba5e901 Plugin onAutoload replaces _ with / in lib paths, this renames some classes.

Thanks for reading. Now go federate!

Leave a Reply

Your email address will not be published. Required fields are marked *