Open mikeal opened 5 years ago
I'll see if I can code up an example quickly... doing it with Node is easier as I can avoid bundling...
Any code sample you do in Node.js that will "just work" if I did that same thing bundled through webpack would be fine :)
If there's something about the browser environment that makes this inherently difficult, let me know and I can use the Node.js snippet to create a simple service instead :)
https://github.com/jimpick/peer-pad-tool
Usage: node index.js <url>
$ node index.js https://dev.peerpad.net/#/w/markdown/HGUcFHKPCe6Wvv2KNLP1fTU867CySJC5zC9SddV1Rhf5/4XTTMCuCB6aTCYz2Py3g7kea382Mi3MvisqtqawmLRMHnb7W8-K3TgUV8e7o7h8epS5efRWQZLTsB8A9TGwR1ByAFq7yrzthCHoFrJdyg5KBDsCZW7JS3as7T24nXHkv5kYgt7MvoAvc4CP7qEtSh9MSmQg3x4P918TgVqVdBxqGmNi1KTbnDLVxj2
Starting...
(node:16284) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 start listeners added. Use emitter.setMaxListeners() to increase limit
Swarm listening on /dns4/ws-star1.par.dwebops.pub/tcp/443/wss/p2p-websocket-star/ipfs/QmULDVgVNTo7RxvMjfyEbCJ5cbjpKyp3sYVTjH9PBvHFMY
Fetching content...
Fetching title...
Title: Demo for peer-pad-tool
This is the document content..
This is a first pass. I'm finding it to be really flakey at the moment. Sometimes it works, sometimes it gets stuck. Sometimes it returns too early with only a partial document. I'm going to investigate further. The "sub-collaborations" we use for the title of the PeerPad document seem to be syncing less reliably than the content ... and the replication lifecycle events don't seem to be firing on an initial sync.
I'd love to get @pgte and @satazor to look at this client example and see if we can come up with something more idiomatic...
The currently deployed version at https://dev.peerpad.net/ is old ... I need to bug @victorb (the Jenkins CD setup is in a broken state)
Right now, our libraries are not silent - I'd like to see the 'Swarm listening' and 'EventEmitter' messages go away.
I've been looking at doing some workflow automation and one thing I'd like to do is take a peerpad (the user will give me the URL to the pad) and commit it to GitHub.
In order to do that I just need a JS code snippet that can get the current pad state as a string for any pad given identifiers I can pull out of the URL. I went through the current docs and didn't quite see how I could do that easily.