diff --git a/js/background.js b/js/background.js index a62db987c..7c9ccbc69 100644 --- a/js/background.js +++ b/js/background.js @@ -391,6 +391,11 @@ }, showStickerPack: async (packId, key) => { + // We can get these events even if the user has never linked this instance. + if (Whisper.Import.isIncomplete() || !Whisper.Registration.everDone()) { + return; + } + // Kick off the download window.Signal.Stickers.downloadEphemeralPack(packId, key); diff --git a/js/views/install_view.js b/js/views/install_view.js index b45257f40..a893003a2 100644 --- a/js/views/install_view.js +++ b/js/views/install_view.js @@ -30,6 +30,8 @@ // the actual next step happens in confirmNumber() on submit form #link-phone }, initialize(options = {}) { + window.readyForUpdates(); + this.selectStep(Steps.SCAN_QR_CODE); this.connect(); this.on('disconnected', this.reconnect); diff --git a/js/views/standalone_registration_view.js b/js/views/standalone_registration_view.js index 8756758f5..9ccd7fc0b 100644 --- a/js/views/standalone_registration_view.js +++ b/js/views/standalone_registration_view.js @@ -12,6 +12,8 @@ templateName: 'standalone', className: 'full-screen-flow', initialize() { + window.readyForUpdates(); + this.accountManager = getAccountManager(); this.render(); diff --git a/main.js b/main.js index 7a8097e8e..bb864eafc 100644 --- a/main.js +++ b/main.js @@ -399,7 +399,14 @@ ipc.on('show-window', () => { showWindow(); }); -ipc.once('ready-for-updates', async () => { +let isReadyForUpdates = false; +async function readyForUpdates() { + if (isReadyForUpdates) { + return; + } + + isReadyForUpdates = true; + // First, install requested sticker pack if (process.argv.length > 1) { const [incomingUrl] = process.argv; @@ -417,7 +424,12 @@ ipc.once('ready-for-updates', async () => { error && error.stack ? error.stack : error ); } -}); +} + +ipc.once('ready-for-updates', readyForUpdates); + +const TEN_MINUTES = 10 * 60 * 1000; +setTimeout(readyForUpdates, TEN_MINUTES); function openReleaseNotes() { shell.openExternal( diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 998a2bceb..f5a98e2aa 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -596,25 +596,25 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#qr img').remove();", - "lineNumber": 133, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#qr .container').show();", "lineNumber": 135, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/install_view.js", + "line": " this.$('#qr .container').show();", + "lineNumber": 137, + "reasonCategory": "usageTrusted", + "updated": "2018-09-19T21:59:32.770Z", + "reasonDetail": "Protected from arbitrary input" + }, { "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " if ($('#qr').length === 0) {", - "lineNumber": 139, + "lineNumber": 141, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -623,7 +623,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#qr .container').hide();", - "lineNumber": 144, + "lineNumber": 146, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -632,25 +632,25 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.qr = new QRCode(this.$('#qr')[0]).makeCode(url);", - "lineNumber": 145, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/install_view.js", - "line": " this.$('#qr').addClass('ready');", "lineNumber": 147, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/install_view.js", + "line": " this.$('#qr').addClass('ready');", + "lineNumber": 149, + "reasonCategory": "usageTrusted", + "updated": "2018-09-19T21:59:32.770Z", + "reasonDetail": "Protected from arbitrary input" + }, { "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName());", - "lineNumber": 152, + "lineNumber": 154, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -659,7 +659,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#link-phone').submit();", - "lineNumber": 157, + "lineNumber": 159, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -668,7 +668,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#link-phone').submit(e => {", - "lineNumber": 167, + "lineNumber": 169, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -677,7 +677,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " let name = this.$(DEVICE_NAME_SELECTOR).val();", - "lineNumber": 171, + "lineNumber": 173, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -686,7 +686,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$(DEVICE_NAME_SELECTOR).focus();", - "lineNumber": 174, + "lineNumber": 176, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -982,7 +982,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('input.number').val(number);", - "lineNumber": 21, + "lineNumber": 23, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -991,25 +991,25 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " el: this.$('#phone-number-input'),", - "lineNumber": 24, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/standalone_registration_view.js", - "line": " this.$('#error').hide();", "lineNumber": 26, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/standalone_registration_view.js", + "line": " this.$('#error').hide();", + "lineNumber": 28, + "reasonCategory": "usageTrusted", + "updated": "2018-09-19T21:59:32.770Z", + "reasonDetail": "Protected from arbitrary input" + }, { "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " const verificationCode = $('#code')", - "lineNumber": 37, + "lineNumber": 39, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1018,7 +1018,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#status').text(s);", - "lineNumber": 50, + "lineNumber": 52, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1027,7 +1027,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " const verificationCode = $('#code')", - "lineNumber": 53, + "lineNumber": 55, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1036,7 +1036,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#error')", - "lineNumber": 64, + "lineNumber": 66, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1045,7 +1045,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " if (this.$('#number-container').hasClass('valid')) {", - "lineNumber": 71, + "lineNumber": 73, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1054,7 +1054,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#request-sms, #request-voice').prop('disabled', 'disabled');", - "lineNumber": 74, + "lineNumber": 76, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1063,25 +1063,25 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#code').addClass('invalid');", - "lineNumber": 79, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, - { - "rule": "jQuery-$(", - "path": "js/views/standalone_registration_view.js", - "line": " this.$('#code').removeClass('invalid');", "lineNumber": 81, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, + { + "rule": "jQuery-$(", + "path": "js/views/standalone_registration_view.js", + "line": " this.$('#code').removeClass('invalid');", + "lineNumber": 83, + "reasonCategory": "usageTrusted", + "updated": "2018-09-19T21:59:32.770Z", + "reasonDetail": "Protected from arbitrary input" + }, { "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#error').hide();", - "lineNumber": 86, + "lineNumber": 88, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1090,7 +1090,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#step2')", - "lineNumber": 92, + "lineNumber": 94, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1099,7 +1099,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#number-container').addClass('invalid');", - "lineNumber": 96, + "lineNumber": 98, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1108,7 +1108,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " $('#error').hide();", - "lineNumber": 101, + "lineNumber": 103, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1117,7 +1117,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#step2')", - "lineNumber": 107, + "lineNumber": 109, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1126,7 +1126,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#number-container').addClass('invalid');", - "lineNumber": 111, + "lineNumber": 113, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input"