174
140

Jason Robinson

jaywink@jasonrobinson.me

Some basic #search on #Socialhome finally starting to come together. Only on my personal node atm though. Explains why many people got a follow from me just now as I'm eagerly searching and following people from my #diaspora contacts :) Remote direct match lookup is still to come though, so can't reach all pods who don't push over the relay system (btw, you should!). Currently the search is for profiles only. Tags will be added soon, after that full text for content.

On the technical side, after prototyping some solutions, went with django-haystack for the search framework and whoosh for the engine. Whoosh is a pure #Python backend with a file index. While this might not offer the performance we will need for large index full text search (from all content!), using Haystack on top means we can just switch transparently to #Elasticsearch at any time without touching pretty much any code - or even support using one or the other. Some people running nodes might not want to install ES.

Landing soon in master, you can try it at my own site if you are interested. It's basic but works.

#django #devdiary

3 days ago
15

Pythonic #JavaScript for Web Developers //

Colleague gave a talk at #EuroPython re #Python Web development and Javascript. He is the one who convinced me to have another look at #VueJS 👍

https://speakerdeck.com/uninen/pythonic-javascript-for-web-developers


3 days ago

Social-Relay version 1.4.0 released

This release adds compatibility with the latest #Diaspora #protocol changes. Also now Social-Relay will verify received payloads to ensure receivers get payloads from only resolvable valid senders.

https://github.com/jaywink/social-relay/releases/tag/1.4.0

What is the relay system?

The #relay system handles distribution of public content using the #Diaspora protocol. This helps new nodes get into the network and allows subscribing to hashtags from around the network. This is an unofficial network addition not directly related to the Diaspora protocol or project itself.

If as a #podmin you want to hook up to the relay system, do as follows:

  • Enable your outbound/inbound relay configuration in your Diaspora pod settings or for #Friendica / #Hubzilla check your own settings/documentation on how to do it.
  • Ensure your node is registered at The-Federation.info. The relay system polls this list for nodes to check.
  • Profit within one hour!

Discuss and improve

Let me know if you have ideas for improving the relay system or just questions about it. Contact me here, GitHub issues or via IRC.

Changelog

Added

  • Accept new style Diaspora public payloads without xml=payload form data.
  • Add profile model. Store remote profile handle + public key for later use, since we don't want to always fetch them.
  • Start validating signatures in sent payloads. This requires fetching remote profiles. Closes #31.

Ping @{David Morley; davidmorley@diasp.org}

jaywink/social-relay
social-relay - Public post relay for the Diaspora federated social network protocol

4 days ago
3

It's such a happy #developer moment when you write a feature, then write #tests for it and even after careful review of #code and some manual #testing, find a nasty bug while writing unit tests.

Another production fuck up avoided by unit tests 😁

5 days ago

federation version 0.13.0 released

This #Python #federation library release mostly fixes compatibility with the latest #Diaspora federation protocol changes that are rolling out to some nodes.

https://github.com/jaywink/federation/releases/tag/v0.13.0

Changelog

Backwards incompatible changes

  • When processing Diaspora payloads, entity used to get a _source_object stored to it. This was an etree.Element created from the source object. Due to serialization issues in applications (for example pushing the object to a task queue or saving to database), _source_object is now a byte string representation for the element done with etree.tostring().

Added

  • New style Diaspora private encrypted JSON payloads are now supported in the receiving side. Outbound private Diaspora payloads are still sent as legacy encrypted payloads. (issue)
    • No additional changes need to be made when calling handle_receive from your task processing. Just pass in the full received XML or JSON payload as a string with recipient user object as before.
  • Add created_at to Diaspora Comment entity XML creator. This is required in renewed Diaspora protocol. (related issue)

Fixed

  • Fix getting sender from a combination of legacy Diaspora encrypted payload and new entity names (for example author). This combination probably only existed in this library.
  • Correctly extend entity _children. Certain Diaspora payloads caused _children for an entity to be written over by an empty list, causing for example status message photos to not be saved. Correctly do an extend on it. (issue)
  • Fix parsing Diaspora profile tag_string into Profile.tag_list if the tag_string is an empty string. This caused the whole Profile object creation to fail. (issue)
  • Fix processing Diaspora payload if it is passed to handle_receive as a bytes object. (issue)
  • Fix broken Diaspora relayables after latest 0.2.0 protocol changes. Previously relayables worked only because they were reverse engineered from the legacy protocol. Now that XML order is not important and tag names can be different depending on which protocol version, the relayable forwarding broke. To fix, we don't regenerate the entity when forwarding it but store the original received object when generating a parent_author_signature (which is optional in some cases, but we generate it anyway for now). This happens in the previously existing entity.sign_with_parent() method. In the sending part, if the original received object (now with a parent author signature) exists in the entity, we send that to the remote instead of serializing the entity to XML.
    • To forward a relayable you must call entity.sign_with_parent() before calling handle_send to send the entity.

Removed

  • Post.photos entity attribute was never used by any code and has been removed. Child entities of type Image are stored in the Post._children as before.
  • Removed deprecated user private key lookup using user.key in Diaspora receive processing. Passed in user objects must now have a private_key attribute.

jaywink/federation
Python library for abstracting social federation protocols

6 days ago

Twööt.

7 days ago
19

Test post, feel free to ignore, or not!

9 days ago
14

Using Waffle.io for a #Kanban board in #Socialhome. Recently they introduced creating #GitHub labels via their UI. I've always felt GitHub makes creating labels unnecessarily complex, not being able to create one through the issue creation page. In Waffle you can now.

If you need a lightweight Kanban board for your project on GitHub, make sure to check out Waffle.

17 days ago

Jaywink - Vuosaari Bass City

New (or rather old) #mixtape out from the archives. This time some dirty grimy #breakbeat. Recorded at a friends place at #Vuosaari, #Helsinki in 2003 (Thanks Jukka <3). At the time I didn't have decks of own, having just moved to Helsinki. Might hear the lack of active practise in a few changes ;)

Enjoy!

20 days ago
1

REFDDDDDD UCCCCCCCCCCCCCCCCCWREDFX CÖÄÄÄÄÄÄÄÄDFFFFFFFF FFIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII IIIIIIIIIIIIIIIIII.’––̣QWX-. AQZZA< ıV666TRRRRRRRRRRRRRRRFDFTGSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS SSSSSSSS87

DSW+FXILPPO b ÄM H N BNB NJN

Ö- DC ,GFHCCX 'ÄÅÖP 9RFDC WEEEEEECCCCCCCCCCCCCWWWWWWWWWWWWWWWWWW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW ’ḶÖ.CCCCC CCCCCCCCF CCCCCC

STG5

Best regards, Titus 1y

22 days ago
8

I <3 #Python mock library 😁

class TestEncryptedPayload:
    @patch("federation.protocols.diaspora.encrypted.PKCS1_v1_5.new")
    @patch("federation.protocols.diaspora.encrypted.AES.new")
    @patch("federation.protocols.diaspora.encrypted.pkcs7_unpad", side_effect=lambda x: x)
    @patch("federation.protocols.diaspora.encrypted.b64decode", side_effect=lambda x: x)
    def test_decrypt(self, mock_decode, mock_unpad, mock_aes, mock_pkcs1):
        mock_decrypt = Mock(return_value=b'{"iv": "foo", "key": "bar"}')
        mock_pkcs1.return_value = Mock(decrypt=mock_decrypt)
        mock_encrypter = Mock(return_value="<foo>bar</foo>")
        mock_aes.return_value = Mock(decrypt=mock_encrypter)
        doc = EncryptedPayload.decrypt(
            {"aes_key": '{"iv": "foo", "key": "bar"}', "encrypted_magic_envelope": "magically encrypted"},
            "private_key",
        )
        mock_pkcs1.assert_called_once_with("private_key")
        mock_decrypt.assert_called_once_with('{"iv": "foo", "key": "bar"}', sentinel=None)
        assert mock_decode.call_count == 4
        mock_aes.assert_called_once_with("bar", AES.MODE_CBC, "foo")
        mock_encrypter.assert_called_once_with("magically encrypted")
        assert doc.tag == "foo"
        assert doc.text == "bar"

(from here)

22 days ago

Always good to run multiple versions in #CI.. Just almost deployed my site with code that broke with #Python 3.4 but was fine in my Python 3.6 development environment. json.JSONDecodeError seems wasn't added until 3.5 😅

23 days ago

Been in the #federated social sphere since 6 years or so and only now actually tried #Friendica 😱 Been spending way too much time looking through #Diaspora lenses..

Have to say it sure does have a lot of settings available. Had to create an account to test some #federation stuff with #Socialhome.

23 days ago
4

Remember kids, say no to #Python mutable class attributes.

In [1]: class A:
   ...:     f = {}
   ...:     

In [2]: a = A()

In [3]: b = A()

In [4]: a.f["foo"] = "bar"

In [5]: a.f
Out[5]: {'foo': 'bar'}

In [6]: b.f
Out[6]: {'foo': 'bar'}

Got bitten nastily again after stupidly defining an empty list on a class, but same goes for other mutable types like dict.

Explanation: https://www.toptal.com/python/python-class-attributes-an-overly-thorough-guide

Python Class Attributes: An Overly Thorough Guide
Python's class attributes can lead to elegant code and frustrating bugs. In this guide, I'll outline specific use-cases for attributes, properties, variables, objects and more.

24 days ago
5

I do love #Bootstrap4, so much has been improved. All the new helper classes are super time savers, for width, display, margins, padding and such. Just make sure to check the changelog every time updating while in alpha stage - not very stable yet :P

http://v4-alpha.getbootstrap.com

#webdev

Bootstrap
The most popular HTML, CSS, and JS framework in the world.

a month ago (edited)

Something I have been thinking would be nice would be pure indexing servers that expose search endpoints for other nodes to implement. A bit like the relays which is a really simple little server that just handles passing on content. But the index server would just listen and store everything it gets sent. There could be many run by volunteers and node admins could choose which one they want to integrate with using a REST API.

An integration for example be allowing users to search by keywords. The index server could have a well tuned search engine (like elasticsearch) which could find relevant posts easily by full text search, not just tags. This would allow finding interesting content and people who post that content, which currently is problem mainly by accident and effort.

Using the relays, the index servers could get filled with content and nodes wouldn't necessarily have to subscribe to every public post available as there would be the option to retrieve some as needed.

And since #Diaspora can these days pull in payloads from old content, you could tell your node to pull in the content from the original source so you can interact with it.

Too many things to do :P

(this oldish #idea extracted from this thread)

a month ago
5

#science

2 months ago
1

Ha. Following from #Socialhome works to and from #Diaspora (in unmerged PR anyway). But not between Socialhome instances 🙄

Tomorrow :P

2 months ago
36

Yay, not far from getting follows working in #Socialhome. Just UI buttons missing, #federation layer works 😅

2 months ago
2

federation v0.12.0 released

#Python #federation now includes more support for the upcoming #diaspora protocol breaking changes and also includes support for the new Contact entity type. Additionally, legacy sharing/following Request entity has fixes.

Repository: https://github.com/jaywink/federation

Changelog:

Backwards incompatible changes

  • Removed exception class NoHeaderInMessageError. New style Diaspora protocol does not have a custom header in the Salmon magic envelope and thus there is no need to raise this anywhere.

Added

  • New style Diaspora public payloads are now supported (see here). Old style payloads are still supported. Payloads are also still sent out old style.
  • Add new Follow base entity and support for the new Diaspora "contact" payload. The simple Follow maps to Diaspora contact entity with following/sharing both true or false. Sharing as a separate concept is not currently supported.
  • Added _receiving_guid to all entities. This is filled with user.guid if user is passed to federation.inbound.handle_receive and it has a guid. Normally in for example Diaspora, this will always be done in private payloads.

Fixed

  • Legacy Diaspora retraction of sharing/following is now supported correctly. The end result is a DiasporaRetraction for entity type Profile. Since the payload doesn't contain the receiving user for a sharing/following retraction in legacy Diaspora protocol, we store the guid of the user in the entity as _receiving_guid, assuming it was passed in for processing.

jaywink/federation
Python library for abstracting social federation protocols

6 days ago (edited)
3

Decided work computer didn't have quite enough #stickers. Much better now.

2 months ago
3

caseyscarborough/github-activity
github-activity - A widget for displaying GitHub activity for a user.

a month ago (edited)
1

git checkout -b activitypub

Time to start taking #Python #federation to multi-protocol stage, as it was planned to be from the start ;) Might take a while but got to start some day!

#activitypub

a month ago (edited)
1

federation 0.11.0 released

Federation is a #Python library for abstracting #federated #social network protocols through one API. Currently #Diaspora is supported for status messages, comments and likes + all the signing and discovery related parts. Plan is to start working on #ActivityPub support in the next few months.

If you would like to participate or want to talk about the library, pop into IRC FreeNode #python-federation or join the Gitter chatroom.

Release on GitHub.

Release notes

Backwards incompatible changes

Diaspora protocol support added for comment and like relayable types. On inbound payloads the signature included in the payload will be verified against the sender public key. A failed verification will raise SignatureVerificationError. For outbound entities, the author private key will be used to add a signature to the payload.

This introduces some backwards incompatible changes to the way entities are processed. Diaspora entity mappers get_outbound_entity and entity utilities get_full_xml_representation now requires the author private_key as a parameter. This is required to sign outgoing Comment and Reaction (like) entities.

Additionally, Diaspora entity mappers message_to_objects and element_to_objects now take an optional sender_key_fetcher parameter. This must be a function that when called with the sender handle will return the sender public key. This allows using locally cached public keys instead of fetching them as needed. NOTE! If the function is not given, each processed payload will fetch the public key over the network.

A failed payload signature verification now raises a SignatureVerificationError instead of a less specific AssertionError.

Added

  • Three new attributes added to entities.
    • Add protocol name to all entities to attribute _source_protocol. This might be useful for applications to know which protocol payload the entity was created from once multiple protocols are implemented.
    • Add source payload object to the entity at _source_object when processing it.
    • Add sender public key to the entity at _sender_key, but only if it was used for validating signatures.
  • Add support for the new Diaspora payload properties coming in the next protocol version. Old XML payloads are and will be still supported.
  • DiasporaComment and DiasporaLike will get the order of elements in the XML payload as a list in xml_tags. For implementers who want to recreate payloads for these relayables, this list should be saved for later use.
  • High level federation.outbound.handle_send helper function now allows sending entities to a list of recipients without having to deal with payload creation or caring about the protocol (in preparation of being a multi-protocol library).
    • The function takes three parameters, entity that will be sent, from_user that is sending (note, not necessarely authoring, this user will be used to sign the payload for Diaspora for example) and a list of recipients as tuples of recipient handle/domain and optionally protocol. In the future, if protocol is not given, it will be guessed from the recipient handle, and if necessary a network lookup will be made to see what protocols the receiving identity supports.
    • Payloads will be delivered to each receiver only once. Currently only public messages are supported through this helper, so multiple recipients on a single domain will cause only one delivery.

Changed

  • Refactor processing of Diaspora payload XML into entities. Diaspora protocol is dropping the <XML><post></post></XML> wrapper for the payloads. Payloads with the wrapper will still be parsed as before.
2 months ago (edited)

Test post from #Socialhome after some sending refactoring. Hello?

2 months ago
16

Yay, first #federated comments in #Socialhome \o> Thanks Benjamin Neff for the help with demystifying the #diaspora relayable signing #magic.

Next, once this wrapped up, following/followers.

https://jasonrobinson.me/content/426110/test-post-for-federated-comments-in-socialhome/

Test post for federated comments in #socialhome

2 months ago
5

Test post for federated comments in #socialhome

2 months ago (edited)
14

HBD #EU <3

4 months ago

#climatechange #humanity

4 months ago