Skip to content

Commit 82686fd

Browse files
author
sanex3339
committed
Reset options button. Version update to 0.24.1
1 parent 1aa86af commit 82686fd

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

App/actions/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ export const obfuscateCode = (code, options) => {
5656
};
5757
};
5858

59+
export const resetOptions = () => ({
60+
'type': types.RESET_OPTIONS,
61+
});
62+
5963
export const toggleOption = (optionType) => ({
6064
'type': optionType
6165
});

App/constants/ActionTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const OBFUSCATE_PENDING = 'OBFUSCATE_PENDING';
55
export const OBFUSCATE_FULFILLED = 'OBFUSCATE_FULFILLED';
66
export const OBFUSCATE_REJECTED = 'OBFUSCATE_REJECTED';
77

8+
export const RESET_OPTIONS = 'RESET_OPTIONS';
9+
810
export const TOGGLE_COMPACT_CODE = 'TOGGLE_COMPACT_CODE';
911
export const TOGGLE_SELF_DEFENDING = 'TOGGLE_SELF_DEFENDING';
1012
export const TOGGLE_DISABLE_CONSOLE_OUTPUT = 'TOGGLE_DISABLE_CONSOLE_OUTPUT';

App/containers/OptionsContainer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33

44
import {connect} from 'react-redux';
55

6-
import {Form, Grid, Segment, Divider} from 'semantic-ui-react';
6+
import {Form, Grid, Segment, Divider, Button} from 'semantic-ui-react';
77

88
import EntryInputContainer from '../containers/EntryInputContainer';
99

@@ -51,6 +51,14 @@ const Options = ({dispatch, options}) =>
5151
<Grid columns={4} relaxed stackable doubling>
5252
<Grid.Column style={{display: 'block'}}>
5353
<Segment basic>
54+
<Button
55+
fluid
56+
onClick={() => dispatch(actions.resetOptions())}
57+
>
58+
Reset options
59+
</Button>
60+
61+
<Divider/>
5462

5563
<Form.Checkbox
5664
label='Compact code'
@@ -225,6 +233,7 @@ const Options = ({dispatch, options}) =>
225233

226234
<EntryInputContainer
227235
label='Domain lock'
236+
disabled={!options.domainLockEnabled}
228237
actionAddEntryToState={(domain) => dispatch(actions.addDomainLock(domain))}
229238
actionRemoveEntryFromState={(domain) => dispatch(actions.removeDomainLock(domain))}
230239
placeholder="domain.com"

App/reducers/options.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const initialState = {
3636
sourceMapSeparate: false,
3737

3838
domainLock: [],
39+
domainLockEnabled: true,
3940
reservedNames: [],
4041
reservedStrings: [],
4142

@@ -73,6 +74,10 @@ export const options = (state = initialState, action) => {
7374

7475
switch (action.type) {
7576

77+
case types.RESET_OPTIONS: {
78+
return initialState;
79+
}
80+
7681
case types.TOGGLE_COMPACT_CODE: {
7782
const compact = !state.compact;
7883
return {
@@ -303,11 +308,20 @@ export const options = (state = initialState, action) => {
303308
renameGlobals: !state.renameGlobals
304309
};
305310

306-
case types.SET_TARGET:
311+
case types.SET_TARGET: {
312+
const target = action.target;
313+
314+
const isNodeTarget = target === 'node';
315+
307316
return {
308317
...state,
309-
target: action.target
318+
target,
319+
...isNodeTarget && {
320+
domainLock: []
321+
},
322+
domainLockEnabled: !isNodeTarget
310323
};
324+
}
311325

312326
case types.SET_IDENTIFIER_NAMES_GENERATOR:
313327
return {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "javascript-obfuscator-web",
3-
"version": "3.0.0",
3+
"version": "3.1.0",
44
"description": "",
55
"engines": {
66
"node": ">=12.13.1"
@@ -32,7 +32,7 @@
3232
"graceful-fs": "4.1.9",
3333
"html-webpack-plugin": "^3.2.0",
3434
"inert": "5.1.0",
35-
"javascript-obfuscator": "0.24.0",
35+
"javascript-obfuscator": "0.24.1",
3636
"less": "2.7.1",
3737
"less-loader": "4.1.0",
3838
"pm2": "3.5.1",

templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h1>JavaScript Obfuscator Tool</h1>
4949
<p>
5050
A free and efficient obfuscator for JavaScript (including ES2017). Make your code harder to copy and
5151
prevent people from stealing your work. This tool is a Web UI to the excellent (and open source)
52-
<code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">javascript-obfuscator</a>@0.24.0</code>
52+
<code><a href="https://github.com/javascript-obfuscator/javascript-obfuscator" target="_new">javascript-obfuscator</a>@0.24.1</code>
5353
created by Timofey Kachalov.
5454
</p>
5555
<div id="GithubBadges">

0 commit comments

Comments
 (0)