-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathedit.component.ts
More file actions
647 lines (555 loc) · 22.1 KB
/
Copy pathedit.component.ts
File metadata and controls
647 lines (555 loc) · 22.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
import { HttpErrorResponse } from '@angular/common/http';
import { Component, Input, OnInit, TemplateRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { switchMap, forkJoin, startWith, tap, catchError, of } from 'rxjs';
import { LoadingService } from '../../services/loading.service';
import { SystemService } from '../../services/system.service';
import { eASICModel } from '../../models/enum/eASICModel';
import { NbToastrService, NbDialogService, NbDialogRef } from '@nebular/theme';
import { LocalStorageService } from 'src/app/services/local-storage.service';
import { OtpAuthService, EnsureOtpResult, EnsureOtpOptions } from '../../services/otp-auth.service';
import { TranslateService } from '@ngx-translate/core';
import { IStratum } from 'src/app/models/IStratum';
enum SupportLevel { Safe = 0, Advanced = 1, Pro = 2 }
@Component({
selector: 'app-edit',
templateUrl: './edit.component.html',
styleUrls: ['./edit.component.scss']
})
export class EditComponent implements OnInit {
public supportLevel: SupportLevel = SupportLevel.Safe;
public form!: FormGroup;
public dialogRef!: NbDialogRef<any>; // Store reference
public frequencyOptions: { name: string; value: number }[] = [];
public voltageOptions: { name: string; value: number }[] = [];
public firmwareUpdateProgress: number | null = null;
public websiteUpdateProgress: number | null = null;
public dontShowWarning: boolean = false;
public eASICModel = eASICModel;
public ASICModel!: eASICModel;
public defaultFrequency: number = 0;
public defaultCoreVoltage: number = 0;
public defaultVrFrequency: number = 0;
public fanCount: number = 1;
public fanLabels: string[] = ['Fan 1', 'Fan 2'];
public ecoFrequency: number = 0;
public ecoCoreVoltage: number = 0;
private originalSettings!: any;
public otpEnabled = false;
private pendingTotp: string | undefined;
private asicFrequencyValues: number[] = [];
private asicVoltageValues: number[] = [];
private stratum: IStratum = null;
private rebootRequiredFields = new Set<string>([
'flipscreen',
'invertscreen',
'hostname',
'ssid',
'wifiPass',
'wifiStatus',
'invertfanpolarity',
'stratumDifficulty',
'stratum_keep',
'poolMode',
'stratumProtocol',
'fallbackStratumProtocol',
]);
@Input() uri = '';
constructor(
private fb: FormBuilder,
private systemService: SystemService,
private toastrService: NbToastrService,
private loadingService: LoadingService,
private localStorageService: LocalStorageService,
private dialogService: NbDialogService,
private otpAuth: OtpAuthService,
private translate: TranslateService,
) { }
ngOnInit(): void {
forkJoin({
info: this.systemService.getInfo(0, 0, this.uri),
asic: this.systemService.getAsicInfo(this.uri)
})
.pipe(this.loadingService.lockUIUntilComplete())
.subscribe(({ info, asic }) => {
this.originalSettings = structuredClone(info);
// nasty work around
this.originalSettings["poolMode"] = info.stratum?.poolMode ?? 0;
this.otpEnabled = !!info.otp;
// Model still from /info (enum-typed)
this.ASICModel = info.ASICModel;
// Prefer defaults from /asic, otherwise fallback to /info
this.defaultFrequency = (asic?.defaultFrequency ?? info.defaultFrequency ?? 0);
this.defaultCoreVoltage = (asic?.defaultVoltage ?? info.defaultCoreVoltage ?? 0);
// eco only from /asic (optional)
this.ecoFrequency = asic?.ecoFrequency ?? undefined;
this.ecoCoreVoltage = asic?.ecoVoltage ?? undefined;
// Store raw options (can be empty if the endpoint returns nothing)
this.asicFrequencyValues = asic?.frequencyOptions ?? [];
this.asicVoltageValues = asic?.voltageOptions ?? [];
this.defaultVrFrequency = info.defaultVrFrequency ?? undefined;
this.fanCount = info.fans?.length ?? info.fanCount ?? 1;
this.fanLabels = info.fans?.map((f, i) => f.label || `Fan ${i + 1}`) ?? ['Fan 1', 'Fan 2'];
const fan1cfg = info.fans?.[1];
const freqBase = this.asicFrequencyValues.map(v => {
let suffix = '';
if (v === this.defaultFrequency) suffix = ' (default)';
if (this.ecoFrequency != null && v === this.ecoFrequency) suffix = ' (eco)';
return { name: `${v}${suffix}`, value: v };
});
const voltBase = this.asicVoltageValues.map(v => {
let suffix = '';
if (v === this.defaultCoreVoltage) suffix = ' (default)';
if (this.ecoCoreVoltage != null && v === this.ecoCoreVoltage) suffix = ' (eco)';
return { name: `${v}${suffix}`, value: v };
});
// Build dropdowns and, if needed, append the current custom value
this.frequencyOptions = this.assembleDropdownOptions(freqBase, info.frequency);
this.voltageOptions = this.assembleDropdownOptions(voltBase, info.coreVoltage);
// fix setting where we allowed to disable temp shutdown
if (info.overheat_temp == 0) {
info.overheat_temp = 70;
}
// respect bounds
info.overheat_temp = Math.max(40, Math.min(90, info.overheat_temp));
// Build the form (Min/Max for volt/freq will be set dynamically right after)
this.form = this.fb.group({
stratum_keep: [info.stratum_keep == 1],
flipscreen: [info.flipscreen == 1],
invertscreen: [info.invertscreen == 1],
autoscreenoff: [info.autoscreenoff == 1],
timeFormat: [this.localStorageService.getItem('timeFormat') || '24h'],
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]],
stratumPassword: ['*****', [Validators.required]],
stratumEnonceSubscribe: [info.stratumEnonceSubscribe == 1],
stratumTLS: [info.stratumTLS == 1],
fallbackStratumURL: [info.fallbackStratumURL, [
Validators.pattern(/^(?!.*stratum\+tcp:\/\/).*$/),
Validators.pattern(/^[^:]*$/),
]],
fallbackStratumPort: [info.fallbackStratumPort, [
Validators.pattern(/^[^:]*$/),
Validators.min(0),
Validators.max(65353)
]],
fallbackStratumUser: [info.fallbackStratumUser],
fallbackStratumPassword: ['*****'],
fallbackStratumEnonceSubscribe: [info.fallbackStratumEnonceSubscribe == 1],
fallbackStratumTLS: [info.fallbackStratumTLS == 1],
hostname: [info.hostname, [Validators.required]],
ssid: [info.ssid, [Validators.required]],
wifiPass: ['*****'],
coreVoltage: [info.coreVoltage, [Validators.min(1005), Validators.max(1400), Validators.required]],
frequency: [info.frequency, [Validators.required]],
jobInterval: [info.jobInterval, [Validators.required]],
stratumDifficulty: [info.stratumDifficulty, [Validators.required, Validators.min(1)]],
stratumProtocol: [info.stratumProtocol ?? 0, [Validators.required]], // 0 = V1, 1 = V2
fallbackStratumProtocol: [info.fallbackStratumProtocol ?? 0],
sv2AuthorityPubkey: [info.sv2AuthorityPubkey ?? ''],
fallbackSv2AuthorityPubkey: [info.fallbackSv2AuthorityPubkey ?? ''],
sv2ChannelType: [info.sv2ChannelType ?? 0], // 0 = Extended, 1 = Standard
fallbackSv2ChannelType: [info.fallbackSv2ChannelType ?? 0],
poolMode: [info.stratum?.poolMode ?? 0, [Validators.required]], // 0 = Failover, 1 = Dual
poolBalance: [info.stratum?.poolBalance ?? 50, [ // Anteil PRIMARY in %
Validators.required,
Validators.min(0),
Validators.max(100),
]],
autofanspeed: [info.autofanspeed ?? 0, [Validators.required]],
pidTargetTemp: [info.pidTargetTemp ?? 55, [
Validators.min(30),
Validators.max(80),
Validators.required
]],
pidP: [info.pidP ?? 6, [
Validators.min(0),
Validators.max(100),
Validators.required
]],
pidI: [info.pidI ?? 0.1, [
Validators.min(0),
Validators.max(10),
Validators.required
]],
pidD: [info.pidD ?? 10, [
Validators.min(0),
Validators.max(100),
Validators.required
]],
invertfanpolarity: [info.invertfanpolarity == 1, [Validators.required]],
manualFanSpeed: [info.manualFanSpeed, [Validators.required]],
overheat_temp: [info.overheat_temp, [
Validators.min(40),
Validators.max(90),
Validators.required
]],
vrFrequency: [info.vrFrequency, [
Validators.min(1000),
Validators.max(100000),
Validators.pattern(/^\d+$/), // only ints
Validators.required,
]],
otpEnabled: [info.otp],
fan1Mode: [fan1cfg?.mode ?? 3, [Validators.required]],
fan1ManualSpeed: [fan1cfg?.manualSpeed ?? 100, [Validators.min(0), Validators.max(100), Validators.required]],
fan1OverheatTemp: [fan1cfg?.overheatTemp ?? 70, [Validators.min(40), Validators.max(90), Validators.required]],
fan1PidTargetTemp: [fan1cfg?.pid?.targetTemp ?? 65, [Validators.min(30), Validators.max(80), Validators.required]],
fan1PidP: [fan1cfg?.pid?.p ?? 6, [Validators.min(0), Validators.max(100), Validators.required]],
fan1PidI: [fan1cfg?.pid?.i ?? 0.1, [Validators.min(0), Validators.max(10), Validators.required]],
fan1PidD: [fan1cfg?.pid?.d ?? 10, [Validators.min(0), Validators.max(100), Validators.required]],
});
this.stratum = info.stratum;
this.form.controls['autofanspeed'].valueChanges
.pipe(startWith(this.form.controls['autofanspeed'].value))
.subscribe(() => this.updatePIDFieldStates());
this.form.controls['fan1Mode'].valueChanges
.pipe(startWith(this.form.controls['fan1Mode'].value))
.subscribe(() => this.updateFan1FieldStates());
this.updatePIDFieldStates();
this.updateFan1FieldStates();
});
}
private updatePIDFieldStates(): void {
const mode = this.form.controls['autofanspeed'].value;
const enable = (ctrl: string) => this.form.controls[ctrl]?.enable({ emitEvent: false });
const disable = (ctrl: string) => this.form.controls[ctrl]?.disable({ emitEvent: false });
if (mode === 0) {
enable('manualFanSpeed');
disable('pidTargetTemp');
disable('pidP');
disable('pidI');
disable('pidD');
} else if (mode === 1) {
disable('manualFanSpeed');
disable('pidTargetTemp');
disable('pidP');
disable('pidI');
disable('pidD');
} else if (mode === 2) {
disable('manualFanSpeed');
enable('pidTargetTemp');
if (this.supportLevel >= 1) {
enable('pidP');
enable('pidI');
enable('pidD');
} else {
disable('pidP');
disable('pidI');
disable('pidD');
}
}
}
private updateFan1FieldStates(): void {
const mode = this.form.controls['fan1Mode'].value;
const enable = (ctrl: string) => this.form.controls[ctrl]?.enable({ emitEvent: false });
const disable = (ctrl: string) => this.form.controls[ctrl]?.disable({ emitEvent: false });
if (mode === 3) {
// LINKED — disable fan1-controls; overheatTemp stays enabled (VReg shutdown threshold)
enable('fan1OverheatTemp');
disable('fan1ManualSpeed');
disable('fan1PidTargetTemp');
disable('fan1PidP');
disable('fan1PidI');
disable('fan1PidD');
} else if (mode === 0) {
// MANUAL
enable('fan1ManualSpeed');
enable('fan1OverheatTemp');
disable('fan1PidTargetTemp');
disable('fan1PidP');
disable('fan1PidI');
disable('fan1PidD');
} else if (mode === 2) {
// PID
disable('fan1ManualSpeed');
enable('fan1OverheatTemp');
enable('fan1PidTargetTemp');
if (this.supportLevel >= 1) {
enable('fan1PidP');
enable('fan1PidI');
enable('fan1PidD');
} else {
disable('fan1PidP');
disable('fan1PidI');
disable('fan1PidD');
}
}
}
public updateSystem(totp?: string) {
const form = this.form.getRawValue();
// Client-only preference
if (form.timeFormat) {
this.localStorageService.setItem('timeFormat', form.timeFormat);
window.dispatchEvent(new CustomEvent('timeFormatChanged', { detail: form.timeFormat }));
delete form.timeFormat;
}
// Allow empty WiFi password; strip masked fields
form.wifiPass = form.wifiPass == null ? '' : form.wifiPass;
if (form.wifiPass === '*****') delete form.wifiPass;
if (form.stratumPassword === '*****') delete form.stratumPassword;
if (form.fallbackStratumPassword === '*****') delete form.fallbackStratumPassword;
form.stratum_keep = form.stratum_keep ? 1 : 0;
// fans[]-Array for the new per channel api
form.fans = [
{
mode: form.autofanspeed,
manualSpeed: form.manualFanSpeed,
overheatTemp: form.overheat_temp,
pid: { targetTemp: form.pidTargetTemp, p: form.pidP, i: form.pidI, d: form.pidD }
}
];
if (this.fanCount > 1) {
form.fans.push({
mode: form.fan1Mode,
manualSpeed: form.fan1ManualSpeed,
overheatTemp: form.fan1OverheatTemp,
pid: { targetTemp: form.fan1PidTargetTemp, p: form.fan1PidP, i: form.fan1PidI, d: form.fan1PidD }
});
}
delete form.fan1Mode;
delete form.fan1ManualSpeed;
delete form.fan1OverheatTemp;
delete form.fan1PidTargetTemp;
delete form.fan1PidP;
delete form.fan1PidI;
delete form.fan1PidD;
if (this.pendingTotp) {
form.totp = this.pendingTotp;
}
return this.systemService.updateSystem(this.uri, form, totp)
}
get requiresReboot(): boolean {
if (!this.form || !this.originalSettings) return false;
const current = this.form.getRawValue();
for (const key of this.rebootRequiredFields) {
if (!(key in current)) {
continue;
}
const currentValue = this.normalizeValue(current[key]);
const originalValue = this.normalizeValue(this.originalSettings[key]);
// Masked password fields: unchanged if still '*****', changed otherwise
if (typeof currentValue === 'string' && currentValue === '*****') {
continue;
}
// Fields not present in original settings (e.g. wifiPass):
// if we got past the '*****' check, the user has typed something new
if (originalValue === undefined || originalValue === null) {
return true;
}
if (currentValue !== originalValue) {
//console.log(`Mismatch on key: ${key}`, currentValue, originalValue);
return true;
}
}
return false;
}
private normalizeValue(value: any): any {
if (typeof value === 'boolean') {
return value ? 1 : 0;
}
return value;
}
showStratumPassword: boolean = false;
toggleStratumPasswordVisibility() {
this.showStratumPassword = !this.showStratumPassword;
}
showFallbackStratumPassword: boolean = false;
toggleFallbackStratumPasswordVisibility() {
this.showFallbackStratumPassword = !this.showFallbackStratumPassword;
}
showWifiPassword: boolean = false;
toggleWifiPasswordVisibility() {
this.showWifiPassword = !this.showWifiPassword;
}
public setDevToolsOpen(supportLevel: number) {
this.supportLevel = supportLevel;
console.log('Advanced Mode:', supportLevel);
const freqBase = this.asicFrequencyValues.map(v => {
let suffix = '';
if (v === this.defaultFrequency) suffix = ' (default)';
if (this.ecoFrequency != null && v === this.ecoFrequency) suffix = ' (eco)';
return { name: `${v}${suffix}`, value: v };
});
const voltBase = this.asicVoltageValues.map(v => {
let suffix = '';
if (v === this.defaultCoreVoltage) suffix = ' (default)';
if (this.ecoCoreVoltage != null && v === this.ecoCoreVoltage) suffix = ' (eco)';
return { name: `${v}${suffix}`, value: v };
});
this.frequencyOptions = this.assembleDropdownOptions(freqBase, this.form.controls['frequency'].value);
this.voltageOptions = this.assembleDropdownOptions(voltBase, this.form.controls['coreVoltage'].value);
this.updatePIDFieldStates();
this.updateFan1FieldStates();
}
public isVoltageTooHigh(): boolean {
if (!this.asicVoltageValues.length) return false;
const maxVoltage = Math.max(...this.asicVoltageValues);
return this.form?.controls['coreVoltage'].value > maxVoltage;
}
public isFrequencyTooHigh(): boolean {
if (!this.asicFrequencyValues.length) return false;
const maxFrequency = Math.max(...this.asicFrequencyValues);
return this.form?.controls['frequency'].value > maxFrequency;
}
public checkVoltageLimit(): void {
this.form.controls['coreVoltage'].updateValueAndValidity({ emitEvent: false });
}
public checkFrequencyLimit(): void {
this.form.controls['frequency'].updateValueAndValidity({ emitEvent: false });
}
/**
* Dynamically assemble dropdown options, including custom values.
* @param predefined The predefined options.
* @param currentValue The current value to include as a custom option if needed.
*/
private assembleDropdownOptions(predefined: { name: string, value: number }[], currentValue: number): { name: string, value: number }[] {
const options = [...predefined];
if (!options.some(option => option.value === currentValue)) {
options.push({
name: `${currentValue} (custom)`,
value: currentValue
});
}
return options;
}
public restart() {
this.otpAuth.ensureOtp$(
this.uri,
this.translate.instant('SECURITY.OTP_TITLE'),
this.translate.instant('SECURITY.OTP_HINT'),
{ disableOtp: true },
)
.pipe(
switchMap(({ totp }: EnsureOtpResult) =>
this.systemService.restart("", totp).pipe(
// drop session on reboot
tap(() => this.otpAuth.clearSession()),
this.loadingService.lockUIUntilComplete()
)
),
catchError((err: HttpErrorResponse) => {
console.log(err);
this.toastrService.danger(this.translate.instant('SYSTEM.RESTART_FAILED'), this.translate.instant('COMMON.ERROR'));
return of(null);
})
)
.subscribe(res => {
if (res !== null) {
this.toastrService.success(this.translate.instant('SYSTEM.RESTART_SUCCESS'), this.translate.instant('COMMON.SUCCESS'));
}
});
}
// Function to check if settings are unsafe
public hasUnsafeSettings(): boolean {
return this.isVoltageTooHigh() || this.isFrequencyTooHigh();
}
// Open warning modal unless user disabled it
public confirmSave(dialog: TemplateRef<any>): void {
if (!this.localStorageService.getBool('hideUnsafeSettingsWarning') && this.hasUnsafeSettings()) {
this.dialogRef = this.dialogService.open(dialog, { closeOnBackdropClick: false });
} else {
this.runSaveWithOptionalOtp();
}
}
// Save preference and close modal
public saveAfterWarning(): void {
if (this.dontShowWarning) {
this.localStorageService.setBool('hideUnsafeSettingsWarning', true);
}
this.dialogRef.close();
this.runSaveWithOptionalOtp();
}
get wrapAroundTime(): number {
const freq = this.form.get('vrFrequency')?.value;
if (!freq || freq <= 0) {
return 0;
}
const wrap = 65536 / freq; // seconds
return wrap;
}
private runSaveWithOptionalOtp(): void {
this.otpAuth.ensureOtp$(
this.uri,
this.translate.instant('SECURITY.OTP_TITLE'),
this.translate.instant('SECURITY.OTP_HINT')
)
.pipe(
switchMap(({ totp }: EnsureOtpResult) =>
this.updateSystem(totp).pipe(this.loadingService.lockUIUntilComplete())
),
)
.subscribe({
next: () => {
this.toastrService.success('Success!', 'Saved.');
},
error: (err: HttpErrorResponse) => {
this.toastrService.danger('Error.', `Could not save. ${err.message}`);
}
});
}
public poolTabHeader(i: 0 | 1) {
const protoKey = i === 0 ? 'stratumProtocol' : 'fallbackStratumProtocol';
const proto = this.form?.get(protoKey)?.value;
const protoLabel = proto === 1 ? ' (SV2)' : ' (SV1)';
if (this.form?.get("poolMode")?.value == 0) {
if (i == 0) {
return this.translate.instant('SETTINGS.PRIMARY_STRATUM_POOL') + protoLabel;
}
return this.translate.instant('SETTINGS.FALLBACK_STRATUM_POOL') + protoLabel;
}
return `Pool ${i + 1}` + protoLabel;
}
public swapPools(): void {
if (!this.form) return;
const a = {
url: 'stratumURL',
port: 'stratumPort',
user: 'stratumUser',
pass: 'stratumPassword',
tls: 'stratumTLS',
en: 'stratumEnonceSubscribe',
};
const b = {
url: 'fallbackStratumURL',
port: 'fallbackStratumPort',
user: 'fallbackStratumUser',
pass: 'fallbackStratumPassword',
tls: 'fallbackStratumTLS',
en: 'fallbackStratumEnonceSubscribe',
};
const get = (k: string) => this.form.get(k)?.value;
const set = (k: string, v: any) => this.form.get(k)?.setValue(v, { emitEvent: false });
// Swap all values
const tmp = {
url: get(a.url),
port: get(a.port),
user: get(a.user),
pass: get(a.pass),
tls: get(a.tls),
en: get(a.en),
};
set(a.url, get(b.url));
set(a.port, get(b.port));
set(a.user, get(b.user));
set(a.pass, get(b.pass));
set(a.tls, get(b.tls));
set(a.en, get(b.en));
set(b.url, tmp.url);
set(b.port, tmp.port);
set(b.user, tmp.user);
set(b.pass, tmp.pass);
set(b.tls, tmp.tls);
set(b.en, tmp.en);
}
}