wlonk/wheretofind.me

Add vCard export option

Opened this issue · 2 comments

wlonk commented

"Get my address book" to pull a vCard for everyone you follow?

Okay. A bare-bones proposal:

  • Add an endpoint at BASE/@user/vcard which returns a vcard 3.0 object. (The vObject Python lib looks like an appropriate way to implement this - I'll have to check if the license is compatible. It cannot produce the more flexible vCard 4.0 format.)
  • Add an endpoint at BASE/follows/vcard which returns a vcard 3.0 object consisting of the sequence of vCard objects for all followed users. (This appears to be legal.)
  • On the expanded user page, add a "download as vCard" link somewhere near the bottom.
  • On the follows page, add a "add to address book" link somewhere near the bottom.
  • In the resulting vCard object, for each location, return URL:<location URL> for each location, with the following exceptions:
    • mailto URLs are instead returned as EMAIL;TYPE=internet fields, and
    • values which are not URLs are instead returned as NOTE fields.
  • In addition, the vCard object should include a FN field consisting of the user's primary name, and a NICKNAME field for each username.
  • Finally, the vCard object will include a PRODID field specifying that it was created by WhereToFind.me.

One limitation of this encoding is that the user's labels for their identities are not transcribed. This appears to be a limitation of the vCard 3.0 format; I'm unsure if 4.0 addresses it.

For example, the vCard for my profile should appear as:

BEGIN:vCard
VERSION:3.0
PRODID:https://wheretofind.me/
FN:owen
NICKNAME:derspiny
NICKNAME:ojacobson
EMAIL;TYPE=internet:owen@grimoire.ca
URL:https://mastodon.transneptune.net/@owen
URL:https://github.com/ojacobson
URL:https://keybase.io/ojacobson
URL:https://www.twitch.tv/derspiny
URL:https://steamcommunity.com/id/ojacobson/
URL:https://grimoire.ca/
END:vCard

macOS' Contacts app renders this card as

screen shot 2019-02-12 at 11 24 49 pm

On further research, vCard 4.0 does't label URLs either, exactly.

However, Contacts.app does allow users to label contact fields, including URLs. I generated a vCard file with such a contact, and the representation was surprising:

item1.URL;type=pref:https://example.com/
item1.X-ABLabel:CUSTOM LABEL

I'll confess I can't fully figure out how this fits in the RFC. type=pref is clear enough to me, but not the item1. parts or the extension system. Either way, though, I'd be comfortable cribbing it to label URLs in generated cards.