Merge branch 'master' into assistant

This commit is contained in:
Joey Hess 2012-07-27 21:05:34 -04:00
commit 0a66947e3b
15 changed files with 207 additions and 7 deletions

View file

@ -0,0 +1,18 @@
[[!comment format=mdwn
username="http://jasonwoof.com/"
nickname="JasonWoof"
subject="Your security solution is fine"
date="2012-07-27T06:37:03Z"
content="""
I think making the html file redirect is just fine. desktopcouch does something like this. They talk about it being there to help you find the port number, but it contains the security token too.
They also have some javascript to delay the redirect for a while so you can bookmark the redirect file. You can click to set a cookie to skip the delay in future.
It's been a while since I used desktopcouch, but I found an old redirect file laying around. Here it is:
http://jasonwoof.com/downloads/desktopcouch-redirect.txt
The code is pretty short, you might find something useful there.
- Jason
"""]]

View file

@ -0,0 +1,66 @@
The webapp now displays actual progress bars, for the actual transfers
that the assistant is making! And it's seriously shiny.
[[!img full.png]]
Yes, I used Bootstrap. I can see why so many people are using it,
that the common complaint is everything looks the same. I spent a few hours
mocking up the transfer display part of the WebApp using Bootstrap, and
arrived at something that doesn't entirely suck remarkably quickly.
The really sweet thing about Bootstrap is that when I resized my browser to
the shape of a cell phone, it magically redrew the WebApp like so:
[[!img phone.png]]
---
To update the display, the WebApp uses two techniques. On noscript
browsers, it just uses a meta refresh, which is about the best I can do. I
welcome feedback; it might be better to just have an "Update" button in
this case.
With javascript enabled, it uses long polling, done over AJAX. There are
some other options I considered, including websockets, and server-sent
events. Websockets seem too new, and while there's a WAI module supporting
server-sent events, and even an example of them in the Yesod book, the
module is not packaged for Debian yet. Anyway, long polling is the most
widely supported, so a good starting place. It seems to work fine too, I
don't really anticipate needing the more sophisticated methods.
(Incidentially, this's the first time I've ever written code that uses AJAX.)
Currently the status display is rendered in html by the web server, and
just updated into place by javascript. I like this approach since it
keeps the javascript code to a minimum and the pure haskell code to a
maximum. But who knows, I may have to switch to JSON that gets rendered by
javascript, for some reason, later on.
---
I was very happy with Yesod when I managed to factor out a
general purpose widget that adds long-polling and meta-refresh to any
other widget. I was less happy with Yesod when I tried to include
jquery on my static site and it kept serving up a truncated version of it.
Eventually worked around what's seemingly a bug in the default WAI
middleware, by disabling that middleware.
----
Also yesterday I realized there were about 30 comments stuck in moderation on
this website. I thought I had a feed of those, but obviously I didn't. I've
posted them all, and also read them all.
----
Next up is probably some cleanup of bugs and minor todos. Including
figuring out why `watch` has started to segfault on OSX when it was
working fine before.
After that, I need to build a way to block the long polling request
until the DaemonStatus and/or TransferQueue change from the version
previously displayed by the WebApp. An interesting concurrency problem..
Once I have that working, I can reduce the current 3 second delay between
refreshes to a very short delay, and the WebApp will update in
near-realtime as changes come in.

View file

@ -0,0 +1,8 @@
[[!comment format=mdwn
username="http://jasonwoof.com/"
nickname="JasonWoof"
subject="auth token length"
date="2012-07-27T18:52:19Z"
content="""
Your auth token looks a little short. Aren't you worried about people brute-forcing it? ;)
"""]]

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="http://joeyh.name/"
ip="4.153.2.20"
subject="comment 2"
date="2012-07-27T18:55:51Z"
content="""
Heh, I consider it overflowing most address fields a bonus, as you don't have to worry when making screenshots. :)
Of course, it changes each app run too..
"""]]