diff options
| author | Shulhan <ms@kilabit.info> | 2021-09-29 01:05:58 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-09-29 01:06:15 +0700 |
| commit | edff37e399ea5408971f2fa1b8787bf21d3f5e6b (patch) | |
| tree | 9ae6d5e64eb41b9162d9db94e28d23a4b7b61288 /_www/target.ts | |
| parent | f9c01618f3a59c257ee601d3cf4de5b0e3d73675 (diff) | |
| download | gorankusu-edff37e399ea5408971f2fa1b8787bf21d3f5e6b.tar.xz | |
_www: store the target attack options to local storage
Once the Attack button is clicked, the Target's attack options will
be stored to local storage. On the next refresh or opening the Trunks
web interface, the stored values will be loaded again.
Diffstat (limited to '_www/target.ts')
| -rw-r--r-- | _www/target.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/_www/target.ts b/_www/target.ts index 565908f..0daccf0 100644 --- a/_www/target.ts +++ b/_www/target.ts @@ -1,7 +1,13 @@ import { WuiInputNumber, WuiInputNumberOpts } from "./wui/input/number.js" import { WuiInputString, WuiInputStringOpts } from "./wui/input/string.js" -import { GenerateFormInput, LoadTargetVar } from "./functions.js" +import { + GenerateFormInput, + LoadTargetOptDuration, + LoadTargetOptRatePerSecond, + LoadTargetOptTimeout, + LoadTargetVar, +} from "./functions.js" import { CLASS_INPUT, CLASS_INPUT_LABEL, @@ -146,7 +152,7 @@ export class Target { let opts_duration: WuiInputNumberOpts = { label: "Duration", hint: "The duration of attack, in seconds.", - value: this.opts.Opts.Duration / 1e9, + value: LoadTargetOptDuration(this.opts), min: 1, class_input: CLASS_INPUT, class_label: CLASS_INPUT_LABEL, @@ -160,7 +166,7 @@ export class Target { let opts_rate: WuiInputNumberOpts = { label: "Rate per second", hint: "The number of request send per second when attacking target.", - value: this.opts.Opts.RatePerSecond, + value: LoadTargetOptRatePerSecond(this.opts), min: 1, class_input: CLASS_INPUT, class_label: CLASS_INPUT_LABEL, @@ -174,7 +180,7 @@ export class Target { let opts_timeout: WuiInputNumberOpts = { label: "Timeout (seconds)", hint: "Timeout for each request, in seconds.", - value: this.opts.Opts.Timeout / 1e9, + value: LoadTargetOptTimeout(this.opts), min: 5, class_input: CLASS_INPUT, class_label: CLASS_INPUT_LABEL, |
