Hi Many thanks for this -- I have been struggling (unsuccessfully) with something similar using MongoDB -- using CouchDB with PouchDB appears to be a better approach.
regards On Monday, March 24, 2014 7:34:45 PM UTC+2, Jon Udell wrote: > > OK I have an initial CouchDB adaptor that seems to work. > > https://gist.github.com/judell/9744381 > > The setup is as follows. First you need CouchDB. ( > https://couchdb.apache.org/, validate the install here > http://couchdb.readthedocs.org/en/latest/intro/tour.html). Then you need > CouchApp (https://github.com/couchapp/couchapp). > > To create an empty CouchApp, do this: > > couchapp startapp tiddly > > This creates, in your current directory, > > tiddly > _attachments > _id > lists > shows > updates > views > > To which I have added two files: > > 1. update.py (I know this is a hack, please show me the right way) > > path = '_attachments/app.html' > f = open(path); > s = f.read() > f.close() > s = s.replace('</head>','<script > src="pouchdb-nightly.js"></script>\n<script>var couchdb = new PouchDB(" > http://localhost:5984/tiddly/");</script>\n</head>'); > f = open(path,'w') > f.write(s) > f.close() > > 2. push.cmd > > python update.py > couchapp push . http://localhost:5984/tiddly/ > > I've based this on the tw5tank edition, and have currently hacked tankbld > to copy the generated app.html into tiddly/_attachments (which is from > where CouchApps serve static docs). > > So the jury-rigged build process is: > > TIDDLY_HOME/tankbld > > COUCH_HOME/push > > I've removed all the external tiddlers from my tw5tank edition, so it > comes up empty looking for the default, TiddlyWiki for Tank. > > To prep CouchDB for the first run, I use PouchDB (the most useful > interface to all Couch-style databases) to create a SkinnyTiddlers > document. You can just do this in the JS debugger console, from a page that > includes <script src="pouchdb-nightly.js">, like so: > > var couchdb = var couchdb = new PouchDB("http://localhost:5984/tiddly/"); > var d = { _id:"SkinnyTiddlers", tiddlers: [] }; > couchdb.put(d, function(err,resp) { e = err; r = resp; } ); > > In Futon, at http://127.0.0.1:5984/_utils/database.html?tiddly, you > should see something like: > > "SkinnyTiddlers" > ID: > SkinnyTiddlers<http://127.0.0.1:5984/_utils/document.html?tiddly/SkinnyTiddlers> > {rev: "161-3c17da122021cf8f3690ef5f981e842d"}"_design/tiddly" > ID: > _design/tiddly<http://127.0.0.1:5984/_utils/document.html?tiddly/_design/tiddly> > {rev: "97-c0865de6abc09624d9292560074a5cb7"} > > > And if you expand SkinnyTiddlers you should see something like: > > *_id*SkinnyTiddlers*_rev*161-3c17da122021cf8f3690ef5f981e842d*tiddlers*[ ] > > Now load the app by visiting > http://localhost:5984/tiddly/_design/tiddly/app.html > > At this point you should be reading from, and saving to, CouchDB. You can > use Futon to watch things happen in the database. > > This is obviously rough around the edges but it seems to work. (I'm > embarrassed to tell you how much debugging of nested async callbacks it > took me to get this going!) > > My interest here, as I mentioned, is to use this with our Thali project. > For that, I expect there will be different packaging and setup issues than > for the mainstream TiddlyWiki community. But I think the basic adaptor > should remain the same. Does it look reasonable to you folks? Is it > something the main project would like to use? If so how should I proceed? > > Thanks, > > Jon > > > > On Tuesday, March 4, 2014 7:32:54 AM UTC-5, Danielo Rodríguez wrote: >> >> This looks promising! >> >> I'm very interested in this kind of implementation for TW. >> Please keep us posted. >> >> El martes, 4 de marzo de 2014 00:02:59 UTC+1, Yaron Goland escribió: >>> >>> BTW, just to a note from the peanut gallery but PouchDB support would >>> solve all our problems! As Jon mentioned we already use PouchDB as our >>> primary client. So switching it from 'server' mode to 'client' mode is >>> beyond trivial. >>> >>> >>> Also, to very briefly explain Thali. Thali is about letting users run >>> their own services on their own devices. So we would want to let someone >>> run TiddlyWiki on their phone. This wouldn't be static either. It would be >>> fully dynamic. They could edit to their heart's content and then using the >>> CouchDB protocol synch those changes either unidirectional (for a blog like >>> experience or to people who don't have edit permission) or bi-directionally >>> (for more of a Wiki style shared editing experience and for keeping their >>> own devices in sync, e.g. a change you make on your phone should show up on >>> your tablet, PC, etc.). >>> >>> >>> What Thali adds on top of vanilla CouchDB is our security model and >>> Tor support. The security model is, as Jon said, public keys. A user is a >>> public key. Period. That's it. >>> >>> >>> So when say my phone wants to synch some changes in my TiddlyWiki with >>> your tablet, my phone would open a mutual SSL/TLS auth connection. The >>> phone would present its public key as a client cert, the server would >>> present its public key as a server cert and now everyone knows who they are >>> talking to. Note that everything works the same in reverse. Your tablet >>> could reach out to my phone in which case the tablet is the client and the >>> phone is server. This is all done using self signed certs. No CAs. No DNS. >>> >>> >>> We use Tor to handle connectivity since Tor hidden services give us >>> the ability to penetrate firewalls/NATs and traffic analysis protection as >>> well. >>> >>> >>> There is more to the Thali vision than just the above (remind me to >>> explain MVC for apps someday or how we exchange public keys) but this is >>> the TiddlyWikiDev alias, not the Thali alias, so I'll stop now. :) >>> >>> >>> Thanks! >>> >>> >>> Yaron >>> >> -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywikidev. For more options, visit https://groups.google.com/d/optout.
