On Thursday, July 20, 2017 at 3:19:06 AM UTC-4, @TiddlyTweeter wrote:
>
> Tutti, Small comments ...
>
> *NoteSelf is currently largely MAGIC*.  
>
> Meaning *its actually quite difficult to conceptually grasp* what it is & 
> how it works. In time it will get clearer. That is NOT a criticism. Its an 
> observation on a technology that just works a different way.
>
> I am still myself unclear on several points ...
>
> (1) CORS settings in Cloudant and what the addressing they ask you for 
> there does? Do you need a "stub" at the address?
>

I had to look this one up too, when I first ran into it. CORS stands for 
Cross-Origin Resource Sharing. One needs to understand a bit about how the 
web works. A website serves up an HTML document. That HTML document has 
links to other things that are used to render the final page. These things 
include pictures and stylesheets and javascript. If they all come from the 
same http server (host and domain) they they are from the "same origin". If 
they get them from some other http server, then they are cross-origin.

For example, if you create a website that makes use of jquery you can 
choose to host a copy of the jquery library on your own website 
(same-origin) or to have your html page get it from the public google 
repository (cross-origin).

CORS came into existence to stop thing like linking images from other 
people's websites without permission among other things like CouchDB.

The reason you need to set-up CORS is that CouchDB was designed from the 
start to be a database server that is accessible directly over the 
Internet. As such they made a few unusual design decisions (from a database 
perspective). Whereas a traditional database (like say MySQL) uses an SQL 
interface with a somewhat simple network protocol, CouchDB chose to use 
HTTP as the interface and network protocol.

So, we use CORS (a relatively recent extension of HTTP) as a security 
setting in CouchDB. It tells the CouchDB server what other websites are 
allowed to send code to a browser that can be used to make calls to the 
CouchDB server.


> (2) Still unclear in the difference between the DOWNLOAD version and the 
> ONLINE version.
>

This also takes a bit to grasp. In the simplest way I can think of, 
NoteSelf takes TiddlyWiki (a single-file document) and turns it into the 
client side of a client-server application. Danielo's genius was in 
figuring out how to make it do that so elegantly.

One of Danielo's plugin(s) is like a modification to the TiddlyWiki json 
export function. Except instead of exporting to a file for download, it 
exports to a CouchDB server through a REST call. And it does it 
automatically every time you save a tiddler.
 

>
> (3) Am very hazy about COOKIE setting when using the ONLINE version.
>

This is a requirement from CouchDB. The CouchDB server uses http cookie 
based authentication. When you log-in to the CouchDB, it sets a cookie. 
That cookie is used as a token to say "hey this guy logged in".

Since CouchDB supports people writing their own login forms, Danielo did 
that. That is what the login popup does when you click the OFFLINE button 
and it turns into a cloud. It sends your credentials to the CouchDB server, 
and if login succeeds, you get cookie.
 

>
> (4) I get the impression that some tiddlers -- like PLUGINS for instance 
> -- can be "hard-coded" into the DOWNLOAD version, rather than be in the 
> browser database. *In other words, there is a "sort-of" TW that exists 
> outside the PouchDB for the download version?*
>

The DOWNLOAD version is the traditional TW way.

There is exactly a TW that exists outside of PouchDB. But if you do it 
entirely the NoteSelf way, that TW is always the empty.html version. 
Everything else comes from CouchDB.

PouchDB is like CouchDB, except it is written entirely in javascript, only 
usable by the browser that runs it, and uses the Browser's local storage 
(specifically the recently introduced IndexDB local storage). 


> (5) I'm unclear IF and HOW one can convert a DOWNLOAD version into a 
> synchronising one with a cloud database version.
>

Danielo's PouchDB plugin holds all the magic. It has the PouchDB and the 
interface for CouchDB. If you put it into any existing TW5, you have turned 
it into a NoteSelf (I think that's all it takes). You then, of course, need 
to set-up the cloud database server stuff.

This next bit I'm not completely clear on (I haven't dug into Danielo's 
code enough yet). I believe that once you have the PouchDB plugins added 
and you've added the settings to communicate with the CouchDB, it works 
pretty much like a new TiddlyWiki saver. When you save a change to a 
tiddler, it sends that tiddler to the local storage of the browser though 
PouchDB and updates the CouchDB (send a json formatted version of the 
tiddler).

Because there needs to be a bit of bootstrap to get all the PouchDB/CouchDB 
stuff working, there are a few tiddlers that are an exception to the "send 
to PouchDB/CouchDB". These always come from the html file.

And since you always have that html file (the empty.html from 
noteself.github.io) and it is Tiddlywiki with a special sort of saver, you 
can do everything you would do with TiddlyWiki like adding plugins to it or 
adding tiddlers to it. You then get your own download version.

Finally, because Danielo built on-top of TiddlyWiki, you can still save 
your NoteSelf wiki just like you can save TiddlyWiki (as a single file).


One final word:

PouchDB (https://pouchdb.com/) is a javascript library that makes use of 
browser storage to provide a database interface and also synchronize that 
database to a back-end server. The back-end server software it supports is 
Apache's CouchDB (http://couchdb.apache.org/)

It can get confusing when needing to talk about both. In general terms 
Pouch is in your browser, Couch is on a server.
 

>
> Best wishes
> Josiah
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/46a6c40a-446c-40ec-920c-652d227dc2dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to