intermediate-component-sa 1.0.5-s → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.server.js +7 -0
- package/client/css/main.css +1 -0
- package/client/index.html +56 -0
- package/client/js/app.js +1 -0
- package/client/js/shims.js +17 -0
- package/client/tsconfig.json +44 -0
- package/package.json +68 -8
- package/server/config/app.config.js +47 -0
- package/server/config/jwt.config.js +4 -0
- package/server/config/logger.config.js +142 -0
- package/server/config/mssql.config.js +32 -0
- package/server/config/redis.config.js +8 -0
- package/server/config/server.config.js +12 -0
- package/server/config/templates.config.js +23 -0
- package/server/crypt.js +29 -0
- package/server/customRequest.js +370 -0
- package/server/index.js +125 -0
- package/server/interfaces/cleaner.interface.js +2 -0
- package/server/interfaces/supervisor.interface.js +2 -0
- package/server/routes-centralized.js +37 -0
- package/server/routes.js +7 -0
- package/server/services/index.js +8 -0
- package/server/services/routes.service.js +18 -0
- package/server/shared/file-manager.js +616 -0
- package/server/shared/http.shared.js +39 -0
- package/server/shared/promises.shared.js +14 -0
- package/server/shared/security.shared.js +52 -0
- package/server/ssl/star_inconcertcc_com.key +28 -0
- package/server/ssl/star_inconcertcc_com.pem +62 -0
- package/README.md +0 -20
- package/index.js +0 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"declaration": false,
|
|
6
|
+
"removeComments": true,
|
|
7
|
+
"noLib": false,
|
|
8
|
+
"lib": ["es2016", "dom"],
|
|
9
|
+
"emitDecoratorMetadata": true,
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"pretty": true,
|
|
13
|
+
"allowUnreachableCode": false,
|
|
14
|
+
"allowUnusedLabels": false,
|
|
15
|
+
"noImplicitAny": false,
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"noImplicitUseStrict": false,
|
|
18
|
+
"noFallthroughCasesInSwitch": true,
|
|
19
|
+
"allowSyntheticDefaultImports": true,
|
|
20
|
+
"typeRoots": [
|
|
21
|
+
"../../node_modules/@types",
|
|
22
|
+
"../../node_modules"
|
|
23
|
+
],
|
|
24
|
+
"types": [
|
|
25
|
+
"core-js",
|
|
26
|
+
"node",
|
|
27
|
+
"express",
|
|
28
|
+
"jasmine",
|
|
29
|
+
"systemjs",
|
|
30
|
+
"jquery",
|
|
31
|
+
"highcharts"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"exclude": [
|
|
35
|
+
"node_modules",
|
|
36
|
+
"dist",
|
|
37
|
+
"src",
|
|
38
|
+
"src/client/app/main-aot.ts"
|
|
39
|
+
],
|
|
40
|
+
"compileOnSave": false,
|
|
41
|
+
"angularCompilerOptions": {
|
|
42
|
+
"preserveWhitespaces": true
|
|
43
|
+
}
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intermediate-component-sa",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project.",
|
|
5
|
-
"main": "
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
5
|
+
"main": "./server/customRequest.js",
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
|
-
"url": "https://
|
|
8
|
+
"url": "https://gitlab.inconcertcc.com/speechanalytics-and-quality/intermediate-component.git"
|
|
12
9
|
},
|
|
13
10
|
"author": "inConcert",
|
|
14
|
-
"license": "ISC"
|
|
15
|
-
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"accept-language-parser": "1.2.0",
|
|
14
|
+
"alasql": "0.4.6",
|
|
15
|
+
"arraybuffer-to-string": "1.0.2",
|
|
16
|
+
"bluebird": "3.4.6",
|
|
17
|
+
"body-parser": "1.15.2",
|
|
18
|
+
"cassandra-client": "0.15.2",
|
|
19
|
+
"compression": "1.6.2",
|
|
20
|
+
"convert-array-to-csv": "1.0.5",
|
|
21
|
+
"cookie-parser": "1.4.3",
|
|
22
|
+
"core-js": "2.5.7",
|
|
23
|
+
"cors": "2.8.1",
|
|
24
|
+
"csvtojson": "2.0.4",
|
|
25
|
+
"excel4node": "1.3.2",
|
|
26
|
+
"express": "4.14.0",
|
|
27
|
+
"extract-zip": "1.6.5",
|
|
28
|
+
"find-process": "1.1.0",
|
|
29
|
+
"fs-extra": "7.0.1",
|
|
30
|
+
"ftp": "0.3.10",
|
|
31
|
+
"g": "^2.0.1",
|
|
32
|
+
"googleapis": "14.2.0",
|
|
33
|
+
"handlebars": "4.0.5",
|
|
34
|
+
"hbs": "4.0.1",
|
|
35
|
+
"html": "1.0.0",
|
|
36
|
+
"ion-rangeslider": "2.2.0",
|
|
37
|
+
"jsdom": "9.9.1",
|
|
38
|
+
"jsonwebtoken": "7.1.9",
|
|
39
|
+
"justgage": "1.2.2",
|
|
40
|
+
"knex": "0.13.0",
|
|
41
|
+
"log4js": "0.6.38",
|
|
42
|
+
"machine-digest": "0.0.7",
|
|
43
|
+
"mailparser": "2.5.0",
|
|
44
|
+
"material-design-icons": "3.0.1",
|
|
45
|
+
"md5": "2.2.1",
|
|
46
|
+
"mkdirp": "0.5.1",
|
|
47
|
+
"moment": "2.15.2",
|
|
48
|
+
"moment-timezone": "0.5.10",
|
|
49
|
+
"mssql": "3.3.0",
|
|
50
|
+
"multer": "1.3.0",
|
|
51
|
+
"mv": "2.1.1",
|
|
52
|
+
"mysql": "2.16.0",
|
|
53
|
+
"ncp": "2.0.0",
|
|
54
|
+
"node-license-server": "0.0.5",
|
|
55
|
+
"promise-request-retry": "1.0.1",
|
|
56
|
+
"raphael": "2.2.7",
|
|
57
|
+
"redis": "2.6.2",
|
|
58
|
+
"replace": "0.3.0",
|
|
59
|
+
"request": "2.87.0",
|
|
60
|
+
"request-promise": "4.1.1",
|
|
61
|
+
"request-promise-native": "1.0.5",
|
|
62
|
+
"rimraf": "2.5.4",
|
|
63
|
+
"scp2": "0.5.0",
|
|
64
|
+
"systeminformation": "4.16.0",
|
|
65
|
+
"socket.io": "2.0.1",
|
|
66
|
+
"socket.io-redis": "5.1.0",
|
|
67
|
+
"stack-trace": "0.0.9",
|
|
68
|
+
"stream-equal": "0.1.12",
|
|
69
|
+
"ts-md5": "1.2.0",
|
|
70
|
+
"ua-parser-js": "0.7.10",
|
|
71
|
+
"uuid": "3.1.0",
|
|
72
|
+
"world-countries": "1.8.1",
|
|
73
|
+
"zip-folder": "1.0.0"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENABLE_CONTACT_ID_PREFIX = {
|
|
4
|
+
default: '',
|
|
5
|
+
instance1: 'campaignId',
|
|
6
|
+
instance2: 'campaignClient',
|
|
7
|
+
instance3: 'campaignCategory',
|
|
8
|
+
instance4: 'sourceId'
|
|
9
|
+
};
|
|
10
|
+
exports.CONTACT_SALE_ID_PREFIX = 'CS';
|
|
11
|
+
exports.DISABLE_MINIFY = false;
|
|
12
|
+
exports.IS_DISTRIBUTED_SERVICE = false;
|
|
13
|
+
exports.DISTRIBUTED_SERVICE_KEYS = {
|
|
14
|
+
default: 'bjFOyOXM6tOBJlkoKa6eGY4ZzovkEiBV01H7swK63elwkQEv',
|
|
15
|
+
instance1: 'm49y5SEFzNjrt1c3SkDAn9ynBWlVsQ3L87fb12OyzNYsdhbu',
|
|
16
|
+
instance2: 'eGk19JaQYDViax1Cll8CKI17OkswmSyVzVPemFQMCB9ReOS7',
|
|
17
|
+
instance3: '3VQjm3IT4PzR0OPoeFsfFzZ3tkzGH38hcO8SnpWTDQot4GOl',
|
|
18
|
+
instance4: 'qqYZfFRzfEp78YlkBzmvIzn9P6m209FFOaNJlezsW3nhVf4U'
|
|
19
|
+
};
|
|
20
|
+
exports.DISTRIBUTED_SERVICE_ORIGINS = {
|
|
21
|
+
default: [
|
|
22
|
+
'A.A.A.A',
|
|
23
|
+
'B.B.B.B',
|
|
24
|
+
'C.C.C.C'
|
|
25
|
+
],
|
|
26
|
+
instance1: [
|
|
27
|
+
'D.D.D.D',
|
|
28
|
+
'E.E.E.E',
|
|
29
|
+
'F.F.F.F'
|
|
30
|
+
],
|
|
31
|
+
instance2: [
|
|
32
|
+
'G.G.G.G',
|
|
33
|
+
'H.H.H.H',
|
|
34
|
+
'I.I.I.I'
|
|
35
|
+
],
|
|
36
|
+
instance3: [
|
|
37
|
+
'J.J.J.J',
|
|
38
|
+
'K.K.K.K',
|
|
39
|
+
'L.L.L.L'
|
|
40
|
+
],
|
|
41
|
+
instance4: [
|
|
42
|
+
'M.M.M.M',
|
|
43
|
+
'N.N.N.N',
|
|
44
|
+
'O.O.O.O'
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
exports.FILE_UPLOAD_LIMIT = 20 * 1024 * 1024;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var path = require("path");
|
|
4
|
+
var stackTrace = require("stack-trace");
|
|
5
|
+
exports.TASK_LOG_FILE = path.resolve(__dirname, '..', 'logs', 'Task.log');
|
|
6
|
+
var getLogPid = function () {
|
|
7
|
+
var pid = process.pid.toString();
|
|
8
|
+
return (pid + ' ').substring(0, 5);
|
|
9
|
+
};
|
|
10
|
+
var getLogLevel = function (loggingEvent) {
|
|
11
|
+
var resultLength = 5;
|
|
12
|
+
var level = loggingEvent.level.toString();
|
|
13
|
+
return '[' + (level + Array(resultLength + 1).join(' ')).substring(0, resultLength) + ']';
|
|
14
|
+
};
|
|
15
|
+
var getLogContext = function (loggingEvent) {
|
|
16
|
+
var resultLength = 30;
|
|
17
|
+
var trace = stackTrace.get();
|
|
18
|
+
if (trace.length <= 9)
|
|
19
|
+
return '[Unknown context]';
|
|
20
|
+
var caller = trace[9];
|
|
21
|
+
var fileName = path.basename(caller.getFileName() || '');
|
|
22
|
+
var lineNumber = caller.getLineNumber() || '';
|
|
23
|
+
var context = (fileName + ':' + lineNumber);
|
|
24
|
+
context = (context.length > resultLength ? '...' + context.slice(-1 * (resultLength - ('...').length)) : context);
|
|
25
|
+
return '[' + (context + Array(resultLength + 1).join(' ')).substring(0, resultLength) + ']';
|
|
26
|
+
};
|
|
27
|
+
exports.LOGGER_CONFIG = {
|
|
28
|
+
appenders: [
|
|
29
|
+
{
|
|
30
|
+
type: 'file',
|
|
31
|
+
filename: path.resolve(__dirname, '..', 'logs', 'AccessLog.log'),
|
|
32
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
33
|
+
backups: 5,
|
|
34
|
+
category: 'AccessLog',
|
|
35
|
+
layout: {
|
|
36
|
+
type: 'pattern',
|
|
37
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %m',
|
|
38
|
+
tokens: {
|
|
39
|
+
pid: getLogPid,
|
|
40
|
+
level: getLogLevel,
|
|
41
|
+
context: getLogContext
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'file',
|
|
47
|
+
filename: path.resolve(__dirname, '..', 'logs', 'ServerScripts.log'),
|
|
48
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
49
|
+
backups: 5,
|
|
50
|
+
category: 'ServerScripts',
|
|
51
|
+
layout: {
|
|
52
|
+
type: 'pattern',
|
|
53
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %x{context} %m',
|
|
54
|
+
tokens: {
|
|
55
|
+
pid: getLogPid,
|
|
56
|
+
level: getLogLevel,
|
|
57
|
+
context: getLogContext
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'file',
|
|
63
|
+
filename: path.resolve(__dirname, '..', 'logs', 'PublicScripts.log'),
|
|
64
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
65
|
+
backups: 15,
|
|
66
|
+
category: 'PublicScripts',
|
|
67
|
+
layout: {
|
|
68
|
+
type: 'pattern',
|
|
69
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %x{context} %m',
|
|
70
|
+
tokens: {
|
|
71
|
+
pid: getLogPid,
|
|
72
|
+
level: getLogLevel,
|
|
73
|
+
context: getLogContext
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: 'file',
|
|
79
|
+
filename: path.resolve(__dirname, '..', 'logs', 'DoubleClick.log'),
|
|
80
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
81
|
+
backups: 5,
|
|
82
|
+
category: 'DoubleClick',
|
|
83
|
+
layout: {
|
|
84
|
+
type: 'pattern',
|
|
85
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %x{context} %m',
|
|
86
|
+
tokens: {
|
|
87
|
+
pid: getLogPid,
|
|
88
|
+
level: getLogLevel,
|
|
89
|
+
context: getLogContext
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'file',
|
|
95
|
+
filename: path.resolve(__dirname, '..', 'logs', 'Sql.log'),
|
|
96
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
97
|
+
backups: 5,
|
|
98
|
+
category: 'Sql',
|
|
99
|
+
layout: {
|
|
100
|
+
type: 'pattern',
|
|
101
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %x{context} %m',
|
|
102
|
+
tokens: {
|
|
103
|
+
pid: getLogPid,
|
|
104
|
+
level: getLogLevel,
|
|
105
|
+
context: getLogContext
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
type: 'file',
|
|
111
|
+
filename: path.resolve(__dirname, '..', 'logs', 'Redis.log'),
|
|
112
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
113
|
+
backups: 5,
|
|
114
|
+
category: 'Redis',
|
|
115
|
+
layout: {
|
|
116
|
+
type: 'pattern',
|
|
117
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %x{context} %m',
|
|
118
|
+
tokens: {
|
|
119
|
+
pid: getLogPid,
|
|
120
|
+
level: getLogLevel,
|
|
121
|
+
context: getLogContext
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'file',
|
|
127
|
+
filename: path.resolve(__dirname, '..', 'logs', 'Task.log'),
|
|
128
|
+
maxLogSize: 20 * 1000 * 1024,
|
|
129
|
+
backups: 5,
|
|
130
|
+
category: 'Task',
|
|
131
|
+
layout: {
|
|
132
|
+
type: 'pattern',
|
|
133
|
+
pattern: '%x{level} %d{ISO8601} %x{pid} %x{context} %m',
|
|
134
|
+
tokens: {
|
|
135
|
+
pid: getLogPid,
|
|
136
|
+
level: getLogLevel,
|
|
137
|
+
context: getLogContext
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MSSQL_HOST = '192.168.2.199';
|
|
4
|
+
exports.MSSQL_PORT = 1433;
|
|
5
|
+
exports.MSSQL_USER = '';
|
|
6
|
+
exports.MSSQL_PASSWORD = '';
|
|
7
|
+
exports.MSSQL_DATABASE = 'Testing_Billing';
|
|
8
|
+
exports.MSSQL_CONN_TIMEOUT = 30 * 1000;
|
|
9
|
+
exports.MSSQL_REQ_TIMEOUT = 300 * 1000;
|
|
10
|
+
exports.MSSQL_POOL_MIN = 0;
|
|
11
|
+
exports.MSSQL_POOL_MAX = 50;
|
|
12
|
+
exports.MSSQL_POOL_IDLE_TIMEOUT = 24 * 60 * 60 * 1000;
|
|
13
|
+
exports.MSSQL_ENCRYPT = false;
|
|
14
|
+
exports.MSSQL_USE_UTC = true;
|
|
15
|
+
exports.MSSQL_CONFIG = {
|
|
16
|
+
user: exports.MSSQL_USER,
|
|
17
|
+
password: exports.MSSQL_PASSWORD,
|
|
18
|
+
server: exports.MSSQL_HOST,
|
|
19
|
+
database: exports.MSSQL_DATABASE,
|
|
20
|
+
port: exports.MSSQL_PORT,
|
|
21
|
+
connectionTimeout: exports.MSSQL_CONN_TIMEOUT,
|
|
22
|
+
requestTimeout: exports.MSSQL_REQ_TIMEOUT,
|
|
23
|
+
pool: {
|
|
24
|
+
max: exports.MSSQL_POOL_MAX,
|
|
25
|
+
min: exports.MSSQL_POOL_MIN,
|
|
26
|
+
idleTimeoutMillis: exports.MSSQL_POOL_IDLE_TIMEOUT
|
|
27
|
+
},
|
|
28
|
+
options: {
|
|
29
|
+
encrypt: exports.MSSQL_ENCRYPT,
|
|
30
|
+
useUTC: exports.MSSQL_USE_UTC
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REDIS_OPTIONS = {
|
|
4
|
+
prefix: 'inconcertCache:'
|
|
5
|
+
};
|
|
6
|
+
exports.REDIS_SESSION_PERSISTENCE = 7 * 24 * 60 * 60;
|
|
7
|
+
exports.REDIS_DATA_PERSISTENCE = 60 * 60;
|
|
8
|
+
exports.REDIS_DATA_PERSISTENCE_RETRY = 10 * 60;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var path = require("path");
|
|
4
|
+
exports.SERVER_MODE = 'prod';
|
|
5
|
+
exports.HTTP_ENABLED = true;
|
|
6
|
+
exports.HTTP_BINDING_HOST = '0.0.0.0';
|
|
7
|
+
exports.HTTP_BINDING_PORT = +('9000');
|
|
8
|
+
exports.HTTPS_ENABLED = false;
|
|
9
|
+
exports.HTTPS_BINDING_HOST = '0.0.0.0';
|
|
10
|
+
exports.HTTPS_BINDING_PORT = 443;
|
|
11
|
+
exports.HTTPS_KEY = path.resolve(__dirname, '../ssl/star_inconcertcc_com.key');
|
|
12
|
+
exports.HTTPS_CERT = path.resolve(__dirname, '../ssl/star_inconcertcc_com.pem');
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var path = require("path");
|
|
4
|
+
exports.TEMP_FOLDER = 'temp';
|
|
5
|
+
exports.TEMP_PATH = path.resolve(__dirname, '..', exports.TEMP_FOLDER);
|
|
6
|
+
exports.TEMPLATE_FOLDER = 'template';
|
|
7
|
+
exports.VIEWS_FOLDER = 'views';
|
|
8
|
+
exports.MAIL_FOLDER = 'mail';
|
|
9
|
+
exports.TEMPLATE_VIEWS_URI = exports.TEMPLATE_FOLDER + '/' + exports.VIEWS_FOLDER;
|
|
10
|
+
exports.TEMPLATE_PATH = path.resolve(__dirname, '..', exports.TEMPLATE_FOLDER);
|
|
11
|
+
exports.TEMPLATE_VIEWS_PATH = path.resolve(__dirname, '..', exports.TEMPLATE_FOLDER, exports.VIEWS_FOLDER);
|
|
12
|
+
exports.TEMPLATE_MAIL_PATH = path.resolve(__dirname, '..', exports.TEMPLATE_FOLDER, exports.MAIL_FOLDER);
|
|
13
|
+
exports.TEMPLATE_TEMP_PERSISTENCE = 24 * 60 * 60;
|
|
14
|
+
exports.TEMPLATE_TEMP_FOLDER = 'temp';
|
|
15
|
+
exports.TEMPLATE_TEMP_PREFIX = 'temp';
|
|
16
|
+
exports.TEMPLATE_EDIT_PREFIX = 'edit';
|
|
17
|
+
exports.TEMPLATE_DOWNLOAD_PREFIX = 'download';
|
|
18
|
+
exports.TEMPLATE_UPLOAD_PREFIX = 'upload';
|
|
19
|
+
exports.TEMPLATE_PREVIEW_EXT = '.jpg';
|
|
20
|
+
exports.TEMPLATE_TEMP_PATH = path.resolve(exports.TEMPLATE_PATH, exports.TEMPLATE_TEMP_FOLDER);
|
|
21
|
+
exports.TEMPLATE_TEMP_URI = exports.TEMPLATE_FOLDER + '/' + exports.TEMPLATE_TEMP_FOLDER;
|
|
22
|
+
exports.STATIC_JS_PATH = path.resolve(__dirname, '../static/js');
|
|
23
|
+
exports.STATIC_JS_PARTIALS_PREFIX = 'static/js/';
|
package/server/crypt.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var crypto = require('crypto');
|
|
4
|
+
var algorithm = 'aes-256-ctr';
|
|
5
|
+
var password = 'vOVH6sdmpNWjRRIqCc7rdxs01lwHzfr3';
|
|
6
|
+
function InconcertEncrypt(myText) {
|
|
7
|
+
var iv = crypto.randomBytes(16);
|
|
8
|
+
var cipher = crypto.createCipheriv(algorithm, password, Buffer.from(iv));
|
|
9
|
+
var encrypted = Buffer.concat([cipher.update(myText), cipher.final()]);
|
|
10
|
+
return encrypted.toString('hex') + "-" + iv.toString('hex');
|
|
11
|
+
}
|
|
12
|
+
exports.InconcertEncrypt = InconcertEncrypt;
|
|
13
|
+
function InconcertDecrypt(myEncryptedText) {
|
|
14
|
+
var iv = crypto.randomBytes(24);
|
|
15
|
+
var decipher = crypto.createDecipheriv(algorithm, Buffer.from(password), iv);
|
|
16
|
+
var decrypted = '';
|
|
17
|
+
decipher.on('readable', function () {
|
|
18
|
+
var data = decipher.read();
|
|
19
|
+
if (data)
|
|
20
|
+
decrypted += data.toString('utf8');
|
|
21
|
+
});
|
|
22
|
+
decipher.on('end', function () {
|
|
23
|
+
return decrypted;
|
|
24
|
+
});
|
|
25
|
+
decipher.write(myEncryptedText, 'hex');
|
|
26
|
+
decipher.end();
|
|
27
|
+
return decrypted;
|
|
28
|
+
}
|
|
29
|
+
exports.InconcertDecrypt = InconcertDecrypt;
|