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

Commit 8b95dcf

Browse files
committed
Added 'unicodeEscapeSequence' and 'renameGlobals' that were missing. This fixes #7 and fixes #9.
1 parent 70fcf69 commit 8b95dcf

4 files changed

Lines changed: 53 additions & 0 deletions

File tree

App/constants/ActionTypes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,7 @@ export const SET_DEAD_CODE_INJECTION_THRESHOLD = 'SET_DEAD_CODE_INJECTION_THRESH
3737
export const TOGGLE_DEAD_CODE_INJECTION = 'TOGGLE_DEAD_CODE_INJECTION'
3838

3939
export const TOGGLE_MANGLE = 'TOGGLE_MANGLE'
40+
41+
export const TOGGLE_UNICODE_ESCAPE_SEQUENCE = 'TOGGLE_UNICODE_ESCAPE_SEQUENCE'
42+
43+
export const TOGGLE_RENAME_GLOBALS = 'TOGGLE_RENAME_GLOBALS'

App/containers/OptionsContainer.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ const Options = ({dispatch, options}) =>
118118
onChange={(event) => dispatch(actions.setStringArrayThreshold(parseFloat(event.target.value))) }
119119
disabled={!options.stringArrayThresholdEnabled} />
120120

121+
<Divider />
122+
123+
<Form.Checkbox
124+
label='Unicode Escape Sequence'
125+
checked={options.unicodeEscapeSequence}
126+
onChange={() => dispatch(actions.toggleOption(types.TOGGLE_UNICODE_ESCAPE_SEQUENCE)) } />
127+
121128
</Segment>
122129
</Grid.Column>
123130

@@ -160,6 +167,13 @@ const Options = ({dispatch, options}) =>
160167
entries={options.reservedNames}
161168
buttonIcon="plus" />
162169

170+
<Divider />
171+
172+
<Form.Checkbox
173+
label='Rename Globals'
174+
checked={options.renameGlobals}
175+
onChange={() => dispatch(actions.toggleOption(types.TOGGLE_RENAME_GLOBALS)) } />
176+
163177
</Segment>
164178
</Grid.Column>
165179

App/reducers/options.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ const initialState = {
3939
deadCodeInjection: false,
4040

4141
mangle: false,
42+
43+
unicodeEscapeSequence: false,
44+
45+
renameGlobals: false,
46+
4247
}
4348

4449
export const options = (state = initialState, action) => {
@@ -222,6 +227,18 @@ export const options = (state = initialState, action) => {
222227
mangle: !state.mangle
223228
}
224229

230+
case types.TOGGLE_UNICODE_ESCAPE_SEQUENCE:
231+
return {
232+
...state,
233+
unicodeEscapeSequence: !state.unicodeEscapeSequence
234+
}
235+
236+
case types.TOGGLE_RENAME_GLOBALS:
237+
return {
238+
...state,
239+
renameGlobals: !state.renameGlobals
240+
}
241+
225242
default:
226243
return state
227244
}

templates/index.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ <h3>Sounds great!</h3>
199199
</td>
200200
</tr>
201201

202+
<tr>
203+
<td class="collapsing">Escape Unicode Sequence</td>
204+
<td>
205+
<p>Converts all the strings to their unicode representation. For instance, the string <code>"Hello World!"</code> will be converted to <code>"'\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21"</code>.</p>
206+
<p>This convertion is pretty easy to revert, and will increase the obfuscated code size greatly. It's not recommended on larger code bases.</p>
207+
</td>
208+
</tr>
209+
202210
<tr>
203211
<td class="collapsing">Disable Console Output</td>
204212
<td>
@@ -248,6 +256,16 @@ <h3>Sounds great!</h3>
248256
</td>
249257
</tr>
250258

259+
<tr>
260+
<td class="collapsing">Rename Globals</td>
261+
<td>
262+
<div class="ui tiny message">
263+
<p><i class="warning sign icon"></i> This option can break your code. Only enable it if you know what it does.</p>
264+
</div>
265+
<p>Enables the obfuscation of global variables and function names with declaration.</p>
266+
</td>
267+
</tr>
268+
251269
<tr>
252270
<td class="collapsing">Source Map</td>
253271
<td>

0 commit comments

Comments
 (0)