Skip to content

Commit

Permalink
Merge pull request #1899 from wireapp/staging
Browse files Browse the repository at this point in the history
release 2017-11-10
  • Loading branch information
bennycode authored Nov 10, 2017
2 parents ec55a84 + a5fe1a7 commit d2f69a1
Show file tree
Hide file tree
Showing 37 changed files with 250 additions and 169 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ before_deploy:
deploy:
# https://wire-webapp-dev.zinfra.io/
- provider: elasticbeanstalk
edge: true
skip_cleanup: true
zip-file: 'aws/s3/ebs.zip'
access-key-id:
Expand All @@ -71,7 +70,6 @@ deploy:

# https://wire-webapp-staging.zinfra.io/
- provider: elasticbeanstalk
edge: true
skip_cleanup: true
zip-file: 'aws/s3/ebs.zip'
access-key-id:
Expand All @@ -88,7 +86,6 @@ deploy:

# https://wire-webapp-prod-next.wire.com/
- provider: elasticbeanstalk
edge: true
skip_cleanup: true
zip-file: 'aws/s3/ebs.zip'
access-key-id:
Expand Down
8 changes: 6 additions & 2 deletions app/script/calling/CallingRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,9 @@ z.calling.CallingRepository = class CallingRepository {
let log_message;
if (is_outgoing) {
if (remote_user_id) {
log_message = `Sending '${type}' message (response: ${response}) to user '${remote_user_id}' in conversation '${conversation_id}'`;
log_message = `Sending '${type}' message (response: ${response}) to user '${remote_user_id}' in conversation '${
conversation_id
}'`;
} else {
log_message = `Sending '${type}' message (response: ${response}) to conversation '${conversation_id}'`;
}
Expand All @@ -1417,7 +1419,9 @@ z.calling.CallingRepository = class CallingRepository {
return;
}

log_message = `Received '${type}' message (response: ${response}) from user '${user_id}' in conversation '${conversation_id}'`;
log_message = `Received '${type}' message (response: ${response}) from user '${user_id}' in conversation '${
conversation_id
}'`;
}

this.logger.info(log_message, call_message_et);
Expand Down
32 changes: 16 additions & 16 deletions app/script/calling/entities/Flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ z.calling.entities.Flow = class Flow {
* @private
* @param {MediaStreamEvent} event - Event that a MediaStream has been removed
* @returns {undefined} No return value
*/
*/
_on_remove_stream(event) {
this.logger.info('Remote MediaStream removed from PeerConnection', event);
}
Expand Down Expand Up @@ -718,8 +718,7 @@ z.calling.entities.Flow = class Flow {
save_remote_sdp(call_message_et) {
let skip_negotiation = false;

return z.calling.SDPMapper
.map_call_message_to_object(call_message_et)
return z.calling.SDPMapper.map_call_message_to_object(call_message_et)
.then(rtc_sdp => z.calling.SDPMapper.rewrite_sdp(rtc_sdp, z.calling.enum.SDP_SOURCE.REMOTE, this))
.then(({sdp: remote_sdp}) => {
const is_remote_offer = remote_sdp.type === z.calling.rtc.SDP_TYPE.OFFER;
Expand Down Expand Up @@ -765,8 +764,7 @@ z.calling.entities.Flow = class Flow {
send_local_sdp(sending_on_timeout = false) {
this._clear_send_sdp_timeout();

z.calling.SDPMapper
.rewrite_sdp(this.peer_connection.localDescription, z.calling.enum.SDP_SOURCE.LOCAL, this)
z.calling.SDPMapper.rewrite_sdp(this.peer_connection.localDescription, z.calling.enum.SDP_SOURCE.LOCAL, this)
.then(({ice_candidates, sdp: local_sdp}) => {
this.local_sdp(local_sdp);

Expand All @@ -778,8 +776,9 @@ z.calling.entities.Flow = class Flow {
}

this.logger.debug(
`Sending local '${local_sdp.type}' SDP containing '${ice_candidates.length}' ICE candidates for flow with '${this.remote_user.name()}'\n${this.local_sdp()
.sdp}`
`Sending local '${local_sdp.type}' SDP containing '${
ice_candidates.length
}' ICE candidates for flow with '${this.remote_user.name()}'\n${this.local_sdp().sdp}`
);
this.should_send_local_sdp(false);

Expand Down Expand Up @@ -894,9 +893,9 @@ z.calling.entities.Flow = class Flow {
_create_sdp_success(rct_sdp) {
this.logger.info(`Creating '${rct_sdp.type}' successful`, rct_sdp);

z.calling.SDPMapper
.rewrite_sdp(rct_sdp, z.calling.enum.SDP_SOURCE.LOCAL, this)
.then(({sdp: local_sdp}) => this.local_sdp(local_sdp));
z.calling.SDPMapper.rewrite_sdp(rct_sdp, z.calling.enum.SDP_SOURCE.LOCAL, this).then(({sdp: local_sdp}) =>
this.local_sdp(local_sdp)
);
}

/**
Expand Down Expand Up @@ -1081,8 +1080,9 @@ z.calling.entities.Flow = class Flow {
*/
_solve_colliding_states(force_renegotiation = false) {
this.logger.debug(
`Solving state collision: Self user ID '${this.self_user_id}', remote user ID '${this
.remote_user_id}', force_renegotiation '${force_renegotiation}'`
`Solving state collision: Self user ID '${this.self_user_id}', remote user ID '${
this.remote_user_id
}', force_renegotiation '${force_renegotiation}'`
);

const self_user_id_looses = this.self_user_id < this.remote_user_id;
Expand Down Expand Up @@ -1344,9 +1344,9 @@ z.calling.entities.Flow = class Flow {

const media_stream = this.media_stream().clone();

z.media.MediaStreamHandler
.get_media_tracks(new_media_stream, media_type)
.forEach(media_stream_track => media_stream.addTrack(media_stream_track));
z.media.MediaStreamHandler.get_media_tracks(new_media_stream, media_type).forEach(media_stream_track =>
media_stream.addTrack(media_stream_track)
);

return new z.media.MediaStreamInfo(z.media.MediaStreamSource.LOCAL, 'self', media_stream);
}
Expand All @@ -1370,7 +1370,7 @@ z.calling.entities.Flow = class Flow {
/**
* Reset the flow.
* @returns {undefined} No return value
*/
*/
reset_flow() {
if (this.media_stream()) {
this._remove_media_stream(this.media_stream());
Expand Down
6 changes: 4 additions & 2 deletions app/script/client/ClientRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,9 @@ z.client.ClientRepository = class ClientRepository {
_remove_obsolete_client_for_user_by_id(user_id, client_ids) {
return this.get_clients_by_user_id(user_id).then(client_ets => {
this.logger.info(
`For user '${user_id}' backend found '${client_ets.length}' active clients. Locally there are sessions for '${client_ids.length}' clients`,
`For user '${user_id}' backend found '${client_ets.length}' active clients. Locally there are sessions for '${
client_ids.length
}' clients`,
{
clients: client_ets,
sessions: client_ids,
Expand Down Expand Up @@ -669,7 +671,7 @@ z.client.ClientRepository = class ClientRepository {
* @param {string} user_id - User ID to be checked
* @param {string} client_id - ID of client to be checked
* @returns {boolean} Is the client the current local client
*/
*/
_is_current_client(user_id, client_id) {
if (!this.current_client()) {
throw new z.client.ClientError(z.client.ClientError.TYPE.CLIENT_NOT_SET);
Expand Down
2 changes: 1 addition & 1 deletion app/script/client/ClientService.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ z.client.ClientService = class ClientService {
*
* @param {string} client_id - ID of client to be retrieved
* @returns {Promise} Resolves with the requested client
*/
*/
get_client_by_id(client_id) {
return this.client.send_request({
type: 'GET',
Expand Down
8 changes: 6 additions & 2 deletions app/script/components/asset/controls/seekBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ z.components.SeekBarComponent = class SeekBarComponent {
_update_seek_bar_style(progress) {
// TODO check if we can find a css solution
if (this.dark_mode) {
return (this.seek_bar.style.backgroundImage = `linear-gradient(to right, currentColor ${progress}%, rgba(141,152,159,0.24) ${progress}%)`);
return (this.seek_bar.style.backgroundImage = `linear-gradient(to right, currentColor ${
progress
}%, rgba(141,152,159,0.24) ${progress}%)`);
}

return (this.seek_bar.style.backgroundImage = `linear-gradient(to right, currentColor ${progress}%, rgba(255,255,255,0.4) ${progress}%)`);
return (this.seek_bar.style.backgroundImage = `linear-gradient(to right, currentColor ${
progress
}%, rgba(255,255,255,0.4) ${progress}%)`);
}

dispose() {
Expand Down
75 changes: 40 additions & 35 deletions app/script/conversation/ConversationRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ z.conversation.ConversationRepository = class ConversationRepository {
* @param {Message} message_et - Message entity
* @param {number} [padding=15] - Padding
* @returns {Promise} Resolves with the message
*/
*/
get_messages_with_offset(conversation_et, message_et, padding = 15) {
const message_date = new Date(message_et.timestamp());

Expand Down Expand Up @@ -1173,7 +1173,9 @@ z.conversation.ConversationRepository = class ConversationRepository {

this._on_member_update(conversation_et, response);
this.logger.info(
`Toggle silence to '${payload.otr_muted}' for conversation '${conversation_et.id}' on '${payload.otr_muted_ref}'`
`Toggle silence to '${payload.otr_muted}' for conversation '${conversation_et.id}' on '${
payload.otr_muted_ref
}'`
);
return response;
})
Expand Down Expand Up @@ -1229,7 +1231,9 @@ z.conversation.ConversationRepository = class ConversationRepository {
.update_member_properties(conversation_et.id, payload)
.catch(error => {
this.logger.error(
`Failed to change conversation '${conversation_et.id}' archived state to '${new_archive_state}': ${error.code}`
`Failed to change conversation '${conversation_et.id}' archived state to '${new_archive_state}': ${
error.code
}`
);
if (error.code !== z.service.BackendClientError.STATUS_CODE.NOT_FOUND) {
throw error;
Expand All @@ -1238,7 +1242,9 @@ z.conversation.ConversationRepository = class ConversationRepository {
.then(() => {
this._on_member_update(conversation_et, {data: payload});
this.logger.info(
`Update conversation '${conversation_et.id}' archive state to '${new_archive_state}' on '${payload.otr_archived_ref}'`
`Update conversation '${conversation_et.id}' archive state to '${new_archive_state}' on '${
payload.otr_archived_ref
}'`
);
});
}
Expand Down Expand Up @@ -1369,8 +1375,7 @@ z.conversation.ConversationRepository = class ConversationRepository {
* @returns {Promise} Resolves when the asset metadata was sent
*/
send_asset_metadata(conversation_et, file) {
return z.assets.AssetMetaDataBuilder
.build_metadata(file)
return z.assets.AssetMetaDataBuilder.build_metadata(file)
.catch(error => {
this.logger.warn(
`Couldn't render asset preview from metadata. Asset might be corrupt: ${error.message}`,
Expand Down Expand Up @@ -1994,8 +1999,7 @@ z.conversation.ConversationRepository = class ConversationRepository {
) {
this.logger.info(`Sending external message of type '${generic_message.content}'`, generic_message);

return z.assets.AssetCrypto
.encrypt_aes_asset(generic_message.toArrayBuffer())
return z.assets.AssetCrypto.encrypt_aes_asset(generic_message.toArrayBuffer())
.then(({key_bytes, sha256, cipher_text}) => {
const generic_message_external = new z.proto.GenericMessage(z.util.create_random_uuid());
generic_message_external.set(
Expand Down Expand Up @@ -2294,7 +2298,9 @@ z.conversation.ConversationRepository = class ConversationRepository {
})
.catch(error => {
this.logger.info(
`Failed to send delete message for everyone with id '${message_et.id}' for conversation '${conversation_et.id}'`,
`Failed to send delete message for everyone with id '${message_et.id}' for conversation '${
conversation_et.id
}'`,
error
);
throw error;
Expand Down Expand Up @@ -3380,15 +3386,15 @@ z.conversation.ConversationRepository = class ConversationRepository {
}
};

return Promise.all(
this._map_recipients(recipients, _remove_redundant_client, _remove_redundant_user)
).then(() => {
if (conversation_et) {
this.update_participating_user_ets(conversation_et);
}
return Promise.all(this._map_recipients(recipients, _remove_redundant_client, _remove_redundant_user)).then(
() => {
if (conversation_et) {
this.update_participating_user_ets(conversation_et);
}

return payload;
});
return payload;
}
);
});
}

Expand Down Expand Up @@ -3516,26 +3522,25 @@ z.conversation.ConversationRepository = class ConversationRepository {
_update_edited_message(conversation_et, event_json) {
const {data: event_data, from, id, time} = event_json;

return this.get_message_in_conversation_by_id(
conversation_et,
event_data.replacing_message_id
).then(original_message_et => {
const from_original_user = from === original_message_et.from;
if (!from_original_user) {
throw new z.conversation.ConversationError(z.conversation.ConversationError.TYPE.WRONG_USER);
}
return this.get_message_in_conversation_by_id(conversation_et, event_data.replacing_message_id).then(
original_message_et => {
const from_original_user = from === original_message_et.from;
if (!from_original_user) {
throw new z.conversation.ConversationError(z.conversation.ConversationError.TYPE.WRONG_USER);
}

if (!original_message_et.timestamp()) {
throw new TypeError('Missing timestamp');
}
if (!original_message_et.timestamp()) {
throw new TypeError('Missing timestamp');
}

event_json.edited_time = time;
event_json.time = new Date(original_message_et.timestamp()).toISOString();
this._delete_message_by_id(conversation_et, id);
this._delete_message_by_id(conversation_et, event_data.replacing_message_id);
this.conversation_service.save_event(event_json);
return event_json;
});
event_json.edited_time = time;
event_json.time = new Date(original_message_et.timestamp()).toISOString();
this._delete_message_by_id(conversation_et, id);
this._delete_message_by_id(conversation_et, event_data.replacing_message_id);
this.conversation_service.save_event(event_json);
return event_json;
}
);
}

/**
Expand Down
24 changes: 18 additions & 6 deletions app/script/cryptography/CryptographyRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ z.cryptography.CryptographyRepository = class CryptographyRepository {
return delete_promise
.catch(database_error => {
this.logger.error(
`Unsuccessful deleting cryptography-relate database content after failed client validation: ${database_error.message}`,
`Unsuccessful deleting cryptography-relate database content after failed client validation: ${
database_error.message
}`,
database_error
);
throw new z.client.ClientError(z.client.ClientError.TYPE.DATABASE_FAILURE);
Expand Down Expand Up @@ -317,21 +319,27 @@ z.cryptography.CryptographyRepository = class CryptographyRepository {
.then(() => {
if (remote_pre_key) {
this.logger.log(
`Initializing session with Client ID '${client_id}' from User ID '${user_id}' with remote PreKey ID '${remote_pre_key.id}'.`
`Initializing session with Client ID '${client_id}' from User ID '${user_id}' with remote PreKey ID '${
remote_pre_key.id
}'.`
);
return this.cryptobox.session_from_prekey(
this._construct_session_id(user_id, client_id),
z.util.base64_to_array(remote_pre_key.key).buffer
);
}
this.logger.warn(
`No remote PreKey for User ID '${user_id}' with Client ID '${client_id}' found. The owner probably deleted the client already.`
`No remote PreKey for User ID '${user_id}' with Client ID '${
client_id
}' found. The owner probably deleted the client already.`
);
return undefined;
})
.catch(error => {
this.logger.warn(
`Invalid remote PreKey for User ID '${user_id}' with Client ID '${client_id}' found. Skipping encryption. Reason: ${error.message}`,
`Invalid remote PreKey for User ID '${user_id}' with Client ID '${
client_id
}' found. Skipping encryption. Reason: ${error.message}`,
error
);
return undefined;
Expand Down Expand Up @@ -452,15 +460,19 @@ z.cryptography.CryptographyRepository = class CryptographyRepository {
if (is_invalid_message || is_invalid_signature) {
// Session is broken, let's see what's really causing it...
this.logger.error(
`Session with client '${remote_client_id}' of user '${remote_user_id}' is broken or out of sync.\nReset the session and decryption is likely to work again.`
`Session with client '${remote_client_id}' of user '${
remote_user_id
}' is broken or out of sync.\nReset the session and decryption is likely to work again.`
);
} else if (is_remote_identity_changed) {
// Remote identity changed
this.logger.error(`Remote identity of client '${remote_client_id}' from user '${remote_user_id}' changed`);
}

this.logger.warn(
`Failed to decrypt event from client '${remote_client_id}' of user '${remote_user_id}'.\nError Code: '${error_code}'\nError Message: ${error.message}`,
`Failed to decrypt event from client '${remote_client_id}' of user '${remote_user_id}'.\nError Code: '${
error_code
}'\nError Message: ${error.message}`,
error
);
this._report_decryption_failure(error, event);
Expand Down
Loading

0 comments on commit d2f69a1

Please sign in to comment.