Skip to content

Commit 6acba27

Browse files
committed
fix(connect): clear wanport upon disabling remote access
Resolve #1615 -- lingering wanport caused issue with LAN Access via Connect, because those URL's are constructed using `wanport`, but since WAN access would be disabled, NGINX would not listen on the port.
1 parent b2e7801 commit 6acba27

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

packages/unraid-api-plugin-connect/src/unraid-connect/connect-settings.service.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,28 @@ export class ConnectSettingsService {
216216
input.forwardType
217217
);
218218

219-
this.configService.set('connect.config.wanaccess', input.accessType === WAN_ACCESS_TYPE.ALWAYS);
220-
if (input.forwardType === WAN_FORWARD_TYPE.STATIC) {
221-
this.configService.set('connect.config.wanport', input.port);
222-
// when forwarding with upnp, the upnp service will clear & set the wanport as necessary
223-
}
219+
// Currently, Dynamic Remote Access (WAN_ACCESS_TYPE.DYNAMIC) is not enabled,
220+
// so we treat it as disabled for this condition.
221+
const wanaccessEnabled = input.accessType === WAN_ACCESS_TYPE.ALWAYS;
222+
224223
this.configService.set(
225224
'connect.config.upnpEnabled',
226-
input.forwardType === WAN_FORWARD_TYPE.UPNP
225+
wanaccessEnabled && input.forwardType === WAN_FORWARD_TYPE.UPNP
227226
);
228227

228+
if (wanaccessEnabled && input.forwardType === WAN_FORWARD_TYPE.STATIC) {
229+
this.configService.set('connect.config.wanport', input.port);
230+
// when forwarding with upnp, the upnp service will clear & set the wanport as necessary
231+
}
232+
233+
this.configService.set('connect.config.wanaccess', wanaccessEnabled);
234+
// do the wanaccess port-override last; it should have the highest precedence
235+
if (!wanaccessEnabled) {
236+
this.configService.set('connect.config.wanport', null);
237+
}
238+
229239
// Use the dynamic remote access service to handle the transition
240+
// currently disabled; this call ensures correct migration behavior.
230241
await this.remoteAccess.enableDynamicRemoteAccess({
231242
type: dynamicRemoteAccessType,
232243
allowedUrl: {
@@ -238,7 +249,6 @@ export class ConnectSettingsService {
238249
});
239250

240251
await this.networkService.reloadNetworkStack();
241-
242252
return true;
243253
}
244254

0 commit comments

Comments
 (0)