luci-app-commands: move URL building to client side

Replace server side dispatcher.build_url() with client side L.url() calls.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2024-07-28 01:14:46 +02:00
parent 385129bd51
commit 0f9c168fa6
1 changed files with 3 additions and 3 deletions

View File

@ -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)
@ -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();
}
@ -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;