Commit graph

19 commits

Author SHA1 Message Date
lilia
5762e59c41 DRY up registration event callbacks
This was just a special case of the extension.on/trigger interface.
2014-12-19 14:02:52 -08:00
lilia
470346c9c4 Save incoming messages and pass to frontend asynchronously
After a message is saved asynchronsly, fire an event and pass the
message attributes to frontend listeners via the chrome-runtime API.

This behavior is similar to the 'storage' event fired by localStorage.
2014-11-24 19:25:03 -08:00
lilia
ced295a630 Move message and conversation storage to IndexedDB
Getting up and running with IndexedDB was pretty easy, thanks to
backbone. The tricky part was making reads and writes asynchronous.
In that process I did some refactoring on Whisper.Threads, which
has been renamed Conversations for consistency with the view names.

This change also adds the unlimitedStorage permission.
2014-11-24 19:25:03 -08:00
lilia
7f04439b37 New websocket protocol 2014-11-14 17:48:57 -08:00
lilia
735737f0bc Merge Whisper.Messages into Whisper Threads
Eliminates the global Whisper.Messages object and consolidates shared
send/receive logic in Whisper.Threads.

To the latter end, note that the decrypted array buffer on an attachment
pointer is now named data instead of decrypted, in order to match the
format of outgoing attachments presented by
FileReader.readAsArrayBuffers and let us use the same handler to base64
encode them.
2014-11-13 15:53:56 -08:00
lilia
5a0e199fc5 Namespace registration helpers 2014-11-13 15:53:56 -08:00
lilia
13446e9c17 "Fix dirty hack" (runtime.reload) in chromium.js
Runtime reload is overkill and causes a jarring ux. Instead, send and
receive messages across the runtime. Also, if we need to jump between
the main ui and options pages, simply navigate within the current tab
rather than spawning a new one.
2014-11-10 16:24:01 -08:00
lilia
a1a528ccdd Finish abstracting native client
Firstly, don't initialize textsecure.nativclient unless the browser
supports it. The mimetype-check trick is hewn from nacl-common.js.

Secondly, nativeclient crypto functions will all automatically wait for
the module to load before sending messages, so we needn't register any
onload callbacks outside nativeclient.js. (Previously, if you wanted to
do crypto with native client, you would have to register a call back and
wait for the module to load.) Now that the native client crypto is
encapsulated behind a nice interface, it can handle all that
onload-callback jazz internally: if the module isn't loaded when you
call a nativeclient function, return a promise that waits for the load
callback, and eventually resolves with the result of the requested
command. This removes the need for textsecure.registerOnLoadCallback.

Finally, although native client has its quirks, it's significantly
faster than the alternative (emscripten compiled js), so this commit
also lets the crypto backend use native client opportunistically, if
it's available, falling back to js if not, which should make us
compatible with older versions of chrome and chromium.
2014-11-09 15:23:23 -08:00
Arlo Breault
bc5dea62c3 Use FileReader to base64 encode attachments
* Implements #82
2014-11-03 15:01:52 -08:00
Marco
69ba6581b0 moved some chromium-specific code into chromium.js (using extension.navigator namespace) 2014-06-01 21:33:58 +02:00
Matt Corallo
d9bf0a41fb textsecure.storage, chromium.js 2014-05-20 22:21:07 -04:00
Matt Corallo
be82547ea1 Move message saving out of helpers.js 2014-05-18 19:50:30 -04:00
Matt Corallo
6bc19ef558 More namespacing 2014-05-17 01:53:58 -04:00
Matt Corallo
8d408e6d8f THOUGH SALL USE TABSTOP AND SHIFTWIDTH 4 (so that indents read right) 2014-05-14 17:21:49 -04:00
Matt Corallo
1137f9d711 Add TODO file showing what still needs to be done 2014-05-04 17:07:25 -04:00
Matt Corallo
3e60368a16 LGPL license (I'd like to be an axolotl/TS JS lib in the future) 2014-05-04 02:34:13 -04:00
Matt Corallo
2ae5628122 Send-to-self works =D 2014-03-26 15:05:09 -04:00
Matt Corallo
8db3885659 Updates, NaCL 2014-01-22 06:23:41 +00:00
Matt Corallo
eec4c66ef6 Fixup dir structure 2014-01-22 03:28:35 +00:00
Renamed from background.js (Browse further)