On Mon, 12 May 2014, Jeremy Ruston wrote:

What would be the best way for the client to detect that it's running
against a tiddlyweb server that would prefer the new content type?

Did we not already say for most deployments asking /status
or /status.js is probably the easiest way? That'll get you:

    https://tank.peermore.com/status

    {"username": "cdent",
     "challengers": ["tiddlywebplugins.tank.challenger"],
     "version": "2.3.0"}

or

    https://tank.peermore.com/status.js

    var tiddlyweb = tiddlyweb || {};
    tiddlyweb.status = {
        "username": "cdent",
        "challengers": ["tiddlywebplugins.tank.challenger"],
        "version": "2.3.0"
    };

Status is an optional plugin but is included on most servers because
it's the best way to get at username info from JavaScript.

So parse the version string and if > 2.3.0, win.

A far more hacky way, but usable on a system with no /status is to GET
a known resource[1] with `accept: application/vnd.tiddlyweb+json` and
inspect the content-type of the response. If it is `application/json`
then the new type is supported. If it is `text/html` or anything else
then it is not.

Compare:

    curl -v -H "Accept: application/json" \
        http://tiddlyspace.com/bags/common/tiddlers/normalize.css

and

    curl -v -H "Accept: application/vnd.tiddlyweb+json" \
        http://tiddlyspace.com/bags/common/tiddlers/normalize.css

with

    curl -v -H "Accept: application/vnd.tiddlyweb+json" \
        https://tank.peermore.com/bags/common/tiddlers/normalize.css

I would think that depending on /status (and thus making
tiddlywebplugins.status a requirement for any server hosting tw5
content) is reasonable.

Another option is just expect and require people use 2.3.0. That will
put some leverage behind getting people (notably tiddlyspace.com) to
keep up to date.

[1] As long as that resource is not a tiddler with type attribute of
`application/json`. If you choose one of those then you'll trigger the
bug on older systems. I suppose that provides a third avenue for
discovery...
--
Chris Dent                                   http://burningchrome.com/
                                [...]

--
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.

Reply via email to