Commit Graph

586 Commits (e41d1829725ab875992c63f486087619498bbeee)

Author SHA1 Message Date
Beaudan 960bd3fff2 Move JobQueue to be a module so that we can use it in preload 6 years ago
Beaudan 7eabae18f5 Replaced more references to signal with loki and updated CONTRIBUTING.md 6 years ago
Jonathan Canfield 97b26778b3 Remap zoom to Command+= on macOS (#3296) 6 years ago
Scott Nonnenberg 74cb808763 New MessageController as the single place for in-memory messages 6 years ago
Scott Nonnenberg 8c4d90df07 Send long text as an attachment instead of inline
Remove Android length warning

Handle incoming long message attachments

Show long download pending status in message bubble

Fix the width of the smallest spinner

Remove Android length warning from HTML templates
6 years ago
Scott Nonnenberg b3ac1373fa Move left pane entirely to React 6 years ago
Scott Nonnenberg ae161c6cf6 Update to Electron 4.x 6 years ago
Scott Nonnenberg ae2db9f09a Improve handling for URLs composed of mixed character sets 6 years ago
sachaaaaa b39b45e29d Fix #214 Replace help menu links 6 years ago
Scott Nonnenberg 5b54c9554e Remove groups table, conversation is single source of truth 6 years ago
Scott Nonnenberg 041fe4be05 Remove JSON column and Backbone Model for unprocessed 6 years ago
Scott Nonnenberg 9c540ab977 Add cache support to Signal Protocol Store 6 years ago
Scott Nonnenberg 1d2c3ae23c Download attachments in separate queue from message processing 6 years ago
Scott Nonnenberg 858c7e629f Fine-tune linkification technique for link previews 6 years ago
sachaaaaa f900a08eda
Merge pull request #177 from sachaaaaa/merge_1_21_0
Merge Signal 1.21.0
6 years ago
sachaaaaa a0f67c22da Merge branch 'textsecure/master' into merge_1_21_0
* textsecure/master: (26 commits)
  v1.21.0
  v1.21.0-beta.4
  Dark Theme: Preserve blue background on app loading screen
  Localization updates
  Fix width of audio player when window is very narrow
  A number of small fixes for Link Previews
  Get rid of the white flash when the app starts up (#3083)
  v1.21.0-beta.3
  Lint fixes
  Introduce new language: NB
  Fail over to all numbers in retry if errors don't have numbers
  Use the proper method for pulling attachments off disk for retry
  Fix rendering bug with verified state in updateVerified()
  Update electron-builder and electron-updater
  Ensure that dialog pops up when permissions denied for voice note
  Lint fixes
  Large update to localization strings
  Link Previews
  Ensure that blocked messages are dropped even after sealed sender
  Don't linkify quoted message contents
  ...

# Conflicts:
#	.github/PULL_REQUEST_TEMPLATE.md
#	_locales/cs/messages.json
#	background.html
#	config/default.json
#	index.html
#	js/models/conversations.js
#	js/modules/web_api.js
#	js/settings_start.js
#	js/views/conversation_view.js
#	js/views/settings_view.js
#	package.json
#	protos/SignalService.proto
#	stylesheets/_index.scss
#	stylesheets/_settings.scss
6 years ago
Beaudan 02d6920ade Tests for loki_p2p_api, added yarn command to generate coverage html, instantiating loki_p2p_api in the test preload 6 years ago
Mikunj 926362f88a Rename queue_manager to job_queue 6 years ago
Mikunj 594a815069 Fix test 6 years ago
Beaudan 9ff96a0250 Fixed tests and moved friend request status enum to new friends file 6 years ago
Scott Nonnenberg 813924685e Link Previews 6 years ago
Mikunj 69f51021b6 Travis windows fixes. 6 years ago
Mikunj 1a15ec9c15 Merge commit signal/master into signal-1.20 6 years ago
Mikunj f92e8485f8 Merge development into lint
Added gitattributes
6 years ago
Beaudan Campbell-Brown ea1d007b4f
Merge pull request #136 from Mikunj/tests
Tests
6 years ago
Mikunj 6bd2d3962e Linted files 6 years ago
Mikunj b4248afd98 Updated a profile test. 6 years ago
Mikunj cd3d17f977 Fix review issues. 6 years ago
Mikunj 6467b0bb45 Fix up tests. 6 years ago
Mikunj 1f10a73e4f Updated strings. 6 years ago
Mikunj feb8af476a Refactored BlockedNumberController. 6 years ago
Mikunj 7aad9417c7 Added blocked number controller tests 6 years ago
Mikunj faeb319c58 Added profile model test. 6 years ago
Scott Nonnenberg e4babdaef0 Updates to backup infrastructure 6 years ago
Scott Nonnenberg 47f834cf5c Encrypt device name on account create, on first launch if needed 6 years ago
Mikunj 654b0dac84 Merge signal-master. 6 years ago
Beaudan 6113f13d3a Rip the worker logic out of message_receiver and add the functionality for it to work with pow. Fix pow tests to work with those changes 6 years ago
Mikunj 0491ceacf1 Added seed dialog.
Fixed issue where incorrect language was used to generate seed.
6 years ago
sachaaaaa bce44c4ec2 remove secretsessioncipher test 6 years ago
sachaaaaa a1255dd31e
Merge pull request #77 from Mikunj/password-protection
Password protection
6 years ago
Mikunj e1aba93aea Merge signal 1.18.1 changes. 6 years ago
Beaudan 7782c58d14 Slight refactor of PoW file to make easier to test plus some tests for the PoW functionality 6 years ago
Mikunj 9e995bde6c Review fixes.
Updated tests.
6 years ago
Mikunj 0b87f13699 Added password dialog view. 6 years ago
Mikunj f53bec38a5 Added password inputs on registration screen.
Fix case where db is deleted but password hash still remains which causes user to never register.
Allow password to have symbols and other characters.
Added more tests.

Moved passHash from config into the sqlite db.
We can do this because we assume if sql failed to initialise then the key provided was wrong and thus we can show the user the password page.
6 years ago
Mikunj 08ebc63fb0 Added simple tests. 6 years ago
Beaudan 13db2d666f Fixed test again after rebase, reworked some logic in the conversation validateNumber function to correctly reflect what libsignal thinks is valid 6 years ago
Beaudan eb7a0dbb3a Fix failing tests except for problematic spellcheck package 6 years ago
Beaudan d8a410cc69 Linting of the test flies 6 years ago
Mikunj 14ecbc3f35 Moved MainHeader into its own Backbone View. 6 years ago
Mikunj 62135a1810 Added a section below conversation list.
Fixed scrolling on conversations.
6 years ago
sachaaaaa 3bf52c8f82
Update test/index.html
Co-Authored-By: Mikunj <Mikunj@users.noreply.github.com>
6 years ago
Scott Nonnenberg 313d08344a Request configuration sync on startup of new version 6 years ago
Mikunj ac4e04912c Minor language fixes. 6 years ago
Mikunj 6ce9d6a08c Added nickname dialog. 6 years ago
Scott Nonnenberg 70eed938d9 Store arrayBuffers in database for remote identity keys 6 years ago
Scott Nonnenberg 11fdf22881 Change sessions.id to a TEXT field to prevent type coercion 6 years ago
Scott Nonnenberg bde1462159 Change sessions.id to a TEXT field to prevent type coercion 6 years ago
Mikunj 8cc9b7b54b Added blocked number model and collection.
Added blocked number controller.
Hooked up BlockedNumberController loading.
6 years ago
Mikunj 0a88f337d5 Merge branch 'sig-development' into merge/signal 7 years ago
Scott Nonnenberg e828253ef0 Restor full function syntax to custom Mocha reporter 7 years ago
Scott Nonnenberg dbf0be2db5 eslintify all test files 7 years ago
Scott Nonnenberg 884bc9333d Make timestamp test a bit more forgiving 7 years ago
Mikunj 1a4adf2281 Merge branch 'development' into merge/signal 7 years ago
Mikunj f589fdac5c Merge signal changes into branch. 7 years ago
Mikunj 4e6df71999 Fix up tests. 7 years ago
Scott Nonnenberg 0297279084 Eliminate some conversation fields which are no longer used 7 years ago
Scott Nonnenberg 1755e0adfd Move all remaining stores to SQLCipher 7 years ago
Scott Nonnenberg a7d78c0e9b Sealed Sender support
https://signal.org/blog/sealed-sender/
7 years ago
Scott Nonnenberg ca61c9cb85 Warnings for dangerous files 7 years ago
Scott Nonnenberg cd60bdd08a Move conversations to SQLCipher 7 years ago
Scott Nonnenberg 7983300f4a Use base64 strings for incoming message cache instead of binary 7 years ago
Scott Nonnenberg 3105b77475 Migrate to SQLCipher for messages/cache
Quite a few other fixes, including:
  - Sending to contact with no avatar yet (not synced from mobile)
  - Left pane doesn't update quickly or at all on new message
  - Left pane doesn't show sent or error status

Also:
 - Contributing.md: Ensure set of linux dev dependencies is complete
7 years ago
Scott Nonnenberg 61f7b8360b Conversation: store lastMessage/lastMessageStatus in memory only 7 years ago
Scott Nonnenberg f39a96bc76 Move to centralized message/cache data layer
Also, ensure that conversation.messageCollection has nothing in it
unless it has an associated ConversationView.
7 years ago
Scott Nonnenberg 34231168a7 On message delete, ensure that all external files are deleted 7 years ago
Scott Nonnenberg 5933a34a18 Use window.log in browser context, turn on console eslint rule 7 years ago
Scott Nonnenberg b159a8d7c7 Update the user agent for debug log requests 7 years ago
Scott Nonnenberg 3c69886320 Finish new Message component, integrate into application
Also:
- New schema version 8 with video/image thumbnails, screenshots, sizes
- Upgrade messages not at current schema version when loading messages
  to show in conversation
- New MessageDetail react component
- New ConversationHeader react component
7 years ago
Scott Nonnenberg 43a44793c5 Remove jshint - move everything over to eslint
Also removed all hints of previous linters
7 years ago
Scott Nonnenberg fc5c52fbdf Remove iOS theme in favor of plain light/dark themes 7 years ago
Scott Nonnenberg ad4387803b New media permission, show dialog when not enabled for voice msg
UI now in separate renderer:
  - the permissions popup
  - settings dialog
  - debug log dialog
  - about window

Couple bug fixes:
  - About Window: Fix 'escape' to close window
  - Remove outdated dist/copy tasks from Gruntfile

Eslintified settings_view.js
7 years ago
Scott Nonnenberg 4415293100 Make all OS menus localizable
Turns out that Electron is not localizing the 'role' elements like we
expected would happen.
7 years ago
Scott Nonnenberg 8eeaad8e18 Remove unused export/import functionality 7 years ago
Scott Nonnenberg 068cce61e6 Fix path-oriented unit test on Windows 7 years ago
Scott Nonnenberg f3bd0cf903 Refactor api.js into web_api, which encapsulates all web access 7 years ago
Scott Nonnenberg eec61f5289 Fine-tune file protocol filter 7 years ago
Scott Nonnenberg 06b0544bbe Hardening: normalize on-disk attachment paths before save/load 7 years ago
Scott Nonnenberg cfe0bd0e79 Move to npm for several dependencies
mustache
jQuery
underscore
backbone
mocha
chai
intl-tel-input
7 years ago
Scott Nonnenberg 01be58acc2 Remove formatting in importError localization string 7 years ago
Scott Nonnenberg 548c8e69cf Emojification now all done with react via a few new components
Three locations were changed:
  1. a group update, which lists a set of contacts
  2. the contact name in the left pane
  3. the conversation title

Three new components were added to window.Signal.Components to support
these scenarios, respectively:
  1. Emojify
  2. ContactName
  3. ConversationTitle

Note that there are a number of other places in the app that should be
emojified, but never have been before. Essentially any place that a
contact name might be shown. A non-exhaustive list:
  - Show group members
  - Show safety number
  - Verified change notification
  - Disappearing timer change notification
  - Contact verification notification
  - Quote contact name
7 years ago
Scott Nonnenberg a5416e42c4 Refactor all emoji utility methods into window.Signal.Emoji 7 years ago
Scott Nonnenberg e2d044e02b Filter file scheme; disable http, https and ftp entirely 7 years ago
Scott Nonnenberg 4e5c8965ff Move to react for newlines, emoji, and links in message body 7 years ago
Scott Nonnenberg aa13a2c6f7 Parse phone numbers into e164 as part of schema upgrade 7 years ago
Daniel Gasienica 16bc1d34c6 Message schema 6: Change classification of media and documents
For an easier implementation, we change our original definition of
`initializeAttachmentMetadata`. This means we have to re-run it marked as
version 6 and mark schema version 5 as deprecated as its definition has changed.
7 years ago
Scott Nonnenberg 26be658892 Remove 'Contact' from 'Contact.*' properties, clean->parse 7 years ago
Scott Nonnenberg adbe989949 validateContact: Return error instead of logging 7 years ago
Scott Nonnenberg 420f81ebcd Move contact migrate code from message.js to contact.js 7 years ago
Scott Nonnenberg 41be7f126b Visuals for embedded contacts as well as contact detail screen 7 years ago
Scott Nonnenberg 3ea3e4e256 Contact sharing: protos and data pipeline
As of this commit: 82b76ccf37
7 years ago
Daniel Gasienica 5c8f734e67 Remove newlines from group IDs 7 years ago
Daniel Gasienica a102016ed8 Port `Settings` and `OS` to TypeScript 7 years ago
Daniel Gasienica 95321e5d3e Remove Vim mode lines 7 years ago
Daniel Gasienica 1dd87ad197 Format all source code using Prettier 7 years ago
Daniel Gasienica 41fe50553f Replace Backbone `saveFile` with `Attachment.save` 7 years ago
Daniel Gasienica 9a76d4bcf8 Whitelist `assert` global for tests 7 years ago
Daniel Gasienica 19411a78c8 Remove dead code 7 years ago
Daniel Gasienica 52e4e5aece Omit undefined keys when comparing IndexedDB data 7 years ago
Daniel Gasienica f36f206a01 Use `IndexablePresence` for `hasFileAttachments` and `hasVisualMediaAttachments`
Reduces index size, makes it easier to debug using IndexedDB inspector, and
hopefully improves lookup performance.
7 years ago
Daniel Gasienica 3a33d862c0 Update backup test fixture 7 years ago
Daniel Gasienica 8b9516de72 Update test for attachment metadata 7 years ago
Daniel Gasienica b0e1cc49a5 Remove legacy Backbone lightbox 7 years ago
Daniel Gasienica 9d84b2f420 Index messages with attachments using a boolean
When indexing message attachment metadata using numeric indexes such as:

```javascript
{
  conversationId: '+12223334455',
  received_at: 123,
  attachments: […],
  numAttachments: 2,
},
{
  conversationId: '+12223334455',
  received_at: 456,
  attachments: [],
  numAttachments: 0,
}
{
  conversationId: '+12223334455',
  received_at: 789,
  attachments: [],
  numAttachments: 1,
}
```

It creates an index as follows:

```
[conversationId, received_at, numAttachments]
['+12223334455', 123, 2]
['+12223334455', 456, 0]
['+12223334455', 789, 1]
```

This means a query such as…

```
lowerBound: ['+12223334455', 0,                1               ]
upperBound: ['+12223334455', Number.MAX_VALUE, Number.MAX_VALUE]
```

…will return all three original entries because they span the `received_at`
from `0` through `Number.MAX_VALUE`. One workaround is to index booleans using
`1 | undefined` where `1` is included in the index and `undefined` is not, but
that way we lose the ability to query for the `false` value. Instead, we flip
adjust the index to `[conversationId, hasAttachments, received_at]` and can
then query messages with attachments using

```
[conversationId, 1 /* hasAttachments */, 0                /* received_at */]
[conversationId, 1 /* hasAttachments */, Number.MAX_VALUE /* received_at */]
```
7 years ago
Daniel Gasienica f9e4613395 Move TS test for message migration 7 years ago
Daniel Gasienica 867bece952 Add `Message.initializeAttachmentMetadata` 7 years ago
Daniel Gasienica df2e6e7864 Port `MIME` module to TypeScript 7 years ago
Scott Nonnenberg bf81c3db63
Document Message v4, remove data-free thumbnails 7 years ago
Scott Nonnenberg c02860af5c
Responding to pull request review feedback
- messages.getQuoteObjectUrl: early return
- backup.js: explaining variables for long if statement
- types/messages.js: Log if thumbnail has neither data nor path
- sendmessage.js:
  - remove extraneous logging
  - fix indentation
  - upload attachments and thumbnails in parallel
- preload: don't load fs for tests, just fse
- _conversation.scss: split two selectors into two lines, 0px -> 0
- backup_test.js: use fse.existsSync and comment twoSlashes regex
- network_tests_view_test.js: Comment duplicate assignment to window.getSocketStatus
7 years ago
Scott Nonnenberg 6ec6bf08c8
Backup E2E test: Normalize paths because glob returns / on WIN 7 years ago
Scott Nonnenberg 1bfc1ed63e
Backup E2E test: Fix path analysis on windows 7 years ago
Scott Nonnenberg a7d44d3344
Backup and end-to-end test! 7 years ago
Scott Nonnenberg c3acf43c47
Eslintify test/backup_test.js 7 years ago
Scott Nonnenberg 3abaeb807d
Prevent infinite repeated errors on leaving electron tests open 7 years ago
Scott Nonnenberg 334fe32210
Fix electron test race condition with protobuf loading 7 years ago
Scott Nonnenberg 12257e1560
MessageView: Show menu w/ 'reply to message' on triple-dot click 7 years ago
Scott Nonnenberg 26e4e97592
Tighten up CSS
- Remove extra padding at top of Android bubbles, via sibling selector
- Don't include .attachments, .quote-wrapper, .content in bubble unless
  we actually need them. This allows for sibling selectors.
- This is a different technique for adding the ReactWrapperView for
  quotes - it is now appended to the DOM instead of attaching to
  something already in the DOM. This allows us to use .remove(), so it's
  a bit cleaner.
- Users of ReactWrapperView can now specify tagName and className
7 years ago
Scott Nonnenberg 30957341e4
Show three dot icon next to message on hover
But only if it doesn't have an error.

Also: reformatted message template in legacy_templates.js to match what
is in background.html for easier diffing.
7 years ago
Scott Nonnenberg a563dc8b37
Style Guide: Additional message examples, a few fixes to enable 7 years ago
Scott Nonnenberg 3bbbf65a6b
Fix iOS: tail, blue partial border, extra attachment space
Turns out that display: inline on the img tag resulted in a mysterious
3px of space added below it.
7 years ago
Scott Nonnenberg 9ad55c803f
Fix handling attachment thumbnails using thumbnail key 7 years ago
Scott Nonnenberg fce9bb7342
Move to central MIME functions, remove some console.log
And generally address PR feedback.
7 years ago
Scott Nonnenberg 92a89a8e41
Fix MessageView test: p -> div 7 years ago
Scott Nonnenberg 2243e348f1
Wire up fake window.Signal.HTML because it's captured on load 7 years ago
Scott Nonnenberg 054d3887a1
Quotes: The full pipeline into the database
1. MessageReceiver always pulls down thumbnails included in quotes
2. Message.upgradeSchema has a new schema that puts all thumbnails on
   disk just like happens with full attachments.
3. handleDataMessage pipes quote from dataMessage into the final message
   destined for the database
7 years ago
Scott Nonnenberg e69586200a
Unleash eslint on message_receiver.js - lots of change 7 years ago
Scott Nonnenberg 21bf02c94d
Fixed examples in Quote.md, rough Android visuals 7 years ago
Scott Nonnenberg ae043bf239
In iOS theme, join attachment bubble with caption bubble 7 years ago
Scott Nonnenberg 3a76c3c86e
Styleguide: Incoming/outgoing attachments of all types 7 years ago
Daniel Gasienica ad05efb7a0 Expose `Signal.Types.Conversation` 7 years ago
Daniel Gasienica 96c07c6373 Bump timeout of `debuglogs` test 7 years ago
Daniel Gasienica 15d221ae0e Simplify testing and linting
Separate linting from testing as follows:

- `yarn jscs`: Run JSCS.
- `yarn jshint`: Run JSHint.
- `yarn lint`: Run all linters, i.e. ESLint, TSLint, JSHint, and JSHint.

- `yarn test-node`: Run Mocha tests in Node.js environment.
- `yarn test-electron`: Run tests in Electron environment via Grunt.
- `yarn test`: Run all tests.

CI
- Align Travis and AppVeyor scripts as much as possible.
- Run linting before tests to fail fast.
- Run Node.js (headless and fast) tests first.
- Run Electron tests last (Travis seems to require custom setup in `travis.sh`).
7 years ago
Daniel Gasienica 24f4ad53bc Use single quotes for identifiers 7 years ago
Daniel Gasienica 432a6ebd7f Redact file paths with escaped slashes 7 years ago
Daniel Gasienica d41e3cd6fc Add test for regular `_redactPath` 7 years ago
Daniel Gasienica a8a7525609 Redact stack traces with forward and backslashes 7 years ago
Daniel Gasienica b0da7d965e Redact URL encoded file paths in stack traces 7 years ago
Daniel Gasienica 2ee78ec556 Prefer `path` over `Path` 7 years ago
Scott Nonnenberg c6c3b65bbc
Introduce React, TypeScript, TSLint and React-StyleGuidist (#2219)
Quite a bit of change here.

First, the basics:

- New dependencies were added: react, typescript, tslint, and react-styleguidist
- A new npm script: transpile. It uses typescript to process .tsx files in js/react, putting .js files next to the original file. It's part of the watch functionality of grunt dev as well as the default task run with just grunt (used to build the app prior to release). A lighter-weight to get watch behavior when just working on React components is to run yarn transpile --watch.
- yarn run clean-transpile will remove generated .js files


Style guide via react-styleguidist. Example site: https://react-styleguidist.js.org/examples/basic/

- Start with yarn styleguide
- Component.md files right next to the .tsx file
- jsdoc-style comments are picked up and added to the generated part of the styleguide - the overall summary and a table listing methods and properties of the component
- It has hot-reloading!
- It uses webpack, which means that our app now pulls in webpack though we don't use it to generate anything for the production app.
- I did a bunch of work to enable the use of Backbone views in this context, which will allow us to move smoothly from the old world to the new. First, add all the permutations in the old way, and then slowly start to re-render those same views with React.

A bit of dependency cleanup to enable use in React components:

- moment was moved from our Bower dependencies to our npm dependencies, so it can be used in React components not running in a browser window.
- i18n was moved into the new commonjs format, so it can be used in React components even if window is not available.

Lastly, a bit of Gruntfile cleanup:

- Removal of Chrome App-era modifications of background.js
- Make jshint/jscs watch more targeted, since more and more we'll be using other tools
7 years ago
Scott Nonnenberg 05303233fb
window.Signal.React -> window.Signal.Components 7 years ago
Scott Nonnenberg 23537546fe
Big refactor: ts/ directory for all typescript, including react
Split out test-specific and general utility react components too.

And moved our test/legacy* files for the Style Guide into a styleguide/
subdirectory of test/.

I think we'll be able to live in this directory structure for a while.
7 years ago
Scott Nonnenberg 887abd75dd
Add missing shim, fix typo 7 years ago
Scott Nonnenberg 104a1ca5d4
Remove i18n.js from jshint run, fix missing semicolon 7 years ago
Daniel Gasienica 4c4443390a Rename `createImporter` to `createAttachmentDataWriter` 7 years ago
Scott Nonnenberg 1326b26585
Full styleguide now available via `yarn styleguide`
Due to a number of hacks, the style guide can be used to show Backbone
views. This will allow a smooth path from the old way of doing things to
the new.
7 years ago
Scott Nonnenberg f86a6ef752
Update style of i18n, pull it in via preload instead of .html 7 years ago
Daniel Gasienica bf67254cc5 Add `Message.createImporter` 7 years ago
Daniel Gasienica 5a6668e677 Add `Attachments.createWriteForExisting`
This function lets us choose where to write attachment to instead of picking
random name.
7 years ago
Daniel Gasienica efd673083d Rename `writeAttachmentData` to `writeNewAttachmentData` 7 years ago
Daniel Gasienica ce8fe0d345 Add `Signal.Startup` module 7 years ago
colefranz 234411cb29 issue-2023: introduce unit tests for inbox view
There were no unit tests for the file at all so I added some simple ones
mostly focused on my changes.
7 years ago
Daniel Gasienica 8474f3cf7f Use `create*` prefix to clarify curried functions 7 years ago
Daniel Gasienica 9c7afab21b Clear database before message view tests 7 years ago
Daniel Gasienica 9065b647ad Run migrations before clearing database during tests 7 years ago
Daniel Gasienica 01480f5dd2 Improve formatting 7 years ago
Daniel Gasienica d6ea158e46 Avoid `dangerouslyCreateAndAdd` in `MessageView` test 7 years ago
Daniel Gasienica 83c979fb84 Rename `createTemporary` to `dangerouslyCreateAndAdd`
Class: `ConversationController`.

This function should not be used in application code as it creates potentially
invalid `Conversation` instances in our global conversation collection. We keep
making it available for testing purposes.
7 years ago
Daniel Gasienica 867f73b80a Use double quotes for identifiers in error messages 7 years ago
Daniel Gasienica 06e7bca276 Use new `stringToArrayBuffer` function 7 years ago
Daniel Gasienica 10afcf1bb0 Add `Attachments.deleteData` 7 years ago
Daniel Gasienica 9b636a1885 Add test for `Attachments.readData` 7 years ago
Daniel Gasienica f6f0359a61 Use `assert.deepEqual` instead of Lodash `isEqual` 7 years ago
Daniel Gasienica aba261122f 🎨 Use `camelCase` for mutable variable 7 years ago
Daniel Gasienica 1c8123ff1a Move `writeAttachmentData` into `Attachments`
Encapsulates all attachment operations that require Node.js / Electron APIs,
e.g. file system access.
7 years ago
Daniel Gasienica 6355c54114 Return relative path from `writeAttachmentData`
This will make our app more robust to changes in location on the file system.
7 years ago
Daniel Gasienica 1262d1d696 Shorten prefix to 2 characters
Using 2 hex characters [0-9a-f] will give us 16 * 16 = 256 root folders which
seems more manageable than 4096 (16^3). Assuming a user has 10,000 attachments,
they should roughly distribute at ~40 per folder with prefix length 2 rather
than ~2.5 per folder with a prefix of 3.
7 years ago
Daniel Gasienica 2cd3d5ac16 Add `Message` schema version 3 7 years ago
Daniel Gasienica ebe2a769c9 Add `Attachment.migrateDataToFileSystem` 7 years ago
Daniel Gasienica 1283c77518 Switch from hashed to random attachment file names
Using hashes, we get the benefit of deduplication but if a user receives two
messages with the same attachment, deleting one would delete it for both since
they are only stored once. To avoid the complexity of tracking number of
references, we simply generate random file names similar to iMessage on MacOS
(?) and Signal Android.
7 years ago
Daniel Gasienica d9de6dacba Add `writeAttachmentData` module 7 years ago
Vincent 5b5903c70e Fix link to Signal update location
Fixes #2043.
7 years ago
Scott Nonnenberg cea42bde7d
Encryption support for backup and restore
Also moved to the _ prefix in backup.js for all private methods exported
for testing.
7 years ago
Scott Nonnenberg 6d8f4b7b6e
Backup: zipped messages.json, flat attachments dir
Backup creates, in a target directory:
  - An attachments folder, with all attachments, each named for their
    parent message's id - a GUID. If there is more than one attachment
    in a given message,  each attachment beyond the first will end with
    '-N', zero-indexed.
  - A file named messages.zip. It contains exactly what went to disk in
    the original export code, but zipped up.

Export is now only 'light,' and in this new messages.zip format.

Import supports both the new format and the old format. If the target
directory has a messages.zip file, we'll treat it as the new format.

Next up: Encrypting attachments and the messages.zip!
7 years ago
Scott Nonnenberg e583434366
Refactor: Move Backup under window.Signal 7 years ago
Daniel Gasienica 8dfaa5619f Prefix private functions with underscore 7 years ago
Daniel Gasienica ed336d31d7 Move schema versioning from `Attachment` to `Message` 7 years ago
Daniel Gasienica b9e9f5e19a 🎨 `withInheritedSchemaVersion` to `inheritSchemaVersion` 7 years ago
Daniel Gasienica c27746b79e Add `Message.withInheritedSchemaVersion` 7 years ago
Daniel Gasienica e9e46464c2 Add `SchemaVersion` type 7 years ago
Daniel Gasienica add4b11df3 Skip invalid attachments and make function sync 7 years ago
Daniel Gasienica 3dfc823716 Add `Attachment.removeSchemaVersion` 7 years ago
Scott Nonnenberg a728c9efbf
Remove all mention of obsolete safety-number-approval setting 7 years ago
Scott Nonnenberg 26c273618a
Refactor: db tasks to database.js, log delete to modules/logs.js 7 years ago
Daniel Gasienica 43b47fd349 Avoid `ensure-error` for privacy reasons
Example:

```
> node
> const nonError = {foo: 'i-am-private'};
undefined

// before
> util.inspect(nonError);
'{ foo: \'i-am-private\' }'

// after
> nonError.toString()
'[object Object]'
>
```
7 years ago
Daniel Gasienica 44b81f68dd Remove privacy redaction from `Errors.toLogFormat` 7 years ago
Daniel Gasienica e71246a9e3 Add tests for `Privacy` module 7 years ago
Daniel Gasienica 49e0850fb2 Extract `Privacy` module
Centralizes how we redact sensitive information.
7 years ago
Daniel Gasienica be3e4d86c2 Add `Errors.toLogFormat`
Allows errors to be formatted and sanitized for logging. Removes sensitive paths
such as the app root directory.

Ideally, this module would be called singular `Error` but that is already a
global name. Using `Errors` plural is  similar to Java convention for utilities
such as `Arrays`, `Collections`, `Files`, etc. See:
https://stackoverflow.com/a/11673838
7 years ago
Daniel Gasienica 52f7de6a10 Add `debuglogs` module 7 years ago
Daniel Gasienica 1e2cd3ae1f Rename ‘File a Bug’ to ‘Report an Issue’
This makes it more consistent with ‘Report an issue’ under View > Debug Log.

Not using ellipsis as menu item doesn’t require user confirmation:
https://stackoverflow.com/a/637708
7 years ago