Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
67c99f60
Commit
67c99f60
authored
Nov 15, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't put define in try/catch. Breaks optimizer.
Add check HAS_CSPRNG instead of the previous check
parent
518c0fca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
39 deletions
+14
-39
converse.js
converse.js
+14
-39
No files found.
converse.js
View file @
67c99f60
...
...
@@ -12,31 +12,6 @@
console
=
{
log
:
function
()
{},
error
:
function
()
{}
};
}
if
(
typeof
define
===
'
function
'
&&
define
.
amd
)
{
var
on_load
=
function
(
CryptoJS
,
otr
)
{
// Use Mustache style syntax for variable interpolation
_
.
templateSettings
=
{
evaluate
:
/
\{\[([\s\S]
+
?)\]\}
/g
,
interpolate
:
/
\{\{([\s\S]
+
?)\}\}
/g
};
if
(
typeof
otr
!==
"
undefined
"
)
{
return
factory
(
jQuery
,
_
,
CryptoJS
,
otr
.
OTR
,
otr
.
DSA
,
console
);
}
else
{
return
factory
(
jQuery
,
_
,
undefined
,
undefined
,
undefined
,
console
);
}
};
var
dependencies
=
[
"
crypto
"
,
"
otr
"
,
"
locales
"
,
"
backbone.localStorage
"
,
"
jquery.tinysort
"
,
"
strophe
"
,
"
strophe.muc
"
,
"
strophe.roster
"
,
"
strophe.vcard
"
,
"
strophe.disco
"
];
try
{
define
(
"
converse
"
,
[
"
crypto
"
,
"
otr
"
,
...
...
@@ -48,13 +23,14 @@
"
strophe.roster
"
,
"
strophe.vcard
"
,
"
strophe.disco
"
],
on_load
);
}
catch
(
e
)
{
console
.
log
(
e
);
// Don't load crypto stuff if the browser doesn't have a CSRNG
dependencies
.
splice
(
0
,
2
);
define
(
"
converse
"
,
dependencies
,
on_load
);
}
],
function
(
CryptoJS
,
otr
)
{
// Use Mustache style syntax for variable interpolation
_
.
templateSettings
=
{
evaluate
:
/
\{\[([\s\S]
+
?)\]\}
/g
,
interpolate
:
/
\{\{([\s\S]
+
?)\}\}
/g
};
return
factory
(
jQuery
,
_
,
CryptoJS
,
otr
.
OTR
,
otr
.
DSA
,
console
);
});
}
else
{
// Browser globals
_
.
templateSettings
=
{
...
...
@@ -77,11 +53,10 @@
var
KEY
=
{
ENTER
:
13
};
var
HAS_CRYPTO
=
(
(
typeof
CryptoJS
!==
"
undefined
"
)
&&
(
typeof
OTR
!==
"
undefined
"
)
&&
(
typeof
DSA
!==
"
undefined
"
)
);
var
HAS_CSPRNG
=
((
typeof
crypto
===
'
undefined
'
)
||
(
(
typeof
crypto
.
randomBytes
!==
'
function
'
)
&&
(
typeof
crypto
.
getRandomValues
!==
'
function
'
)
));
// Default configuration values
// ----------------------------
...
...
@@ -134,7 +109,7 @@
]));
// Only allow OTR if we have the capability
this
.
allow_otr
=
this
.
allow_otr
&&
HAS_C
RYPTO
;
this
.
allow_otr
=
this
.
allow_otr
&&
HAS_C
SPRNG
;
// Translation machinery
// ---------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment