Commit Graph

549 Commits (84237cae6f12b55cd317cf80fb87a37ca88dc75e)

Author SHA1 Message Date
lilia 96af6b56ef Handle incoming sync messages
Assign them to the correct conversation and mark them outgoing with the
correct timestamp.

Closes #150
10 years ago
lilia 65c70a9117 Fix provisioning flow
Fix undefined axolotl.protobufs.ProvisionMessage, referenced in
libaxolotl/protocol.js
10 years ago
Matt Corallo 148410a826 Move jquery dep from libaxolotl to libaxolotl tests 10 years ago
Matt Corallo 44a094c324 Re-run concat 10 years ago
Matt Corallo f1f5914879 Re-run concat 10 years ago
Matt Corallo cb6cb4ff89 Re-add jquery as it is needed for our test runners 10 years ago
Matt Corallo 8398a52c20 Re-run concat 10 years ago
Matt Corallo bb32a51d66 s/textsecure.protocol/axolotl.protocol/ 10 years ago
Matt Corallo 403ae4376d Move attachment/websocket [en|de]cryption to libtextsecure 10 years ago
Matt Corallo 184b1ec89c Move protocol protobufs to libaxolotl/, handling DeviceControl 10 years ago
lilia 05a5b7e76c Fixes #152
Android client was crashing any time the base64-encoded public key
included a '+' due to lack of url encoding.
10 years ago
lilia a104ee9ca6 Remove unused variables 10 years ago
lilia 44f9ea5d49 Fix identity key error rendering 10 years ago
lilia 9fe99adf0c Get scrolling right on conversation load 10 years ago
lilia f5c7be7d35 Add some resizes 10 years ago
lilia 5a302271b3 Remove unneeded listeners 10 years ago
lilia 0463e385e8 Remove uneeded render
This is an artifact of a time when conversation elements would pop in
and out of the dom at a moment's notice, and thus needed to rebind their
event listeners regularly.
10 years ago
lilia 5e064db28f Render the message list view. 10 years ago
lilia 5ad5464dd1 Fetch messages in the background 10 years ago
lilia 52b3114970 Simplify list view resizing 10 years ago
lilia 3279dddcc3 Consolidate window logic in panel controller
Previously the conversation window would query the background page
for a model id and then fetch the conversation. Instead, we can fetch
the conversation before opening the window, which simplifies the front
end scripts and avoids creating multiple copies of the same model.
10 years ago
lilia 44b1e5c88e Move inbox collection to the background page
No more waiting, no more messy fetch logic. Background page
bootstraps the inbox and keeps it up to date.
10 years ago
lilia a5bc261365 Clear selected files after each sent message 10 years ago
lilia 2de682ef7b Don't create a group without a name 10 years ago
lilia d5c85dfbd8 Resize inbox listview after it finishes loading
Ensures that scrollbars are properly setup on load.
10 years ago
lilia 4422582ab7 Fixup opening existing private conversations 10 years ago
lilia 200981e022 Avoid adding empty-string numbers to recipients 10 years ago
lilia 3a099657e6 Untangle select vs open events 10 years ago
lilia b27826cba5 Conversations must have an id before saving 10 years ago
lilia a7a44e9b99 Swap in unminified typeahead code
For your debugging and auditing convenience.
10 years ago
lilia 9087918500 Don't add new convos to inbox until a message is sent 10 years ago
lilia af49ad9b90 Dry up new contact init and handling 10 years ago
lilia 63d232dedb Draw attention to invalid numbers 10 years ago
lilia 746e6530b9 WIP pill view for selected recipients 10 years ago
lilia c84ccfc735 Wrap model phonenumber validation in try/catch 10 years ago
lilia eae072e72d Remove unneeded var, add todo 10 years ago
lilia fc3a600e72 Validate conversation type 10 years ago
lilia 5e3ed1658b Show phone numbers in contact selector 10 years ago
lilia 9e245e67e0 Fix double-opening exsisting conversations from typeahead 10 years ago
lilia b2345a5ec8 Remove unused variable 10 years ago
lilia ce4ce164af Stop clobbering conversation attributes
Unless the background page fetches the latest details of a conversation
before updating it, it may clobber or nullify some attributes e.g., the
contact's name.
10 years ago
lilia aca3db97da New messages auto-update the inbox & conversation
When a new message arrives, if its conversation is not already opened,
the background page opens it. If it is alrady open the window is
focused. Finally, the 'message' event is triggered, resulting in
   1. the inbox refetches conversations
   2. all conversations fetch new messages

TODO: only send this event to the target window
10 years ago
lilia db5e7fd6b6 Fix list view scrolling
Resize handlers are ugly. But not as ugly as scroll handlers. :p
Normalized some whitespace along the way.
10 years ago
lilia 0f29cf2043 Put spaces between joined members in group updates 10 years ago
lilia d435ff003b Improve typeahead contact selector experience
Store and match on various phone number formats. Still not perfect, as
occasionally all the models are returned for a non-matching query.
10 years ago
lilia acc2c6f536 Sort contact selector by title 10 years ago
lilia 51dd287b60 Break up a long line 10 years ago
lilia a00632c728 Hook up group creation flow UI
Checkboxes add and remove members as well as exposing the group update
ui. The conversation window is opened after saving the group.
10 years ago
lilia b3e32a2642 Only load contacts (not groups) in the typeahead 10 years ago
lilia 2f93fb9fbc Remove unneeded comparator
This collection is just an in-memory indexer used for typeaheads. For
display, the matching models are added to a separate collection. Thus,
the order of the elements in the typeahead collection does not matter.
10 years ago
lilia 0d6fbabb3e Trigger a checkbox event from conversation list items 10 years ago
lilia e05405e832 Format phone numbers before saving conversations
Saving the national and internation versions of the number lets us use
those attributes in a typeahead collection.
10 years ago
lilia ed928aa4e3 Add index on conversation type
So we can load only groups or only contacts.

This changes the schema and requires you to delete your database to
re-run the migration.
10 years ago
lilia 3d5553df09 Remove listener for model open event 10 years ago
lilia 87cd3f5053 Save and open new contact on click 10 years ago
lilia 17f3263a21 Listen for escape key anywhere in the inbox 10 years ago
lilia 070393170c Auto-focus new conversation input field 10 years ago
lilia b1ad04298f Add title bar label to new conversation view 10 years ago
lilia d26dc8c7e6 Move openConversation handler to InboxView
Removes the background page ref to inbox which should fix view tests.
Prep for handling new contact creation.
10 years ago
lilia 1eab26635b Remove unused variable 10 years ago
lilia 9a6c6bcd98 Reset the typahead before showing it 10 years ago
lilia b13e36a11c Style conversation menu 10 years ago
lilia 80ce2d95e0 Sort contacts by name in compose flow 10 years ago
lilia 6d81011f6a Add back button to compose view 10 years ago
lilia fedfdcdd7e Style elements for compose flow 10 years ago
lilia 17deb69a91 Make conversation panel work with a new contact
Prevent view from fetching messages without an id, as this causes a
crash.
10 years ago
lilia 5762724709 Don't show new contact unless input may be a phone number 10 years ago
lilia 4ee4872b27 Stop matching typeahead against group members
It feels a little weird when you can't see the matching member. Would
consider putting this back in if we display the member list in the
contact list item view.
10 years ago
lilia 00e9e3b757 Setup loading gif on conversation list
TODO: get actual gif asset in there.
10 years ago
lilia cc0acc56dd Initially hide newConversationView 10 years ago
lilia 613dc3bedd Start on support for messaging a brand new contact 10 years ago
lilia d3d84f3124 Let typeahead surface groups with matching members 10 years ago
lilia e149650d94 Refactor typeahead into new conversation view 10 years ago
lilia f207137b35 Customize typeahead tokenizer 10 years ago
lilia c6a19afd29 Tweak contact style in typeahead
Remove message snippets and dates.
Add checkboxes.
10 years ago
lilia 7bcceacf69 Implement typeahead (first pass) 10 years ago
lilia 79cdadd816 Add backbone typeahead component 10 years ago
lilia 79b4c89ce4 Fixup attachment preview 10 years ago
lilia bd86546cea Make chat window titles match contact list 10 years ago
lilia 1a553fef17 Hide file modal until it's needed 10 years ago
lilia 58e7f3c7e1 Fix file input click zone
Previously, the ugly file input was hidden with opacity, and styled as a
square paperclip icon, but its drop and click zones were not constrained
to the visible square. They remained active across the whole 'Choose
File' button, which overlapped with the textarea. Instead, hide the file
input complete (display: none) and transmit click events from the
paperclip to the input programmatically.

Eventually, we'll need to address drag and drop events, but I want to do
that at the window level. Otherwise dropping a file outside the file
input drop zone causes the browser to navigate to the file://... url.
10 years ago
lilia 8498d7ad1f Fixup conversation page styles and functionality
Render the entire conversation from a template, because some parts of it
must be rendered conditionally if it is a group vs private conversation.

Also apply some style fixes and restore lost functionality:
  * Make conversation title bar fixed.
  * Widens message bubbles.
  * Unhide message list.
  * Restore attachment rendering.
  * Restore message sending and attachment file selection.
  * Style attachments file input as a paperclip.
  * Style send button like on Android and make it a submit input.
10 years ago
lilia 34d5f3e88a Cleanup inbox view
Don't auto open the last conversation. It doesn't make sense now that we
no longer have two column layout.

Don't trigger/listen for selected events. There's no need since the list
item opens a new popup now.
10 years ago
lilia 607d5d3307 Abstract chrome browser action and windows stuff 10 years ago
lilia 71da6a1df1 Move index2 to index 10 years ago
Riley Shaw 94ce4d4b91 Simplify panel state management and message passing 10 years ago
Riley Shaw 9071d98395 Update styles to material design to match Android client (first pass) 10 years ago
Riley Shaw 783a3f7c15 Prevent duplicate conversations and refocus on click (still buggy) 10 years ago
Riley Shaw 7ec27f814f Get conversations loading through localStorage 10 years ago
Riley Shaw 2cbcb28ee3 Start on panels 10 years ago
Matt Corallo 02d0c58e5e Mostly done device-bringup stuff 10 years ago
lilia c0a8c00884 Rebuild libtextsecure also 10 years ago
lilia 8097db9af7 Micro refactor group update setup in message view 10 years ago
Matt Corallo 29b2ffc769 Update to real server provisioning API 10 years ago
Matt Corallo c112c59ce6 Fix group send (fixes #129) 10 years ago
lilia 94e14f2c85 Add license headers
Closes #75
10 years ago
lilia 5d044bd00e Fire an event on phone number validation
Fix a bug introduced by recent phone number input work that prevented
the call and sms buttons from being clickable.
10 years ago
lilia f6376c0fa2 Rename event
'open' seems a better name for an event that triggers the open function.
10 years ago
lilia f73596c240 Add a view for attachment previews 10 years ago
Emily Chao bb2b53035e Restyled message attachments
Added a size limit, added functionality to delete the attachments before sending in a more user-friendly way
10 years ago
lilia 9baafddb14 Add license to file input view 10 years ago
lilia d470b0eb53 Less jquery, more templating in conversation view
`if (foo) then jquery-dom-insert...` is a poor pattern to follow.
Instead, let mustache do the work.
10 years ago
Emily Chao e74cba8a92 Restyled country dropdown
Added jquery plugin that allows for flags and country codes to be
displayed in a user-friendly way, on top of the existing phone view
10 years ago
Emily Chao 5d3020b9ed Refactor phone number input view
Moves validation logic to its own view to be shared on index and options
pages.
10 years ago
lilia 44007ca58f Add rudimentary ui for sending a group update 10 years ago
Matt Corallo 334550b779 Regenerate components/libts 10 years ago
Matt Corallo 5785f4033c Compile curve25519/webcrypto into libtextsecure.js 10 years ago
Matt Corallo 07899557dc Give libtextsecure its own components (with way fewer deps) 10 years ago
Matt Corallo 8ad1a38b5b Move js files around for libtextsecure split 10 years ago
Matt Corallo 13d403b334 Switch to isNumberSane in group storage 10 years ago
Matt Corallo 17782660e2 Add isNumberSane to textsecure.utils for basic validation 10 years ago
Matt Corallo 6b933455e3 Merge pull request #108 from TheBlueMatt/refreshgroup
Replace all the refreshGroups stuff
10 years ago
Matt Corallo eac506557f Replace refreshGroups with singular refreshGroup on send 10 years ago
Matt Corallo 0b19e5b9c3 Replace numer->group with group->number->registrationId tracking 10 years ago
Matt Corallo 67bb400b87 Revert "Don't refreshGroups in tryMessageAgain", making a better one
This reverts commit f9e68be45b.

Conflicts:
	js/sendmessage.js
10 years ago
lilia d119bdff01 restore default avatars 10 years ago
Matt Corallo 6124084807 Bring padding calculation in-line with android 10 years ago
lilia d8efc4d216 Handle incoming group avatars on group creation 10 years ago
lilia 3d6c251fd1 Group avatars 10 years ago
lilia d52db8fe6f Render group updates
Not pretty, but it works. Also allows for later localization.
Copy/behavior is borrowed from the Android client.

Closes #104
Fixes #65
10 years ago
lilia 4e6faf4e27 Always listen for (re-)registration events
If we clear local storage and re-register in a foreground page, the
background page needs to re-init its websocket with the new account
credentials.
10 years ago
Matt Corallo 7ebf0f5085 Remove last \t in protocol.js 10 years ago
Matt Corallo 406be10f53 s/\t/ /g in sendmessage.js 10 years ago
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.
10 years ago
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.
10 years ago
lilia 0292c12712 Catch and save Bad Mac errors on the incoming message model 10 years ago
lilia 40b54185f3 If we happen to get a group message with no update, use a blank name 10 years ago
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.
10 years ago
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.
10 years ago
Dave Sescleifer 2462aba24b Fixed timestamps and added last message to the gutter 10 years ago
Dave Sescleifer 441962abc6 Fixed date format 10 years ago
lilia 1175f2ae3c Scratch that, reverse it. 10 years ago
lilia 8ed73d0ce5 Normalize send-path error handling
Receive and handle an array of errors in both the group and individual
cases.
10 years ago
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.
10 years ago
lilia 30bca85f5a Fix undefined proto.source 10 years ago
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.
10 years ago
lilia 348b5a53b1 Fixup OutgoingIdentityKeyError handling 10 years ago
lilia 3795ea5070 Fix message view using the wrong attribute 10 years ago
lilia cfd4ccc803 Move index querying logic to /models 10 years ago
lilia 6cbde7894a Delivery receipts 10 years ago
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].
10 years ago
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.
10 years ago
lilia 5762e59c41 DRY up registration event callbacks
This was just a special case of the extension.on/trigger interface.
10 years ago
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.
10 years ago
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.
10 years ago
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.
10 years ago
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.
10 years ago
lilia 2209407d5e Keepalive endpoint 11 years ago
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.
11 years ago
lilia 2ba88bd13a Shorten keep alive interval. Closes #97 11 years ago