Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit b626fe8

Browse files
committed
Updated to use the javascript-obfuscator@0.12.1 which includes the new 'target' option.
1 parent 525464a commit b626fe8

File tree

7 files changed

+89
-36
lines changed

7 files changed

+89
-36
lines changed

App/actions/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,8 @@ export const setDeadCodeInjectionThreshold = (threshold) => ({
9292
'type': types.SET_DEAD_CODE_INJECTION_THRESHOLD,
9393
threshold
9494
});
95+
96+
export const setTarget = (target) => ({
97+
'type': types.SET_TARGET,
98+
target
99+
});

App/constants/ActionTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ export const TOGGLE_MANGLE = 'TOGGLE_MANGLE'
4141
export const TOGGLE_UNICODE_ESCAPE_SEQUENCE = 'TOGGLE_UNICODE_ESCAPE_SEQUENCE'
4242

4343
export const TOGGLE_RENAME_GLOBALS = 'TOGGLE_RENAME_GLOBALS'
44+
45+
export const SET_TARGET = 'SET_TARGET'

App/containers/OptionsContainer.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,25 @@ export const SOURCEMAP_INLINE = 'inline'
1515
export const SOURCEMAP_SEPARATE = 'separate'
1616

1717
const SOURCEMAP_OPTIONS = [
18-
{ text: 'Off', value: SOURCEMAP_OFF },
19-
{ text: 'Inline', value: SOURCEMAP_INLINE },
20-
{ text: 'Separate', value: SOURCEMAP_SEPARATE },
18+
{ text: 'Off', value: SOURCEMAP_OFF },
19+
{ text: 'Inline', value: SOURCEMAP_INLINE },
20+
{ text: 'Separate', value: SOURCEMAP_SEPARATE },
2121
];
2222

2323
const STRING_ARRAY_ENCODING_OPTIONS = [
24-
{ text: 'Off', value: 'false' },
25-
{ text: 'Base64', value: 'base64' },
26-
{ text: 'RC4', value: 'rc4' },
24+
{ text: 'Off', value: 'false' },
25+
{ text: 'Base64', value: 'base64' },
26+
{ text: 'RC4', value: 'rc4' },
27+
];
28+
29+
export const TARGET_BROWSER = 'browser'
30+
export const TARGET_EXTENSION = 'extension'
31+
export const TARGET_NODE = 'node'
32+
33+
const TARGET_OPTIONS = [
34+
{ text: 'Browser', value: TARGET_BROWSER },
35+
{ text: 'Extension', value: TARGET_EXTENSION },
36+
{ text: 'Node', value: TARGET_NODE },
2737
];
2838

2939
const Options = ({dispatch, options}) =>
@@ -209,6 +219,14 @@ const Options = ({dispatch, options}) =>
209219
step="1"
210220
onChange={(event) => dispatch(actions.setSeed(parseInt(event.target.value))) } />
211221

222+
<Divider />
223+
224+
<Form.Select
225+
label='Target'
226+
value={options.target}
227+
onChange={(event, {value}) => dispatch(actions.setTarget(value)) }
228+
options={TARGET_OPTIONS} />
229+
212230
</Segment>
213231
</Grid.Column>
214232

App/reducers/options.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ const initialState = {
4444

4545
renameGlobals: false,
4646

47+
target: 'browser',
48+
4749
}
4850

4951
export const options = (state = initialState, action) => {
@@ -239,6 +241,12 @@ export const options = (state = initialState, action) => {
239241
renameGlobals: !state.renameGlobals
240242
}
241243

244+
case types.SET_TARGET:
245+
return {
246+
...state,
247+
target: action.target
248+
}
249+
242250
default:
243251
return state
244252
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"extract-text-webpack-plugin": "^2.0.0-beta",
3131
"graceful-fs": "^4.1.9",
3232
"inert": "^4.0.2",
33-
"javascript-obfuscator": "^0.11.2",
33+
"javascript-obfuscator": "^0.12.1",
3434
"less": "^2.7.1",
3535
"less-loader": "^2.2.3",
3636
"react": "^15.3.1",

templates/index.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<div class="column">
2828
<div class="ui basic segment">
2929
<h1>JavaScript Obfuscator Tool</h1>
30-
<p>A free and efficient obfuscator for JavaScript (including ES6). Make your code harder to copy and prevent people from stealing your work. This tool is a Web UI to the excellent (and open source) <code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">JavaScript Obfuscator</a>@0.11.2</code> created by Timofey Kachalov.</p>
30+
<p>A free and efficient obfuscator for JavaScript (including ES6). Make your code harder to copy and prevent people from stealing your work. This tool is a Web UI to the excellent (and open source) <code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">JavaScript Obfuscator</a>@0.12.1</code> created by Timofey Kachalov.</p>
3131
</div>
3232
</div>
3333
</div>
@@ -295,6 +295,22 @@ <h3>Sounds great!</h3>
295295
</td>
296296
</tr>
297297

298+
<tr>
299+
<td class="collapsing">Target</td>
300+
<td>
301+
<p>You can set the target environment of the obfuscated code to one of the following:</p>
302+
<ul>
303+
<li><strong>browser</strong></li>
304+
<li><strong>extension</strong></li>
305+
<li><strong>node</strong></li>
306+
</ul>
307+
<p>Use the <code>extension</code> target option if the obfuscated code will be used on a browser extension. Code obfuscated with this option does not use the <code>eval</code> JavaScript function.</p>
308+
<div class="ui tiny message">
309+
<p><i class="warning sign icon"></i>Currently the output of <code>browser</code> and <code>node</code> is identical.</p>
310+
</div>
311+
312+
</td>
313+
</tr>
298314

299315
</tbody>
300316
</table>

yarn.lock

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,17 +1135,17 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3:
11351135
strip-ansi "^3.0.0"
11361136
supports-color "^2.0.0"
11371137

1138-
chalk@2.1.0:
1139-
version "2.1.0"
1140-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e"
1138+
chalk@2.3.0:
1139+
version "2.3.0"
1140+
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba"
11411141
dependencies:
11421142
ansi-styles "^3.1.0"
11431143
escape-string-regexp "^1.0.5"
11441144
supports-color "^4.0.0"
11451145

1146-
chance@1.0.11:
1147-
version "1.0.11"
1148-
resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.11.tgz#48e82f7583df356053e0ad122d4654c5066c570d"
1146+
chance@1.0.12:
1147+
version "1.0.12"
1148+
resolved "https://registry.yarnpkg.com/chance/-/chance-1.0.12.tgz#6764c9cb7b4f34856fb780d07f0e17a6601c6c08"
11491149

11501150
charenc@~0.0.1:
11511151
version "0.0.2"
@@ -1182,9 +1182,9 @@ clap@^1.0.9:
11821182
dependencies:
11831183
chalk "^1.1.3"
11841184

1185-
class-validator@0.7.2:
1186-
version "0.7.2"
1187-
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.7.2.tgz#35ed86f0590bbb60161a8c8ef9c813cb38572ffe"
1185+
class-validator@0.7.3:
1186+
version "0.7.3"
1187+
resolved "https://registry.yarnpkg.com/class-validator/-/class-validator-0.7.3.tgz#3c2821b8cf35fd8d5f4fcb8063bc57fb50049e7e"
11881188
dependencies:
11891189
validator "^7.0.0"
11901190

@@ -2424,9 +2424,9 @@ invariant@^2.0.0, invariant@^2.2.0:
24242424
dependencies:
24252425
loose-envify "^1.0.0"
24262426

2427-
inversify@4.3.0:
2428-
version "4.3.0"
2429-
resolved "https://registry.yarnpkg.com/inversify/-/inversify-4.3.0.tgz#d2ecd2ae18340e7f1ab5148a3e44b87080391366"
2427+
inversify@4.5.0:
2428+
version "4.5.0"
2429+
resolved "https://registry.yarnpkg.com/inversify/-/inversify-4.5.0.tgz#1a575ddf1db216ed3292d9b0f70f497de275874e"
24302430

24312431
invert-kv@^1.0.0:
24322432
version "1.0.0"
@@ -2608,26 +2608,26 @@ items@2.x.x:
26082608
version "2.1.1"
26092609
resolved "https://registry.yarnpkg.com/items/-/items-2.1.1.tgz#8bd16d9c83b19529de5aea321acaada78364a198"
26102610

2611-
javascript-obfuscator@^0.11.2:
2612-
version "0.11.2"
2613-
resolved "https://registry.yarnpkg.com/javascript-obfuscator/-/javascript-obfuscator-0.11.2.tgz#3c1b8946d3b26318cd18470ef5d43a4321196647"
2611+
javascript-obfuscator@^0.12.1:
2612+
version "0.12.1"
2613+
resolved "https://registry.yarnpkg.com/javascript-obfuscator/-/javascript-obfuscator-0.12.1.tgz#a7913240d81fed971ef1225136b957f5ce258cb2"
26142614
dependencies:
2615-
chalk "2.1.0"
2616-
chance "1.0.11"
2617-
class-validator "0.7.2"
2615+
chalk "2.3.0"
2616+
chance "1.0.12"
2617+
class-validator "0.7.3"
26182618
commander "2.11.0"
26192619
escodegen-wallaby "1.6.12"
26202620
esmangle "1.0.1"
26212621
esprima "4.0.0"
26222622
estraverse "4.2.0"
2623-
inversify "4.3.0"
2623+
inversify "4.5.0"
26242624
md5 "2.2.1"
26252625
mkdirp "0.5.1"
26262626
opencollective "1.0.3"
26272627
reflect-metadata "0.1.10"
2628-
source-map-support "0.4.18"
2628+
source-map-support "0.5.0"
26292629
string-template "1.0.0"
2630-
tslib "1.7.1"
2630+
tslib "1.8.0"
26312631

26322632
jodid25519@^1.0.0:
26332633
version "1.0.2"
@@ -4051,11 +4051,11 @@ source-list-map@^0.1.4, source-list-map@~0.1.0:
40514051
version "0.1.6"
40524052
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.6.tgz#e1e6f94f0b40c4d28dcf8f5b8766e0e45636877f"
40534053

4054-
source-map-support@0.4.18:
4055-
version "0.4.18"
4056-
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f"
4054+
source-map-support@0.5.0:
4055+
version "0.5.0"
4056+
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.0.tgz#2018a7ad2bdf8faf2691e5fddab26bed5a2bacab"
40574057
dependencies:
4058-
source-map "^0.5.6"
4058+
source-map "^0.6.0"
40594059

40604060
source-map-support@^0.4.2:
40614061
version "0.4.3"
@@ -4067,6 +4067,10 @@ source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.1, sour
40674067
version "0.5.6"
40684068
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
40694069

4070+
source-map@^0.6.0:
4071+
version "0.6.1"
4072+
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
4073+
40704074
source-map@~0.1.33:
40714075
version "0.1.43"
40724076
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346"
@@ -4292,9 +4296,9 @@ tryit@^1.0.1:
42924296
version "1.0.2"
42934297
resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.2.tgz#c196b0073e6b1c595d93c9c830855b7acc32a453"
42944298

4295-
tslib@1.7.1:
4296-
version "1.7.1"
4297-
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec"
4299+
tslib@1.8.0:
4300+
version "1.8.0"
4301+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6"
42984302

42994303
tty-browserify@0.0.0:
43004304
version "0.0.0"

0 commit comments

Comments
 (0)