summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-commands/luasrc/view
diff options
context:
space:
mode:
authort123yh <t123yh@outlook.com>2016-08-03 18:19:04 +0800
committert123yh <t123yh@outlook.com>2017-01-15 23:13:10 +0800
commit077ac32635dc0048a684ee0a40345a262e661ecc (patch)
tree9e893c582f59cc76da28a99afa4638d76422186d /applications/luci-app-commands/luasrc/view
parent1367f7b624e9ee926cdbd3235a9fec4450c904b5 (diff)
luci-app-commands: Allow executing without downloading on public links
Signed-off-by: t123yh <t123yh@outlook.com>
Diffstat (limited to 'applications/luci-app-commands/luasrc/view')
-rw-r--r--applications/luci-app-commands/luasrc/view/commands.htm15
-rw-r--r--applications/luci-app-commands/luasrc/view/commands_public.htm50
2 files changed, 59 insertions, 6 deletions
diff --git a/applications/luci-app-commands/luasrc/view/commands.htm b/applications/luci-app-commands/luasrc/view/commands.htm
index 73b9e6a2ce..f094e186d4 100644
--- a/applications/luci-app-commands/luasrc/view/commands.htm
+++ b/applications/luci-app-commands/luasrc/view/commands.htm
@@ -108,16 +108,19 @@
if (legend && output)
{
- var link = location.protocol + '//' + location.hostname +
+ var prefix = location.protocol + '//' + location.hostname +
(location.port ? ':' + location.port : '') +
- location.pathname.split(';')[0] + 'command/' +
- id + (args ? '/' + args : '');
-
+ location.pathname.split(';')[0] + 'command/';
+ var suffix = (args ? '/' + args : '');
+
+ var link = prefix + id + suffix;
+ var link_nodownload = prefix + id + "s" + suffix;
+
legend.style.display = 'none';
output.parentNode.style.display = 'block';
output.innerHTML = String.format(
- '<div class="alert-message"><%:Access command with%> <a href="%s">%s</a></div>',
- link, link
+ '<div class="alert-message"><p><%:Download execution result%> <a href="%s">%s</a></p><p><%:Or display result%> <a href="%s">%s</a></p></div>',
+ link, link, link_nodownload, link_nodownload
);
location.hash = '#output';
diff --git a/applications/luci-app-commands/luasrc/view/commands_public.htm b/applications/luci-app-commands/luasrc/view/commands_public.htm
new file mode 100644
index 0000000000..f20799d40f
--- /dev/null
+++ b/applications/luci-app-commands/luasrc/view/commands_public.htm
@@ -0,0 +1,50 @@
+<%#
+ Copyright 2016 t123yh <t123yh@outlook.com>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<% css = [[
+.alert-success {
+ color: #3c763d;
+ background-color: #dff0d8;
+ border-color: #d6e9c6;
+}
+
+.alert {
+ padding: 15px;
+ margin-bottom: 20px;
+ border: 1px solid transparent;
+ border-radius: 4px;
+}
+
+.alert-warning {
+ color: #8a6d3b;
+ background-color: #fcf8e3;
+ border-color: #faebcc;
+}
+]] -%>
+
+<%+header%>
+
+<% if exitcode == 0 then %>
+ <div class="alert alert-success" role="alert"> <%:Command executed successfully.%> </div>
+<% else %>
+ <div class="alert alert-warning" role="alert"> <%:Command exited with status code %> <%= exitcode %> </div>
+<% end %>
+
+<% if stdout ~= "" then %>
+ <h3><%:Standard Output%></h3>
+ <pre><%= stdout %></pre>
+<% end %>
+
+<% if stderr ~= "" then %>
+ <h3><%:Standard Error%></h3>
+ <pre><%= stderr %></pre>
+<% end %>
+
+<script>
+ <%# Display top bar on mobile devices -%>
+ document.getElementsByClassName('brand')[0].style.setProperty("display", "block", "important");
+</script>
+
+<%+footer%> \ No newline at end of file