Commit Graph

317 Commits

Author SHA1 Message Date
Scott Nonnenberg 8add0ac8a1
Enable CI and packaged builds with Electron v3 (#2939)
* Update spectron to fix linux CI runs

* Point test-release grunt task at release folder

* Ensure that build folders of socks/smart-buffer are in build

* AppVeyor: windows build output folder is now release

* Travis: Force build output to release directory
2018-11-27 16:20:48 -08:00
Scott Nonnenberg 3e0abe80eb Update proxy-agent to latest 2018-11-27 09:53:02 -08:00
Scott Nonnenberg bdec2d4781 Update icon-gen for Electron v3 compatibility 2018-11-26 18:14:22 -08:00
Scott Nonnenberg 97bfe5859c Update lodash to latest release 2018-11-26 18:09:50 -08:00
Scott Nonnenberg 68af1ae1ea Show dialog if application fails to start up properly 2018-11-26 15:26:22 -08:00
Scott Nonnenberg dc2afe4b6e Update websocket dep; 1.0.25 was causing errors w/Electron3 2018-11-26 15:26:04 -08:00
Scott Nonnenberg 58544472c8 Upgrade to node 10.13.0; update chokidar, its dep upath fails 2018-11-26 15:26:04 -08:00
Scott Nonnenberg 6039c29d12 Update to Electron3; reinstall native deps for nan which builds 2018-11-26 15:26:04 -08:00
Scott Nonnenberg d600c384cf yarn.lock: Update to latest yarn, add integrity fields 2018-11-26 15:26:04 -08:00
sachaaaaa 13858dfa66 yarn.lock and fix missing variable in transmission error handling 2018-10-26 10:12:26 +11:00
sachaaaaa 6d84eb69e7 upgrade node-fetch to 2.2.0 2018-10-09 14:41:14 +11:00
Scott Nonnenberg ecb126e74c
Custom linter to check code quality (#2753) 2018-09-20 15:24:52 -07:00
Scott Nonnenberg 998c35dcb3 Split configuration into low and high traffic files
Also, we're now handling config ourselves instead of using
electron-config and config dependencies.
2018-08-29 10:40:16 -07:00
Scott Nonnenberg f59ec92fef Routine update to Electron v2.0.8 2018-08-28 13:54:03 -07:00
Scott Nonnenberg e13f431456 Build libcrypto.a on Ubuntu 14.04 for maximum compatibility 2018-08-02 19:12:18 -07:00
Scott Nonnenberg fe84e92359 node-sqlcipher update: always build, statically link openssl 2018-08-02 17:32:51 -07:00
Scott Nonnenberg ce2f3bd3c4 Statically compile openssl into sqlcipher for linux targets 2018-08-01 10:58:26 -07:00
Scott Nonnenberg f9780f85bf Yarn lockfile catch-up 2018-07-31 17:17:53 -07:00
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
2018-07-31 17:08:45 -07:00
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
2018-07-17 15:58:07 -07:00
Scott Nonnenberg 43a44793c5 Remove jshint - move everything over to eslint
Also removed all hints of previous linters
2018-07-17 15:54:32 -07:00
Scott Nonnenberg 8eeaad8e18 Remove unused export/import functionality 2018-06-21 11:54:01 -07:00
Scott Nonnenberg ec3e36824c Remove jscs from the project 2018-05-23 16:26:48 -07:00
Scott Nonnenberg cfe0bd0e79 Move to npm for several dependencies
mustache
jQuery
underscore
backbone
mocha
chai
intl-tel-input
2018-05-23 16:26:48 -07:00
Scott Nonnenberg 91c247ef8d Move all forks to @scottnonnenberg-signal account 2018-05-23 12:26:17 -07:00
Scott Nonnenberg e02887565b
Update to electron v2.0.1 (#2401)
* Remove extra parenthesis causing warnings on latest chromium

* Update to electron 2.0.1

* Move all @types dependencies to devDependencies

* Update electron-builder/electron-updater

* Update to Node.js 8.9.3 to match Electron 2.0.1
2018-05-23 12:17:58 -07:00
Scott Nonnenberg 4e5c8965ff Move to react for newlines, emoji, and links in message body 2018-05-14 16:09:37 -07:00
Scott Nonnenberg 41be7f126b Visuals for embedded contacts as well as contact detail screen 2018-05-07 19:09:55 -07:00
Daniel Gasienica 58399549c3 Add `protobufjs` dependency 2018-05-07 21:53:39 -04:00
Daniel Gasienica 38b23c6627 Add `@types/semver` 2018-05-02 20:01:56 -04:00
Daniel Gasienica 0b4c60c272 Add `@types/sinon` 2018-05-02 19:58:33 -04:00
Daniel Gasienica e3191c9017 Remove `node-notifier` 2018-05-02 19:58:33 -04:00
Scott Nonnenberg 58fddc4e9d Remove electron builder support for publishing to S3
We do this ourselves now.
2018-05-01 09:46:36 -07:00
Daniel Gasienica 1bf3ab630c Add `eslint-config-prettier` 2018-04-30 16:52:43 -04:00
Daniel Gasienica 5ec8b1c6e1 Add `@types/jquery` 2018-04-25 15:24:51 -04:00
Daniel Gasienica 3a8c3ccdab Add `prettier` 2018-04-25 15:24:51 -04:00
Daniel Gasienica 8ef04cb1fd Move `@types/*` dependencies to `devDependencies` 2018-04-25 15:24:51 -04:00
Daniel Gasienica 10bede85c9 Add `filesize` dependency 2018-04-25 15:24:50 -04:00
Daniel Gasienica 9533c09707 Add `@types/lodash` 2018-04-25 15:24:50 -04:00
Scott Nonnenberg 21bf02c94d
Fixed examples in Quote.md, rough Android visuals 2018-04-13 18:05:44 -07:00
Daniel Gasienica 9d159da79c Add Microsoft contributed TSlint rules: `tslint-microsoft-contrib` 2018-04-11 19:45:31 -04:00
Daniel Gasienica 9d41b86162 Remove escaping from `linkText`
We leverage jQuery’s HTML escaping in `$.html(…)`.
2018-04-11 16:36:42 -04:00
Daniel Gasienica d9381c543e Add `linkify-it` dependency 2018-04-11 16:36:42 -04:00
Daniel Gasienica 6f8dee402d Add `@types/mocha` 2018-04-11 16:36:42 -04:00
Daniel Gasienica 7ac4bee959 Add `@types/chai` 2018-04-11 16:36:42 -04:00
Daniel Gasienica 78ba4eddc1 Add `@types/lodash` 2018-04-11 16:36:42 -04:00
Daniel Gasienica f5641fe6d6 Add `link-text` dependency
It only has the minimum required dependencies:
- `linkify-it`: Best-in-class link detection library with support for
                Unicode/IDN.
- `escape-html`: Standalone dependency for escaping HTML.
- `uc.micro`: Standalone dependency of Unicode data files.
2018-04-11 16:36:42 -04:00
Scott Nonnenberg be91a89d68
Parse theme from querystring, put on util. Moment from require()
We also fully set up i18n and put it on util as well as making
it available on windows.i18n for Backbone views.
2018-04-05 08:31:43 -07:00
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.
2018-04-04 16:08:38 -07:00
Scott Nonnenberg 893fb1cb9e
Introduce React/TypeScript/TSLint into app for new UI components
npm run transpile
  Works on files under js/react/
  Outputs files right next to the .tsx file

This is part of our `grunt dev` task, as well as the default grunt task,
which does everything else necessary to get a raw git checkout ready to
run.
2018-04-04 16:08:27 -07:00
Scott Nonnenberg 1ad2b080c8
Move moment from bower deps to npm deps 2018-04-04 16:00:38 -07:00
Daniel Gasienica 29832c445a Add `@sindresorhus/is` dependency
This will allow us to do runtime and, once we have TypeScript support,
compile-time type checks.
2018-04-04 17:40:19 -04:00
Scott Nonnenberg 4e6d1e128f
Update to electron 1.8.4 (#2186) 2018-03-26 14:39:55 -07:00
Daniel Gasienica 7eaa6ef2f7 Remove `string-to-arraybuffer` dependency
The function is simple enough to inline and this allows us to reduce our
dependencies surface area.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 19a70ad8b8 Add `to-arraybuffer` dependency
Used for converting Node.js buffers to `ArrayBuffer`.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 0fc2868f0e Remove `tempy` dependency
We already use `tmp`.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 14f58281bc Add `string-to-array-buffer` as dev dependency
Used for testing attachment data migration.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 925ddbd7db Add `tempy` as dev dependency
Useful for creating random temporary directories for testing.
2018-03-26 16:38:34 -04:00
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!
2018-03-20 11:53:22 -07:00
Scott Nonnenberg fd056e1b4c
Add nsp to dev dependencies and to travis and CI scripts 2018-03-14 14:42:13 -07:00
Daniel Gasienica c317f34f67 Remove `ensure-error` and `clean-error` dependency
It potentially could leak information from serialized non-errors that are thrown
due to `util.inspect`.
2018-03-08 17:45:55 -05:00
Daniel Gasienica 96442967cc Add `eslint-plugin-mocha`
Allows us to set various lint rules for our tests.
2018-03-08 16:23:51 -05:00
Daniel Gasienica ef40dfa841 Use forked `electron-unhandled`
Omits use of `ensure-error` for privacy.

Before:
`Uncaught error or unhandled promise rejection: NonError: { private: true }`

After:
`Uncaught error or unhandled promise rejection: [object Object]`

Tested using:

```
setTimeout(() => {
  throw new Error('sync: booooom!');
}, 5000);

setTimeout(() => {
  Promise.reject(new Error('async: promise'))
}, 10000);

setTimeout(() => {
  Promise.reject({private: true});
}, 15000);
```
2018-03-08 16:23:51 -05:00
Daniel Gasienica 9e5fec1d81 Add `electron-unhandled` dependency 2018-03-08 16:22:37 -05:00
Daniel Gasienica 0810ea6909 Remove `superagent` dependency
We’ve replaced it with more modern and Node.js based `got`:
https://www.npmjs.com/package/got
2018-03-08 16:21:27 -05:00
Daniel Gasienica 04afb6a318 Add `form-data` dependency
Used for upload debug logs to S3.
2018-03-08 16:21:27 -05:00
Daniel Gasienica b4c6f6733b Add `got` dependency
The plan is to use this for our future HTTP needs as it is:
- modern
- promise based
- popular
- likely to support custom certificate authorities (CAs)

Chosen over the following alternatives:
- superagent (older, promises added later, potential lack of custom CA support)
- axios (no team experience with it; less popular than `got`)
- request (older, heavy-weight, promises not native)
- jQuery (old, trying to move away from jQuery altogether and move towards
  declarative UIs)
- `fetch` (too low-level, no native timeout support)
2018-03-08 16:21:27 -05:00
Daniel Gasienica e289479c6b Add `superagent` dependency
HTTP client with higher-level API than `fetch` and support for timeouts, etc.
2018-03-08 16:21:27 -05:00
Daniel Gasienica a98a7ba690 Add `sinon` dev dependency
Useful tool for testing: http://sinonjs.org/
2018-03-05 10:29:11 -05:00
Daniel Gasienica 9eb1fed766
Update `yarn.lock` after manual `package.json` changes (#2097)
To update the following dependencies…

- electron-updater
- electron-builder
- electron-publisher-s3
- spectron

…`package.json` was mistakenly updated manually which prevented an update
of `yarn.lock`.

This change brings them in sync.
2018-03-02 15:22:22 -05:00
Daniel Gasienica a4c52b8d64
Upgrade to Electron 1.8.2 / Node.js 8.2.1 (#2066)
* Upgrade to Electron 1.8.2 / Node.js 8.2.1

* Update CI Node.js versions

* Make `engines` top-level property

This was accidentally included under `build` which is disallowed
by `electron-builder`.

* Refactor notification updates

Allows easier debugging through variable inspection.

* Use `appId` for Application User Model ID

Recommended in:
https://github.com/electron/electron/issues/10864#issuecomment-346229090

* Update `spectron` to 3.8.0

* Bump `electron-builder` based dependencies

* Use `config.extraMetadata` instead of `em`

Prevents `Unknown argument: em` error.

See: https://github.com/electron-userland/electron-builder/issues/2615

* Revert AUMID to be based on `packageJson.name`

In our build artifact `packageJson.build.appId` causes an NPE.
2018-03-02 14:43:03 -05:00
Daniel Gasienica a1ac810343 Security: Replace Unicode order overrides in attachment names
As a user, when I receive a file attachment, I want to have confidence that the
filename I see in the Signal Desktop app is the same as it will be on disk.

To prevent user confusion when receiving files with Unicode order override
characters, e.g. `test<LTRO>fig.exe` appearing as `testexe.gif`, we replace all
occurrences of order overrides (`U+202D` and `U+202E`) with `U+FFFD`.

**Changes**
- [x] Bump `Attachment` `schemaVersion` to 2.
- [x] Replace all Unicode order overrides in `attachment.filename`:
      `Attachment.replaceUnicodeOrderOverrides`.
- [x] Add tests for existing `Attachment.upgradeSchema`
- [x] Add tests for existing `Attachment.withSchemaVersion`
- [x] Add tests for `Attachment.replaceUnicodeOrderOverrides` positives.
- [x] Add `testcheck` generative property-based testing library
      (based on QuickCheck) to ensure valid filenames are preserved.

---

commit 855bdbc7e647e44f73b9e1f5e6d64f734c61169a
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 13:02:01 2018 -0500

    Log error stack in case of error

commit 6e053ed66aee136f186568fa88aacd4814b2ab07
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:30:28 2018 -0500

    Improve `upgradeStep` error handling

commit 8c226a2523b701cb578b2137832c3eaf3475bb2b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:30:08 2018 -0500

    Check for expected version before upgrade

    Prevents out of order upgrade steps.

commit 28b0675591e782169128f75429b7bab2a22307fa
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:29:52 2018 -0500

    Reject invalid attachments

commit 41f4f457dae9416dae66dc2fa2079483d1f127a9
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:29:36 2018 -0500

    Fix upgrade pipeline order

commit 3935629e91c49b8d96c1e02bd37b1b31d1180720
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:28:25 2018 -0500

    Avoid `_.isPlainObject`

    Attachments are deserialized from a protocol buffer and can have a
    non-plain-object constructor.

commit 39f6e7f622ff4885e2ccafa354e0edb5864c55d8
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:19:07 2018 -0500

    Define basic attachment validity

commit adcf7e3243cd90866cc35990c558ff7829019037
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 22 12:18:54 2018 -0500

    Add tests for attachment upgrade pipeline

commit 82fc4644d7e654eea9f348518b086497be2b0cb4
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 21 12:20:24 2018 -0500

    Favor `async` / `await` over `then`

commit 8fe49e3c40e78ced0b8f2eb0b678f4bae842855d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 21 12:19:59 2018 -0500

    Add `eslint-more` plugin

    This will enable us to disallow `then` in favor of `async` / `await`.

commit 020beefb25f508ae96cf3fc099599fbbca98802b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 21 11:31:49 2018 -0500

    Remove unnecessary `async` modifiers

commit 177090c5f5ad9836f0ca0a5c2f298779519e3692
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 21 11:30:55 2018 -0500

    Document `operator-linebreak` ESLint rule

commit 25622b7c59291cb672ae057c47e7327a564cca40
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 21 11:14:15 2018 -0500

    Prefix internal function with `_`

commit 6aa3cf5098df71e9b710064739ec49d74f81b7bf
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 19:00:07 2018 -0500

    Replace all Unicode order override occurrences

commit fd6e23b0a519bce3c12c5b9ac676bcd198034fed
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:48:41 2018 -0500

    Whitelist `testcheck` `check` and `gen` globals

commit 400bae9fac5078821813bc0ca17a5d7a72900161
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:46:57 2018 -0500

    🎨 Fix lint errors

commit da53d3960aa7aa36b7cc1fcff414c9e929c0d9fc
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:42:42 2018 -0500

    Add tests for `Attachment.withSchemaVersion`

commit ec203444239d9e3c443ba88cab7ef4672151072d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:42:17 2018 -0500

    Add test for `Attachment.upgradeSchema`

commit 4540d5bdf7a4279f49d2e4c6ee03f47b93df46bf
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:05:29 2018 -0500

    Rename `setSchemaVersion` --> `withSchemaVersion`

    Put the schema version first for better readability.

commit e379cf919feda31d1fa96d406c30fd38e159a11d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:03:22 2018 -0500

    Add filename sanitization to upgrade pipeline

commit 1e344a0d15926fc3e17be20cd90bfa882b65f337
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:01:55 2018 -0500

    Test that we preserve non-suspicious filenames

commit a2452bfc98f93f82bed48b438757af2e66a6af82
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 17:00:56 2018 -0500

    Add `testcheck` dependency

    Allows for generative property-based testing similar to Haskell’s QuickCheck.
    See: https://medium.com/javascript-inside/f91432247c27

commit ceb5bfd2484a77689fdb8e9edd18d4a7b093a486
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 16:15:33 2018 -0500

    Replace Unicode order override characters

    Prevents users from being tricked into clicking a file named `testexe.fig`
    that appears as `testexe.gif` due to a Unicode order override character.

    See:
    - http://unicode.org/reports/tr36/#Bidirectional_Text_Spoofing
    - https://krebsonsecurity.com/2011/09/right-to-left-override-aids-email-attacks/

commit bc605afb1c6af3a5ebc31a4c1523ff170eb96ffe
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 16:12:29 2018 -0500

    Remove `CURRENT_PROCESS_VERSION`

    Reintroduce this whenever we need it. We currently only deal with schema version
    numbers within this module.
2018-02-22 13:21:53 -05:00
Daniel Gasienica a0da73ca8d Auto-orient image attachments based on EXIF metadata
As described in #998, images are sometimes displayed with an incorrect
orientation. This is because cameras often write files in the native sensor byte
order and attach the `Orientation` EXIF metadata to tell end-user devices how to
display the images based on the original author’s capture orientation.

Electron/Chromium (and therefore Signal Desktop) currently doesn’t support
applying this metadata for `<img>` tags, e.g. CSS `image-orientation: from-
image`. As a workaround, this change uses the `loadImage` library with the
`orientation: true` flag to auto-orient images ~~before display~~ upon receipt
and before sending.

**Changes**
- [x] ~~Auto-orient images during display in message list view~~
  - [x] Ensure image is not displayed until loaded (to prevent layout reflow) .
- [x] Auto-orient images upon receipt and before storing in IndexedDB
      (~~or preserve original data until Chromium offers native fix?~~)
- [x] Auto-orient images in compose area preview.
- [x] ~~Auto-orient images in lightbox view~~
- [x] Auto-orient images before sending / storage.
- [x] Add EditorConfig for sharing code styles across editors.
- [x] Fix ESLint ignore file.
- [x] Change `function-paren-newline` ESLint rule from
      `consistent` to `multiline`.
- [x] Add `operator-linebreak` ESLint rule for consistency.
- [x] Added `blob-util` dependency for converting between array buffers,
      blobs, etc.
- [x] Extracted `createMessageHandler` to consolidate logic for
      `onMessageReceived` and `onSentMessage`.
- [x] Introduce `async` / `await` to simplify async coding (restore control flow
      for branching, loops, and exceptions).
- [x] Introduce `window.Signal` namespace for exposing ES2015+ CommonJS modules.
- [x] Introduce rudimentary `Message` and `Attachment` types to begin defining a
      schema and versioning. This will allow us to track which changes, e.g.
      auto-orient JPEGs, per message / attachment as well as which fields
    are stored.
- [x] Renamed `window.dataURLtoBlob` to `window.dataURLToBlobSync` to both fix
      the strange `camelCase` as well as to highlight that this operation is
      synchronous and therefore blocks the user thread.
- [x] Normalize all JPEG MIME types to `image/jpeg`, eliminating the
      invalid `image/jpg`.
- [x] Add `npm run test-modules` command for testing non-browser specific
      CommonJS modules.
- **Stretch Goals**
  - [ ] ~~Restrict `autoOrientImage` to `Blob` to narrow API interface.~~ Do
        this once we use PureScript.
  - [ ] ~~Return non-JPEGs as no-op from `autoOrientImage`.~~ Skipping
        `autoOrientImage` for non-JPEGs altogether.
  - [ ] Retroactively auto-orient existing JPEG image attachments in the
        background.

---

Fixes #998

---

- **Blog:** EXIF Orientation Handling Is a Ghetto:
    https://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/
- **Chromium Bug:** EXIF orientation is ignored:
    https://bugs.chromium.org/p/chromium/issues/detail?id=56845
- **Chromium Bug:** Support for the CSS image-orientation CSS property:
    https://bugs.chromium.org/p/chromium/issues/detail?id=158753

---

commit ce5090b473a2448229dc38e4c3f15d7ad0137714
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 16 10:35:36 2018 -0500

    Inline message descriptors

commit 329036e59c138c1e950ec7c654eebd7d87076de5
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 15 17:34:40 2018 -0500

    Clarify order of operations

    Semantically, it makes more sense to do `getFile` before `clearForm`
    even though it seems to work either way.

commit f9d4cfb2ba0d8aa308b0923bbe6066ea34cb97bd
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 15 17:18:26 2018 -0500

    Simplify `operator-linebreak` configuration

    Enabling `before` caused more code changes and it turns out our previous
    configuration is already the default.

commit db588997acdd90ed2ad829174ecbba744383c78b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 15 17:15:59 2018 -0500

    Remove obsolete TODO

commit 799c8817633f6afa0b731fc3b5434e463bd850e3
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 15 17:12:18 2018 -0500

    Enable ESLint `function-paren-newline` `multiline`

    Per discussion.

commit b660b6bc8ef41df7601a411213d6cda80821df87
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Thu Feb 15 17:10:48 2018 -0500

    Use `messageDescriptor.id` not `source`

commit 5e7309d176f4a7e97d3dc4c738e6b0ccd4792871
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 16:29:01 2018 -0500

    Remove unnecessary `eslint-env`

commit 393b3da55eabd7413596c86cc3971b063a0efe31
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 16:19:17 2018 -0500

    Refactor `onSentMessage` and `onMessageReceived`

    Since they are so similar, we create the handlers using new
    `createMessageHandler` function. This allows us to ensure both synced and
    received messages go through schema upgrade pipeline.

commit b3db0bf179c9a5bea96480cde28c6fa7193ac117
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 16:18:21 2018 -0500

    Add `Message` descriptor functions

commit 8febf125b1b42fe4ae1888dd50fcee2749dc1ff0
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 14:46:56 2018 -0500

    Fix typo

commit 98d951ef77bd578b313a4ff4b496b793e82e88d5
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 12:22:39 2018 -0500

    Remove `promises` reference

commit a0e9559ed5bed947dabf28cb672e63d39948d854
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 12:22:13 2018 -0500

    Fix `AttachmentView::mediaType` fall-through

commit 67be916a83951b8a1f9b22efe78a6da6b1825f38
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 12:03:41 2018 -0500

    Remove minor TODOs

commit 0af186e118256b62905de38487ffacc41693ff47
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 11:44:41 2018 -0500

    Enable ESLint for `js/views/attachment_view.js`

commit 28a2dc5b8a28e1a087924fdc7275bf7d9a577b92
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 11:44:12 2018 -0500

    Remove dynamic type checks

commit f4ce36fcfc2737de32d911cd6103f889097813f6
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 11:27:56 2018 -0500

    Rename `process` to `upgradeSchema`

    - `Message.process` -> `Message.upgradeSchema`
    - `Attachment.process` -> `Attachment.upgradeSchema`
    - `Attachment::processVersion` -> `Attachment::schemaVersion`

    Document version history.

commit 41b92c0a31050ba05ddb1c43171d651f3568b9ac
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 11:11:50 2018 -0500

    Add `operator-linebreak` ESLint rule

    Based on the following discussion:
    https://github.com/signalapp/Signal-Desktop/pull/2040#discussion_r168029106

commit 462defbe55879060fe25bc69103d4429bae2b2f6
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Wed Feb 14 11:01:30 2018 -0500

    Add missing `await` for `ConversationController.getOrCreateAndWait`

    Tested this by setting `if` condition to `true` and confirming it works.
    It turns rotating a profile key is more involved and might require
    registering a new account according to Matthew.

commit c08058ee4b883b3e23a40683de802ac81ed74874
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 16:32:24 2018 -0500

    Convert `FileList` to `Array`

commit 70a6c4201925f57be1f94d9da3547fdefc7bbb53
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 15:46:34 2018 -0500

    🎨 Fix lint errors

commit 2ca7cdbc31d4120d6c6a838a6dcf43bc209d9788
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 15:07:09 2018 -0500

    Skip `autoOrientImage` for non-JPEG images

commit 58eac383013c16ca363a4ed33dca5c7ba61284e5
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 14:55:35 2018 -0500

    Move new-style modules to `window.Signal` namespace

commit 02c9328877dce289d6116a18b1c223891bd3cd0b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 14:35:23 2018 -0500

    Extract `npm run test-modules` command

commit 2c708eb94fba468b81ea9427734896114f5a7807
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 13:25:51 2018 -0500

    Extract `Message.process`

commit 4a2e52f68a77536a0fa04aa3c29ad3e541a8fa7e
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 13:25:12 2018 -0500

    Fix EditorConfig

commit a346bab5db082720f5d47363f06301380e870425
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 13:13:02 2018 -0500

    Remove `vim` directives on ESLint-ed files

commit 7ec885c6359e495b407d5bc3eac9431d47c37fc6
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 13:08:24 2018 -0500

    Remove CSP whitelisting of `blob:`

    We no longer use `autoOrientImage` using blob URLs. Bring this back if we
    decide to auto-orient legacy attachments.

commit 879b6f58f4a3f4a9ed6915af6b1be46c1e90e0ca
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:57:05 2018 -0500

    Use `Message` type to determine send function

    Throws on invalid message type.

commit 5203d945c98fd2562ae4e22c5c9838d27dec305b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:56:48 2018 -0500

    Whitelist `Whisper` global

commit 8ad0b066a3690d3382b86bf6ac00c03df7d1e20b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:56:32 2018 -0500

    Add `Whisper.Types` namespace

    This avoids namespace collision for `Whisper.Message`.

commit 785a949fce2656ca7dcaf0869d6b9e0648114e80
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:55:43 2018 -0500

    Add `Message` type

commit 674a7357abf0dcc365455695d56c0479998ebf27
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:35:23 2018 -0500

    Run ESLint on `Conversation::sendMessage`

commit cd985aa700caa80946245b17ea1b856449f152a0
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:34:38 2018 -0500

    Document type signature of `FileInputView::readFile`

commit d70d70e52c49588a1dc9833dfe5dd7128e13607f
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:31:16 2018 -0500

    Move attachment processing closer to sending

    This helps ensure processing happens uniformly, regardless of which code
    paths are taken to send an attachment.

commit 532ac3e273a26b97f831247f9ee3412621b5c112
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:22:29 2018 -0500

    Process attachment before it’s sent

    Picked this place since it already had various async steps, similar to
    `onMessageReceived` for the incoming `Attachment.process`.

    Could we try have this live closer to where we store it in IndexedDB, e.g.
    `Conversation::sendMessage`?

commit a4582ae2fb6e1d3487131ba1f8fa6a00170cb32c
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 12:21:42 2018 -0500

    Refactor `getFile` and `getFiles`

    Lint them using ESLint.

commit 07e9114e65046d791fc4f6ed90d6e2e938ad559d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:37:31 2018 -0500

    Document incoming and outgoing attachments fields

    Note how outgoing message attachments only have 4 fields. This presumably
    means the others are not used in our code and could be discarded for
    simplicity.

commit fdc3ef289d6ec1be344a12d496839d5ba747bb6a
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:36:21 2018 -0500

    Highlight that `dataURLToBlob` is synchronous

commit b9c6bf600fcecedfd649ef2ae3c8629cced4e45a
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:35:49 2018 -0500

    Add EditorConfig configuration

commit e56101e229d56810c8e31ad7289043a152c6c449
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:34:23 2018 -0500

    Replace custom with `blob-util` functions

    IMPORTANT: All of them are async so we need to use `await`, otherwise we get
    strange or silent errors.

commit f95150f6a9569fabcb31f3acd9f6b7bf50b5d145
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:17:30 2018 -0500

    Revert "Replace custom functions with `blob-util`"

    This reverts commit 8a81e9c01bfe80c0e1bf76737092206c06949512.

commit 33860d93f3d30ec55c32f3f4a58729df2eb43f0d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:13:02 2018 -0500

    Revert "Replace `blueimp-canvas-to-blob` with `blob-util`"

    This reverts commit 31b3e853e4afc78fe80995921aa4152d9f6e4783.

commit 7a0ba6fed622d76a3c39c7f03de541a7edb5b8dd
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 11:12:58 2018 -0500

    Replace `blueimp-canvas-to-blob` with `blob-util`

commit 47a5f2bfd8b3f546e27e8d2b7e1969755d825a66
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 10:55:34 2018 -0500

    Replace custom functions with `blob-util`

commit 1cfa0efdb4fb1265369e2bf243c21f04f044fa01
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 10:47:02 2018 -0500

    Add `blob-util` dependency

commit 9ac26be1bd783cd5070d886de107dd3ad9c91ad1
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 10:46:44 2018 -0500

    Document why we drop original image data during auto-orient

commit 4136d6c382b99f41760a4da519d0db537fa7de8d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 10:46:27 2018 -0500

    Extract `DEFAULT_JPEG_QUALITY`

commit 4a7156327eb5f94dba80cb300b344ac591226b0e
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 10:37:11 2018 -0500

    Drop support for invalid `image/jpg` MIME type

commit 69fe96581f25413194032232f1bf704312e4754c
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:54:30 2018 -0500

    Document `window.onInvalidStateError` global

commit a48ba1c77458da38583ee9cd488f70a59f6ee0fd
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:54:04 2018 -0500

    Selectively run ESLint on `js/background.js`

    Enabling ESLint on a per function basis allows us to incrementally improve
    the codebase without requiring large and potentially risky refactorings.

commit e6d1cf826befc17ad4ec72fda8e761701665635e
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:16:23 2018 -0500

    Move async attachment processing to `onMessageReceived`

    We previously processed attachments in `handleDataMessage` which is mostly a
    synchronous function, except for the saving of the model. Moving the
    processing into the already async `onMessageReceived` improves code clarity.

commit be6ca2a9aae5b59c360817deb1e18d39d705755e
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:14:49 2018 -0500

    Document import of ES2015+ modules

commit eaaf7c41608fb988b8f4bbaa933cff110115610e
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:14:29 2018 -0500

    🎨 Fix lint error

commit a25b0e2e3d0f72c6a7bf0a15683f02450d5209ee
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:13:57 2018 -0500

    🎨 Organize `require`s

commit e0cc3d8fab6529d01b388acddf8605908c3d236b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 09:07:17 2018 -0500

    Implement attachment process version

    Instead of keeping track of last normalization (processing) date, we now
    keep track of an internal processing version that will help us understand
    what kind of processing has already been completed for a given attachment.
    This will let us retroactively upgrade existing attachments.

    As we add more processing steps, we can build a processing pipeline that can
    convert any attachment processing version into a higher one,
    e.g. 4 -> 5 -> 6 -> 7.

commit ad9083d0fdb880bc518e02251e51a39f7e1c585f
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:50:31 2018 -0500

    Ignore ES2015+ files during JSCS linting

commit 96641205f734927aaebc2342d977c555799c3e3b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:48:07 2018 -0500

    Improve ESLint ignore rules

    Apparently, using unqualified `/**` patterns prevents `!` include patterns.
    Using qualified glob patterns, e.g. `js/models/**/*.js`, lets us work
    around this.

commit 255e0ab15bd1a0ca8ca5746e42d23977c8765d01
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:44:59 2018 -0500

    🔤 ESLint ignored files

commit ebcb70258a26f234bd602072ac7c0a1913128132
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:35:47 2018 -0500

    Whitelist `browser` environment for ESLint

commit 3eaace6f3a21421c5aaaaf01592408c7ed83ecd3
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:35:05 2018 -0500

    Use `MIME` module

commit ba2cf7770e614415733414a2dcc48f110b929892
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:32:54 2018 -0500

    🎨 Fix lint errors

commit 65acc86e8580e88f7a6611eb4b8fa5d7291f7a3f
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:30:42 2018 -0500

    Add ES2015+ files to JSHint ignored list

commit 8b6494ae6c9247acdfa059a9b361ec5ffcdb39f0
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:29:20 2018 -0500

    Document potentially unexpected `autoScale` behavior

commit 8b4c69b2002d1777d3621be10f92cbf432f9d4d6
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:26:47 2018 -0500

    Test CommonJS modules separately

    Not sure how to test them as part of Grunt `unit-tests` task as
    `test/index.html` doesn’t allow for inclusion of CommonJS modules that use
    `require`. The tests are silently skipped.

commit 213400e4b2bba3efee856a25b40e269221c3c39d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Tue Feb 13 08:24:27 2018 -0500

    Add `MIME` type module

commit 37a726e4fb4b3ed65914463122a5662847b5adee
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 20:18:05 2018 -0500

    Return proper `Error` from `blobArrayToBuffer`

commit 164752db5612220e4dcf58d57bcd682cb489a399
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 20:15:41 2018 -0500

    🎨 Fix ESLint errors

commit d498dd79a067c75098dd3179814c914780e5cb4f
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 20:14:33 2018 -0500

    Update `Attachment` type field definitions

commit 141155a1533ff8fb616b70ea313432781bbebffd
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 20:12:50 2018 -0500

    Move `blueimp-canvas-to-blob` from Bower to npm

commit 7ccb833e5d286ddd6235d3e491c62ac1e4544510
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:33:50 2018 -0500

    🎨 Clarify data flow

commit e7da41591fde5a830467bebf1b6f51c1f7293e74
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:31:21 2018 -0500

    Use `blobUrl` for consistency

commit 523a80eefe0e2858aa1fb2bb9539ec44da502963
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:28:06 2018 -0500

    Remove just-in-time image auto-orient for lightbox

    We can bring this back if our users would like auto-orient for old
    attachments.

commit 0739feae9c47dd523c10740d6cdf746d539f270c
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:27:21 2018 -0500

    Remove just-in-time auto-orient of message attachments

    We can bring this back if our users would like auto-orient for old
    attachments. But better yet, we might implement this as database migration.

commit ed43c66f92830ee233d5a94d0545eea4da43894d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:26:24 2018 -0500

    Auto-orient JPEG attachments upon receipt

commit e2eb8e36b017b048d57602fca14e45d657e0e1a1
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:25:26 2018 -0500

    Expose `Attachment` type through `Whisper.Attachment`

commit 9638fbc987b84f143ca34211dc4666d96248ea2f
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:23:39 2018 -0500

    Use `contentType` from `model`

commit 032c0ced46c3876cb9474b26f9d53d6f1c6b16a0
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:23:04 2018 -0500

    Return `Error` object for `autoOrientImage` failures

commit ff04bad8510c4b21aef350bed2b1887d0e055b98
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:22:32 2018 -0500

    Add `options` for `autoOrientImage` output type / quality

commit 87745b5586d1e182b51c9f9bc5e4eaf6dbc16722
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:18:46 2018 -0500

    Add `Attachment` type

    Defines various functions on attachments, e.g. normalization
    (auto-orient JPEGs, etc.)

commit de27fdc10a53bc8882a9c978e82265db9ac6d6f5
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 16:16:34 2018 -0500

    Add `yarn grunt` shortcut

    This allows us to use local `grunt-cli` for `grunt dev`.

commit 59974db5a5da0d8f4cdc8ce5c4e3c974ecd5e754
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 10:10:11 2018 -0500

    Improve readability

commit b5ba96f1e6f40f2e1fa77490c583217768e1f412
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 10:08:12 2018 -0500

    Use `snake_case` for module names

    Prevents problems across case-sensitive and case-insensitive file systems.

    We can work around this in the future using a lint rule such as
    `eslint-plugin-require-path-exists`.
    See discussion:
    https://github.com/signalapp/Signal-Desktop/pull/2040#discussion_r167365931

commit 48c5d3155c96ef628b00d99b52975e580d1d5501
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Mon Feb 12 10:05:44 2018 -0500

    🎨 Use destructuring

commit 4822f49f22382a99ebf142b337375f7c25251d76
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 17:41:40 2018 -0500

    Auto-orient images in lightbox view

commit 7317110809677dddbbef3fadbf912cdba1c010bf
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 17:40:14 2018 -0500

    Document magic number for escape key

commit c790d07389a7d0bbf5298de83dbcfa8be1e7696b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 17:38:35 2018 -0500

    Make second `View` argument an `options` object

commit fbe010bb63d0088af9dfe11f153437fab34247e0
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 17:27:40 2018 -0500

    Allow `loadImage` to fetch `blob://` URLs

commit ec35710d002b019a273eeb48f94dcaf2babe5d96
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:57:48 2018 -0500

    🎨 Shorten `autoOrientImage` import

commit d07433e3cf316c6a143a0c9393ba26df9e3af17b
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:57:19 2018 -0500

    Make `autoOrientImage` module standalone

commit c285bf5e33cdf10e0ef71e72cd6f55aef0df96ef
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:55:44 2018 -0500

    Replace `loadImage` with `autoOrientImage`

commit 44318549235af01fd061c25f557c93fd21cebb7a
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:53:23 2018 -0500

    Add `autoOrientImage` module

    This module exposes `loadImage` with a `Promise` based interface and pre-
    populates `orientation: true` option to auto-orient input. Returns data URL
    as string.

    The module uses a named export as refactoring references of modules with
    `default` (`module.exports`) export references can be error-prone.
    See: https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html

commit c77063afc6366fe49615052796fe46f9b369de39
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:44:30 2018 -0500

    Auto-orient preview images

    See: #998

commit 06dba5eb8f662c11af3a9ba8395bb453ab2e5f8d
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:43:23 2018 -0500

    TODO: Use native `Canvas::toBlob`

    One challenge is that `Canvas::toBlob` is async whereas
    `dataURLtoBlob` is sync.

commit b15c304a3125dd023fd90990e6225a7303f3596f
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 16:42:45 2018 -0500

    Make `null` check strict

    Appeases JSHint. ESLint has a nice `smart` option for `eqeqeq` rule:
    https://eslint.org/docs/rules/eqeqeq#smart

commit ea70b92d9b18201758e11fdc25b09afc97b50055
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 15:23:58 2018 -0500

    Use `Canvas::toDataURL` to preserve `ImageView` logic

    This way, all the other code paths remain untouched in case we want to
    remove the auto-orient code once Chrome supports the `image-orientation`
    CSS property.

    See:
    - #998
    - https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation

commit 62fd744f9f27d951573a68d2cdfe7ba2a3784b41
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 14:38:04 2018 -0500

    Use CSS to constrain auto-oriented images

commit f4d3392687168c237441b29140c7968b49dbef9e
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 14:35:02 2018 -0500

    Replace `ImageView` `el` with auto-oriented `canvas`

    See: #998

commit 1602d7f610e4993ad1291f88197f9ead1e25e776
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 14:25:48 2018 -0500

    Pass `Blob` to `View` (for `ImageView`)

    This allows us to do JPEG auto-orientation based on EXIF metadata.

commit e6a414f2b2a80da1137b839b348a38510efd04bb
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 14:25:12 2018 -0500

    🔪 Remove newline

commit 5f0d9570d7862fc428ff89c2ecfd332a744537e5
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 11:17:02 2018 -0500

    Expose `blueimp-load-image` as `window.loadImage`

commit 1e1c62fe2f6a76dbcf1998dd468c26187c9871dc
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 11:16:46 2018 -0500

    Add `blueimp-load-image` npm dependency

commit ad17fa8a68a21ca5ddec336801b8568009bef3d4
Author: Daniel Gasienica <daniel@gasienica.ch>
Date:   Fri Feb 9 11:14:40 2018 -0500

    Remove `blueimp-load-image` Bower dependency
2018-02-21 10:28:13 -05:00
Scott Nonnenberg 7ceeb8bac4
Update electron to 1.7.12 (#2029) 2018-02-02 10:04:38 -08:00
Scott Nonnenberg 5bb6b2f77f
Update to latest Electron 1.7.x (#1996)
Fixes #1991, related to IME input on Mac.
2018-01-23 13:48:30 -08:00
Scott Nonnenberg 9ef8228ff8
Update electron-builder to latest, with .ico fix (#1976) 2018-01-17 15:27:18 -08:00
Scott Nonnenberg 177dfb3220
Dependency updates, fixes required for successful release (#1966)
* A number of fixes required for successful build after upgrades

- extract now takes an absolute directory only
- something changed, so we now need to force NODE_ENV=production; we use
  electron-is-dev for this
- electron-builder, electron-publisher-s3, and electron-updater are now
  updated to their latest available versions

* Add direct dependency on extract-zip, since we use it directly

* Load 'config' module after we've modified NODE_ENV

* Downgrade electron-builder due to bug, downgrade icon-maker too

The latest electron-builder came with a fix for one of our bugs as well
as a new bug that blocks builds on Windows: https://github.com/electron-userland/electron-builder/issues/2462

There's no good reason to upgrade icon-maker. And a good reason to keep at the version on github: https://github.com/jaretburkett/electron-icon-maker/issues/7
2018-01-12 16:14:45 -08:00
Scott Nonnenberg 64fe9dbfb2
Clean logs on start - and eslint/mocha with code coverage (#1945)
* Clean logs on startup; install server-side testing/linting

* Add eslint config, make all of app/ conform to its demands

* Add Node.js testing and linting to CI

* Lock project to Node.js 7.9.0, used by Electron 1.7.10

* New eslint error: trailing commas in function argumensts

Node 7.9.0 doesn't like trailing commas, but Electron does

* Move electron to devDependency, tell eslint it's built-in
2018-01-08 13:19:25 -08:00
Scott Nonnenberg 94a8c7e524
Update a number of dependencies to the latest: builder, websocket, spellcheck (#1920)
* Update builder to the latest

* Upgrade a number of dependencies
2018-01-08 10:48:15 -08:00
Scott Nonnenberg 8fd0adc486
Update to Electron 1.7.10 (#1919) 2018-01-04 16:20:41 -08:00
Scott Nonnenberg 5caee59921
Support the latest phone number formats via libphonenumber (#1899)
* Update to the latest google-libphonenumber

* Update package.json to the format uses when updating it
2017-12-14 16:30:24 -08:00
Scott Nonnenberg 18ee8a3557
Remove obsolete emoji via a new fork of emoji-panel (#1893)
In many cases this removes generic emoji in favor of new gendered
options (one of which was a copy of the previous generic emoji anyway).
2017-12-14 11:30:41 -08:00
Scott Nonnenberg b17a67ec65
Support pass-through proxies with HTTPS_PROXY env var (#1878)
We've simplified; HTTPS_PROXY or https_proxy is used for all requests.

We also require that only our self-signed certificates are used for
secure traffic. That rules out all SSL-terminating MITM proxies, since
we don't trust their root certificate.

Once we're sure that this system works for people, we'll improve config
on MacOS and Windows.
2017-12-08 10:38:01 -08:00
Scott Nonnenberg acc94edd23
Add proxy support based on environment variables (#1855)
We pull proxy settings from environment variables:

- HTTPS_PROXY for sending, profile pulls, and attachment download/upload
- WSS_PROXY for connecting to the websocket for receiving messages
- ALL_PROXY to provide one server for both

More details on our proxy handling:

- https://github.com/Rob--W/proxy-from-env#environment-variables
- https://github.com/TooTallNate/node-proxy-agent

This is the natural way of things for Linux. My understanding is that
most proxies on MacOS are system-wide and transparent, so it's not so
urgent. But Windows will likely require further UI for configuration.
Will need to do some testing with Windows users.
2017-12-04 15:35:50 -08:00
Lilia 9c7ba87d6a Add support for Emoji 5 (#1797)
* Add support for Emoji 5

Update to latest emoji-datasource and emoji-js and switch to an up-to-date fork
of emoji-panel.

// FREEBIE

* Dark theme support for emoji-panel

Fixes #1763

// FREEBIE
2017-11-27 15:54:59 -08:00
Scott Nonnenberg 17f0bb42bc
deployment: update electron-publisher-s3 to match builder update 2017-11-22 17:37:54 -08:00
Scott Nonnenberg 16ad94148a
Introduce library for notifications on downlevel windows (#1812) 2017-11-22 13:50:52 -08:00
Scott Nonnenberg be2d4535a8
yarn.lock and libtextsecure.js catchup 2017-11-21 19:10:22 -08:00
Scott Nonnenberg f7140af9cb
Update to the latest 1.7.x electron (#1736) 2017-11-08 17:32:52 -08:00
Scott Nonnenberg 9e6d50b966
Merge branch 'master' into development
Bringing our development (beta) branch inline with all the more urgent
fixes which went directly into the master (production) branch.
2017-11-08 17:02:00 -08:00
Scott Nonnenberg d098328ee2
Update to the latest Electron 1.6.x (#1666) 2017-11-01 19:06:46 -07:00
Lilia 1f967abf0a Update libphonenumber (#1598)
* Update libphonenumber

Also switch from bower to yarn for managing this dependency.

// FREEBIE

* Remove libphonenumber from bower.json

// FREEBIE
2017-10-30 14:45:57 -07:00
Lilia fb931b4733 Emoji picker (#1608)
* Add emoji button and popup panel

This integrates a simple third party emoji panel with a few css overrides to
correct some relative paths and colors.

The trickiest thing about this is ensuring we don't break the layout, which is
acheived through precise control over the panel's height, and prodigious calls
to updateMessageFieldSize.

// FREEBIE

* Don't close emoji panel on click, do close on send

To better facilitate multiple emoji entry.

// FREEBIE

* Make panel emojis bigger and higher resolution

// FREEBIE

* Move paperclip button to the right of the microphone

This makes our bottom-bar button arrangement more comfortable and consistent
with Android.

// FREEBIE

* Move emoji picker padding to inner container

* Insert emojis at cursor position

Don't just append to the end like a n00b! Also handle selected text correctly.
https://stackoverflow.com/questions/11076975

// FREEBIE

* A few visual tweaks to reduce visual complexity of emoji panel

- No gray buffer on the right side of the emoji panel
- No gray buffer between message compose text box and emoji window
- The scroll bar for the emojis is the same as our normal scrollbars
2017-10-30 13:54:55 -07:00
Lilia af8b0164b5 Move to node fetch API for web requests instead of XHR (#1552)
* Use node-fetch instead of xhr

* Remove XMLHttpRequest.js

// FREEBIE

* Avoid calling json() on non json responses

Previously we would catch and swallow JSON parsing errors resulting from an
empty response, though empty responses are normal from a few endpoints, like
requesting sms or voice registration codes.

Since the JSON parsing call is now handled internally by node-fetch, we have to
keep closer track of our expected response type to avoid throwing an exception.

// FREEBIE
2017-10-20 15:52:02 -07:00
Scott Nonnenberg 0291882328 Update electron-updater and supply it with windows/publisherName (#1535)
This ensures that the signing certificate of any binary pulled down as
part of auto-update on Windows is in the CA chain (not self-signed) and
has the right publisherName. electron-updater also rejects any unsigned
binary when asked to check the publisherName.

FREEBIE
2017-10-04 14:05:23 -07:00
Scott Nonnenberg 29053059b2 Update electron to v1.6.14 to get security fix (#1519)
https://electron.atom.io/blog/2017/09/27/chromium-rce-vulnerability-fix

FREEBIE
2017-09-28 17:44:29 -07:00
Scott Nonnenberg 4c48d12dc3
Remove unused grunt tasks: sauce labs and connect
We can't run our tests in a standalone server anymore, so no need for
connect.

Similarly, sauce labs is no longer necessary because all of our tests
are run locally inside of Electron.

FREEBIE
2017-09-25 15:38:27 -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 4449a5f110 Upgrade emoji support (#1482)
* Upgrade emoji deps and move to node_modules

Add support for Emoji 3.0 and switch from bower to yarn for managing emoji
dependencies.

// FREEBIE

* Delete old emoji deps

// FREEBIE

* Don't copy emoji on windows

It is no longer necessary since the symlinked image dir is gone.

// FREEBIE

* Update emoji test

// FREEBIE

* Fix emoji tests; remove all overrides of emoji-js functions

FREEBIE
2017-09-15 13:22:11 -07:00
Scott Nonnenberg e6c7ebcaf9
Update builder (Windows taskbar), tweak config (GNOME taskbar) (#1473)
* Update electron-builder and config, grunt-exec, and spellchecker

electron-builder is a major update: ^18.8.1 -> ^19.27.3

Fixes #1463, where we lose the user's decision to pin to taskbar

The other three are all minor changes, but it's generally good to stay
up to date.

FREEBIE

* Add category for our Linux build target

Fixes #1460, though the recommended list of categories doesn't seem to
match what is shown in Linux Mint. Hopefully it understands that
what was previously 'Networking' should now be 'Internet'

Standard list:
  https://standards.freedesktop.org/menu-spec/latest/apa.html

FREEBIE

* Add StartupWMClass to .desktop file so GNOME can find running app

Fixes #1432

FREEBIE
2017-09-14 17:04:03 -07:00
Lilia 50c470e53d
Certificate pinning via node XMLHttpRequest implementation (#1394)
* Add certificate pinning on https service requests

Make https requests to the server using node apis instead of browser apis, so we
can specify our own CA list, which contains only our own CA.

This protects us from MITM by a rogue CA.

As a bonus, this let's us drop the use of non-standard ports and just use good
ol' default 443 all the time, at least for http requests.

// FREEBIE

* Make certificateAuthorities an option on requests

Modify node-based xhr implementation based on driverdan/node-XMLHttpRequest,
adding support for setting certificate authorities on each request.

This allows us to pin our master CA for requests to the server and cdn but not
to the s3 attachment server, for instance. Also fix an exception when sending
binary data in a request: it is submitted as an array buffer, and must be
converted to a node Buffer since we are now using a node based request api.

// FREEBIE

* Import node-based xhr implementation

Add a copy of https://github.com/driverdan/node-XMLHttpRequest@86ff70e, and
expose it to the renderer in the preload script.

In later commits this module will be extended to support custom certificate
authorities.

// FREEBIE

* Support "arraybuffer" responseType on requests

When fetching attachments, we want the result as binary data rather than a utf8
string. This lets our node-based XMLHttpRequest honor the responseType property
if it is set on the xhr.

Note that naively using the raw `.buffer` from a node Buffer won't work, since
it is a reuseable backing buffer that is often much larger than the actual
content defined by the Buffer's offset and length.

Instead, we'll prepare a return buffer based on the response's content length
header, and incrementally write chunks of data into it as they arrive.

// FREEBIE

* Switch to self-signed server endpoint

* Log more error info on failed requests

With the node-based xhr, relevant error info are stored in statusText and
responseText when a request fails.

// FREEBIE

* Add node-based websocket w/ support for custom CA

// FREEBIE

* Support handling array buffers instead of blobs

Our node-based websocket calls onmessage with an arraybuffer instead of a blob.
For robustness (on the off chance we switch or update the socket implementation
agian) I've kept the machinery for converting blobs to array buffers.

// FREEBIE

* Destroy all wacky server ports

// FREEBIE
2017-09-14 17:03:17 -07:00
Scott Nonnenberg 270f626cd7
Add lodash for server-side utility functions
FREEBIE
2017-09-14 17:03:17 -07:00
Scott Nonnenberg 122719688a
Add os-locale to reliably get xx-XX style locale on all OSes
FREEBIE
2017-09-14 17:03:17 -07:00
Scott Nonnenberg 51768a16c4
Add semver and spellchecker directly, remove electron-provider
FREEBIE
2017-09-14 17:03:17 -07:00
David Balatero 9a7f4ae41c
Show dialog box when there's an update for download 2017-09-14 16:53:50 -07:00
Scott Nonnenberg ebc373185a
Introduce new dependency for user settings: electron-config
FREEBIE
2017-09-14 16:53:48 -07:00
lilia d63c603c21
Add spectron 2017-09-14 16:53:45 -07:00
lilia 81d8b78d05
Switch to grunt-sass + node-sass-import-once
These modules together allow us to import css files from third party
components without maintaining symlinks that essentially rename them as
sass partials, which doesn't work on windows.

// FREEBIE
2017-09-14 16:53:44 -07:00
lilia 7ef901d628
yarn remove icon-gen 2017-09-14 16:53:41 -07:00
lilia 7d47b53dc3
Generate icons with electron-icon-maker
Either icon-gen or local scaling of images was producing a corrupted and
glitchy .icns file. With this module, we need only provide a 1024px
image and it handles the scaling and generation of all other icon
assets.

// FREEBIE
2017-09-14 16:53:40 -07:00
lilia c9537ff9a9
Add asar for inspeting asar contents 2017-09-14 16:53:40 -07:00
lilia 429cc46cf9
yarn add --dev electron-publisher-s3
// FREEBIE
2017-09-14 16:53:40 -07:00
lilia 9f873e21a2
yarn upgrade electron-builder 2017-09-14 16:53:40 -07:00
lilia 8732127b1d
yarn upgrade icon-gen 2017-09-14 16:53:40 -07:00
lilia a885123ab3
Upgrade dev dependencies
Including multiple major version upgrades.

// FREEBIE
2017-09-14 16:53:40 -07:00
lilia 404c8baffc
yarn upgrade
// FREEBIE
2017-09-14 16:53:40 -07:00
lilia 90ad83a91d
Add yarn.lock
Remove grunt-preen due to its dependency on module incompatible with
current node.

// FREEBIE
2017-09-14 16:53:40 -07:00