Commit graph

184 commits

Author SHA1 Message Date
Scott Nonnenberg
3fbd1ab618 Use error.stack instead of error for console log
Chrome/V8 give you the error name, message and callstack at that
property, where toString() gives you [object NavigatorUserMediaError]

FREEBIE
2017-06-20 16:57:11 -07:00
r-clancy
66b19d5cf7 Add support for opening the inbox via a shortcut - fixes #1134. 2017-05-24 10:51:38 -07:00
lilia
16f3717824 Move refresh prekeys out of SignalProtocolStore
Use an event/listener instead

// FREEBIE
2017-05-23 11:08:23 -07:00
lilia
aed5735620 Improve keychange notice reliability/perf
Bind a single listener to keychange events from the storage interface,
which then looks up relevant conversations and adds notices to them,
with tests.

Previously we would need to instantiate a conversation model in order to
start listening to its key change events. In practice this usually
happens at startup but we shouldn't rely on it, and it incurs higher
overhead since it creates a different listener for each conversation.

// FREEBIE
2017-05-09 15:41:41 -07:00
lilia
40af226a4a Move Whisper.events out of views and tests 2017-04-21 13:21:18 -07:00
lilia
44a4ff3b52 Refactor install view
Let install view manage the connection to the provisioning socket as
well as cleaning up the window on completion, simplifying options.js.
Call `remove` so that the view stops listening when the window closes.
Move view script and template to background page.
Adds ability to hide nav if this isn't our first run.

// FREEBIE
2017-04-13 13:15:42 -07:00
lilia
df65585e71 Network status listens to some global events
Listen for reconnectTimer to display reconnection info. Listen for
unauthorized to update network status immediately after a failed login,
rather than waiting for the normal 5s interval to time out.

// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
3f05c8ff87 Rename window.events to Whisper events
// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
fcff07df98 Remove some global refs to window.events
// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
510a5cb7fe Namespace global listeners to Whisper 2017-04-12 20:43:16 -07:00
lilia
cce1fe5c4b Simplify openConversation
Now that the InboxView is initialized in the background page context, we
can manipulate it more directly, without going through a global function
on the foreground window.

// FREEBIE
2017-04-10 12:45:58 -07:00
lilia
06e53871b2 Fix blank window after unlink
Don't wait for background init before rendering inbox.

If the client detects that it has become unlinked, it will not call
`init()`, never fire the deferredInit, and never render the inbox,
but we want to allow users access to their local messages even if they
have (perhaps temporarily) unlinked the desktop client.

Also, prefer not to extend Backbone.Model until/unless we really need
it.

// FREEBIE
2017-04-10 12:43:14 -07:00
Sam Vevang
ed4991974b set up a new view for displaying the network status
// FREEBIE
2017-04-08 00:10:56 -07:00
Sam Vevang
e4a21d1a53 move main application view over to messageReceiver namespace
The goal here is to allow synchronous property lookup between objects
and mvc/backbone semantics.

// FREEBIE
2017-04-08 00:10:56 -07:00
lilia
611bbaef35 Don't hardcode the attachment server url
There may come a day when we may need to change this url from the server
side. On that day, clients should continue to operate normally. The
service should be able to change attachment server locations without
requiring a client update.

// FREEBIE
2017-03-10 15:24:19 -08:00
lilia
25ee61d3cb Fix timers after suspend/resume/pause
We use timers to decide when to query and delete expired messages or
when to perform signed key rotations.

Internally, timers are counters that get updated when the CPU ticks, so
if the CPU sleeps, the timer will stop counting, and start again after
it wakes up, ignoring the intervening passage of wall clock time.

To fix this, without having to query the database or other potentially
high overhead operations too often, use an interval to frequently check
the wall clock time. If time jumps forward, trigger a global event so
other listeners can update their possibly-inaccurate timers.

https://stackoverflow.com/questions/6346849/what-happens-to-settimeout-when-the-computer-goes-to-sleep
https://stackoverflow.com/questions/4079115/can-any-desktop-browsers-detect-when-the-computer-resumes-from-sleep

// FREEBIE
2017-03-01 14:36:40 -08:00
lilia
886557a2aa Drop chrome.runtime.onMessage events
We can use Backbone.Events instead.

// FREEBIE
2017-02-28 11:49:56 -08:00
lilia
e4b9c51f88 Rework expiring messages management
// FREEBIE
2017-02-22 16:18:01 -08:00
lilia
dfe9ee9679 Remove dead code 2017-02-16 18:06:20 -08:00
lilia
536dd7b951 Add signed key rotation scheduler
Rotate signed prekey every 48hrs, waiting for online access if
necessary. After a rotation attempt is made, schedule the next run for
48hrs in the future.

We use a timeout to "wake up" and handle the rotation. This timeout gets
set on startup and whenever the next rotation time is changed. For
paranoia's sake, always clear the current timeout before setting the
next one.

Since new registrations necessarily upload new signed keys, we reset the
scheduled time to T+48hrs on `registration_done` events.

// FREEBIE
2017-02-16 18:06:20 -08:00
lilia
dfc292ac70 Serialize prekey refreshes & other account mgmt
Fixes #1060

// FREEBIE
2017-02-14 15:24:09 -08:00
lilia
7e06e014c4 Add debug logging for #1030
// FREEBIE
2017-02-03 21:28:01 -08:00
lilia
5be5f985fc Lint 2017-01-25 20:40:25 -08:00
lilia
f2bdafc7e9 Validate/reformat phone numbers in contact syncs
Turns out there's no garauntee that Android will send us contact info
with phone numbers in e164 format. When that happens, we fail to update
the correct contact. Fix by performing validation on the incoming number
before attempting to merge changes to the name, avatar, or color.

Fixes #903
2017-01-25 20:40:24 -08:00
lilia
1f0a93bf70 Ensure new installs default to non-blocking
// FREEBIE
2016-10-05 19:10:20 +09:00
lilia
02ea4f2475 Use read receipt envelope to infer startExpirationTime
Avoids display of phantom messages that are only received and marked
read locally long after they have expired on another linked device.
2016-09-28 17:20:02 -07:00
lilia
96fd017890 Support for incoming expiring messages
When initialized, or when expiration-related attributes change, expiring
messages will set timers to self-destruct. On self-destruct they trigger
'expired' events so that frontend listeners can clean up any collections
and views referencing them.

At startup, load all messages pending expiration so they can start their
timers even if they haven't been loaded in the frontend yet.

Todo: Remove expired conversation snippets from the left pane.
2016-09-28 17:20:02 -07:00
lilia
7b3b01bdf6 Refactor registration event
Make AccountManager into an event target for better separation between
app and service-library handling of registration events.
2016-09-20 13:42:33 -07:00
lilia
6dcff46e26 Move chrome-specific calls to chromium.js
// FREEBIE
2016-09-20 13:37:50 -07:00
lilia
b1afb79a14 Set theme based on master device userAgent
// FREEBIE
2016-09-15 16:28:46 -07:00
lilia
9db13310b4 Add port 80
// FREEBIE
2016-09-08 15:00:05 -07:00
lilia
0487fa3cd1 Add server fallback port 8443
// FREEBIE
2016-09-08 14:31:19 -07:00
lilia
53f20640af Add support for syncing colors
// FREEBIE
2016-09-07 13:04:45 -07:00
lilia
e5b54d9b6a Bubble up InvalidStateErrors and log them
These may be indicative of a potentially fatal lack of disk space.

// FREEBIE
2016-08-11 12:22:32 -07:00
lilia
186c597e24 Use port 4433 on staging
Now with over 9000% more CA-signed cert!

// FREEBIE
2016-07-28 18:39:55 -07:00
lilia
8e1d884a10 Add button for re-importing contacts from phone
Add a section under settings for performing a contact sync from your
mobile device. This just re-runs the same import operation that occurs
at install/link time.

// FREEBIE
2016-06-16 16:43:07 -07:00
lilia
ffa702c934 Update libsignal-protocol v0.9.0
* Exposes crypto APIs.
* Move worker methods to libsigna.worker.
* Move ProvisioningCipher to libtextsecure.
2016-05-17 12:03:37 -07:00
lilia
cd2218ada7 Move hard-coded worker url out of libtextsecure
// FREEBIE
2016-05-15 17:04:13 -07:00
lilia
0cd7f84a05 Refactor read state tracking
Adds support for handling early arriving read receipts.

// FREEBIE
2016-04-14 11:57:52 -07:00
lilia
d1e9534542 Refactor delivery receipt tracking
Move code for matching receipts to messages (and vice versa) to its own
file.

// FREEBIE
2016-04-13 13:57:56 -07:00
lilia
a5ec2321fd Use helper function
// FREEBIE
2016-04-09 00:16:44 -07:00
lilia
2f90645142 Break up long line
// FREEBIE
2016-04-09 00:16:21 -07:00
lilia
0f4f00ff4e Fix read sync on duplicate messages
In the case of a double send (same message encrypted and sent twice due
to key conflict bug), we would mark the first instance read twice rather
than marking both instances read. Fix by searching for matching messages
that have not yet been marked read.

// FREEBIE
2016-04-04 16:14:15 -07:00
lilia
9aa429e18a Add frontend support for expiring releases
When a release expires, it gets a persistent banner notification to
upgrade, and an ephemeral toast warning when trying to send a message.

// FREEBIE
2016-04-03 21:11:50 -07:00
lilia
8fe00f79b2 Fix sorting on incoming key conflicts
// FREEBIE
2016-03-25 14:32:58 -07:00
lilia
d39a19d889 Fix crash on read receipt event if no listeners
// FREEBIE
2016-03-18 17:06:38 -07:00
lilia
760bfffb50 Show all contacts all the time
Contacts without conversation identity appear in alphabetical order at
the end of the inbox.

// FREEBIE
2016-03-18 11:21:11 -07:00
lilia
7fb4d3d8aa Load all inbox convos before rendering
This is a better alternative to the fix in 0434c4b, which causes
problems when creating a new conversation from entering a phone number.

// FREEBIE
2016-03-17 20:58:56 -07:00
lilia
c4a88dd651 Fix getUnread query
Booleans are not valid keys in indexeddb.
https://www.w3.org/TR/IndexedDB/#dfn-valid-key

// FREEBIE
2016-02-26 12:25:56 -08:00
lilia
1f897f32b7 Track and sync unread messages
// FREEBIE
2016-02-22 17:11:17 -08:00