Commit graph

523 commits

Author SHA1 Message Date
Daniel Reichert
5114fa1f0a Update name and repository in package.json 2014-12-12 14:33:18 -08:00
lilia
2209407d5e Keepalive endpoint 2014-12-10 23:48:26 -08:00
lilia
4f97f8c1e4 Incoming request bodies are no longer base64
Since the socket is not a text-based transport, there's no need to
base64-encode the IncomingPushMessageSignal.
2014-12-10 23:48:23 -08:00
lilia
2ba88bd13a Shorten keep alive interval. Closes #97 2014-12-06 23:42:51 -08:00
Daniel Reichert
46ec7c966f Add test coverage of isEqual function 2014-12-03 03:40:29 -08:00
lilia
8257fa7478 Add support for deleting a conversation
Note that the conversation record is not actually destroyed,
merely marked inactive, preserving the contact name, photo,
etc...
2014-12-03 01:37:06 -08:00
lilia
7b23e24b71 Add stringview license info and script tags
Closes #94
2014-12-03 01:36:10 -08:00
Daniel Reichert
db5683a69d Move Base64 functions to their own file
Remove Base64 string functions from helpers.js

Rename Base64 string functions

Removed unused functions from stringview.js
2014-12-03 00:42:55 -08:00
lilia
ee0d7edc0b WebSocket-Resources / websocket refactor
This commit provides the javascript complement to
[WebSocket-Resources](https://github.com/WhisperSystems/WebSocket-Resources),
allowing us to use a bi-directional request-response framework over
websockets.

See websocket-resources.js and websocket-resources_test.js
for usage details.

Along the way I also factored the websocket keepalive and reconnect
logic into its own file/wrapper object.
2014-11-29 11:43:30 -08:00
lilia
ccbe837ca2 Rebind events when opening a previously opened conversation 2014-11-25 13:54:44 -08:00
lilia
99a2685f93 Store attachments as binary blobs
Move base64 encoding of attachments to an AttachmentView. This makes
image rendering an asynchronous task so we fire an update event to
indicate to the parent MessageListView that its content has changed
height and it is time to scroll down.
2014-11-25 12:42:44 -08:00
lilia
bf22da209f Fix tests 2014-11-24 19:25:03 -08:00
lilia
d1c5b6da7a Get rid of Layout global
Instead, trigger and listen for events on the conversation collection
object.
2014-11-24 19:25:03 -08:00
lilia
a835887459 Fix scroll when re-opening a conversation 2014-11-24 19:25:03 -08:00
lilia
fd3a72d435 Destroy all globals
Well, not *all* globals..
2014-11-24 19:25:03 -08:00
lilia
c0681beca7 Consolidate message callbacks
Register the runtime callback at the top level view rather than having
each conversation view register independently.
Also refactors Layout into InboxView.
2014-11-24 19:25:03 -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
Arlo Breault
5638b20046 Expose test results to sauce
* Do what blanket does, adding another level of indirection in the
   reporting.
2014-11-24 19:11:36 -08:00
lilia
94634fc77a Remove nativeclient from test page
Native client won't work on Sauce. Removing for now. TODO: find a
way to gracefully disable native client in the Sauce environment.
2014-11-24 19:04:19 -08:00
lilia
cc28120582 Add secure environment vars for travis 2014-11-24 14:23:51 -08:00
Arlo Breault
693e9a1e0e Add the build status 2014-11-22 20:31:12 -08:00
Arlo Breault
8d56a1b248 Run tests on Sauce Labs
* Issue #57
2014-11-22 20:30:57 -08:00
Daniel Reichert
6125f7cbbb Add basic test coverage of toArrayBuffer function 2014-11-20 14:06:32 -08:00
lilia
7f04439b37 New websocket protocol 2014-11-14 17:48:57 -08:00
lilia
9364cee578 Misc cleanup threads 2014-11-13 15:53:57 -08:00
lilia
b9859ad9d4 Add some license headers 2014-11-13 15:53: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
28290477f4 Nicer timestamps with momentjs
This dependency may be a little heavy for our current use case, but we can
roll with it for now and find something slimmer if it turns out yagni.

Closes #77
Closes #40
2014-11-12 11:45:58 -08:00
Sumit Bindal
d537d6a91f Fixing lint errors
Fixing JSLint Problems
2014-11-11 17:59:52 -08:00
lilia
0956d328da Fixes #71 Autoscroll
Conversation view autoscroll triggers on dom change, not storage change,
ensuring that we don't scroll before the new element is inserted.
2014-11-10 23:19:03 -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
4119c13ba2 Registration ux tweaks 2014-11-10 16:24:00 -08:00
lilia
3eb98ddc3b Fix options page stylesheet path 2014-11-10 12:24:11 -08:00
lilia
18378d8097 Fold nacl-common into components 2014-11-10 01:35:15 -08:00
lilia
db69bacff1 Do fewer string conversions in tests 2014-11-10 01:02:18 -08:00
lilia
1ad898a62e Simplify webcrypto type conversion
Previously we'd get a WordArray and convert to string before converting
to array buffer. Instead, go directly to array buffer.
2014-11-09 21:52:36 -08:00
lilia
e190582d9e Build CryptoJS components into webcrypto.js
We only depend on cryptojs for this webcrypto polyfill, so let Grunt
concatenate them into one file.

The reference in the getString helper isn't needed since we use the
built in string converters on CryptoJS's word arrays.
2014-11-09 21:52:33 -08:00
lilia
4518d03f43 Move protocol test to end of suite and extend timeout
The keygen test works without native client, but it takes a loooooong
tiiiiiiime.
2014-11-09 19:20:33 -08:00
lilia
c69c05c15d Remove obsolete argument 2014-11-09 18:58:05 -08:00
lilia
0ff3d438be Update libphonenumber
```
bower install
cd components/libphonenumber-api
./build.sh
grunt
```
Closes #54
2014-11-09 18:28:25 -08:00
lilia
1c4c47e7f3 Avoid breaking changes in qrcode library
Due to syntax errors in its bower.json.
https://github.com/davidshimjs/qrcodejs/pull/39
2014-11-09 18:28:25 -08:00
lilia
2f58ea5f3a Fixup curve25519 module
Rename methods on the curve25519 interface to be a bit more high level.
Cleanup emscripten wrapper class, wrap long lines and such. Also add a
grunt task alias for building the emscripten compiled curve
implementation.
2014-11-09 15:30:37 -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
lilia
8d323a4d71 Hooray for options 2014-11-08 11:38:32 -08:00
lilia
59f22ecb26 Clean up after crazy emscripten fueled rager
Man you shoulda been there. Code was compiling all over the damn place.
It was wild.

Seriously though. Ignore that intermediate compiled file. What happens
in build stays in build.
2014-11-08 11:03:24 -08:00
lilia
30dd43a959 Remove stray debugging test 2014-11-08 10:58:56 -08:00
lilia
b4f4f87a7c Add emscripten-compiled curve25519 module
Build with `grunt compile && grunt concat:curve25519` after installing
emscripten.

Enable by either (a) not loading nativeclient.js or (b) setting
`textsecure.NATIVE_CLIENT = false` before loading nativeclient.js.
2014-11-08 10:56:30 -08:00
lilia
3d27c98845 Remove stray curve25519.js include 2014-11-08 10:46:04 -08:00