git ssb

2+

dinoworm ๐Ÿ› / ssb-graphviz



refactor to work with browserify as a static page

%9clsY0haPibJLTmBynItyCWjNxnveaBcTE0pEwjxJ18=.sha256
Closed dinoworm ๐Ÿ› wants to merge commits into master from browserify-static-page
dinoworm ๐Ÿ› · 12/9/2016, 12:35:51 AM

refactor to work with browserify as a static page

this changes how the data is fetched from sbot, so that it's done all at once in a file called data.js as a single asynchronous function. this way, we can use configurify to pre-fetch the data as a browserify transform, so it's available to the browser without needing access to sbot. i kept the image urls the same, so they depend on a local sbot running (i'd like to make this configurable, but for now it's the same as the daily stats graph).

keep in mind, this means the graph only updates when it's re-browserified, so if anyone wants to host an active graph i recommend a daily cron job running the build script or something to keep it up to date. i'm interested down the road in how to use sbot directly in the browser, but for now this works. :)

/cc @ev

dinoworm ๐Ÿ› mentioned this pull request in [@ev](@8Qee0I/DwI5DHSCi3p5fsl6FyLGArrnDz3ox9qZr5Qc=.ed25519) here's `ssb-graphviz` in the browser: :firew
dinoworm ๐Ÿ› updated the branch to 83bc901e · 12/9/2016, 12:53:32 AM
%jSVsnSb4MSGTtsVrbUMMKGffAhyW3CpP+lqjEu8PDC4=.sha256 ev · 12/9/2016, 12:58:20 AM

@dinosaur This is awesome!

ssb-ws serves images to the public web.

See: https://evbogue.com/ws/blobs/get/&6/avNqHBq8nm9wnqx6dHXRoi4s5yuilh/9MFI95y0as=.sha256

%BOD8THOC/ahSNLiSo2BxKpGVtwTHnUQeVlKv3vOXWa4=.sha256 dinoworm ๐Ÿ› · 12/9/2016, 1:18:02 AM

@ev okay cool, well i'll make it so you can configure a base url to find blobs, which defaults to http://localhost:7777/ (the default local Patchwork / sbot address)

also, did you notice you can also access the same blob at:

https://evbogue.com/blobs/get/&6/avNqHBq8nm9wnqx6dHXRoi4s5yuilh/9MFI95y0as=.sha256 ?

dinoworm ๐Ÿ› updated the branch to 5ab82c84 · 12/9/2016, 1:29:26 AM
%W0UkHU58+W8flKY26tOto2uqUWmrva3Fs2GdrO1Zw2g=.sha256 dinoworm ๐Ÿ› · 12/9/2016, 1:32:41 AM

@ev

now you can configure a different blob base url with BLOB_URL environment variable.

so for example, to run the local dev server using your remote blobs, you can do BLOB_URL=https://evbogue.com/blobs/get/ npm start. i'll redeploy the http://dinosaur.is/ssb-graphviz site using your remote blobs. :smile:

%bP6TSpYf1frfyj+ntrUi8z+agKMkjGNml2HTglnY9FM=.sha256 dinoworm ๐Ÿ› · 12/9/2016, 1:32:59 AM

oops BLOBS_URL

%IndjS7cihBx3CX3JXDax89hYmkczzAeFP6kcAovnyTI=.sha256 dinoworm ๐Ÿ› · 12/9/2016, 1:40:56 AM

i'm wondering if a better approach is to make ssb-graphviz a plugin to sbot, so it would automatically run alongside sbot (which means pub owners can easily host a live graph of their pub's view of ssb) and therefore have direct access to all the sbot goodies. also this way we can do live and lazy queries, rather than a single query for everything during the compilation step.

%9JhPKIaIIb7p6iRU4U8hnvcdOWIJN0e6lsqYwPZ2N0E=.sha256 dinoworm ๐Ÿ› · 12/9/2016, 8:11:58 AM

closing in favor of %M0R0mWi....

while this works right meow: http://dinosaur.is/ssb-graphviz/, i don't think it's the right approach.

· 12/9/2016, 8:12:06 AM

Built with git-ssb-web