Commit graph

3622 commits

Author SHA1 Message Date
Daniel Gasienica 7d4ef9315b Add yarn test-ts 2018-04-11 16:36:42 -04:00
Daniel Gasienica f38370f40e Add custom type definition for link-text 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
Daniel Gasienica 9b22e0667a
Redact More Variants Of Paths In Stack Traces (#2229)
- [x] Redact stack traces with both forward and backslashes.
- [x] Redact paths with escaped forward slashes.
- [x] Redact URL-encoded paths.
- [x] Minor: Use `is` vs Lodash `is*` for type checking.
- [x] Minor: Rename `Path` to `path`, etc.
- [x] Add ESLint `quotes` rule to allow double quotes to avoid escaping single quotes.
- [x] Consistently use single quotes to denote identifiers in error messages,
      e.g. `'foo' is required`.
2018-04-11 16:35:54 -04:00
Daniel Gasienica 24f4ad53bc Use single quotes for identifiers 2018-04-11 15:54:32 -04:00
Daniel Gasienica 819671a23a Add ESLint quotes rule 2018-04-11 15:41:40 -04:00
Daniel Gasienica 432a6ebd7f Redact file paths with escaped slashes 2018-04-11 15:30:59 -04:00
Daniel Gasienica d41e3cd6fc Add test for regular _redactPath 2018-04-11 15:30:59 -04:00
Daniel Gasienica a8a7525609 Redact stack traces with forward and backslashes 2018-04-11 15:30:59 -04:00
Daniel Gasienica b0da7d965e Redact URL encoded file paths in stack traces 2018-04-11 15:30:59 -04:00
Daniel Gasienica f2c9ccae90 Prefer is.* over Lodash is* functions 2018-04-11 15:30:59 -04:00
Daniel Gasienica 2ee78ec556 Prefer path over Path 2018-04-11 15:30:59 -04:00
Scott Nonnenberg 8467352994
Rename file for Whisper.ReactWrapperView (#2232) 2018-04-11 09:30:28 -07:00
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
2018-04-06 08:13:00 -07:00
Scott Nonnenberg 96bd90a4e0
Simplify assignment; add warning to preload.js about Style Guide 2018-04-05 17:16:15 -07:00
Scott Nonnenberg 05303233fb
window.Signal.React -> window.Signal.Components 2018-04-05 16:10:59 -07:00
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.
2018-04-05 15:30:40 -07:00
Scott Nonnenberg 50d4dbaae7
Remove 'use strict' from i18n.js 2018-04-05 13:42:41 -07:00
Scott Nonnenberg 76be13552f
js/i18n.js -> js/modules/i18n.js 2018-04-05 12:51:29 -07:00
Scott Nonnenberg e5322e8261
Finish rename of MessageParents, re-add moment to page
(we were getting crashes in the initial setup of a backbone view)
2018-04-05 12:50:52 -07:00
Scott Nonnenberg cdd16c9780
Rename test-only MessageParents to ConversationContext 2018-04-05 12:41:48 -07:00
Scott Nonnenberg 61a7846149
Fix typo in index.ts 2018-04-05 12:39:34 -07:00
Scott Nonnenberg 2384092e9e
Use Array.isArray in i18n.js 2018-04-05 12:39:16 -07:00
Scott Nonnenberg bb73d470a5
Gruntfile: Sort lines in jshint/jscs config 2018-04-05 12:26:30 -07:00
Scott Nonnenberg 23293a3c00
New tslint rule: Interfaces must not start with I 2018-04-05 12:24:43 -07:00
Scott Nonnenberg 1052341d79
Fix tslint errors and add tslint to CI task in package.json 2018-04-05 08:37:04 -07: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 887abd75dd
Add missing shim, fix typo 2018-04-05 08:31:19 -07:00
Scott Nonnenberg ed12e1b076
Add mp3 to project, make binary files available in rsg on util 2018-04-05 08:30:30 -07:00
Scott Nonnenberg 104a1ca5d4
Remove i18n.js from jshint run, fix missing semicolon 2018-04-04 17:26:57 -07:00
Scott Nonnenberg ef6a0c1162
v1.7.0-beta.3
Update to electron 1.8.4 (#2186)

Migrate all attachments from IndexedDB to file system in the background (#2208, #2193, #2165, #2162, #2129)

Save attachments to disk when importing Chrome app export (#2212)

Fixed: Read receipts setting would not be synchronized along with re-link (#2218)

Fixed: Clicking conversation in left pane when already selected would remove focus on message composition field - thanks
@colefranz! (#2032)

Fixed: Searching for the phone number of an existing contact, then selecting 'start conversation' would erase contact details (#2191)

Fixed: Selecting Settings menu option multiple times would open multiple instances of settings view - thanks @navdeepsinghkhalsa (#2167)

Dev:
  - Relax Node.js version requirements (#2203)
  - Fix a few typos in documentation - thanks @Vinnl (#2171)
  - Update issue template to mention that translation should be via Transifex (#2157)
2018-04-04 17:13:23 -07:00
Scott Nonnenberg 3899eb8d0b
Add 'use strict' to i18n.js 2018-04-04 16:30:52 -07:00
Daniel Gasienica e329c23aa0
Support Attachments On File System During Export + Import (#2212)
- [x] Load attachments into memory before export.
- [x] Save attachments to correct place in user profile upon import.
- [x] Upgrade message schema upon import.
- [x] Support both encrypted imports as well as unencrypted Chrome imports.

**Tests**

- [x] Export / import small database (25 messages) with some attachments already
      on disk (`schemaVersion >= 3`) and some not (`schemaVersion < 3`).
- [x] Import Chrome web app import (found and fixed issue with missing
      `schemaVersion`).
- [x] Export / import of real-world Signal Beta data (before: `IndexedDB`
      ~372MB / after: `IndexedDB` ~5.7MB / `attachments.noindex` ~234MB)
 
**Test commands:**

```javascript
// Export
let key = new Uint8Array([1, 3, 4, 5, 6, 7, 8, 11, 23, 34, 1, 34, 3, 5, 45, 45, 1, 3, 4, 5, 6, 7, 8, 11, 23, 34, 1, 34, 3, 5, 45, 45]);
Signal.Backup.exportToDirectory('/Users/<user>/Desktop/Signal-import-export-test', {key});

// Import
let key = new Uint8Array([1, 3, 4, 5, 6, 7, 8, 11, 23, 34, 1, 34, 3, 5, 45, 45, 1, 3, 4, 5, 6, 7, 8, 11, 23, 34, 1, 34, 3, 5, 45, 45]);
Signal.Backup.importFromDirectory('/Users/<user>/Desktop/Signal-import-export-test', {key});

// Import from Chrome
Signal.Backup.importFromDirectory('/Users/<user>/Desktop/Signal Export 2018 Apr 3 at 11.00.54 pm');
```
2018-04-04 19:25:35 -04:00
Daniel Gasienica 41ac9586eb Add start-backup script
This helps running a Signal Desktop instance from a backup (copy of profile
folder) when testing functionality such as database migrations, import/export,
etc.

Usage:
```
BACKUP=development-backup-2018-04-04 PROFILE=development ./scripts/start-backup
```

WARNING: This deletes the original profile and overwrites it with backup.
2018-04-04 19:11:46 -04:00
Daniel Gasienica 195e9b777c Rename willHaveAttachmentsSavedOnFileSystemDuringUpgrade
New name: `willAttachmentsGoToFileSystemOnUpgrade`
2018-04-04 19:11:46 -04:00
Daniel Gasienica 4c4443390a Rename createImporter to createAttachmentDataWriter 2018-04-04 19:11:46 -04: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 f86a6ef752
Update style of i18n, pull it in via preload instead of .html 2018-04-04 16:03:10 -07:00
Scott Nonnenberg 1ad2b080c8
Move moment from bower deps to npm deps 2018-04-04 16:00:38 -07:00
Scott Nonnenberg e32dad2e9b
Gruntfile: limit jshint/jscs watch tasks to own files, not *.js 2018-04-04 15:56:47 -07:00
Scott Nonnenberg 26f69b633a
Gruntfile: Remove edits to background.js; no longer applicable 2018-04-04 15:56:47 -07:00
Daniel Gasienica 5ea1a305a6 Clarify error origin 2018-04-04 18:41:50 -04:00
Daniel Gasienica 9dcb64b53c Initialize schema version upon import 2018-04-04 18:41:50 -04:00
Daniel Gasienica cfad983d08 Consistently use ciphertext instead of encrypted 2018-04-04 18:41:50 -04:00
Daniel Gasienica a61c905146 Impliclity decrypt data if key is present 2018-04-04 18:41:50 -04:00
Daniel Gasienica 94c75762b5 Add Message.createAttachmentLoader 2018-04-04 18:41:50 -04:00