Skip to content

Commit

Permalink
Fix javascript-obfuscator handling to use the latest method
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuhitoyokoi committed May 11, 2020
1 parent d99132e commit db63b60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/nodegen.js
Expand Up @@ -244,7 +244,7 @@ function function2node(data, options) {
var nodeTemplate = fs.readFileSync(path.join(__dirname, '../templates/function/node.js.mustache'), 'utf-8');
var nodeSourceCode = mustache.render(nodeTemplate, params);
if (options.obfuscate) {
nodeSourceCode = obfuscator.obfuscate(nodeSourceCode, { stringArrayEncoding: 'rc4' });
nodeSourceCode = obfuscator.obfuscate(nodeSourceCode, { stringArrayEncoding: 'rc4' }).getObfuscatedCode();
}
fs.writeFileSync(path.join(data.dst, data.module, 'node.js'), nodeSourceCode);

Expand Down Expand Up @@ -386,7 +386,7 @@ function swagger2node(data, options) {
beautify: false
});
if (options.obfuscate) {
nodejsSourceCode = obfuscator.obfuscate(nodejsSourceCode, { stringArrayEncoding: 'rc4' });
nodejsSourceCode = obfuscator.obfuscate(nodejsSourceCode, { stringArrayEncoding: 'rc4' }).getObfuscatedCode();
}
fs.writeFileSync(path.join(data.dst, data.module, 'lib.js'), nodejsSourceCode);

Expand Down Expand Up @@ -456,7 +456,7 @@ function swagger2node(data, options) {
beautify: false
});
if (options.obfuscate) {
nodeSourceCode = obfuscator.obfuscate(nodeSourceCode, { stringArrayEncoding: 'rc4' });
nodeSourceCode = obfuscator.obfuscate(nodeSourceCode, { stringArrayEncoding: 'rc4' }).getObfuscatedCode();
}
fs.writeFileSync(path.join(data.dst, data.module, 'node.js'), nodeSourceCode);

Expand Down Expand Up @@ -759,7 +759,7 @@ function wottd2node(data, options) {
const nodeTemplate = fs.readFileSync(path.join(__dirname, '../templates/webofthings/node.js.mustache'), 'utf-8');
let nodeSourceCode = mustache.render(nodeTemplate, data);
if (options.obfuscate) {
nodeSourceCode = obfuscator.obfuscate(nodeSourceCode, { stringArrayEncoding: 'rc4' });
nodeSourceCode = obfuscator.obfuscate(nodeSourceCode, { stringArrayEncoding: 'rc4' }).getObfuscatedCode();
}
fs.writeFileSync(path.join(data.dst, data.module, 'node.js'), nodeSourceCode);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -46,7 +46,7 @@
"cldr": "5.5.4",
"colors": "1.4.0",
"csv-string": "3.1.8",
"javascript-obfuscator": "0.27.2",
"javascript-obfuscator": "0.28.1",
"jimp": "0.9.6",
"js-string-escape": "1.0.1",
"minimist": "1.2.5",
Expand Down

0 comments on commit db63b60

Please sign in to comment.