git ssb

0+

dangerousbeans / yap



forked from Dominic / yap
Tree:
📄LICENSE
📄README.md
📁apis
📄index.js
📄layout.js
📄mentions.js
📄package.json
📁static
📁test
📁translations
📄util.js
README.md

yap (yet-another-patch*)

yet another approach to writing patchapps.

Intended for server side html rendering (like patchfoo) or invalidation based lightweight front ends.

see also:

architecture

The idea here is to create a traditional http/html only app, but then supercharge it with cache invalidation, to give the feel of a live updating realtime single page js app. The trick is simple: each rendered element, say a post, thread, or avatar includes within it the metadata to update it:

<link
  rel="partial-refresh"
  href="/message?id=%25sXODvWtsqedx9%2F%2Fesx67pbo79uF3X4mgGinkUBfRnaE%3D.sha256"
  id="_b17383bd6b6ca9e7"
  data-cache="524883383"
>

the link element is the first child of the element it updates. href is the url to call to render this element. It's actually called as "/partial/"+href, which tells the backend not to send layout top level html.

the id and data-cache attributes are used to check wether the cache for this element is correct. The client sends a request to the server and asks if "_b17383bd6b6ca9e7": 524883383 is still correct. If the server says it isn't, then the client rerequests this element, and updates the page. If it is still current, the client does nothing.

Currently, the client javascript checks if something is still up to date when you return to that page after being away for a while. (todo: check periodically when away from the page)

currently only threads and posts are checked. feeds - which tend to be ranges arn't checked. I am still figuring out a good way to update these.

plugins

this code requires the following plugins

known bugs

TODO

implement these all as independent routes

views

forms / actions

Built with git-ssb-web