Commit graph

88 commits

Author SHA1 Message Date
Scott Nonnenberg 7b49180bc0
Big update to new signal branding (#2018) 2018-01-30 14:22:51 -08:00
Scott Nonnenberg c64f0fc75e
app.quit() -> app.exit(), immediate app close on second instance (#2017) 2018-01-30 10:55:49 -08:00
Martino Pilia 7034d8759d Add badge for unread messages to the tray icon (#1934)
This commit adds a badge to the tray icon that displays the number of
unread messages, if there is any. It is implemented by providing
alternative versions of the icon, that replace the default image when a
message is received.

The badge is rendered graphically as a red circle containing the number
of unread messages. Since a different icon file is needed for each
possible number of unread messages, but this number is clearly
unbounded, only the numbers from 1 to 9 are provided. If there are 10 or
more unread messages, a single badge (depicted as "9+") is used.

Resolves #1917
2018-01-17 15:27:58 -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 deb9bab086
Remove duplicate showWindow method (#1918) 2018-01-03 18:18:13 -08:00
Scott Nonnenberg 5cf320e429
Show window if hidden when second instance attempts to start (#1897) 2017-12-14 12:27:52 -08:00
Jon Roberts bc399c6777 a slightly more reasonable min-width (#1863) 2017-12-14 11:31:07 -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 f013eed9d1
Merge branch 'master' into development
Bringing beta up to date with production v1.0.40
2017-12-04 16:08:19 -08:00
Scott Nonnenberg c195ba2630
Save prekeys optimistically, track confirms, new clean behavior (#1846)
* Re-enable libtextsecure unit tests, get passing, run in CI

* Save prekeys optimistically, track confirmed, new clean behavior

* Eliminate potential conflicts when rotating on startup

* Remove last symlink: get libtextsecure tests running on windows
2017-12-01 13:35:39 -08:00
Scott Nonnenberg 6cb8b99637
Harden our handling of config.json, verify that window is visible (#1830)
* Validate config-provided locatio against available screens

* Increase buffer around screen from 10px to 100px

* Protect against null mainWindow, fix height/width typo

* Properly handle missing x and y

* Move to _.isNumber for checking x and y

* Use greater than or less than to allow for y = 0, exactly 100px
2017-11-30 11:58:00 -08:00
johannes karoff 89297af5d2 add urgency hints for linux platform (#1820) 2017-11-27 15:14:48 -08:00
Martino Pilia cd50fe3123 Add a tray icon to the application (#1676)
This commit adds a tray icon to the application, shown in the system
tray bar, that can be used to minimise the application window.  This
is a common feature on most desktop messaging apps (e.g. Telegram
Desktop or Slack) and allows to save space in the system task bar.

The tray icon provides a context menu that contains a button to
show/hide the application window, and a button to quit the
application. When the tray icon is clicked, the visibility of the
window is toggled.  When the close (x) button of the window is
pressed, the application is not terminated but minimised to the tray
icon instead (it can be terminated by using the "Quit" entry in the
File menu or in the context menu of the tray icon).

The tray icon is disabled by default, and two command line arguments
are available to enable it:
  --use-tray-icon: enables the tray icon
  --start-in-tray: enables the tray icon and the application starts
                   minimised in the tray bar

Resolves: #1480
2017-11-27 14:48:09 -08:00
Scott Nonnenberg cdfdd6b381
Fix notifications: windows -> window, serialize false setting 2017-11-22 14:32:39 -08:00
Scott Nonnenberg 16ad94148a
Introduce library for notifications on downlevel windows (#1812) 2017-11-22 13:50:52 -08:00
Scott Nonnenberg 0e328f3911
Merge branch 'master' into development
This catches the development branch up with v1.0.39 in master.
2017-11-21 18:25:59 -08:00
Scott Nonnenberg 1c455c83e0
Set parent window for about/new version, escape to close (#1795)
* Set parent window for about/new version, escape to close

* Exclude jquery from jshint run
2017-11-21 15:23:18 -08:00
Scott Nonnenberg 48ec4003dd
Use icon from /images for window creation (#1738) 2017-11-08 19:11:33 -08:00
Scott Nonnenberg 1fdaa00660
Add icon to the window manually on creation (#1735)
This supplements the work we already do to tell the OS about our icon.
2017-11-08 17:33:20 -08:00
Scott Nonnenberg 30c5b62687
Don't call createWindow before the app is ready for it (#1665) 2017-11-02 08:13:41 -07:00
Scott Nonnenberg c94d4efd18
Beta versions support: SxS support, in-app env/instance display (#1606)
* Script for beta config; unique data dir, in-app env/type display

To release a beta build, increment the version and add -beta-N to the
end, then go through all the standard release activities.

The prepare-build npm script then updates key bits of the package.json
to ensure that the beta build can be installed alongside a production
build. This includes a new name ('Signal Beta') and a different location
for application data.

Note: Beta builds can be installed alongside production builds.

As part of this, a couple new bits of data are shown across the app:

- Environment (development or test, not shown if production)
- App Instance (disabled in production; used for multiple accounts)

These are shown in:

- The window title - both environment and app instance. You can tell
  beta builds because the app name, preceding these data bits, is
  different.
- The about window - both environment and app instance. You can tell
  beta builds from the version number.
- The header added to the debug log - just environment. The version
  number will tell us if it's a beta build, and app instance isn't
  helpful.

* Turn on single-window mode in non-production modes

Because it's really frightening when you see 'unable to read from db'
errors in the console.

* aply.sh: More instructions for initial setup and testing

* Gruntfile: Get consistent with use of package.json datas

* Linux: manually update desktop keys, since macros not available
2017-10-30 13:57:13 -07:00
Scott Nonnenberg 07d19d12c2 Reduce logging when the window moves (#1568) 2017-10-18 11:57:48 -07:00
Scott Nonnenberg 75cece3358 Improve OS menu (#1563)
* Remove reload options, new file/help menus, tools/log at bottom

* Further menus refactor: install handlers at template creation

* WIP: Further tune menus, add custom about window

* New About window, new help menu items, menu labels now i18n

* Default device name on registration is now computer hostname

The OS of the device makes sense for those of us testing across a lot of
different OSes. And maybe for a user with just one desktop device. But
most users with multiple desktop devices are using the same OS for both.

* About window: Only show window when content is ready

* Fix typo in app/menu.js
2017-10-13 16:49:16 -07:00
Axel 3dc3667b45 Add setting to hide menu bar (#1551)
* Add setting to hide menu bar

Add a setting in the themes section to hide the menu bar.
The menu bar is not needed in everyday use and might not fit in with
signals dark theme. The hidden menu bar can still be shown by pressing
alt.
autoHideMenuBar is added to windowConfig and saved and restored on
startup to prevent flickering.

* Trigger events only when related setting changes

Set the event to trigger on instanciation of the view.
Notification settings no longer reapply the theme or menu bar settings.

* Save window state when closing the window

When not moving or resizing the window, no BrowserWindow config would be
created and saved.
2017-10-13 11:39:18 -07:00
Lilia 23700e1776 Re-enable fullscreen on OSX (#1525)
* Re-enable fullscreen on OSX

We were inadvertantly disabling the fullscreen button due to a quick of the
BrowserWindow api. Add some guards to make sure we no longer save or use a
previously-stored `fullscreen: false` in our window configs.

// FREEBIE

* Use logger.info instead of console.log

Note the use of stringify to make config object safe for bunyan
https://github.com/trentm/node-bunyan#log-method-api

// FREEBIE
2017-10-03 11:07:40 -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 ae190fed44
Profiles (#1453)
* Add AES-GCM encryption for profiles

With tests.

* Add profileKey to DataMessage protobuf

// FREEBIE

* Decrypt and save profile names

// FREEBIE

* Save incoming profile keys

* Move pad/unpad to crypto module

// FREEBIE

* Support fetching avatars from the cdn

// FREEBIE

* Translate failed authentication errors

When AES-GCM authentication fails, webcrypto returns a very generic error. The
same error is thrown for invalid length inputs, but our earlier checks in
decryptProfile should rule out those failure modes and leave us safe to assume
that we either had bad ciphertext or the wrong key.

// FREEBIE

* Handle profile avatars (wip) and log decrypt errors

// FREEBIE

* Display profile avatars

Synced contact avatars will still override profile avatars.

* Display profile names in convo list

Only if we don't have a synced contact name.

// FREEBIE

* Make cdn url an environment config

Use different ones for staging and production

// FREEBIE

* Display profile name in conversation header

* Display profile name in group messages

* Update conversation header if profile avatar changes

// FREEBIE

* Style profile names small with ~

* Save profileKeys from contact sync messages

// FREEBIE

* Save profile keys from provisioning messages

For standalone accounts, generate a random profile key.

// FREEBIE

* Special case for one-time sync of our profile key

Android will use a contact sync message to sync a profile key from Android
clients who have just upgraded and generated their profile key. Normally we
should receive this data in a provisioning message.

// FREEBIE

* Infer profile sharing from synced data messages

* Populate profile keys on outgoing messages

Requires that `profileSharing` be set on the conversation.

// FREEBIE

* Support for the profile key update flag

When receiving a message with this flag, don't init a message record, just
process the profile key and move on.

// FREEBIE

* Display profile names in group member list

* Refresh contact's profile on profile key changes

// FREEBIE

* Catch errors on profile save

// FREEBIE

* Save our own synced contact info

Don't return early if we get a contact sync for our own number

// FREEBIE
2017-09-14 17:04:00 -07:00
Scott Nonnenberg 272955b9d6
focus() visible window on show-window instead of show() (#1455)
When clicking on a notification in Windows when a window had been stuck
to one side of the screen using Snap, the window would be repositioned.

Fixes #1453

FREEBIE
2017-09-14 17:03:18 -07:00
Scott Nonnenberg af81b1a045
Fix unlinked loading screen hang, fix error dialog on start (#1440)
* main.js: check for truthiness of mainwindow, not === null

FREEBIE

* background.js: Connect to websocket even if we are unlinked

We know registration isn't done, but it has been done before. So instead
of sitting tight, we connect to the socket to start everything up and
attempt to the websocket once more.

FREEBIE
2017-09-14 17:03:18 -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
lilia 04e40043d2
Add View -> Debug Log to menu bar
Just send an event from the main process to the renderer,
The latter routes it the appropriate view method.

For now it's a no-op unless the main window exists and it is showing the inbox,
which will be addressed in a future commit.

// FREEBIE
2017-09-14 16:53:52 -07:00
Scott Nonnenberg 8243f25e5a
Fix auto-update dialog now that locale-loading has been changed
FREEBIE
2017-09-14 16:53:52 -07:00
Scott Nonnenberg 53d1e7e6c7
Load locale information only after application's 'ready' event
FREEBIE
2017-09-14 16:53:51 -07:00
David Balatero a6af40e9f9
Couple of semicolons to match style 2017-09-14 16:53:51 -07:00
David Balatero 8f30e13ec1
Rename autoupdate -> auto_update, remove redundancy 2017-09-14 16:53:51 -07:00
David Balatero ceaff68d55
Refactor locale to only expose the data we care about 2017-09-14 16:53:51 -07:00
David Balatero 5e5ca80a6e
Refactor configuration out into reusable files 2017-09-14 16:53:51 -07:00
David Balatero ed831dacd0
Refactor external source files to live in app/ 2017-09-14 16:53:50 -07:00
David Balatero db62494109
Force app to quit on Mac when we auto update 2017-09-14 16:53:50 -07:00
David Balatero 07d8b862db
Use app interface to get the version 2017-09-14 16:53:50 -07:00
David Balatero 1b2e94b100
Add a fallback message when no locale is set 2017-09-14 16:53:50 -07:00
David Balatero 9a7f4ae41c
Show dialog box when there's an update for download 2017-09-14 16:53:50 -07:00
David Balatero 9c21c3c7e6
Enforce a minimum window size 2017-09-14 16:53:50 -07:00
Scott Nonnenberg 0ad35cc0e6
Move electron-config init below our change to appData path 2017-09-14 16:53:48 -07:00
Scott Nonnenberg 69d4a77f1e
Remember window position, size, and maximized/fullscreen status
FREEBIE
2017-09-14 16:53:48 -07:00
Scott Nonnenberg fd8b8910a3
Eliminate HIDE_DEV_TOOLS environment variable. Hide in test env.
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg f31125eccc
process.env.NODE_ENV -> environment
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg 255ba58b2e
Enable complete exit of Electron process after grunt unit-tests
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg 5635095d1a
Initial version of grunt unit-tests, tests from command-line
FREEBIE
2017-09-14 16:53:47 -07:00
Scott Nonnenberg 4402a91976
Use correct locale, fall back to en if we don't have translations
FREEBIE
2017-09-14 16:53:47 -07:00