Skip to content

Support advanced connection options in web gui #450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions web/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,11 @@ <h4 class="modal-title" id="myModalLabel">Connect to remote node...</h4>
</div>
</div>
</form>
<span
id="connectURLPreview"
<input
id="connectURLInput"
class="text-muted"
style="float: left; position: relative; bottom: 5px"
style="border: none; width: 80%; float: left; position: relative; bottom: 5px"
>
</span>
<span
id="qsyWarning"
class="text-danger"
Expand Down
2 changes: 1 addition & 1 deletion web/dist/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/js/app.js.map

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions web/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,11 @@ <h4 class="modal-title" id="myModalLabel">Connect to remote node...</h4>
</div>
</div>
</form>
<span
id="connectURLPreview"
<input
id="connectURLInput"
class="text-muted"
style="float: left; position: relative; bottom: 5px"
style="border: none; width: 80%; float: left; position: relative; bottom: 5px"
>
</span>
<span
id="qsyWarning"
class="text-danger"
Expand Down
41 changes: 27 additions & 14 deletions web/src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ function initConnectModal() {
$('#radioOnlyInput').change(onConnectInputChange);
$('#addrInput').change(onConnectInputChange);
$('#targetInput').change(onConnectInputChange);
$('#connectURLInput').change((e) => {
setConnectValues($(e.target).val())
});
$('#updateRmslistButton').click((e) => {
$(e.target).prop('disabled', true);
updateRmslist(true);
Expand Down Expand Up @@ -580,29 +583,39 @@ function setConnectValues(url) {
refreshExtraInputGroups();
onConnectInputChange();
onConnectFreqChange();
setConnectURL(url);
}

function getConnectURL() {
let url =
$('#transportSelect').val() + '://' + $('#addrInput').val() + '/' + $('#targetInput').val();
function getConnectURL() { return $('#connectURLInput').val(); }

let params = '';
function setConnectURL(url) { $('#connectURLInput').val(url); }

function buildConnectURL() {
// Instead of building from scratch, we use the current URL as a starting
// point to retain URI parts not supported by the modal. The unsupported
// parts may originate from a connect alias or by manual edit of the URL
// field.
var current = getConnectURL()
let url = URI(current)
.protocol($('#transportSelect').val())
.hostname($('#addrInput').val())
.path($('#targetInput').val());
if ($('#freqInput').val() && $('#freqInput').parent().hasClass('has-success')) {
params += '&freq=' + $('#freqInput').val();
url = url.setQuery("freq", $('#freqInput').val());
} else {
url = url.removeQuery("freq");
}
if ($('#bandwidthInput').val()) {
params += '&bw=' + $('#bandwidthInput').val();
url = url.setQuery("bw", $('#bandwidthInput').val());
} else {
url = url.removeQuery("bw");
}
if ($('#radioOnlyInput').is(':checked')) {
params += '&radio_only=true';
}

if (params) {
url += params.replace('&', '?');
url = url.setQuery("radio_only", "true");
} else {
url = url.removeQuery("radio_only");
}

return url;
return url.build();
}

function onConnectFreqChange() {
Expand Down Expand Up @@ -678,7 +691,7 @@ function onConnectBandwidthChange() {
}

function onConnectInputChange() {
$('#connectURLPreview').empty().append(getConnectURL());
setConnectURL(buildConnectURL());
}

function refreshExtraInputGroups() {
Expand Down
Loading