Skip to content

Commit

Permalink
fix dyndns hostname displayed in UI when behind proxy host
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Hofer committed Mar 19, 2022
1 parent 89fd682 commit 0335d4a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions templates/ddns_token_list.htm
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,15 @@ <h4><tmpl_var name="dyndns_protocol_txt"></h4>
const records = button.data('records').split(',').filter(n => n);
const modal = $(this);
const proxy_host = '<tmpl_var name="PROXY_HOST">'.trim();
let base_url = window.location.protocol + '//' + window.location.hostname;
let url_hostname;
let base_url;
let custom_port = false;
if (proxy_host !== '') {
base_url = 'https://' + proxy_host
url_hostname = proxy_host;
base_url = 'https://' + url_hostname;
} else {
url_hostname = window.location.hostname;
base_url = window.location.protocol + '//' + url_hostname;
if (window.location.port !== '80' && window.location.port !== '443' && window.location.port !== '') {
base_url += ':' + window.location.port;
custom_port = true;
Expand Down Expand Up @@ -319,7 +323,7 @@ <h4><tmpl_var name="dyndns_protocol_txt"></h4>
const hostname = record + '.' + zone.slice(0, -1);
const url_dyndns = base_url + '/nic/update?hostname=' + hostname + '&myip=' + example_data;
modal.find('input#dyndns-url').val(url_dyndns);
modal.find('input#dyndns-server').val(window.location.hostname);
modal.find('input#dyndns-server').val(url_hostname);
modal.find('input#dyndns-auth-pass').val(token);
modal.find('input#dyndns-hostname').val(hostname);
}
Expand Down

0 comments on commit 0335d4a

Please sign in to comment.