Skip to content

Commit

Permalink
luci-app-commands: move URL building to client side
Browse files Browse the repository at this point in the history
Replace server side dispatcher.build_url() with client side L.url() calls.

Signed-off-by: Jo-Philipp Wich <[email protected]>
  • Loading branch information
jow- committed Jul 27, 2024
1 parent 385129b commit 0f9c168
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions applications/luci-app-commands/ucode/template/commands.ut
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';

stxhr.get('{{ dispatcher.build_url('admin/system/commands/run') }}/' + id + (args ? '?args=' + args : ''), null,
stxhr.get(L.url('admin/system/commands/run', id) + (args ? '?args=' + args : ''), null,
function(x, st)
{
if (st)
Expand Down Expand Up @@ -88,7 +88,7 @@
if (field)
args = encodeURIComponent(field.value);

location.href = '{{ dispatcher.build_url('admin/system/commands/download') }}/' + id + (args ? '/' + args : '');
location.href = L.url('admin/system/commands/download', id) + (args ? '/' + args : '');

ev.preventDefault();
}
Expand All @@ -105,7 +105,7 @@

if (legend && output)
{
var prefix = location.protocol + '//' + location.host + '{{ dispatcher.build_url('command') }}/';
var prefix = location.protocol + '//' + location.host + L.url('command') + '/';
var suffix = (args ? '?args=' + args : '');

var link = prefix + id + suffix;
Expand Down

0 comments on commit 0f9c168

Please sign in to comment.