Skip to content

Commit

Permalink
added more validation for AxeOS settings
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamin-wilson committed Nov 15, 2023
1 parent dea4a75 commit a5bcec5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2>Settings</h2>
<input formControlName="wifiPass" type="password">
</div>
<div class="form-group">
<label>Stratum URL:</label>
<label>Stratum URL: (Do not include 'stratum+tcp://' or port</label>
<input formControlName="stratumURL" type="text">
</div>
<div class="form-group">
Expand Down Expand Up @@ -116,22 +116,22 @@ <h2>Settings</h2>
</div>


<div class="form-group">
<label>Fan Speed {{form.controls['fanspeed'].value}}% <span
*ngIf="form.controls['autofanspeed'].value == true">(disabled, automatic) </span> <b
*ngIf="form.controls['fanspeed'].value < 33" style="color:red">Danger: Could Cause
<div class="form-group" *ngIf="form.controls['autofanspeed'].value != true">
<label>Fan Speed {{form.controls['fanspeed'].value}}%
<b *ngIf="form.controls['fanspeed'].value < 33" style="color:red">Danger: Could Cause
Overheating</b> <b *ngIf="form.controls['fanspeed'].value == 100" style="color: #F2A900">S19
Simulator</b></label>
<input formControlName="fanspeed" type="range" [min]="0" [max]="100">
</div>
<div class="mt-2">
<button [disabled]="form.invalid" (click)="updateSystem()" class="btn btn-primary mr-2">Save</button>
<b style="line-height: 34px;">You must restart this device after saving for changes to take effect.</b>
</div>


</form>
</ng-container>

<div class="mt-2">
<button (click)="updateSystem()" class="btn btn-primary mr-2">Save</button>
<b style="line-height: 34px;">You must restart this device after saving for changes to take effect.</b>
</div>


</div>
Expand Down
13 changes: 11 additions & 2 deletions main/http_server/axe-os/src/app/components/edit/edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,17 @@ export class EditComponent {
this.form = this.fb.group({
flipscreen: [info.flipscreen == 1],
invertscreen: [info.invertscreen == 1],
stratumURL: [info.stratumURL, [Validators.required]],
stratumPort: [info.stratumPort, [Validators.required]],
stratumURL: [info.stratumURL, [
Validators.required,
Validators.pattern(/^(?!.*stratum\+tcp:\/\/).*$/),
Validators.pattern(/^[^:]*$/),
]],
stratumPort: [info.stratumPort, [
Validators.required,
Validators.pattern(/^[^:]*$/),
Validators.min(0),
Validators.max(65353)
]],
stratumUser: [info.stratumUser, [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: [info.wifiPass, [Validators.required]],
Expand Down
12 changes: 12 additions & 0 deletions main/http_server/axe-os/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ button {

}

button:disabled,
button[disabled] {
background: #45657f;
border: 1px solid #1c4567;
cursor: not-allowed;

&:hover {
background: #45657f;
border: 1px solid #1c4567;
}
}

input[type="text"],
input[type="password"],
input[type="number"],
Expand Down

0 comments on commit a5bcec5

Please sign in to comment.