-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NewsServer Add UI - Default encryption and ports (#225)
- moved `Server.Encryption` between `Server.Host` and `Server.Port`; - made `Server.Encryption` to `ON` by default; - made port depend on `Server.Encryption value unless user has put something up: - 563/443 for secure; - 119/80 for unsecure.
- Loading branch information
Showing
2 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* This file is part of nzbget. See <https://nzbget.com>. | ||
* | ||
* Copyright (C) 2012-2019 Andrey Prygunkov <[email protected]> | ||
* Copyright (C) 2024 Denis <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -1323,10 +1324,66 @@ var Config = (new function($) | |
{ | ||
var optFormId = $(control).parent().attr('id'); | ||
var option = findOptionById(optFormId); | ||
|
||
if (option.onchange) | ||
{ | ||
option.onchange(option); | ||
} | ||
|
||
tlsSwitchHelper(option) | ||
} | ||
} | ||
|
||
function tlsSwitchHelper(option) | ||
{ | ||
var defaultPort = '119'; | ||
var defaultTlsPort = '563'; | ||
|
||
var defaultPort2 = '80'; | ||
var defaultTlsPort2 = '443'; | ||
|
||
var suffixStartIdx = option.formId.indexOf('_Encryption'); | ||
if (suffixStartIdx < 0) | ||
{ | ||
return; | ||
} | ||
|
||
var portOptionId = option.formId.substring(0, suffixStartIdx) + '_Port'; | ||
var portOption = findOptionById(portOptionId); | ||
var useTls = getOptionValue(option) === 'yes'; | ||
var currentPort = getOptionValue(portOption); | ||
var inputField = $('#' + portOptionId)[0]; | ||
|
||
if (useTls) | ||
{ | ||
if (currentPort === defaultPort) | ||
{ | ||
inputField.value = defaultTlsPort; | ||
return; | ||
} | ||
|
||
if (currentPort === defaultPort2) | ||
{ | ||
inputField.value = defaultTlsPort2; | ||
} | ||
|
||
return; | ||
} | ||
|
||
if (!useTls) | ||
{ | ||
if (currentPort === defaultTlsPort) | ||
{ | ||
inputField.value = defaultPort; | ||
return; | ||
} | ||
|
||
if (currentPort === defaultTlsPort2) | ||
{ | ||
inputField.value = defaultPort2; | ||
} | ||
|
||
return; | ||
} | ||
} | ||
|
||
|