Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit 0fd46cf

Browse files
committed
changes for VP and dxsync in node 4 and password encryption
1 parent b803269 commit 0fd46cf

14 files changed

Lines changed: 53 additions & 8 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules/
22
.idea/
33
**/npm-debug.log
44
**/node_modules/**
5-
/build
5+
/build
6+
*.project

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = function(grunt) {
1010
files : [{
1111
expand : true,
1212
cwd : ".",
13-
src : ["install.cmd", "install.sh", "readme.md", "wcm-design.tar.gz", "dashboard.tar.gz", "sp-server.tar.gz", "LICENSE", "NOTICE"],
13+
src : ["install.cmd", "install.sh", "readme.md", "wcm-design.tar.gz", "dashboard.tar.gz", "dxsync-1.0.2.tar.gz", "sp-server.tar.gz", "LICENSE", "NOTICE"],
1414
dest : "/",
1515
filter : "isFile"
1616
}]

dashboard.tar.gz

549 Bytes
Binary file not shown.

digexp-dashboard/js/controllers/appListController.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,11 @@ dashboardControllers.controller('AppsListController', ['$scope', '$route', '$loc
639639
if (server.userName && server.password) {
640640
args += " -portalUser " + server.userName + " -portalPassword " + server.password;
641641
}
642+
var cPath = server.contenthandlerPath.split('/');
643+
if (cPath.length > 3){
644+
args += " -virtualPortalID " + cPath[3];
645+
};
646+
642647
return args;
643648
};
644649

digexp-dashboard/js/controllers/listWcmDesignsController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function($scope) {
116116
}, function(err) {
117117
debugLogger.error(err);
118118
$parent.$parent.loadingNewLibraries--;
119-
$parent.$parent.$apply(function(){$scope.status = 'Error Pulling Library ' + library.title;});
119+
window.alert('Error Pulling Library ' + library.title + ' ' + err);
120120
$parent.$apply();
121121
debugLogger.log("Error adding " + library.title);
122122
});

digexp-dashboard/js/dashConfig.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var dashConfig = (function(){
2323
};
2424

2525
return {
26+
clearConfig: function() {configInfo = "";},
2627
getConfigInfo: function (){
2728
// Read base config first, then get any overrides from user-settings.json
2829
if(configInfo == ""){
@@ -33,6 +34,12 @@ var dashConfig = (function(){
3334
var data = fs.readFileSync('./user-settings.json', 'utf8');
3435
var userConfig = JSON.parse(data);
3536
// Copy settings
37+
userConfig.servers.forEach(function(server){
38+
if(server.password)
39+
var nPwd = decrypt( server.password );
40+
if(nPwd.length != 0)
41+
server.password = nPwd;
42+
});
3643
copyObj(configInfo, userConfig);
3744
}
3845
}
@@ -44,6 +51,10 @@ var dashConfig = (function(){
4451
fs.exists("./dashboard-config.json", function (exists) {
4552
if (exists) {
4653
copyObj(configInfo, newConfig);
54+
configInfo.servers.forEach(function(server){
55+
if(server.password)
56+
server.password = encrypt( server.password );
57+
});
4758
fs.writeFile("./dashboard-config.json", JSON.stringify(configInfo, null, ' '));
4859
}
4960
});
@@ -68,7 +79,13 @@ var dashConfig = (function(){
6879
rVal = configInfo.spAppServer;
6980
break;
7081
case this.tools.dxTheme:
71-
rVal = configInfo.dxThemeServer;
82+
var serverInfo = {};
83+
copyObj(serverInfo, this.getServerInfo(configInfo.dxThemeServer));
84+
var cPath = serverInfo.contenthandlerPath.split('/');
85+
if (cPath.length > 3){
86+
serverInfo.contenthandlerPath = '/' + cPath[1] + '/' + cPath[2];
87+
};
88+
return serverInfo;
7289
break;
7390
case this.tools.wcmDesigns:
7491
rVal = configInfo.wcmDesignsServer;

digexp-dashboard/js/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var settings = (function() {
2222
configInfo.servers.push({});
2323
configInfo.servers[count].name = (document.querySelector("#serverName"+ count) || {}).value;
2424
configInfo.servers[count].userName = (document.querySelector("#userName"+ count) || {}).value;
25-
configInfo.servers[count].password = (document.querySelector("#password"+ count) || {}).value;
25+
configInfo.servers[count].password = encrypt((document.querySelector("#password"+ count) || {}).value);
2626
configInfo.servers[count].host = (document.querySelector("#host"+count) || {}).value;
2727
configInfo.servers[count].port = (document.querySelector("#port"+count) || {}).value;
2828
configInfo.servers[count].secure = (document.querySelector("#secure"+count) || {}).checked;
@@ -35,7 +35,7 @@ var settings = (function() {
3535

3636
// update user-settings.json
3737
fs.writeFileSync('./user-settings.json', JSON.stringify(configInfo, null, 4));
38-
38+
dashConfig.clearConfig();
3939
},
4040
setSettings: function(newSettings) {
4141
var configInfo = dashConfig.getConfigInfo();

digexp-dashboard/js/utils.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* specific language governing permissions and limitations under the License.
99
*/
1010
var tracer = require("tracer"),
11+
algorithm = "aes-256-ctr",
12+
password = "U6Jv]H[tf;mxE}6t*PQz?j474A7T@Vx%gcVJA#2cr2GNh96ve+",
1113
debugEnvironmentVar = process.env.DIGEXP_DEBUG || '',
1214
debugNames = debugEnvironmentVar.toUpperCase().split(','),
1315
debugFunctions = {};
@@ -31,6 +33,22 @@ function debugLogger(moduleName) {
3133
return debugFunctions[moduleName];
3234
};
3335

36+
function encrypt( text ) {
37+
var crypto = require('crypto');
38+
var cipher = crypto.createCipher( algorithm, password );
39+
var crypted = cipher.update( text, "utf8", "hex" );
40+
crypted += cipher.final( "hex" );
41+
return crypted;
42+
}
43+
44+
function decrypt( text ) {
45+
var crypto = require('crypto');
46+
var decipher = crypto.createDecipher( algorithm, password );
47+
var dec = decipher.update( text, "hex", "utf8" );
48+
dec += decipher.final( "utf8" );
49+
return dec;
50+
}
51+
3452
var getModified = function(dirName, dateString, ignore, callback){
3553
// takes the name of the directory you want to find the modified and a string for a date that is the toLocaleString of a date object
3654
//
@@ -97,4 +115,6 @@ utils.copyProperties = function(a, b) {
97115
};
98116

99117
utils.debugLogger = debugLogger;
118+
utils.encrypt = encrypt;
119+
utils.decrypt = decrypt;
100120

digexp-dashboard/postinstall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var rm_rf = function(path, cb) {
4444

4545
console.log("Installing dxsync:");
4646

47-
ch.exec("npm install https://github.com/digexp/dxsync/archive/1.0.2.tar.gz --no-optional",
47+
ch.exec("npm install https://github.com/OpenNTF/WebDevToolkitForDx/blob/master/dxsync-1.0.2.tar?raw=true --no-optional",
4848
function(err) {
4949
if (err) {
5050
console.error("Error installing dxsync: " + err.message);

digexp-wcm-design/lib/wcm-authenticated-request.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ var globalPassword = '';
477477
var authCookie = null;
478478

479479
var init = function(host, port, user, password, contentHandlerPath) {
480-
debugLogger.trace('init:: host::' + host + ' port::' + port + ' user::' + user + ' password::' + password + ' contentHandlerPath::' + contentHandlerPath);
480+
debugLogger.trace('init:: host::' + host + ' port::' + port + ' user::' + user + ' contentHandlerPath::' + contentHandlerPath);
481481
var deferred = Q.defer(), initialize = function(contentHandlerPath) {
482482
var pathComponents = contentHandlerPath.split('/');
483483
// for vitrula portals the last component is the portal context if

0 commit comments

Comments
 (0)