Fix anonymous inbound settings

This commit is contained in:
everoddandeven 2025-03-23 11:56:14 +01:00
parent 1787748282
commit 41455d95e2
2 changed files with 28 additions and 35 deletions

View file

@ -1313,23 +1313,16 @@
<div *ngIf="!currentI2pdSettings.enabled" class="row g-3">
<h4 class="mb-3">I2P Anonymous Inbound</h4>
<div class="col-10">
<div class="col-12">
<label for="i2p-anonymous-inbound-address" class="form-label">Inbound Address</label>
<input (input)="onI2pAnonymousInboundChange()" [disabled]="!canEditNodeSettings || currentI2pdSettings.enabled" type="text" class="form-control" id="i2p-anonymous-inbound-address" placeholder="...sxakefmed.i2p" [(ngModel)]="i2pAnonymousInboundAddress" [ngModelOptions]="{standalone: true}">
<small class="text-body-secondary">
Specify inbound hidden service address for receiving incoming I2P connections
</small>
</div>
<div class="col-md-2">
<label for="i2p-anonymous-inbound-port" class="form-label">Inbound port</label>
<input (change)="onI2pAnonymousInboundChange()" [disabled]="!canEditNodeSettings || currentI2pdSettings.enabled" type="number" min="0" class="form-control" id="i2p-anonymous-inbound-port" placeholder="28083" [(ngModel)]="i2pAnonymousInboundPort" [ngModelOptions]="{standalone: true}">
<small class="text-body-secondary">
</small>
</div>
<div class="col-8">
<label for="i2p-anonymous-inbound-forward-ip" class="form-label">Forward Ip</label>
<label for="i2p-anonymous-inbound-forward-ip" class="form-label">Forward IP</label>
<input (input)="onI2pAnonymousInboundChange()" [disabled]="!canEditNodeSettings || currentI2pdSettings.enabled" type="text" class="form-control" id="i2p-anonymous-inbound-forward-ip" placeholder="127.0.0.1" [(ngModel)]="i2pAnonymousInboundForwardIp" [ngModelOptions]="{standalone: true}">
<small class="text-body-secondary">
Forward node ip

View file

@ -464,19 +464,17 @@ export class SettingsComponent extends BasePageComponent implements AfterViewIni
return;
}
const components = i2pProxy.replace(`i2p,`, '').split(',');
const address = components[0];
const port = components[1];
const socks = components[2];
const socksComponent = socks.split(':');
const socksIp = socksComponent[0];
const socksPort = socksComponent[1];
const maxConnections = components[3];
const components = i2pProxy.split(',');
const i2pAddress = components[0];
const inboundAddress = components[1];
const maxConnections = components[2];
const c = inboundAddress.split(':');
const forwardHost = c[0];
const forwardPort = c[1];
this.i2pAnonymousInboundAddress = address;
this.i2pAnonymousInboundPort = parseInt(port);
this.i2pAnonymousInboundForwardIp = socksIp;
this.i2pAnonymousInboundForwardPort = parseInt(socksPort);
this.i2pAnonymousInboundAddress = i2pAddress;
this.i2pAnonymousInboundForwardIp = forwardHost;
this.i2pAnonymousInboundForwardPort = parseInt(forwardPort);
if (maxConnections) {
this.i2pAnonymousInboundMaxConnections = parseInt(maxConnections);
@ -511,9 +509,9 @@ export class SettingsComponent extends BasePageComponent implements AfterViewIni
}
private refreshTorAnonymousInbound(): void {
const torProxy = this._currentSettings.anonymousInbounds.tor;
const anonInbound = this._currentSettings.anonymousInbounds.tor;
if (!DaemonSettings.isValidTorAnonymousInbound(torProxy)) {
if (!DaemonSettings.isValidTorAnonymousInbound(anonInbound)) {
this.torAnonymousInboundAddress = '';
this.torAnonymousInboundPort = 0;
this.torAnonymousInboundForwardIp = '';
@ -522,19 +520,21 @@ export class SettingsComponent extends BasePageComponent implements AfterViewIni
return;
}
const components = torProxy.replace(`tor,`, '').split(',');
const address = components[0];
const port = components[1];
const socks = components[2];
const socksComponent = socks.split(':');
const socksIp = socksComponent[0];
const socksPort = socksComponent[1];
const maxConnections = components[3];
const components = anonInbound.split(',');
const addressAndPort = components[0];
const forwardAddress = components[1];
const maxConnections = components[2];
const c = forwardAddress.split(':');
const forwardHost = c[0];
const forwardPort = c[1];
const v = addressAndPort.split(':');
const onion = v[0];
const onionPort = v[1];
this.torAnonymousInboundAddress = address;
this.torAnonymousInboundPort = parseInt(port);
this.torAnonymousInboundForwardIp = socksIp;
this.torAnonymousInboundForwardPort = parseInt(socksPort);
this.torAnonymousInboundAddress = onion;
this.torAnonymousInboundPort = parseInt(onionPort);
this.torAnonymousInboundForwardIp = forwardHost;
this.torAnonymousInboundForwardPort = parseInt(forwardPort);
if (maxConnections) {
this.torAnonymousInboundMaxConnections = parseInt(maxConnections);