Commit graph

46 commits

Author SHA1 Message Date
Scott Nonnenberg
cd60bdd08a Move conversations to SQLCipher 2018-10-01 18:18:37 -07:00
Scott Nonnenberg
5933a34a18 Use window.log in browser context, turn on console eslint rule 2018-07-21 14:52:43 -07:00
Daniel Gasienica
b510916ef5 Split globals into third-party and own 2018-05-02 19:18:33 -04:00
Daniel Gasienica
1dd87ad197 Format all source code using Prettier 2018-04-30 16:53:34 -04:00
Daniel Gasienica
805031ade8 Conditionally run post-attachment migrations
Introduce placeholder migrations for Backbone models so they never implicitly
run migrations whenever they are `fetch`ed. We prefer to run our migrations
explicitly upon app startup and then let Backbone models be (slightly) dumb(er)
models, without inadvertently triggering migrations.
2018-04-02 17:42:04 -04:00
Daniel Gasienica
bfbeedab5c Temporarily disable post-attachment migration migrations 2018-04-02 15:26:24 -04:00
Daniel Gasienica
a18e462817 Move migrations to Signal.Migrations 2018-04-02 12:17:36 -04:00
Daniel Gasienica
d16178638e Split database migrations into pre- and post-attachment migration
- Run light-weight migrations before attachment migration.
- Run regular migrations after attachments have been moved to disk.
2018-04-02 12:17:36 -04:00
Daniel Gasienica
db2941cbb0 Measure duration of migration 2018-03-19 19:27:59 -04:00
Daniel Gasienica
dbdf6fd880 Run version 17 migration upon startup 2018-03-19 19:27:59 -04:00
Daniel Gasienica
c81ce1dc92 Fix log line 2018-03-19 19:27:59 -04:00
Scott Nonnenberg
c760fe29ac
Fix broken storeNames.forEach, since it's not an array 2018-03-14 14:42:15 -07:00
Scott Nonnenberg
26c273618a
Refactor: db tasks to database.js, log delete to modules/logs.js 2018-03-14 14:42:15 -07:00
Scott Nonnenberg
3527740598
Format updates to js/database.js 2018-03-14 14:42:14 -07:00
Scott Nonnenberg
6b11f67dc6
Move logging to disk via bunyan
- Logging is available in main process as well as renderer process, and
  entries all go to one set of rotating files. Log entries in the
  renderer process go to DevTools as well as the console. Entries from
  the main process only show up in the console.
- We save three days of logs, one day per file in %userData%/logs
- The 'debug' object store is deleted in a new database migration
- Timestamps and level included in the new log we generate for publish
  as well as the devtools
- The bunyan API is exposed via windows.log (providing the ability to
  log at different levels, and save objects instead of just text), so we
  can move our code to it over time.

FREEBIE
2017-09-25 15:00:34 -07:00
lilia
3a9f4f0df3
Flatten database migrations
We can compress or toss out most of these one-off data migrations since
everyone starts from scratch with electron.

// FREEBIE
2017-09-14 16:53:39 -07:00
Scott Nonnenberg
bd0050b6c6 Cache messages on receipt, remove from cache when processed
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
4a1dc46ab3 Fixes to get local verification and sync messages working
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
b93042f12f Add verified status
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
c6bfdec84d Remove blockingApproval
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
9f4a657e8a Add database migration
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4c945acb76 Remove unused object store reference
// FREEBIE
2017-03-04 17:57:32 -08:00
lilia
58d2f71e09 Add migration to clean up old expiring messages
Expiring messages received before 0.31.0 may not have an expires_at time
populated. Loading these messages once will update their expires_at if
it wasn't already set. To avoid loading too many messages into memory,
add them individually, and remove them from the collection as soon as
they are added, allowing them to be garbage collected immediately.

// FREEBIE
2017-03-01 18:05:36 -08:00
lilia
e4b9c51f88 Rework expiring messages management
// FREEBIE
2017-02-22 16:18:01 -08:00
lilia
b888e01044 Add an index on message.expireTimer
This allows us to query all expiring messages on startup.
2016-09-28 17:20:02 -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
1f897f32b7 Track and sync unread messages
// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
b8602a3b42 Make migrations more robust
Occasionally these will fail if they happen to be executed before the
necessary dependencies (storage, ConversationCollection) are declared.

// FREEBIE
2016-02-12 17:18:37 -08:00
lilia
48626ceafb Remove spurious storage.fetch from migration
This should really only be called once, from background.js.

Calling it twice can cause doubled listeners for the registration_done
event, which in turn leads to duplicate post-registration callbacks,
dual sync requests, and an eventual datastore inconsistency.

Fixes #670

// FREEBIE
2016-02-12 17:02:11 -08:00
lilia
bf632bfa54 Fix migrations
Migrations should always call next() exactly once.

// FREEBIE
2016-02-03 17:56:23 -08:00
lilia
87ddcef333 Make debug log persistent
Save log entries in indexedDB rather than just in memory. Reload them
whenever the background page is refreshed.

// FREEBIE
2016-02-03 13:30:55 -08:00
lilia
34ae81c30d Redo previous migration
This time, wait for storage to be ready.

Fixes #608

// FREEBIE
2016-01-15 01:40:26 -08:00
lilia
6a268f0325 Migrate registration state
Follow up to 5223e6e for existing installations that never set this flag.

// FREEBIE
2016-01-14 10:38:46 -08:00
lilia
01593363eb Add migration to update search tokens
Previous commit changed the token schema slightly so now we need to run
a migration to update existing conversations.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
ed32801c3e Reset unreadCounts
Add a migration to reset bad unreadCounts from previously broken
unreadCount tracking. This will execute exactly once per installation.

// FREEBIE
2015-11-19 17:27:24 -08:00
lilia
f70c22f898 Add search field to inbox
Using the search field produces a filtered view of all contacts and
groups containing the input. To make this fast and scalable, add an
index on a 'tokens' array containing words from the conversation name
and different forms of phone number.

Closes #365

// FREEBIE
2015-10-15 13:33:07 -07:00
lilia
f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00
lilia
2e272b6894 Turn off idb query logging
++speed
2015-07-16 12:13:45 -07:00
lilia
d230df5622 Move local identitykey and registrationid to indexeddb 2015-05-15 11:38:14 -07:00
lilia
d0e262d7cb AxolotlStore stores groups in indexeddb 2015-05-06 17:49:31 -07:00
lilia
c26c6fc317 Store sessions by encodedNumber
Storing multiple sessions in a single indexeddb record is prone to
clobbering data due to races between requests to update multiple device
sessions for the same number, since you have to read the current state
of the device->session map and update it. Splitting the records up makes
it so that those updates can be made in parallel. Selecting all the
sessions for a given number can still be done efficiently thanks to
indexeddb range queries.
2015-05-05 17:44:59 -07:00
lilia
7eda48f755 Move Session Storage to indexedDB 2015-05-05 17:44:58 -07:00
lilia
96eafc7750 Integrate libaxolotl async storage changes
* Session records are now opaque strings, so treat them that way:
  - no more cross checking identity key and session records
  - Move hasOpenSession to axolotl wrapper
  - Remote registration ids must be fetched async'ly via protocol wrapper
* Implement async AxolotlStore using textsecure.storage
* Add some db stores and move prekeys and signed keys to indexeddb
* Add storage tests
* Rename identityKey storage key from libaxolotl25519KeyidentityKey to
  simply identityKey, since it's no longer hardcoded in libaxolotl
* Rework registration and key-generation, keeping logic in libtextsecure
  and rendering in options.js.
* Remove key_worker since workers are handled at the libaxolotl level
  now
2015-05-05 17:44:55 -07:00
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.
2015-02-11 17:38:01 -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
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