Skip to content

Commit

Permalink
Merge pull request #130 from NazarUsov/2.0.2
Browse files Browse the repository at this point in the history
2.1.0
  • Loading branch information
sowle authored Nov 5, 2024
2 parents ca847ff + c5a829e commit 54c3dc3
Show file tree
Hide file tree
Showing 50 changed files with 232 additions and 88 deletions.
10 changes: 8 additions & 2 deletions html_source/src/app/api/services/api-zano.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ export class ApiZanoService {
return this.httpClient.get<WrapInfo>('https://wrapped.zano.org/api2/get_wrap_info');
}

getVerifiedAssetInfoWhitelist(type: 'mainnet' | 'testnet'): Observable<{ assets: VerifiedAssetInfoWhitelist; signature: string }> {
getVerifiedAssetInfoWhitelist(type: 'mainnet' | 'testnet'): Observable<{
assets: VerifiedAssetInfoWhitelist;
signature: string;
}> {
let url: string;
if (type === 'mainnet') {
url = 'https://api.zano.org/assets_whitelist.json';
} else {
url = 'https://api.zano.org/assets_whitelist_testnet.json';
}
return this.httpClient.get<{ assets: VerifiedAssetInfoWhitelist; signature: string }>(url);

return this.httpClient.get<{ assets: VerifiedAssetInfoWhitelist; signature: string }>(url, {
headers: { 'Cache-Control': 'no-cache' },
});
}
}
4 changes: 2 additions & 2 deletions html_source/src/app/pages/auth/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<form (ngSubmit)="onSubmitCreatePass()" *ngIf="type === 'reg'" [formGroup]="regForm" class="form">
<div class="auth-card-form">
<div class="form__field fixed mb-2">
<div class="form__field mb-2">
<label for="master-pass">{{ 'LOGIN.SETUP_MASTER_PASS' | translate }}</label>
<input
(contextmenu)="variablesService.onContextMenuPasteSelect($event)"
Expand All @@ -19,7 +19,7 @@
/>
<div *ngIf="regForm.controls['password'].dirty && regForm.controls['password'].errors" class="error">
<div *ngIf="regForm.controls['password'].errors.pattern">
{{ 'ERRORS.WRONG_PASSWORD' | translate }}
{{ 'ERRORS.REGEXP_INVALID_PASSWORD' | translate }}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import { BehaviorSubject } from 'rxjs';
/>
<div *ngIf="createForm.controls.path.dirty && createForm.controls.password.invalid" class="error">
<div *ngIf="createForm.controls.password.hasError('pattern')">
{{ 'ERRORS.WRONG_PASSWORD' | translate }}
{{ 'ERRORS.REGEXP_INVALID_PASSWORD' | translate }}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Wallet } from '@api/models/wallet.model';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { regExpPassword, ZanoValidators } from '@parts/utils/zano-validators';
import { ZanoValidators } from '@parts/utils/zano-validators';
import { WalletsService } from '@parts/services/wallets.service';
import { notFileZanoWallet, wrongPassword } from '@parts/utils/zano-errors';
import { BreadcrumbItems } from '@parts/components/breadcrumbs/breadcrumbs.models';
Expand Down Expand Up @@ -118,7 +118,7 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
Validators.maxLength(this.variablesService.maxWalletNameLength),
ZanoValidators.duplicate(this.variablesService.walletNamesForComparisons),
]),
password: this.fb.control('', [Validators.pattern(regExpPassword)]),
password: this.fb.control(''),
filePath: this.fb.control('', Validators.required),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Wallet } from '@api/models/wallet.model';
import { TranslateService } from '@ngx-translate/core';
import { debounceTime, startWith, takeUntil } from 'rxjs/operators';
import { combineLatest, Subject } from 'rxjs';
import { regExpPassword, ZanoValidators } from '@parts/utils/zano-validators';
import { ZanoValidators } from '@parts/utils/zano-validators';
import { WalletsService } from '@parts/services/wallets.service';
import { BreadcrumbItems } from '@parts/components/breadcrumbs/breadcrumbs.models';

Expand Down Expand Up @@ -64,9 +64,9 @@ export class RestoreWalletComponent implements OnInit, OnDestroy {
ZanoValidators.duplicate(this.variablesService.walletNamesForComparisons),
]),
seedPhrase: this._fb.control('', Validators.required),
password: this._fb.control('', Validators.pattern(regExpPassword)),
password: this._fb.control(''),
confirm: this._fb.control(''),
seedPassword: this._fb.control('', Validators.pattern(regExpPassword)),
seedPassword: this._fb.control(''),
},
{
validators: [ZanoValidators.formMatch('password', 'confirm')],
Expand Down
14 changes: 13 additions & 1 deletion html_source/src/app/pages/seed-phrase/seed-phrase.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ import { BreadcrumbItems } from '@parts/components/breadcrumbs/breadcrumbs.model
placeholder="{{ 'PLACEHOLDERS.PASSWORD_PLACEHOLDER' | translate }}"
type="password"
/>
<div
*ngIf="
seedPhraseForm.controls.password.invalid &&
(seedPhraseForm.controls['password'].dirty ||
seedPhraseForm.controls['password'].touched)
"
class="error"
>
<ng-container *ngIf="seedPhraseForm.controls['password'].hasError('pattern')">
{{ 'ERRORS.REGEXP_INVALID_PASSWORD' | translate }}
</ng-container>
</div>
</div>
<div class="form__field">
Expand Down Expand Up @@ -228,7 +240,7 @@ export class SeedPhraseComponent implements OnInit, OnDestroy {
seedPhraseForm = this.fb.group(
{
password: this.fb.nonNullable.control('', Validators.pattern(regExpPassword)),
confirmPassword: this.fb.nonNullable.control('', Validators.pattern(regExpPassword)),
confirmPassword: this.fb.nonNullable.control(''),
},
{
validators: [ZanoValidators.formMatch('password', 'confirmPassword')],
Expand Down
26 changes: 18 additions & 8 deletions html_source/src/app/pages/settings/settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,20 @@ <h1 class="ml-2">{{ 'SETTINGS.TITLE' | translate }}</h1>

<div class="form__field">
<label>{{ 'SETTINGS.USE_TOR_TO_RELAY_TRANSACTIONS' | translate }} (Temporarily disabled)</label>
<app-switch (emitChange)="toggleUseTor()" [disabled]="true" [value]="false && appUseTor"></app-switch>
<app-switch (emitChange)="toggleUseTor()" [disabled]="true"
[value]="false && appUseTor"></app-switch>
</div>

<div class="form__field">
<label>{{ 'SETTINGS.DARK_THEME' | translate }}</label>
<app-switch (emitChange)="toggleDarkTheme()" [value]="variablesService.settings.isDarkTheme"></app-switch>
<app-switch (emitChange)="toggleDarkTheme()"
[value]="variablesService.settings.isDarkTheme"></app-switch>
</div>

<div class="form__field">
<label>{{ 'SETTINGS.SHOW_BALANCE' | translate }}</label>
<app-switch (emitChange)="showPrice()" [value]="this.variablesService.visibilityBalance$ | async"></app-switch>
<app-switch (emitChange)="showPrice()"
[value]="this.variablesService.visibilityBalance$ | async"></app-switch>
</div>

<form [formGroup]="zanoCompanionForm">
Expand All @@ -121,7 +124,8 @@ <h1 class="ml-2">{{ 'SETTINGS.TITLE' | translate }}</h1>
<ng-container *ngIf="zanoCompanionForm.controls.zanoCompation.getRawValue()">
<div class="form__card">
<div class="form__field form__field--secret">
<label for="field-secret">{{ 'SETTINGS.FORM.ZANO_COMPANION.LABELS.LABEL2' | translate }}</label>
<label
for="field-secret">{{ 'SETTINGS.FORM.ZANO_COMPANION.LABELS.LABEL2' | translate }}</label>
<input
(contextmenu)="
variablesService.onContextMenuOnlyCopy($event, zanoCompanionForm.controls['secret'].value)
Expand All @@ -148,7 +152,8 @@ <h1 class="ml-2">{{ 'SETTINGS.TITLE' | translate }}</h1>
</div>

<div class="form__field">
<label for="field-port">{{ 'SETTINGS.FORM.ZANO_COMPANION.LABELS.LABEL3' | translate }}</label>
<label
for="field-port">{{ 'SETTINGS.FORM.ZANO_COMPANION.LABELS.LABEL3' | translate }}</label>
<input
(contextmenu)="
variablesService.onContextMenuOnlyCopy($event, this.variablesService.rpc_port?.toString())
Expand Down Expand Up @@ -206,6 +211,11 @@ <h4 class="master-password-title mb-2">
>
{{ 'SETTINGS.FORM_ERRORS.CURRENT_PASS_NOT_MATCH' | translate }}
</div>
<div *ngIf="changeForm.invalid && (changeForm.controls['password'].dirty ||
changeForm.controls['password'].touched) && changeForm.controls['password'].errors?.pattern"
class="error">
{{ 'ERRORS.REGEXP_INVALID_PASSWORD' | translate }}
</div>
</div>

<div class="form__field">
Expand All @@ -224,7 +234,7 @@ <h4 class="master-password-title mb-2">
class="error"
>
<div *ngIf="changeForm.controls['new_password'].errors?.pattern">
{{ 'ERRORS.WRONG_PASSWORD_MUST_BE' | translate }} a-zA-Z0-9_.*|~!?@#$%^&+&#123;}()<>:;"'-=,/[]*$
{{ 'ERRORS.REGEXP_INVALID_PASSWORD' | translate }}
</div>
<div *ngIf="changeForm.controls['new_password'].hasError('required')">
{{ 'ERRORS.REQUIRED' | translate }}
Expand Down Expand Up @@ -269,8 +279,8 @@ <h4 class="master-password-title mb-2">
{{ 'SETTINGS.MASTER_PASSWORD.BUTTON' | translate }}
</button>
<span *ngIf="ifSaved" [class.active]="ifSaved" class="ml-1 color-aqua">{{
'SETTINGS.SETTINGS_SAVED' | translate
}}</span>
'SETTINGS.SETTINGS_SAVED' | translate
}}</span>
</div>
</form>

Expand Down
6 changes: 3 additions & 3 deletions html_source/src/app/pages/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class SettingsComponent implements OnInit {
});

this.backend.getIsDisabledNotifications(state => {
this.currentNotificationsState = state;
this.currentNotificationsState = !state;
});

this.zanoCompanionForm.valueChanges.pipe(debounceTime(200)).subscribe({
Expand Down Expand Up @@ -256,10 +256,10 @@ export class SettingsComponent implements OnInit {

toggleNotifications(): void {
if (!this.currentNotificationsState) {
this.backend.setIsDisabledNotifications('true');
this.backend.setIsDisabledNotifications('false');
this.currentNotificationsState = true;
} else {
this.backend.setIsDisabledNotifications('false');
this.backend.setIsDisabledNotifications('true');
this.currentNotificationsState = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ import { BreadcrumbItems } from '@parts/components/breadcrumbs/breadcrumbs.model
placeholder="{{ 'PLACEHOLDERS.PASSWORD_PLACEHOLDER' | translate }}"
type="password"
/>
<div
*ngIf="
passwordSeedPhraseForm.controls.password.invalid &&
(passwordSeedPhraseForm.controls['password'].dirty ||
passwordSeedPhraseForm.controls['password'].touched)
"
class="error"
>
<ng-container *ngIf="passwordSeedPhraseForm.controls['password'].hasError('pattern')">
{{ 'ERRORS.REGEXP_INVALID_PASSWORD' | translate }}
</ng-container>
</div>
</div>
<div class="form__field">
Expand Down Expand Up @@ -239,7 +251,7 @@ export class WalletDetailsComponent {
passwordSeedPhraseForm = this.fb.group(
{
password: this.fb.control('', Validators.pattern(regExpPassword)),
confirmPassword: this.fb.control('', Validators.pattern(regExpPassword)),
confirmPassword: this.fb.control(''),
},
{
validators: [ZanoValidators.formMatch('password', 'confirmPassword')],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h3 mat-dialog-title>
<input
(contextmenu)="variablesService.onContextMenuPasteSelect($event)"
[class.invalid]="form.controls.amount.touched && form.controls.amount.invalid"
[decimalPoint]="data.assetInfo.decimal_point"
[decimalPoint]="data.asset_info.decimal_point"
[placeholder]="'1000000' | translate"
appInputValidate="money"
autofocus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
export class BurnCustomAssetComponent {
public readonly variablesService: VariablesService = inject(VariablesService);

public readonly data: { assetInfo: AssetInfo } = inject(MAT_DIALOG_DATA);
public readonly data: { asset_info: AssetInfo } = inject(MAT_DIALOG_DATA);

public readonly matDialogRef: MatDialogRef<BurnCustomAssetComponent> = inject(MatDialogRef);

Expand All @@ -29,7 +29,7 @@ export class BurnCustomAssetComponent {
(control): ValidationErrors | null => {
const { value: amount } = control;
const {
assetInfo: { asset_id },
asset_info: { asset_id },
} = this.data;
const { currentWallet, maximum_value } = this.variablesService;
const prepared_amount = new BigNumber(amount);
Expand Down Expand Up @@ -67,7 +67,7 @@ export class BurnCustomAssetComponent {
currentWallet: { wallet_id },
} = this.variablesService;
const {
assetInfo: { asset_id, decimal_point },
asset_info: { asset_id, decimal_point },
} = this.data;

const params = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3 mat-dialog-title>
<input
(contextmenu)="variablesService.onContextMenuPasteSelect($event)"
[class.invalid]="form.controls.amount.touched && form.controls.amount.invalid"
[decimalPoint]="data.assetInfo.decimal_point"
[decimalPoint]="data.asset_info.decimal_point"
[placeholder]="'1000000' | translate"
appInputValidate="money"
autofocus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
export class EmitCustomAssetComponent {
public readonly variablesService: VariablesService = inject(VariablesService);

public readonly data: { assetInfo: AssetInfo } = inject(MAT_DIALOG_DATA);
public readonly data: { asset_info: AssetInfo } = inject(MAT_DIALOG_DATA);

public readonly matDialogRef: MatDialogRef<EmitCustomAssetComponent> = inject(MatDialogRef);

Expand All @@ -30,7 +30,7 @@ export class EmitCustomAssetComponent {
Validators.required,
(control): ValidationErrors | null => {
const {
assetInfo: { total_max_supply, current_supply, decimal_point },
asset_info: { total_max_supply, current_supply, decimal_point },
} = this.data;
const { value: amount } = control;

Expand All @@ -51,7 +51,7 @@ export class EmitCustomAssetComponent {
currentWallet: { wallet_id, address },
} = this.variablesService;
const {
assetInfo: { asset_id, decimal_point },
asset_info: { asset_id, decimal_point },
} = this.data;
const { amount } = this.form.getRawValue();
const params: EmitParams = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
})
export class UpdateCustomAssetComponent {
public readonly variablesService: VariablesService = inject(VariablesService);
public readonly data: { assetInfo: AssetInfo } = inject(MAT_DIALOG_DATA);
public readonly data: { asset_info: AssetInfo } = inject(MAT_DIALOG_DATA);
public readonly matDialogRef: MatDialogRef<UpdateCustomAssetComponent> = inject(MatDialogRef);
private readonly _backendService: BackendService = inject(BackendService);
private readonly fb: NonNullableFormBuilder = inject(NonNullableFormBuilder);
Expand Down Expand Up @@ -56,7 +56,7 @@ export class UpdateCustomAssetComponent {

public submit(): void {
const { wallet_id } = this.variablesService.currentWallet;
const { asset_id } = this.data.assetInfo;
const { asset_id } = this.data.asset_info;
const { owner } = this.form.getRawValue();
const params: UpdateAssetParams = {
asset_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<div *ngIf="form.controls.ticker.errors['maxlength'] as err">
{{ 'ERRORS.MAX_LENGTH' | translate : { requiredLength: err.requiredLength } }}
</div>

<div *ngIf="form.controls.ticker.errors['pattern'] as err">
{{ 'ERRORS.INVALID_TICKER_PATTERN' | translate }}
</div>
</div>
</div>

Expand Down Expand Up @@ -60,6 +64,10 @@
<div *ngIf="form.controls.full_name.errors['maxLength'] as err">
{{ 'ERRORS.MAX_LENGTH' | translate : { requiredLength: err.requiredLength } }}
</div>

<div *ngIf="form.controls.full_name.errors['pattern'] as err">
{{ 'ERRORS.INVALID_FULL_NAME_ASSET_PATTERN' | translate }}
</div>
</div>
</div>
</div>
Expand All @@ -69,7 +77,7 @@
<div class="form__field">
<label for="total_max_supply">
{{ 'CREATE_NEW_ASSETS.FORM.LABELS.LABEL3' | translate }}
<span class="color-red">*</span>
<!--<span class="color-red">*</span>-->
</label>
<input
(contextmenu)="variablesService.onContextMenu($event)"
Expand Down
Loading

0 comments on commit 54c3dc3

Please sign in to comment.