Commit graph

68 commits

Author SHA1 Message Date
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
Scott Nonnenberg
b4e3cc0e6c
Load test page and run tests on start when NODE_ENV=test
FREEBIE
2017-09-14 16:53:46 -07:00
lilia
7c6da5a157
Make 'Restart Signal' actually restart Signal
Previously it would just reload the page.

// FREEBIE
2017-09-14 16:53:45 -07:00
lilia
2ccd8c21f3
Limit hidden window behavior to osx
Only on osx is it customary to remain running in the background when the
window is closed.

// FREEBIE
2017-09-14 16:53:45 -07:00
lilia
cfb1e62603
Fix menu on non-darwin 2017-09-14 16:53:45 -07:00
lilia
b5649a6874
Add ability to unhide the window from the renderer
via ipc, for instance if a notification is clicked but the window is
closed/hidden.

// FREEBIE
2017-09-14 16:53:43 -07:00
lilia
d018fa63ff
Add Show option under the Window menu
Window > Show will reveal the mainWindow after it has been closed.

// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
d71250b752
More main process logging
// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
b66a887184
Don't check for updates in the MAS build
// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
ade5e593a7
Add some logging to main process startup sequence
// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
c2014b062d
Don't makeSingleInstance in a MAS build
It seems that makeSingleInstance will always return true in the MAS
build.* Luckily, OSX mostly enforces single-instance for us when opening
the app from Finder. If the user attempts to run a second instance from
the command line, it will create a window but fail to load.

*TODO: Revisit why makeSingleInstance is broken in the MAS build.

// FREEBIE
2017-09-14 16:53:42 -07:00
lilia
84fba7d968
Prevent window navigation
Navigation is the default handler for file drag and drop events on the
window.

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
c1fa33327d
Allow multi-instance in development 2017-09-14 16:53:41 -07:00
lilia
0c9cca08ba
Draw attention to the window on new messages
// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
ea930d53ae
Set badge count
This is displayed on the launcher icon on linux/mac

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
44adc04395
Closing the window hides the window on mac
Clicking the dock icon restores it again.

// FREEBIE
2017-09-14 16:53:41 -07:00
lilia
77d5ef2f68
Add spellcheck
As of Electron 1.6.5, this requires disabling the sandbox in order to
get access to the `webFrame` api.

// FREEBIE
2017-09-14 16:53:39 -07:00
lilia
878b15c288
Add node version to debug log
The chrome, electron, and signal versions are already included in the
user agent string.

// FREEBIE
2017-09-14 16:53:39 -07:00
lilia
46b0146a4c
Log user data directory 2017-09-14 16:53:38 -07:00
lilia
934d06b512
Override environment vars in production
Don't allow environment vars to muck with configs in production.

// FREEBIE
2017-09-14 16:53:38 -07:00
lilia
14b65a9dce
Log on app ready 2017-09-14 16:53:38 -07:00