Move to npm for several dependencies
mustache jQuery underscore backbone mocha chai intl-tel-input
This commit is contained in:
parent
a593a148e8
commit
cfe0bd0e79
32 changed files with 146 additions and 35694 deletions
|
@ -22,7 +22,6 @@ libtextsecure/test/test.js
|
|||
test/test.js
|
||||
|
||||
# Third-party files
|
||||
js/jquery.js
|
||||
js/Mp3LameEncoder.min.js
|
||||
js/WebAudioRecorderMp3.js
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ stylesheets/manifest.css
|
|||
|
||||
# Third-party files
|
||||
components/**
|
||||
js/jquery.js
|
||||
js/Mp3LameEncoder.min.js
|
||||
js/WebAudioRecorderMp3.js
|
||||
libtextsecure/libsignal-protocol.js
|
||||
|
|
24
Gruntfile.js
24
Gruntfile.js
|
@ -7,15 +7,12 @@ module.exports = function(grunt) {
|
|||
var bower = grunt.file.readJSON('bower.json');
|
||||
var components = [];
|
||||
for (var i in bower.concat.app) {
|
||||
components.push('components/' + bower.concat.app[i] + '/**/*.js');
|
||||
components.push(bower.concat.app[i]);
|
||||
}
|
||||
components.push('components/' + 'webaudiorecorder/lib/WebAudioRecorder.js');
|
||||
|
||||
var libtextsecurecomponents = [];
|
||||
for (i in bower.concat.libtextsecure) {
|
||||
libtextsecurecomponents.push(
|
||||
'components/' + bower.concat.libtextsecure[i] + '/**/*.js'
|
||||
);
|
||||
libtextsecurecomponents.push(bower.concat.libtextsecure[i]);
|
||||
}
|
||||
|
||||
var importOnce = require('node-sass-import-once');
|
||||
|
@ -34,8 +31,8 @@ module.exports = function(grunt) {
|
|||
},
|
||||
test: {
|
||||
src: [
|
||||
'components/mocha/mocha.js',
|
||||
'components/chai/chai.js',
|
||||
'node_modules/mocha/mocha.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'test/_test.js',
|
||||
],
|
||||
dest: 'test/test.js',
|
||||
|
@ -75,10 +72,10 @@ module.exports = function(grunt) {
|
|||
},
|
||||
libtextsecuretest: {
|
||||
src: [
|
||||
'components/jquery/dist/jquery.js',
|
||||
'node_modules/jquery/dist/jquery.js',
|
||||
'components/mock-socket/dist/mock-socket.js',
|
||||
'components/mocha/mocha.js',
|
||||
'components/chai/chai.js',
|
||||
'node_modules/mocha/mocha.js',
|
||||
'node_modules/chai/chai.js',
|
||||
'libtextsecure/test/_test.js',
|
||||
],
|
||||
dest: 'libtextsecure/test/test.js',
|
||||
|
@ -103,7 +100,6 @@ module.exports = function(grunt) {
|
|||
'!js/backup.js',
|
||||
'!js/components.js',
|
||||
'!js/database.js',
|
||||
'!js/jquery.js',
|
||||
'!js/libsignal-protocol-worker.js',
|
||||
'!js/libtextsecure.js',
|
||||
'!js/logging.js',
|
||||
|
@ -147,10 +143,6 @@ module.exports = function(grunt) {
|
|||
src: 'components/webaudiorecorder/lib/WebAudioRecorderMp3.js',
|
||||
dest: 'js/WebAudioRecorderMp3.js',
|
||||
},
|
||||
{
|
||||
src: 'components/jquery/dist/jquery.js',
|
||||
dest: 'js/jquery.js',
|
||||
},
|
||||
],
|
||||
},
|
||||
res: {
|
||||
|
@ -326,6 +318,7 @@ module.exports = function(grunt) {
|
|||
env: {
|
||||
NODE_ENV: environment,
|
||||
},
|
||||
requireName: 'unused',
|
||||
});
|
||||
|
||||
function getMochaResults() {
|
||||
|
@ -468,6 +461,7 @@ module.exports = function(grunt) {
|
|||
|
||||
var app = new Application({
|
||||
path: [dir, config.exe].join('/'),
|
||||
requireName: 'unused',
|
||||
});
|
||||
|
||||
app
|
||||
|
|
|
@ -48,7 +48,7 @@ a {
|
|||
<a href="https://signal.org">signal.org</a>
|
||||
</div>
|
||||
|
||||
<script type='text/javascript' src='js/jquery.js'></script>
|
||||
<script type='text/javascript' src='node_modules/jquery/dist/jquery.js'></script>
|
||||
<script>
|
||||
$(document).on('keyup', function(e) {
|
||||
if (e.keyCode === 27) {
|
||||
|
|
81
bower.json
81
bower.json
|
@ -5,28 +5,18 @@
|
|||
"license": "GPLV3",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"jquery": "liliakai/jquery#2.1.1-ajax-nativetransport",
|
||||
"underscore": "~1.7.0",
|
||||
"backbone": "~1.1.2",
|
||||
"protobuf": "~3.8.0",
|
||||
"mustache": "~0.8.2",
|
||||
"qrcode": "https://github.com/davidshimjs/qrcodejs.git#1c78ccd71",
|
||||
"indexeddb-backbonejs-adapter": "*",
|
||||
"intl-tel-input": "~4.0.1",
|
||||
"blueimp-load-image": "~1.13.0",
|
||||
"autosize": "~4.0.0",
|
||||
"webaudiorecorder": "https://github.com/higuma/web-audio-recorder-js.git",
|
||||
"mp3lameencoder": "https://github.com/higuma/mp3-lame-encoder-js.git"
|
||||
"blueimp-load-image": "~1.13.0",
|
||||
"indexeddb-backbonejs-adapter": "*",
|
||||
"mp3lameencoder": "https://github.com/higuma/mp3-lame-encoder-js.git",
|
||||
"protobuf": "~3.8.0",
|
||||
"qrcode": "https://github.com/davidshimjs/qrcodejs.git#1c78ccd71",
|
||||
"webaudiorecorder": "https://github.com/higuma/web-audio-recorder-js.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~2.0.1",
|
||||
"chai": "~3.5.0",
|
||||
"mock-socket": "~0.3.2"
|
||||
},
|
||||
"preen": {
|
||||
"jquery": [
|
||||
"dist/jquery.js"
|
||||
],
|
||||
"long": [
|
||||
"dist/Long.js"
|
||||
],
|
||||
|
@ -36,40 +26,12 @@
|
|||
"protobuf": [
|
||||
"dist/ProtoBuf.js"
|
||||
],
|
||||
"mustache": [
|
||||
"mustache.js"
|
||||
],
|
||||
"underscore": [
|
||||
"underscore.js"
|
||||
],
|
||||
"backbone": [
|
||||
"backbone.js"
|
||||
],
|
||||
"qrcode": [
|
||||
"qrcode.js"
|
||||
],
|
||||
"mocha": [
|
||||
"mocha.js",
|
||||
"mocha.css"
|
||||
],
|
||||
"chai": [
|
||||
"chai.js"
|
||||
],
|
||||
"indexeddb-backbonejs-adapter": [
|
||||
"backbone-indexeddb.js"
|
||||
],
|
||||
"intl-tel-input": [
|
||||
"build/css/intlTelInput.css",
|
||||
"build/img/flags.png",
|
||||
"build/js/intlTelInput.js"
|
||||
],
|
||||
"emojijs": [
|
||||
"lib/emoji.js",
|
||||
"demo/emoji.css"
|
||||
],
|
||||
"emojidata": [
|
||||
"img-apple-64/*"
|
||||
],
|
||||
"mock-socket": [
|
||||
"dist/mock-socket.js"
|
||||
],
|
||||
|
@ -86,24 +48,23 @@
|
|||
},
|
||||
"concat": {
|
||||
"app": [
|
||||
"jquery",
|
||||
"long",
|
||||
"bytebuffer",
|
||||
"protobuf",
|
||||
"mustache",
|
||||
"underscore",
|
||||
"backbone",
|
||||
"indexeddb-backbonejs-adapter",
|
||||
"qrcode",
|
||||
"moment",
|
||||
"intl-tel-input",
|
||||
"backbone.typeahead",
|
||||
"autosize"
|
||||
"node_modules/jquery/dist/jquery.js",
|
||||
"components/long/**/*.js",
|
||||
"components/bytebuffer/**/*.js",
|
||||
"components/protobuf/**/*.js",
|
||||
"node_modules/mustache/mustache.js",
|
||||
"node_modules/underscore/underscore.js",
|
||||
"node_modules/backbone/backbone.js",
|
||||
"components/indexeddb-backbonejs-adapter/**/*.js",
|
||||
"components/qrcode/**/*.js",
|
||||
"node_modules/intl-tel-input/build/js/intlTelInput.js",
|
||||
"components/autosize/**/*.js",
|
||||
"components/webaudiorecorder/lib/WebAudioRecorder.js"
|
||||
],
|
||||
"libtextsecure": [
|
||||
"long",
|
||||
"bytebuffer",
|
||||
"protobuf"
|
||||
"components/long/**/*.js",
|
||||
"components/bytebuffer/**/*.js",
|
||||
"components/protobuf/**/*.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 69 KiB |
File diff suppressed because one or more lines are too long
9205
components/jquery/dist/jquery.js
vendored
9205
components/jquery/dist/jquery.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,270 +0,0 @@
|
|||
@charset "utf-8";
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
}
|
||||
|
||||
#mocha {
|
||||
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
margin: 60px 50px;
|
||||
}
|
||||
|
||||
#mocha ul,
|
||||
#mocha li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mocha ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#mocha h1,
|
||||
#mocha h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mocha h1 {
|
||||
margin-top: 15px;
|
||||
font-size: 1em;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
#mocha h1 a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha h1 a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#mocha .suite .suite h1 {
|
||||
margin-top: 0;
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
#mocha .hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mocha .suite {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test {
|
||||
margin-left: 15px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#mocha .test.pending:hover h2::after {
|
||||
content: '(pending)';
|
||||
font-family: arial, sans-serif;
|
||||
}
|
||||
|
||||
#mocha .test.pass.medium .duration {
|
||||
background: #c09853;
|
||||
}
|
||||
|
||||
#mocha .test.pass.slow .duration {
|
||||
background: #b94a48;
|
||||
}
|
||||
|
||||
#mocha .test.pass::before {
|
||||
content: '✓';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #00d6b2;
|
||||
}
|
||||
|
||||
#mocha .test.pass .duration {
|
||||
font-size: 9px;
|
||||
margin-left: 5px;
|
||||
padding: 2px 5px;
|
||||
color: #fff;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#mocha .test.pass.fast .duration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha .test.pending {
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.pending::before {
|
||||
content: '◦';
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.fail {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test.fail pre {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha .test.fail::before {
|
||||
content: '✖';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre.error {
|
||||
color: #c00;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* (1): approximate for browsers not supporting calc
|
||||
* (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
|
||||
* ^^ seriously
|
||||
*/
|
||||
#mocha .test pre {
|
||||
display: block;
|
||||
float: left;
|
||||
clear: left;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
max-width: 85%; /*(1)*/
|
||||
max-width: calc(100% - 42px); /*(2)*/
|
||||
word-wrap: break-word;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
-moz-border-radius: 3px;
|
||||
-moz-box-shadow: 0 1px 3px #eee;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#mocha .test h2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#mocha .test a.replay {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 0;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
line-height: 15px;
|
||||
text-align: center;
|
||||
background: #eee;
|
||||
font-size: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
-webkit-transition: opacity 200ms;
|
||||
-moz-transition: opacity 200ms;
|
||||
transition: opacity 200ms;
|
||||
opacity: 0.3;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#mocha .test:hover a.replay {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#mocha-report.pass .test.fail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.fail .test.pass {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha-report.pending .test.pass,
|
||||
#mocha-report.pending .test.fail {
|
||||
display: none;
|
||||
}
|
||||
#mocha-report.pending .test.pass.pending {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#mocha-error {
|
||||
color: #c00;
|
||||
font-size: 1.5em;
|
||||
font-weight: 100;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
#mocha-stats {
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
color: #888;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
#mocha-stats .progress {
|
||||
float: right;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#mocha-stats em {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha-stats a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha-stats a:hover {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
#mocha-stats li {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
list-style: none;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
#mocha-stats canvas {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#mocha code .comment { color: #ddd; }
|
||||
#mocha code .init { color: #2f6fad; }
|
||||
#mocha code .string { color: #5890ad; }
|
||||
#mocha code .keyword { color: #8a6343; }
|
||||
#mocha code .number { color: #2f6fad; }
|
||||
|
||||
@media screen and (max-device-width: 480px) {
|
||||
#mocha {
|
||||
margin: 60px 0px;
|
||||
}
|
||||
|
||||
#mocha #stats {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,570 +0,0 @@
|
|||
/*!
|
||||
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
||||
* http://github.com/janl/mustache.js
|
||||
*/
|
||||
|
||||
/*global define: false*/
|
||||
|
||||
(function (root, factory) {
|
||||
if (typeof exports === "object" && exports) {
|
||||
factory(exports); // CommonJS
|
||||
} else {
|
||||
var mustache = {};
|
||||
factory(mustache);
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define(mustache); // AMD
|
||||
} else {
|
||||
root.Mustache = mustache; // <script>
|
||||
}
|
||||
}
|
||||
}(this, function (mustache) {
|
||||
|
||||
// Workaround for https://issues.apache.org/jira/browse/COUCHDB-577
|
||||
// See https://github.com/janl/mustache.js/issues/189
|
||||
var RegExp_test = RegExp.prototype.test;
|
||||
function testRegExp(re, string) {
|
||||
return RegExp_test.call(re, string);
|
||||
}
|
||||
|
||||
var nonSpaceRe = /\S/;
|
||||
function isWhitespace(string) {
|
||||
return !testRegExp(nonSpaceRe, string);
|
||||
}
|
||||
|
||||
var Object_toString = Object.prototype.toString;
|
||||
var isArray = Array.isArray || function (object) {
|
||||
return Object_toString.call(object) === '[object Array]';
|
||||
};
|
||||
|
||||
function isFunction(object) {
|
||||
return typeof object === 'function';
|
||||
}
|
||||
|
||||
function escapeRegExp(string) {
|
||||
return string.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
var entityMap = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
"/": '/'
|
||||
};
|
||||
|
||||
function escapeHtml(string) {
|
||||
return String(string).replace(/[&<>"'\/]/g, function (s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
}
|
||||
|
||||
function escapeTags(tags) {
|
||||
if (!isArray(tags) || tags.length !== 2) {
|
||||
throw new Error('Invalid tags: ' + tags);
|
||||
}
|
||||
|
||||
return [
|
||||
new RegExp(escapeRegExp(tags[0]) + "\\s*"),
|
||||
new RegExp("\\s*" + escapeRegExp(tags[1]))
|
||||
];
|
||||
}
|
||||
|
||||
var whiteRe = /\s*/;
|
||||
var spaceRe = /\s+/;
|
||||
var equalsRe = /\s*=/;
|
||||
var curlyRe = /\s*\}/;
|
||||
var tagRe = /#|\^|\/|>|\{|&|=|!/;
|
||||
|
||||
/**
|
||||
* Breaks up the given `template` string into a tree of tokens. If the `tags`
|
||||
* argument is given here it must be an array with two string values: the
|
||||
* opening and closing tags used in the template (e.g. [ "<%", "%>" ]). Of
|
||||
* course, the default is to use mustaches (i.e. mustache.tags).
|
||||
*
|
||||
* A token is an array with at least 4 elements. The first element is the
|
||||
* mustache symbol that was used inside the tag, e.g. "#" or "&". If the tag
|
||||
* did not contain a symbol (i.e. {{myValue}}) this element is "name". For
|
||||
* all text that appears outside a symbol this element is "text".
|
||||
*
|
||||
* The second element of a token is its "value". For mustache tags this is
|
||||
* whatever else was inside the tag besides the opening symbol. For text tokens
|
||||
* this is the text itself.
|
||||
*
|
||||
* The third and fourth elements of the token are the start and end indices,
|
||||
* respectively, of the token in the original template.
|
||||
*
|
||||
* Tokens that are the root node of a subtree contain two more elements: 1) an
|
||||
* array of tokens in the subtree and 2) the index in the original template at
|
||||
* which the closing tag for that section begins.
|
||||
*/
|
||||
function parseTemplate(template, tags) {
|
||||
tags = tags || mustache.tags;
|
||||
template = template || '';
|
||||
|
||||
if (typeof tags === 'string') {
|
||||
tags = tags.split(spaceRe);
|
||||
}
|
||||
|
||||
var tagRes = escapeTags(tags);
|
||||
var scanner = new Scanner(template);
|
||||
|
||||
var sections = []; // Stack to hold section tokens
|
||||
var tokens = []; // Buffer to hold the tokens
|
||||
var spaces = []; // Indices of whitespace tokens on the current line
|
||||
var hasTag = false; // Is there a {{tag}} on the current line?
|
||||
var nonSpace = false; // Is there a non-space char on the current line?
|
||||
|
||||
// Strips all whitespace tokens array for the current line
|
||||
// if there was a {{#tag}} on it and otherwise only space.
|
||||
function stripSpace() {
|
||||
if (hasTag && !nonSpace) {
|
||||
while (spaces.length) {
|
||||
delete tokens[spaces.pop()];
|
||||
}
|
||||
} else {
|
||||
spaces = [];
|
||||
}
|
||||
|
||||
hasTag = false;
|
||||
nonSpace = false;
|
||||
}
|
||||
|
||||
var start, type, value, chr, token, openSection;
|
||||
while (!scanner.eos()) {
|
||||
start = scanner.pos;
|
||||
|
||||
// Match any text between tags.
|
||||
value = scanner.scanUntil(tagRes[0]);
|
||||
if (value) {
|
||||
for (var i = 0, len = value.length; i < len; ++i) {
|
||||
chr = value.charAt(i);
|
||||
|
||||
if (isWhitespace(chr)) {
|
||||
spaces.push(tokens.length);
|
||||
} else {
|
||||
nonSpace = true;
|
||||
}
|
||||
|
||||
tokens.push(['text', chr, start, start + 1]);
|
||||
start += 1;
|
||||
|
||||
// Check for whitespace on the current line.
|
||||
if (chr === '\n') {
|
||||
stripSpace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Match the opening tag.
|
||||
if (!scanner.scan(tagRes[0])) break;
|
||||
hasTag = true;
|
||||
|
||||
// Get the tag type.
|
||||
type = scanner.scan(tagRe) || 'name';
|
||||
scanner.scan(whiteRe);
|
||||
|
||||
// Get the tag value.
|
||||
if (type === '=') {
|
||||
value = scanner.scanUntil(equalsRe);
|
||||
scanner.scan(equalsRe);
|
||||
scanner.scanUntil(tagRes[1]);
|
||||
} else if (type === '{') {
|
||||
value = scanner.scanUntil(new RegExp('\\s*' + escapeRegExp('}' + tags[1])));
|
||||
scanner.scan(curlyRe);
|
||||
scanner.scanUntil(tagRes[1]);
|
||||
type = '&';
|
||||
} else {
|
||||
value = scanner.scanUntil(tagRes[1]);
|
||||
}
|
||||
|
||||
// Match the closing tag.
|
||||
if (!scanner.scan(tagRes[1])) {
|
||||
throw new Error('Unclosed tag at ' + scanner.pos);
|
||||
}
|
||||
|
||||
token = [ type, value, start, scanner.pos ];
|
||||
tokens.push(token);
|
||||
|
||||
if (type === '#' || type === '^') {
|
||||
sections.push(token);
|
||||
} else if (type === '/') {
|
||||
// Check section nesting.
|
||||
openSection = sections.pop();
|
||||
|
||||
if (!openSection) {
|
||||
throw new Error('Unopened section "' + value + '" at ' + start);
|
||||
}
|
||||
if (openSection[1] !== value) {
|
||||
throw new Error('Unclosed section "' + openSection[1] + '" at ' + start);
|
||||
}
|
||||
} else if (type === 'name' || type === '{' || type === '&') {
|
||||
nonSpace = true;
|
||||
} else if (type === '=') {
|
||||
// Set the tags for the next time around.
|
||||
tagRes = escapeTags(tags = value.split(spaceRe));
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure there are no open sections when we're done.
|
||||
openSection = sections.pop();
|
||||
if (openSection) {
|
||||
throw new Error('Unclosed section "' + openSection[1] + '" at ' + scanner.pos);
|
||||
}
|
||||
|
||||
return nestTokens(squashTokens(tokens));
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines the values of consecutive text tokens in the given `tokens` array
|
||||
* to a single token.
|
||||
*/
|
||||
function squashTokens(tokens) {
|
||||
var squashedTokens = [];
|
||||
|
||||
var token, lastToken;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
if (token) {
|
||||
if (token[0] === 'text' && lastToken && lastToken[0] === 'text') {
|
||||
lastToken[1] += token[1];
|
||||
lastToken[3] = token[3];
|
||||
} else {
|
||||
squashedTokens.push(token);
|
||||
lastToken = token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return squashedTokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forms the given array of `tokens` into a nested tree structure where
|
||||
* tokens that represent a section have two additional items: 1) an array of
|
||||
* all tokens that appear in that section and 2) the index in the original
|
||||
* template that represents the end of that section.
|
||||
*/
|
||||
function nestTokens(tokens) {
|
||||
var nestedTokens = [];
|
||||
var collector = nestedTokens;
|
||||
var sections = [];
|
||||
|
||||
var token, section;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case '#':
|
||||
case '^':
|
||||
collector.push(token);
|
||||
sections.push(token);
|
||||
collector = token[4] = [];
|
||||
break;
|
||||
case '/':
|
||||
section = sections.pop();
|
||||
section[5] = token[2];
|
||||
collector = sections.length > 0 ? sections[sections.length - 1][4] : nestedTokens;
|
||||
break;
|
||||
default:
|
||||
collector.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
return nestedTokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple string scanner that is used by the template parser to find
|
||||
* tokens in template strings.
|
||||
*/
|
||||
function Scanner(string) {
|
||||
this.string = string;
|
||||
this.tail = string;
|
||||
this.pos = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns `true` if the tail is empty (end of string).
|
||||
*/
|
||||
Scanner.prototype.eos = function () {
|
||||
return this.tail === "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Tries to match the given regular expression at the current position.
|
||||
* Returns the matched text if it can match, the empty string otherwise.
|
||||
*/
|
||||
Scanner.prototype.scan = function (re) {
|
||||
var match = this.tail.match(re);
|
||||
|
||||
if (match && match.index === 0) {
|
||||
var string = match[0];
|
||||
this.tail = this.tail.substring(string.length);
|
||||
this.pos += string.length;
|
||||
return string;
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
/**
|
||||
* Skips all text until the given regular expression can be matched. Returns
|
||||
* the skipped string, which is the entire tail if no match can be made.
|
||||
*/
|
||||
Scanner.prototype.scanUntil = function (re) {
|
||||
var index = this.tail.search(re), match;
|
||||
|
||||
switch (index) {
|
||||
case -1:
|
||||
match = this.tail;
|
||||
this.tail = "";
|
||||
break;
|
||||
case 0:
|
||||
match = "";
|
||||
break;
|
||||
default:
|
||||
match = this.tail.substring(0, index);
|
||||
this.tail = this.tail.substring(index);
|
||||
}
|
||||
|
||||
this.pos += match.length;
|
||||
|
||||
return match;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a rendering context by wrapping a view object and
|
||||
* maintaining a reference to the parent context.
|
||||
*/
|
||||
function Context(view, parentContext) {
|
||||
this.view = view == null ? {} : view;
|
||||
this.cache = { '.': this.view };
|
||||
this.parent = parentContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new context using the given view with this context
|
||||
* as the parent.
|
||||
*/
|
||||
Context.prototype.push = function (view) {
|
||||
return new Context(view, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the given name in this context, traversing
|
||||
* up the context hierarchy if the value is absent in this context's view.
|
||||
*/
|
||||
Context.prototype.lookup = function (name) {
|
||||
var value;
|
||||
if (name in this.cache) {
|
||||
value = this.cache[name];
|
||||
} else {
|
||||
var context = this;
|
||||
|
||||
while (context) {
|
||||
if (name.indexOf('.') > 0) {
|
||||
value = context.view;
|
||||
|
||||
var names = name.split('.'), i = 0;
|
||||
while (value != null && i < names.length) {
|
||||
value = value[names[i++]];
|
||||
}
|
||||
} else {
|
||||
value = context.view[name];
|
||||
}
|
||||
|
||||
if (value != null) break;
|
||||
|
||||
context = context.parent;
|
||||
}
|
||||
|
||||
this.cache[name] = value;
|
||||
}
|
||||
|
||||
if (isFunction(value)) {
|
||||
value = value.call(this.view);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
/**
|
||||
* A Writer knows how to take a stream of tokens and render them to a
|
||||
* string, given a context. It also maintains a cache of templates to
|
||||
* avoid the need to parse the same template twice.
|
||||
*/
|
||||
function Writer() {
|
||||
this.cache = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears all cached templates in this writer.
|
||||
*/
|
||||
Writer.prototype.clearCache = function () {
|
||||
this.cache = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses and caches the given `template` and returns the array of tokens
|
||||
* that is generated from the parse.
|
||||
*/
|
||||
Writer.prototype.parse = function (template, tags) {
|
||||
var cache = this.cache;
|
||||
var tokens = cache[template];
|
||||
|
||||
if (tokens == null) {
|
||||
tokens = cache[template] = parseTemplate(template, tags);
|
||||
}
|
||||
|
||||
return tokens;
|
||||
};
|
||||
|
||||
/**
|
||||
* High-level method that is used to render the given `template` with
|
||||
* the given `view`.
|
||||
*
|
||||
* The optional `partials` argument may be an object that contains the
|
||||
* names and templates of partials that are used in the template. It may
|
||||
* also be a function that is used to load partial templates on the fly
|
||||
* that takes a single argument: the name of the partial.
|
||||
*/
|
||||
Writer.prototype.render = function (template, view, partials) {
|
||||
var tokens = this.parse(template);
|
||||
var context = (view instanceof Context) ? view : new Context(view);
|
||||
return this.renderTokens(tokens, context, partials, template);
|
||||
};
|
||||
|
||||
/**
|
||||
* Low-level method that renders the given array of `tokens` using
|
||||
* the given `context` and `partials`.
|
||||
*
|
||||
* Note: The `originalTemplate` is only ever used to extract the portion
|
||||
* of the original template that was contained in a higher-order section.
|
||||
* If the template doesn't use higher-order sections, this argument may
|
||||
* be omitted.
|
||||
*/
|
||||
Writer.prototype.renderTokens = function (tokens, context, partials, originalTemplate) {
|
||||
var buffer = '';
|
||||
|
||||
// This function is used to render an arbitrary template
|
||||
// in the current context by higher-order sections.
|
||||
var self = this;
|
||||
function subRender(template) {
|
||||
return self.render(template, context, partials);
|
||||
}
|
||||
|
||||
var token, value;
|
||||
for (var i = 0, len = tokens.length; i < len; ++i) {
|
||||
token = tokens[i];
|
||||
|
||||
switch (token[0]) {
|
||||
case '#':
|
||||
value = context.lookup(token[1]);
|
||||
if (!value) continue;
|
||||
|
||||
if (isArray(value)) {
|
||||
for (var j = 0, jlen = value.length; j < jlen; ++j) {
|
||||
buffer += this.renderTokens(token[4], context.push(value[j]), partials, originalTemplate);
|
||||
}
|
||||
} else if (typeof value === 'object' || typeof value === 'string') {
|
||||
buffer += this.renderTokens(token[4], context.push(value), partials, originalTemplate);
|
||||
} else if (isFunction(value)) {
|
||||
if (typeof originalTemplate !== 'string') {
|
||||
throw new Error('Cannot use higher-order sections without the original template');
|
||||
}
|
||||
|
||||
// Extract the portion of the original template that the section contains.
|
||||
value = value.call(context.view, originalTemplate.slice(token[3], token[5]), subRender);
|
||||
|
||||
if (value != null) buffer += value;
|
||||
} else {
|
||||
buffer += this.renderTokens(token[4], context, partials, originalTemplate);
|
||||
}
|
||||
|
||||
break;
|
||||
case '^':
|
||||
value = context.lookup(token[1]);
|
||||
|
||||
// Use JavaScript's definition of falsy. Include empty arrays.
|
||||
// See https://github.com/janl/mustache.js/issues/186
|
||||
if (!value || (isArray(value) && value.length === 0)) {
|
||||
buffer += this.renderTokens(token[4], context, partials, originalTemplate);
|
||||
}
|
||||
|
||||
break;
|
||||
case '>':
|
||||
if (!partials) continue;
|
||||
value = isFunction(partials) ? partials(token[1]) : partials[token[1]];
|
||||
if (value != null) buffer += this.renderTokens(this.parse(value), context, partials, value);
|
||||
break;
|
||||
case '&':
|
||||
value = context.lookup(token[1]);
|
||||
if (value != null) buffer += value;
|
||||
break;
|
||||
case 'name':
|
||||
value = context.lookup(token[1]);
|
||||
if (value != null) buffer += mustache.escape(value);
|
||||
break;
|
||||
case 'text':
|
||||
buffer += token[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return buffer;
|
||||
};
|
||||
|
||||
mustache.name = "mustache.js";
|
||||
mustache.version = "0.8.1";
|
||||
mustache.tags = [ "{{", "}}" ];
|
||||
|
||||
// All high-level mustache.* functions use this writer.
|
||||
var defaultWriter = new Writer();
|
||||
|
||||
/**
|
||||
* Clears all cached templates in the default writer.
|
||||
*/
|
||||
mustache.clearCache = function () {
|
||||
return defaultWriter.clearCache();
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses and caches the given template in the default writer and returns the
|
||||
* array of tokens it contains. Doing this ahead of time avoids the need to
|
||||
* parse templates on the fly as they are rendered.
|
||||
*/
|
||||
mustache.parse = function (template, tags) {
|
||||
return defaultWriter.parse(template, tags);
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders the `template` with the given `view` and `partials` using the
|
||||
* default writer.
|
||||
*/
|
||||
mustache.render = function (template, view, partials) {
|
||||
return defaultWriter.render(template, view, partials);
|
||||
};
|
||||
|
||||
// This is here for backwards compatibility with 0.4.x.
|
||||
mustache.to_html = function (template, view, partials, send) {
|
||||
var result = mustache.render(template, view, partials);
|
||||
|
||||
if (isFunction(send)) {
|
||||
send(result);
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
// Export the escaping function so that the user may override it.
|
||||
// See https://github.com/janl/mustache.js/issues/244
|
||||
mustache.escape = escapeHtml;
|
||||
|
||||
// Export these mainly for testing, but also for advanced usage.
|
||||
mustache.Scanner = Scanner;
|
||||
mustache.Context = Context;
|
||||
mustache.Writer = Writer;
|
||||
|
||||
}));
|
File diff suppressed because it is too large
Load diff
|
@ -1 +0,0 @@
|
|||
../components/intl-tel-input/build/img/flags.png
|
9205
js/jquery.js
vendored
9205
js/jquery.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -915,19 +915,15 @@
|
|||
);
|
||||
});
|
||||
},
|
||||
removeIdentityKey: function(number) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var identityRecord = new IdentityRecord({ id: number });
|
||||
identityRecord
|
||||
.fetch()
|
||||
.then(function() {
|
||||
identityRecord.destroy();
|
||||
})
|
||||
.fail(function() {
|
||||
reject(new Error('Tried to remove identity for unknown number'));
|
||||
});
|
||||
resolve(textsecure.storage.protocol.removeAllSessions(number));
|
||||
});
|
||||
removeIdentityKey: async function(number) {
|
||||
const identityRecord = new IdentityRecord({ id: number });
|
||||
try {
|
||||
await wrapDeferred(identityRecord.fetch());
|
||||
await wrapDeferred(identityRecord.destroy());
|
||||
return textsecure.storage.protocol.removeAllSessions(number);
|
||||
} catch (error) {
|
||||
throw new Error('Tried to remove identity for unknown number');
|
||||
}
|
||||
},
|
||||
|
||||
// Groups
|
||||
|
@ -972,7 +968,7 @@
|
|||
return collection.fetch().then(resolve, reject);
|
||||
}).then(function() {
|
||||
// Return a plain array of plain objects
|
||||
return collection.map('attributes');
|
||||
return collection.map(model => model.attributes);
|
||||
});
|
||||
},
|
||||
addUnprocessed: function(data) {
|
||||
|
|
|
@ -14,23 +14,21 @@ describe('Key generation', function() {
|
|||
assert.strictEqual(keyPair.privKey.byteLength, 32);
|
||||
}
|
||||
function itStoresPreKey(keyId) {
|
||||
it('prekey ' + keyId + ' is valid', function(done) {
|
||||
it('prekey ' + keyId + ' is valid', function() {
|
||||
return textsecure.storage.protocol
|
||||
.loadPreKey(keyId)
|
||||
.then(function(keyPair) {
|
||||
validateStoredKeyPair(keyPair);
|
||||
})
|
||||
.then(done, done);
|
||||
});
|
||||
});
|
||||
}
|
||||
function itStoresSignedPreKey(keyId) {
|
||||
it('signed prekey ' + keyId + ' is valid', function(done) {
|
||||
it('signed prekey ' + keyId + ' is valid', function() {
|
||||
return textsecure.storage.protocol
|
||||
.loadSignedPreKey(keyId)
|
||||
.then(function(keyPair) {
|
||||
validateStoredKeyPair(keyPair);
|
||||
})
|
||||
.then(done, done);
|
||||
});
|
||||
});
|
||||
}
|
||||
function validateResultKey(resultKey) {
|
||||
|
@ -48,13 +46,13 @@ describe('Key generation', function() {
|
|||
});
|
||||
}
|
||||
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
localStorage.clear();
|
||||
libsignal.KeyHelper.generateIdentityKeyPair()
|
||||
.then(function(keyPair) {
|
||||
return textsecure.storage.protocol.put('identityKey', keyPair);
|
||||
})
|
||||
.then(done, done);
|
||||
return libsignal.KeyHelper.generateIdentityKeyPair().then(function(
|
||||
keyPair
|
||||
) {
|
||||
return textsecure.storage.protocol.put('identityKey', keyPair);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the first time', function() {
|
||||
|
@ -66,14 +64,11 @@ describe('Key generation', function() {
|
|||
* identityKey: <ArrayBuffer>
|
||||
* }
|
||||
*/
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
var accountManager = new textsecure.AccountManager('');
|
||||
accountManager
|
||||
.generateKeys(count)
|
||||
.then(function(res) {
|
||||
result = res;
|
||||
})
|
||||
.then(done, done);
|
||||
return accountManager.generateKeys(count).then(function(res) {
|
||||
result = res;
|
||||
});
|
||||
});
|
||||
for (var i = 1; i <= count; i++) {
|
||||
itStoresPreKey(i);
|
||||
|
@ -92,29 +87,22 @@ describe('Key generation', function() {
|
|||
assert.strictEqual(result.preKeys[i].keyId, i + 1);
|
||||
}
|
||||
});
|
||||
it('result contains the correct public keys', function(done) {
|
||||
Promise.all(result.preKeys.map(validateResultKey))
|
||||
.then(function() {
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
it('result contains the correct public keys', function() {
|
||||
return Promise.all(result.preKeys.map(validateResultKey));
|
||||
});
|
||||
it('returns a signed prekey', function(done) {
|
||||
it('returns a signed prekey', function() {
|
||||
assert.strictEqual(result.signedPreKey.keyId, 1);
|
||||
assert.instanceOf(result.signedPreKey.signature, ArrayBuffer);
|
||||
validateResultSignedKey(result.signedPreKey).then(done, done);
|
||||
return validateResultSignedKey(result.signedPreKey);
|
||||
});
|
||||
});
|
||||
describe('the second time', function() {
|
||||
var result;
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
var accountManager = new textsecure.AccountManager('');
|
||||
accountManager
|
||||
.generateKeys(count)
|
||||
.then(function(res) {
|
||||
result = res;
|
||||
})
|
||||
.then(done, done);
|
||||
return accountManager.generateKeys(count).then(function(res) {
|
||||
result = res;
|
||||
});
|
||||
});
|
||||
for (var i = 1; i <= 2 * count; i++) {
|
||||
itStoresPreKey(i);
|
||||
|
@ -133,29 +121,22 @@ describe('Key generation', function() {
|
|||
assert.strictEqual(result.preKeys[i - 1].keyId, i + count);
|
||||
}
|
||||
});
|
||||
it('result contains the correct public keys', function(done) {
|
||||
Promise.all(result.preKeys.map(validateResultKey))
|
||||
.then(function() {
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
it('result contains the correct public keys', function() {
|
||||
return Promise.all(result.preKeys.map(validateResultKey));
|
||||
});
|
||||
it('returns a signed prekey', function(done) {
|
||||
it('returns a signed prekey', function() {
|
||||
assert.strictEqual(result.signedPreKey.keyId, 2);
|
||||
assert.instanceOf(result.signedPreKey.signature, ArrayBuffer);
|
||||
validateResultSignedKey(result.signedPreKey).then(done, done);
|
||||
return validateResultSignedKey(result.signedPreKey);
|
||||
});
|
||||
});
|
||||
describe('the third time', function() {
|
||||
var result;
|
||||
before(function(done) {
|
||||
before(function() {
|
||||
var accountManager = new textsecure.AccountManager('');
|
||||
accountManager
|
||||
.generateKeys(count)
|
||||
.then(function(res) {
|
||||
result = res;
|
||||
})
|
||||
.then(done, done);
|
||||
return accountManager.generateKeys(count).then(function(res) {
|
||||
result = res;
|
||||
});
|
||||
});
|
||||
for (var i = 1; i <= 3 * count; i++) {
|
||||
itStoresPreKey(i);
|
||||
|
@ -174,17 +155,13 @@ describe('Key generation', function() {
|
|||
assert.strictEqual(result.preKeys[i - 1].keyId, i + 2 * count);
|
||||
}
|
||||
});
|
||||
it('result contains the correct public keys', function(done) {
|
||||
Promise.all(result.preKeys.map(validateResultKey))
|
||||
.then(function() {
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
it('result contains the correct public keys', function() {
|
||||
return Promise.all(result.preKeys.map(validateResultKey));
|
||||
});
|
||||
it('result contains a signed prekey', function(done) {
|
||||
it('result contains a signed prekey', function() {
|
||||
assert.strictEqual(result.signedPreKey.keyId, 3);
|
||||
assert.instanceOf(result.signedPreKey.signature, ArrayBuffer);
|
||||
validateResultSignedKey(result.signedPreKey).then(done, done);
|
||||
return validateResultSignedKey(result.signedPreKey);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>libtextsecure test runner</title>
|
||||
<link rel="stylesheet" href="../../components/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('Protocol Wrapper', function() {
|
|||
});
|
||||
});
|
||||
describe('processPreKey', function() {
|
||||
it('rejects if the identity key changes', function(done) {
|
||||
it('rejects if the identity key changes', function() {
|
||||
var address = new libsignal.SignalProtocolAddress(identifier, 1);
|
||||
var builder = new libsignal.SessionBuilder(store, address);
|
||||
return builder
|
||||
|
@ -29,11 +29,10 @@ describe('Protocol Wrapper', function() {
|
|||
encodedNumber: address.toString(),
|
||||
})
|
||||
.then(function() {
|
||||
done(new Error('Allowed to overwrite identity key'));
|
||||
throw new Error('Allowed to overwrite identity key');
|
||||
})
|
||||
.catch(function(e) {
|
||||
assert.strictEqual(e.message, 'Identity key changed');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -189,12 +189,9 @@ describe('SignalProtocolStore', function() {
|
|||
})
|
||||
.then(done, done);
|
||||
});
|
||||
it('returns empty array for a number with no device ids', function(done) {
|
||||
return store
|
||||
.getDeviceIds('foo')
|
||||
.then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
})
|
||||
.then(done, done);
|
||||
it('returns empty array for a number with no device ids', function() {
|
||||
return store.getDeviceIds('foo').then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
"dependencies": {
|
||||
"@sindresorhus/is": "^0.8.0",
|
||||
"archiver": "^2.1.1",
|
||||
"backbone": "^1.3.3",
|
||||
"blob-util": "^1.3.0",
|
||||
"blueimp-canvas-to-blob": "^3.14.0",
|
||||
"blueimp-load-image": "^2.18.0",
|
||||
|
@ -66,10 +67,13 @@
|
|||
"fs-extra": "^5.0.0",
|
||||
"google-libphonenumber": "^3.0.7",
|
||||
"got": "^8.2.0",
|
||||
"intl-tel-input": "^12.1.15",
|
||||
"jquery": "^3.3.1",
|
||||
"linkify-it": "^2.0.3",
|
||||
"lodash": "^4.17.4",
|
||||
"mkdirp": "^0.5.1",
|
||||
"moment": "^2.21.0",
|
||||
"mustache": "^2.3.0",
|
||||
"node-fetch": "https://github.com/scottnonnenberg-signal/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4",
|
||||
"os-locale": "^2.1.0",
|
||||
"pify": "^3.0.0",
|
||||
|
@ -84,6 +88,7 @@
|
|||
"testcheck": "^1.0.0-rc.2",
|
||||
"tmp": "^0.0.33",
|
||||
"to-arraybuffer": "^1.0.1",
|
||||
"underscore": "^1.9.0",
|
||||
"websocket": "^1.0.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
@import 'variables';
|
||||
@import '../components/intl-tel-input/build/css/intlTelInput.css';
|
||||
@import '../node_modules/intl-tel-input/build/css/intlTelInput.css';
|
||||
@import 'progress';
|
||||
.iti-flag {
|
||||
// override intlTelInput's flags image location
|
||||
background: url('../images/flags.png');
|
||||
background: url('../node_modules/intl-tel-input/build/img/flags.png');
|
||||
}
|
||||
|
||||
.intl-tel-input .country-list {
|
||||
|
|
|
@ -68,19 +68,16 @@ before(function(done) {
|
|||
};
|
||||
});
|
||||
|
||||
async function clearDatabase(done) {
|
||||
async function clearDatabase() {
|
||||
await Signal.Migrations.Migrations0DatabaseWithAttachmentData.run({
|
||||
Backbone,
|
||||
databaseName: Whisper.Database.id,
|
||||
});
|
||||
|
||||
const convos = new Whisper.ConversationCollection();
|
||||
await convos.fetch();
|
||||
await convos.destroyAll();
|
||||
await wrapDeferred(convos.fetch());
|
||||
await wrapDeferred(convos.destroyAll());
|
||||
const messages = new Whisper.MessageCollection();
|
||||
await messages.fetch();
|
||||
await messages.destroyAll();
|
||||
if (done) {
|
||||
done();
|
||||
}
|
||||
await wrapDeferred(messages.fetch());
|
||||
await wrapDeferred(messages.destroyAll());
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset='utf-8'>
|
||||
<title>TextSecure test runner</title>
|
||||
<link rel="stylesheet" href="../components/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../stylesheets/manifest.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -41,7 +41,7 @@ describe('KeyChangeListener', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
return store.saveIdentity(address.toString(), newKey);
|
||||
store.saveIdentity(address.toString(), newKey);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ describe('KeyChangeListener', function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
return store.saveIdentity(address.toString(), newKey);
|
||||
store.saveIdentity(address.toString(), newKey);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -268,15 +268,11 @@
|
|||
it('matches by name', function(done) {
|
||||
testSearch(['John', 'Doe', 'john', 'doe', 'John Doe', 'john doe'], done);
|
||||
});
|
||||
it('does not match +', function(done) {
|
||||
it('does not match +', function() {
|
||||
var collection = new Whisper.ConversationCollection();
|
||||
return collection
|
||||
.search('+')
|
||||
.then(function() {
|
||||
assert.isUndefined(collection.get(convo.id), 'got result for "+"');
|
||||
done();
|
||||
})
|
||||
.catch(done);
|
||||
return collection.search('+').then(function() {
|
||||
assert.isUndefined(collection.get(convo.id), 'got result for "+"');
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -81,16 +81,15 @@ describe('SignalProtocolStore', function() {
|
|||
});
|
||||
|
||||
describe('When there is no existing key (first use)', function() {
|
||||
before(function(done) {
|
||||
store.removeIdentityKey(identifier).then(function() {
|
||||
store
|
||||
.saveIdentity(address.toString(), testKey.pubKey)
|
||||
.then(function() {
|
||||
record.fetch().then(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
before(function() {
|
||||
return store
|
||||
.removeIdentityKey(identifier)
|
||||
.then(function() {
|
||||
return store.saveIdentity(address.toString(), testKey.pubKey);
|
||||
})
|
||||
.then(function() {
|
||||
return wrapDeferred(record.fetch());
|
||||
});
|
||||
});
|
||||
it('marks the key firstUse', function() {
|
||||
assert(record.get('firstUse'));
|
||||
|
@ -1197,13 +1196,10 @@ describe('SignalProtocolStore', function() {
|
|||
})
|
||||
.then(done, done);
|
||||
});
|
||||
it('returns empty array for a number with no device ids', function(done) {
|
||||
return store
|
||||
.getDeviceIds('foo')
|
||||
.then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
})
|
||||
.then(done, done);
|
||||
it('returns empty array for a number with no device ids', function() {
|
||||
return store.getDeviceIds('foo').then(function(deviceIds) {
|
||||
assert.sameMembers(deviceIds, []);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ describe('ConversationSearchView', function() {
|
|||
type: 'group',
|
||||
left: true,
|
||||
});
|
||||
before(function(done) {
|
||||
convo.save().then(done);
|
||||
before(() => {
|
||||
return wrapDeferred(convo.save());
|
||||
});
|
||||
describe('with no messages', function() {
|
||||
var input = $('<input>');
|
||||
|
@ -82,13 +82,13 @@ describe('ConversationSearchView', function() {
|
|||
type: 'group',
|
||||
left: true,
|
||||
});
|
||||
before(function(done) {
|
||||
convo.save().then(done);
|
||||
before(() => {
|
||||
return wrapDeferred(convo.save());
|
||||
});
|
||||
describe('with no messages', function() {
|
||||
before(function(done) {
|
||||
view.resetTypeahead();
|
||||
view.typeahead_view.collection.on('reset', function() {
|
||||
view.typeahead_view.collection.once('reset', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -100,12 +100,12 @@ describe('ConversationSearchView', function() {
|
|||
});
|
||||
});
|
||||
describe('with messages', function() {
|
||||
before(function(done) {
|
||||
convo.save({ lastMessage: 'asdf' }).then(function() {
|
||||
view.typeahead_view.collection.on('reset', function() {
|
||||
before(done => {
|
||||
wrapDeferred(convo.save({ lastMessage: 'asdf' })).then(function() {
|
||||
view.resetTypeahead();
|
||||
view.typeahead_view.collection.once('reset', function() {
|
||||
done();
|
||||
});
|
||||
view.resetTypeahead();
|
||||
});
|
||||
});
|
||||
it('should surface left groups with messages', function() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe('MessageView', function() {
|
||||
var convo, message;
|
||||
|
||||
before(async done => {
|
||||
before(async () => {
|
||||
await clearDatabase();
|
||||
convo = new Whisper.Conversation({ id: 'foo' });
|
||||
message = convo.messageCollection.add({
|
||||
|
@ -13,7 +13,6 @@ describe('MessageView', function() {
|
|||
});
|
||||
|
||||
await storage.put('number_id', '+18088888888.1');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should display the message text', function() {
|
||||
|
|
22
yarn.lock
22
yarn.lock
|
@ -736,6 +736,12 @@ babylon@^6.8.1:
|
|||
version "6.17.0"
|
||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932"
|
||||
|
||||
backbone@^1.3.3:
|
||||
version "1.3.3"
|
||||
resolved "https://registry.yarnpkg.com/backbone/-/backbone-1.3.3.tgz#4cc80ea7cb1631ac474889ce40f2f8bc683b2999"
|
||||
dependencies:
|
||||
underscore ">=1.8.3"
|
||||
|
||||
bail@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/bail/-/bail-1.0.2.tgz#f7d6c1731630a9f9f0d4d35ed1f962e2074a1764"
|
||||
|
@ -4465,6 +4471,10 @@ internal-ip@1.2.0:
|
|||
dependencies:
|
||||
meow "^3.3.0"
|
||||
|
||||
intl-tel-input@^12.1.15:
|
||||
version "12.1.15"
|
||||
resolved "https://registry.yarnpkg.com/intl-tel-input/-/intl-tel-input-12.1.15.tgz#7393e6b77572731bbc65ca4585782e8ba3d74de4"
|
||||
|
||||
into-stream@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/into-stream/-/into-stream-3.1.0.tgz#96fb0a936c12babd6ff1752a17d05616abd094c6"
|
||||
|
@ -4941,6 +4951,10 @@ jpeg-js@^0.2.0:
|
|||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.2.0.tgz#53e448ec9d263e683266467e9442d2c5a2ef5482"
|
||||
|
||||
jquery@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca"
|
||||
|
||||
js-base64@^2.1.8:
|
||||
version "2.1.9"
|
||||
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce"
|
||||
|
@ -5839,6 +5853,10 @@ multicast-dns@^6.0.1:
|
|||
dns-packet "^1.3.1"
|
||||
thunky "^1.0.2"
|
||||
|
||||
mustache@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/mustache/-/mustache-2.3.0.tgz#4028f7778b17708a489930a6e52ac3bca0da41d0"
|
||||
|
||||
mute-stream@0.0.7, mute-stream@~0.0.4:
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
|
||||
|
@ -9141,6 +9159,10 @@ underscore.string@~3.2.3:
|
|||
version "3.2.3"
|
||||
resolved "https://registry.yarnpkg.com/underscore.string/-/underscore.string-3.2.3.tgz#806992633665d5e5fcb4db1fb3a862eb68e9e6da"
|
||||
|
||||
underscore@>=1.8.3, underscore@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.0.tgz#31dbb314cfcc88f169cd3692d9149d81a00a73e4"
|
||||
|
||||
underscore@~1.6.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.6.0.tgz#8b38b10cacdef63337b8b24e4ff86d45aea529a8"
|
||||
|
|
Loading…
Reference in a new issue