Browse Source

Added options to disable nacl and webcrypto

master
Igor Zhukov 10 years ago
parent
commit
94e0be9668
  1. 2
      app/js/lib/config.js
  2. 5
      app/js/lib/ng_utils.js

2
app/js/lib/config.js

@ -29,6 +29,8 @@ Config.Modes = { @@ -29,6 +29,8 @@ Config.Modes = {
test: location.search.indexOf('test=1') > 0,
debug: location.search.indexOf('debug=1') > 0,
ssl: location.search.indexOf('ssl=1') > 0 || location.protocol == 'https:',
nacl: location.search.indexOf('nacl=0')== -1,
webcrypto: location.search.indexOf('webcrypto=0')== -1,
packed: location.protocol == 'app:' || location.protocol == 'chrome-extension:',
ios_standalone: window.navigator.standalone && navigator.userAgent.match(/iOS|iPhone|iPad/),
chrome_packed: window.chrome && chrome.app && chrome.app.window && true || false

5
app/js/lib/ng_utils.js

@ -507,7 +507,7 @@ angular.module('izhukov.utils', []) @@ -507,7 +507,7 @@ angular.module('izhukov.utils', [])
naClEmbed = false,
taskID = 0,
awaiting = {},
webCrypto = window.crypto && (window.crypto.subtle || window.crypto.webkitSubtle)/* || window.msCrypto && window.msCrypto.subtle*/,
webCrypto = Config.Modes.webcrypto && window.crypto && (window.crypto.subtle || window.crypto.webkitSubtle)/* || window.msCrypto && window.msCrypto.subtle*/,
useSha1Crypto = webCrypto && webCrypto.digest !== undefined,
finalizeTask = function (taskID, result) {
var deferred = awaiting[taskID];
@ -518,7 +518,8 @@ angular.module('izhukov.utils', []) @@ -518,7 +518,8 @@ angular.module('izhukov.utils', [])
}
};
if (navigator.mimeTypes &&
if (Config.Modes.nacl &&
navigator.mimeTypes &&
navigator.mimeTypes['application/x-pnacl'] !== undefined) {
var listener = $('<div id="nacl_listener"><embed id="mtproto_crypto" width="0" height="0" src="nacl/mtproto_crypto.nmf" type="application/x-pnacl" /></div>').appendTo($('body'))[0];
listener.addEventListener('load', function (e) {

Loading…
Cancel
Save