From 6425d492f1f349a76ea6a87b5db72a3779de977c Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 27 Sep 2019 12:04:31 +0200 Subject: [PATCH] move credential.js from customize.dist/ to www/common/ --- customize.dist/login.js | 2 +- .../common/common-credential.js | 24 ++++++++++++++----- www/common/cryptpad-common.js | 2 +- www/register/main.js | 2 +- www/settings/inner.js | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) rename customize.dist/credential.js => www/common/common-credential.js (80%) diff --git a/customize.dist/login.js b/customize.dist/login.js index 21668140f..0bf36b7ce 100644 --- a/customize.dist/login.js +++ b/customize.dist/login.js @@ -4,7 +4,7 @@ define([ '/bower_components/chainpad-crypto/crypto.js', '/common/common-util.js', '/common/outer/network-config.js', - '/customize/credential.js', + '/common/common-credential.js', '/bower_components/chainpad/chainpad.dist.js', '/common/common-realtime.js', '/common/common-constants.js', diff --git a/customize.dist/credential.js b/www/common/common-credential.js similarity index 80% rename from customize.dist/credential.js rename to www/common/common-credential.js index cdbd835c5..ffbc482d6 100644 --- a/customize.dist/credential.js +++ b/www/common/common-credential.js @@ -1,9 +1,6 @@ -define([ - '/customize/application_config.js', - '/bower_components/scrypt-async/scrypt-async.min.js', -], function (AppConfig) { +(function () { +var factory = function (AppConfig, Scrypt) { var Cred = {}; - var Scrypt = window.scrypt; Cred.MINIMUM_PASSWORD_LENGTH = typeof(AppConfig.minimumPasswordLength) === 'number'? AppConfig.minimumPasswordLength: 8; @@ -86,4 +83,19 @@ define([ }; return Cred; -}); +}; + + if (typeof(module) !== 'undefined' && module.exports) { + module.exports = factory( + {}, //require("../../customize.dist/application_config.js"), + require("../bower_components/scrypt-async/scrypt-async.min.js") + ); + } else if ((typeof(define) !== 'undefined' && define !== null) && (define.amd !== null)) { + define([ + '/customize/application_config.js', + '/bower_components/scrypt-async/scrypt-async.min.js', + ], function (AppConfig) { + return factory(AppConfig, window.scrypt); + }); + } +}()); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 0516bf057..3be8ed032 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1017,7 +1017,7 @@ define([ var Cred, Block, Login; Nthen(function (waitFor) { require([ - '/customize/credential.js', + '/common/common-credential.js', '/common/outer/login-block.js', '/customize/login.js' ], waitFor(function (_Cred, _Block, _Login) { diff --git a/www/register/main.js b/www/register/main.js index 63324f810..d052f88b0 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -3,7 +3,7 @@ define([ '/customize/login.js', '/common/cryptpad-common.js', '/common/test.js', - '/customize/credential.js', // preloaded for login.js + '/common/common-credential.js', '/common/common-interface.js', '/common/common-util.js', '/common/common-realtime.js', diff --git a/www/settings/inner.js b/www/settings/inner.js index 6fe07e3fe..416f99bb8 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -9,7 +9,7 @@ define([ '/common/common-hash.js', '/customize/messages.js', '/common/hyperscript.js', - '/customize/credential.js', + '/common/common-credential.js', '/customize/application_config.js', '/api/config', '/common/make-backup.js',