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

Commit 6eb96b8

Browse files
committed
Added the 'seed' input to the UI, which was added on javascript-obfuscator@0.8.2.
1 parent 129287c commit 6eb96b8

5 files changed

Lines changed: 31 additions & 0 deletions

File tree

App/actions/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,8 @@ export const setSourceMapFileName = (fileName) => ({
7777
'type': types.SET_SOURCEMAP_FILE_NAME,
7878
fileName
7979
});
80+
81+
export const setSeed = (seed) => ({
82+
'type': types.SET_SEED,
83+
seed
84+
});

App/constants/ActionTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ export const REMOVE_DOMAIN_LOCK = 'REMOVE_DOMAIN_LOCK'
2727

2828
export const ADD_RESERVED_NAME = 'ADD_RESERVED_NAME'
2929
export const REMOVE_RESERVED_NAME = 'REMOVE_RESERVED_NAME'
30+
31+
export const SET_SEED = 'SET_SEED'

App/containers/OptionsContainer.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,15 @@ const Options = ({dispatch, options}) =>
144144
entries={options.reservedNames}
145145
buttonIcon="plus" />
146146

147+
<Form.Input
148+
type='number'
149+
label='Seed'
150+
defaultValue={options.seed || 0}
151+
min="0"
152+
max="99999999"
153+
step="1"
154+
onChange={(event) => dispatch(actions.setSeed(parseInt(event.target.value))) } />
155+
147156
</Segment>
148157
</Grid.Column>
149158

App/reducers/options.js

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

3030
domainLock: [],
3131
reservedNames: [],
32+
33+
seed: 0,
3234
}
3335

3436
export const options = (state = initialState, action) => {
@@ -152,6 +154,12 @@ export const options = (state = initialState, action) => {
152154
reservedNames: state.reservedNames.filter((name) => name !== action.name),
153155
}
154156

157+
case types.SET_SEED:
158+
return {
159+
...state,
160+
seed: action.seed
161+
}
162+
155163
default:
156164
return state
157165
}

templates/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ <h3>Sounds great!</h3>
204204
</td>
205205
</tr>
206206

207+
<tr>
208+
<td class="collapsing">Seed</td>
209+
<td>
210+
<p>By default (<code>seed = 0</code>), each time you obfuscate your code you'll get a new result (i.e: different variable names, different variables inserted into the <code>stringArray</code>, etc). If you want repeatable results, set the <code>seed</code> to a specific integer.</p>
211+
</td>
212+
</tr>
213+
207214
</tbody>
208215
</table>
209216

0 commit comments

Comments
 (0)