Skip to content

Commit

Permalink
update modal text, parameters, section visibility for TXT tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Hofer committed Apr 16, 2023
1 parent 3732638 commit a99bf88
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/lang/de_ddns_token_list.lng
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $wb["limit_records_txt"] = 'Subdomain-Limit';
$wb["active_txt"] = 'Aktiv';
$wb["token_urls_title_txt"] = 'Token URLs für dynamische DNS Aktualisierungen';
$wb["token_urls_simple_mode_txt"] = 'Einfacher Modus';
$wb["simple_mode_unavailable_txt"] = 'Für den einfachen Modus muss das Token auf genau eine Zone und maximal eine Subdomain limitiert sein';
$wb["simple_mode_unavailable_txt"] = 'Für den einfachen Modus muss das Token auf genau eine Zone und maximal einen A/AAAA Eintrag limitiert sein';
$wb["token_url_simple_warning_title_txt"] = 'Warnung!';
$wb["token_url_simple_warning_txt"] = 'Dies ändert den primären DNS Eintrag';
$wb["token_urls_advanced_mode_txt"] = 'Standard Update URL';
Expand All @@ -18,6 +18,7 @@ $wb["username_txt"] = 'Benutzername';
$wb["password_txt"] = 'Passwort';
$wb["url_parameter_description_txt"] = 'URL parameter Beschreibung';
$wb["optional_txt"] = '(optional)';
$wb["url_parameter_action_txt"] = 'add/update/delete, für TXT Einträge wird update nicht unterstützt';
$wb["url_parameter_zone_txt"] = 'Die DNS Zone zum aktualisieren';
$wb["url_parameter_record_txt"] = 'Der DNS Eintrag zum aktualisieren';
$wb["url_parameter_type_txt"] = 'Der DNS Eintragstyp zum aktualisieren (A or AAAA)';
Expand Down
3 changes: 2 additions & 1 deletion lib/lang/en_ddns_token_list.lng
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $wb["limit_records_txt"] = 'Limit records';
$wb["active_txt"] = 'Active';
$wb["token_urls_title_txt"] = 'Token URLs for dynamic DNS updates';
$wb["token_urls_simple_mode_txt"] = 'Simple mode';
$wb["simple_mode_unavailable_txt"] = 'Simple mode requires the token to be restricted to a single zone and at most one record';
$wb["simple_mode_unavailable_txt"] = 'Simple mode requires the token to be restricted to a single zone and at most one A/AAAA record';
$wb["token_url_simple_warning_title_txt"] = 'Warning!';
$wb["token_url_simple_warning_txt"] = 'This will update the zones main record';
$wb["token_urls_advanced_mode_txt"] = 'Standard update URL';
Expand All @@ -18,6 +18,7 @@ $wb["username_txt"] = 'Username';
$wb["password_txt"] = 'Password';
$wb["url_parameter_description_txt"] = 'URL parameter description';
$wb["optional_txt"] = '(optional)';
$wb["url_parameter_action_txt"] = 'add/update/delete. For TXT records, update is not supported';
$wb["url_parameter_zone_txt"] = 'The DNS Zone to update';
$wb["url_parameter_record_txt"] = 'The Record to update';
$wb["url_parameter_type_txt"] = 'The Record type to update (A or AAAA)';
Expand Down
18 changes: 15 additions & 3 deletions templates/ddns_token_list.htm
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ <h4><tmpl_var name="token_urls_advanced_mode_txt"></h4>
</div>
<strong><tmpl_var name="url_parameter_description_txt">:</strong>
<dl class="dl-horizontal">
<dt id="action-key">action</dt>
<dd id="action-text"><tmpl_var name="url_parameter_action_txt"></dd>
<dt>zone</dt>
<dd><span id="zone-optional"><tmpl_var name="optional_txt"> </span><tmpl_var name="url_parameter_zone_txt"></dd>
<dt>record</dt>
Expand Down Expand Up @@ -277,7 +279,7 @@ <h4><tmpl_var name="dyndns_protocol_txt"></h4>
}
}
let script_url = base_url + '/ddns/update.php';
if (zones.length === 1 && records.length <= 1 && (types.indexOf('A') !== -1 || types.indexOf('AAAA') !== -1)) {
if (zones.length === 1 && records.length <= 1 && types.indexOf('TXT') !== -1) {
const url_simple = script_url + '?token=' + token;
modal.find('input#token-url-simple').val(url_simple);
if (records.length === 0) {
Expand All @@ -292,10 +294,17 @@ <h4><tmpl_var name="dyndns_protocol_txt"></h4>
const zone = zones.length === 0 ? 'example.com.' : zones[0];
const record = records.length === 0 ? 'hostname' : records[0];
let example_data = '<tmpl_var name="url_ip_placeholder_txt">';
if(types.indexOf('A') === -1 && types.indexOf('AAAA') === -1) {
let url_action_param = '';
if (types.indexOf('TXT') !== -1) {
url_action_param = 'action=add&';
example_data = 'XY';
modal.find('#action-key').show();
modal.find('#action-text').show();
} else {
modal.find('#action-key').hide();
modal.find('#action-text').hide();
}
const url_advanced = script_url + '?zone=' + zone + '&type=' + types[0] + '&record=' + record + '&data=' + example_data + '&token=' + token;
const url_advanced = script_url + '?' + url_action_param + 'zone=' + zone + '&type=' + types[0] + '&record=' + record + '&data=' + example_data + '&token=' + token;
// set standard url parameters
modal.find('input#token-url-advanced').val(url_advanced);
modal.find('input#token-auth-pass').val(token);
Expand All @@ -318,6 +327,9 @@ <h4><tmpl_var name="dyndns_protocol_txt"></h4>
if (custom_port) {
// hide dyndns mode on non-default ports
modal.find('div#dyndns-mode').hide();
} else if (types.indexOf('A') === -1 && types.indexOf('AAAA') === -1) {
// hide dyndns mode for non A/AAAA tokens
modal.find('div#dyndns-mode').hide();
} else {
modal.find('div#dyndns-mode').show();
const hostname = record + '.' + zone.slice(0, -1);
Expand Down

0 comments on commit a99bf88

Please sign in to comment.