Commit graph

458 commits

Author SHA1 Message Date
Matt Corallo
2c781e5b62 s/\t/ /g in test/index.html 2015-01-06 14:46:33 -08:00
Matt Corallo
28aa0a5508 s/\t/ /g in fake_api.js 2015-01-06 14:46:23 -08:00
Matt Corallo
1f8b8cd0ea s/\t/ /g in testvectors.js 2015-01-06 14:44:25 -08:00
Matt Corallo
406be10f53 s/\t/ /g in sendmessage.js 2015-01-06 14:39:54 -08:00
Lilia
cf99f03acd Merge pull request #107 from zmanian/FixTravisBuildsOnPullRequests
Fix for Travis Builds on pull requests
2015-01-03 10:42:17 +01:00
Zaki Manian
7b851ba548 Do not run saucelabs tests on pull requests because they will fail 2015-01-02 20:33:52 -08:00
lilia
fca67d7b0e Simplify pushMessageContent handler slightly
New private conversations have their type set in onMessageReceived. New
group conversations should be handled the same way as normal group
updates. It was pointed out we should never have to handle a group
message without a preceding group update, as those would be rejected by
textsecure.processDecrypted. An exception would be if you delete the
group from indexedDB but not localStorage, but that's not a mode we
should be supporting.

Also in this change I switched to instantiating a new conversation
object on every call to handlePushMessageContent. Originally, I thought
to use the local conversation list as a cache, but it's a bit simpler to
re-read from the database every time for now. Later on we should revisit
and optimize for fewer read/writes per incoming message.
2014-12-24 15:37:05 -08:00
lilia
0ea176dfa0 Don't require a conversation name
Just display a sensible default in the frontend if it's unset.
For private conversations this should be the phone number, for
groups, the list of numbers.
2014-12-24 14:32:11 -08:00
lilia
ff259a7dee Tolerate extra whitespace in the registration code field 2014-12-24 14:31:04 -08:00
lilia
0292c12712 Catch and save Bad Mac errors on the incoming message model 2014-12-23 18:31:57 -08:00
lilia
40b54185f3 If we happen to get a group message with no update, use a blank name 2014-12-23 15:07:43 -08:00
lilia
f23403f82b Fix arguments to sendMessageProto in tryMessageAgain
As ov ccc98d2 sendMessageProto takes a timestamp for the first argument,
in service of app-level delivery receipts.
2014-12-23 15:02:03 -08:00
lilia
f9e68be45b Don't refreshGroups in tryMessageAgain
This was intended to sync the group state of a recently re-installed
client, but is prone to overkill when we have a lot of old stale groups
around. Also this implementation incurs some rate limit errors from the
server.
2014-12-23 14:28:19 -08:00
Dave Sescleifer
2462aba24b Fixed timestamps and added last message to the gutter 2014-12-22 23:38:26 -08:00
Dave Sescleifer
1c47fb7ed8 Contact name now overflows into ellipsis 2014-12-22 23:38:26 -08:00
Dave Sescleifer
441962abc6 Fixed date format 2014-12-22 23:38:26 -08:00
lilia
1175f2ae3c Scratch that, reverse it. 2014-12-22 17:20:05 -08:00
Dave Sescleifer
893fffdad8 Added ✓ to delivered messages
Closes #100
Closes #101
2014-12-22 16:39:35 -08:00
lilia
8ed73d0ce5 Normalize send-path error handling
Receive and handle an array of errors in both the group and individual
cases.
2014-12-22 15:11:04 -08:00
lilia
80993753de Fix bug overwriting existing conversation names
On incoming messages for pre-existing conversations, don't update any
attributes unless it's a group update message.
2014-12-22 13:24:12 -08:00
lilia
30bca85f5a Fix undefined proto.source 2014-12-22 13:24:02 -08:00
lilia
ccc98d2f3d Fixup delivery receipts
Uses app-level timestamps for outgoing messages.
Adds timestamp property to the outgoing jsonData.
Triggers a runtime event to notify frontend on delivery receipts.
Renders delivered messages with a 'delivered' class.
2014-12-21 21:36:40 -08:00
lilia
348b5a53b1 Fixup OutgoingIdentityKeyError handling 2014-12-20 00:36:44 -08:00
lilia
3795ea5070 Fix message view using the wrong attribute 2014-12-19 17:59:23 -08:00
lilia
cfd4ccc803 Move index querying logic to /models 2014-12-19 17:59:18 -08:00
lilia
6cbde7894a Delivery receipts 2014-12-19 17:59:09 -08:00
lilia
1a4811fcef Fix tests 2014-12-19 17:39:40 -08:00
lilia
006653ed8e DB/Index Redux
This change removes the timestamp field from messages and conversations
in favor of multiple semantically named timestamp fields: sent_at,
received_at on messages; active_at on conversations. This requires/lets
us rethink and improve our indexing scheme thusly:

The inbox index on conversations will order entries by the
conversation.active_at property, which should only appear on
conversations destined for the inbox.

The receipt index will use the message.sent_at property, for effecient
lookup of outgoing messages by timestamp, for use in processing delivery
receipts.

The group index on conversation.members is multi-entry, meaning that
looking up any phone number in this index will efficiently yield all
groups the number belongs to.

The conversation index lets us scan messages in a single conversation,
in the order they were received (or the reverse order). It is a compound
index on [conversationId, received_at].
2014-12-19 17:39:40 -08:00
lilia
9c736df7d0 Handle incoming identity key changes
This ended up turning into a rewrite/refactor of the background page.
For best results, view this diff with `-w` to ignore whitespace. In
order to support retrying message decryption, possibly at a much later
time than the message is received, we now implement the following:

Each message is saved before it is decrypted. This generates a unique
message_id which is later used to update the database entry with the
message contents, or with any errors generated during processing.

When an IncomingIdentityKeyError occurs, we catch it and save it on the
model, then update the front end as usual. When the user clicks to
accept the new key, the error is replayed, which causes the message to
be decrypted and then passed to the background page for normal
processing.
2014-12-19 17:30:09 -08:00
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
e68720f07f Frontend support for ReplayableErrors
Eventually we'll store errors on the message model, and this change will
let us render and process them.
2014-12-18 20:07:45 -08:00
lilia
4a401f07f3 Rewrite ReplayableErrors
ReplayableErrors make it easy for the frontend to handle identity key
errors by wrapping the necessary steps into one convenient little
replay() callback function.

The frontend remains agnostic to what those steps are. It just calls
replay() once the user has acknowledged the key change.

The protocol layer is responsible for registering the callbacks needed
by the IncomingIdentityKeyError and OutgoingIdentityKeyError.
2014-12-18 20:00:14 -08:00
lilia
14c53ff710 Support for lower-level queries on indexedDB
superfeedr has done a nice job with this backbone -> indexedDB adapter,
but their query interface is somewhat limited. This commit adds an
alternate interface that lets us specify the index and cursor bounds we
want. This interface requires deeper knowledge of indexedDB indices, but
is more powerful overall.
2014-12-18 19:45:53 -08:00
lilia
8c93101989 Don't store conversationType on messages
This was used to conditionally render messages in the group style, but
it's actually unnecessary. We can render the same markup in both cases
and change the appearance with css.
2014-12-18 19:45:53 -08:00
lilia
27fa391112 Indentation 2014-12-18 17:43:36 -08:00
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