diff --git a/Gruntfile.js b/Gruntfile.js index 71d79ae8..89d2ac13 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -125,9 +125,7 @@ module.exports = function(grunt) { if (srcpath.match('background.js')) { return content.replace( /textsecure-service-staging.whispersystems.org/g, - 'textsecure-service-ca.whispersystems.org').replace( - /whispersystems-textsecure-attachments-staging.s3.amazonaws.com/g, - 'whispersystems-textsecure-attachments.s3.amazonaws.com'); + 'textsecure-service-ca.whispersystems.org'); } else if (srcpath.match('expire.js')) { var gitinfo = grunt.config.get('gitinfo'); var commited = gitinfo.local.branch.current.lastCommitTime; diff --git a/js/background.js b/js/background.js index b1a74221..63356fd9 100644 --- a/js/background.js +++ b/js/background.js @@ -35,7 +35,6 @@ var SERVER_URL = 'https://textsecure-service-staging.whispersystems.org'; var SERVER_PORTS = [80, 4433, 8443]; - var ATTACHMENT_SERVER_URL = 'https://whispersystems-textsecure-attachments-staging.s3.amazonaws.com'; var messageReceiver; window.getSocketStatus = function() { if (messageReceiver) { @@ -108,7 +107,7 @@ // initialize the socket and start listening for messages messageReceiver = new textsecure.MessageReceiver( - SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD, mySignalingKey, ATTACHMENT_SERVER_URL + SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD, mySignalingKey ); messageReceiver.addEventListener('message', onMessageReceived); messageReceiver.addEventListener('receipt', onDeliveryReceipt); @@ -119,7 +118,7 @@ messageReceiver.addEventListener('error', onError); window.textsecure.messaging = new textsecure.MessageSender( - SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD, ATTACHMENT_SERVER_URL + SERVER_URL, SERVER_PORTS, USERNAME, PASSWORD ); if (firstRun === true && textsecure.storage.user.getDeviceId() != '1') { if (!storage.get('theme-setting') && textsecure.storage.get('userAgent') === 'OWI') { diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 3f3e184f..e997d2b4 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -37660,7 +37660,7 @@ var TextSecureServer = (function() { attachment : "v1/attachments" }; - function TextSecureServer(url, ports, username, password, attachment_server_url) { + function TextSecureServer(url, ports, username, password) { if (typeof url !== 'string') { throw new Error('Invalid server url'); } @@ -37668,17 +37668,6 @@ var TextSecureServer = (function() { this.url = url; this.username = username; this.password = password; - - this.attachment_id_regex = RegExp("^https:\/\/.*\/(\\d+)\?"); - if (attachment_server_url) { - // strip trailing / - attachment_server_url = attachment_server_url.replace(/\/$/,''); - // and escape - attachment_server_url = attachment_server_url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - this.attachment_id_regex = RegExp( "^" + attachment_server_url + "\/(\\d+)\?"); - } - - } TextSecureServer.prototype = { @@ -37882,11 +37871,6 @@ var TextSecureServer = (function() { urlParameters : '/' + id, validateResponse : {location: 'string'} }).then(function(response) { - var match = response.location.match(this.attachment_id_regex); - if (!match) { - console.log('Invalid attachment url for incoming message', response.location); - throw new Error('Received invalid attachment url'); - } return ajax(response.location, { type : "GET", responseType: "arraybuffer", @@ -37899,13 +37883,6 @@ var TextSecureServer = (function() { call : 'attachment', httpType : 'GET', }).then(function(response) { - // Extract the id as a string from the location url - // (workaround for ids too large for Javascript numbers) - var match = response.location.match(this.attachment_id_regex); - if (!match) { - console.log('Invalid attachment url for outgoing message', response.location); - throw new Error('Received invalid attachment url'); - } return ajax(response.location, { type : "PUT", contentType : "application/octet-stream", @@ -38226,12 +38203,12 @@ var TextSecureServer = (function() { * vim: ts=4:sw=4:expandtab */ -function MessageReceiver(url, ports, username, password, signalingKey, attachment_server_url) { +function MessageReceiver(url, ports, username, password, signalingKey) { this.url = url; this.signalingKey = signalingKey; this.username = username; this.password = password; - this.server = new TextSecureServer(url, ports, username, password, attachment_server_url); + this.server = new TextSecureServer(url, ports, username, password); var address = libsignal.SignalProtocolAddress.fromString(username); this.number = address.getName(); @@ -38702,8 +38679,8 @@ MessageReceiver.prototype.extend({ window.textsecure = window.textsecure || {}; -textsecure.MessageReceiver = function(url, ports, username, password, signalingKey, attachment_server_url) { - var messageReceiver = new MessageReceiver(url, ports, username, password, signalingKey, attachment_server_url); +textsecure.MessageReceiver = function(url, ports, username, password, signalingKey) { + var messageReceiver = new MessageReceiver(url, ports, username, password, signalingKey); this.addEventListener = messageReceiver.addEventListener.bind(messageReceiver); this.removeEventListener = messageReceiver.removeEventListener.bind(messageReceiver); this.getStatus = messageReceiver.getStatus.bind(messageReceiver); @@ -39051,8 +39028,8 @@ Message.prototype = { } }; -function MessageSender(url, ports, username, password, attachment_server_url) { - this.server = new TextSecureServer(url, ports, username, password, attachment_server_url); +function MessageSender(url, ports, username, password) { + this.server = new TextSecureServer(url, ports, username, password); this.pendingMessages = {}; } @@ -39459,8 +39436,8 @@ MessageSender.prototype = { window.textsecure = window.textsecure || {}; -textsecure.MessageSender = function(url, ports, username, password, attachment_server_url) { - var sender = new MessageSender(url, ports, username, password, attachment_server_url); +textsecure.MessageSender = function(url, ports, username, password) { + var sender = new MessageSender(url, ports, username, password); textsecure.replay.registerFunction(sender.tryMessageAgain.bind(sender), textsecure.replay.Type.ENCRYPT_MESSAGE); textsecure.replay.registerFunction(sender.retransmitMessage.bind(sender), textsecure.replay.Type.TRANSMIT_MESSAGE); textsecure.replay.registerFunction(sender.sendMessage.bind(sender), textsecure.replay.Type.REBUILD_MESSAGE); diff --git a/libtextsecure/api.js b/libtextsecure/api.js index 9609fc6a..04649244 100644 --- a/libtextsecure/api.js +++ b/libtextsecure/api.js @@ -139,7 +139,7 @@ var TextSecureServer = (function() { attachment : "v1/attachments" }; - function TextSecureServer(url, ports, username, password, attachment_server_url) { + function TextSecureServer(url, ports, username, password) { if (typeof url !== 'string') { throw new Error('Invalid server url'); } @@ -147,17 +147,6 @@ var TextSecureServer = (function() { this.url = url; this.username = username; this.password = password; - - this.attachment_id_regex = RegExp("^https:\/\/.*\/(\\d+)\?"); - if (attachment_server_url) { - // strip trailing / - attachment_server_url = attachment_server_url.replace(/\/$/,''); - // and escape - attachment_server_url = attachment_server_url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - this.attachment_id_regex = RegExp( "^" + attachment_server_url + "\/(\\d+)\?"); - } - - } TextSecureServer.prototype = { @@ -361,11 +350,6 @@ var TextSecureServer = (function() { urlParameters : '/' + id, validateResponse : {location: 'string'} }).then(function(response) { - var match = response.location.match(this.attachment_id_regex); - if (!match) { - console.log('Invalid attachment url for incoming message', response.location); - throw new Error('Received invalid attachment url'); - } return ajax(response.location, { type : "GET", responseType: "arraybuffer", @@ -378,13 +362,6 @@ var TextSecureServer = (function() { call : 'attachment', httpType : 'GET', }).then(function(response) { - // Extract the id as a string from the location url - // (workaround for ids too large for Javascript numbers) - var match = response.location.match(this.attachment_id_regex); - if (!match) { - console.log('Invalid attachment url for outgoing message', response.location); - throw new Error('Received invalid attachment url'); - } return ajax(response.location, { type : "PUT", contentType : "application/octet-stream", diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 33ec0c59..08c19d65 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -2,12 +2,12 @@ * vim: ts=4:sw=4:expandtab */ -function MessageReceiver(url, ports, username, password, signalingKey, attachment_server_url) { +function MessageReceiver(url, ports, username, password, signalingKey) { this.url = url; this.signalingKey = signalingKey; this.username = username; this.password = password; - this.server = new TextSecureServer(url, ports, username, password, attachment_server_url); + this.server = new TextSecureServer(url, ports, username, password); var address = libsignal.SignalProtocolAddress.fromString(username); this.number = address.getName(); @@ -478,8 +478,8 @@ MessageReceiver.prototype.extend({ window.textsecure = window.textsecure || {}; -textsecure.MessageReceiver = function(url, ports, username, password, signalingKey, attachment_server_url) { - var messageReceiver = new MessageReceiver(url, ports, username, password, signalingKey, attachment_server_url); +textsecure.MessageReceiver = function(url, ports, username, password, signalingKey) { + var messageReceiver = new MessageReceiver(url, ports, username, password, signalingKey); this.addEventListener = messageReceiver.addEventListener.bind(messageReceiver); this.removeEventListener = messageReceiver.removeEventListener.bind(messageReceiver); this.getStatus = messageReceiver.getStatus.bind(messageReceiver); diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index 17c38b02..2be68316 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -104,8 +104,8 @@ Message.prototype = { } }; -function MessageSender(url, ports, username, password, attachment_server_url) { - this.server = new TextSecureServer(url, ports, username, password, attachment_server_url); +function MessageSender(url, ports, username, password) { + this.server = new TextSecureServer(url, ports, username, password); this.pendingMessages = {}; } @@ -512,8 +512,8 @@ MessageSender.prototype = { window.textsecure = window.textsecure || {}; -textsecure.MessageSender = function(url, ports, username, password, attachment_server_url) { - var sender = new MessageSender(url, ports, username, password, attachment_server_url); +textsecure.MessageSender = function(url, ports, username, password) { + var sender = new MessageSender(url, ports, username, password); textsecure.replay.registerFunction(sender.tryMessageAgain.bind(sender), textsecure.replay.Type.ENCRYPT_MESSAGE); textsecure.replay.registerFunction(sender.retransmitMessage.bind(sender), textsecure.replay.Type.TRANSMIT_MESSAGE); textsecure.replay.registerFunction(sender.sendMessage.bind(sender), textsecure.replay.Type.REBUILD_MESSAGE);