fix small errors

This commit is contained in:
root
2017-07-26 02:08:21 +02:00
parent d4f18a504b
commit 2a03b0a359
4 changed files with 55 additions and 48 deletions

View File

@@ -57,13 +57,16 @@ def reload():
return render_index("Commands in cmds.cfg reloaded")
@app.route("/<string:cmd>")
def cm(cmd):
if cmd in keys:
@app.route("/<string:k>")
def cm(k):
if k in keys:
if "vers" in cfg and cfg.vers == 2:
c=cmds[cmd].cmd
if "cmd" in cmds[k] and cmds[k]:
c=cmds[k]["cmd"]
else:
c=cmds[k]
else:
c=cmds[cmd]
c=cmds[k]
return run_cmd(c)
else:
return render_template("index.html", out="Command not found", cmds=cmds, keys=keys, title=cfg.title.decode("utf8"), vers=cfg.vers), 404
return render_index("Command not found", 404)

View File

@@ -1,3 +1,4 @@
<!-- -*- jinja2 -*- -->
<html>
<head>
<title>{{title}}</title>
@@ -9,49 +10,49 @@
<div class="container">
<div class="row">
<div class="col-12">
<h1>{{title}}</h1>
{% if vers == 1 %}
<ul>
{% for k in keys %}
<li>
<h1>{{title}}</h1>
{% if vers == 1 %}
<ul>
{% for k in keys %}
<li>
<a href="{{k}}">{{k}}</a>
</li>
{% endfor %}
</ul>
{% endif %}
<a href="{{k}}">{{k}}</a>
{% if vers == 2 %}
<ul class="list-unstyled">
{% for k in keys %}
<li>
{% if "cmd" in cmds[k] %}
<a href="{{k}}">
{% endif %}
<h5>
{% if "title" in cmds[k] %} {{cmds[k]["title"] }} {% else %} {{k}} {% endif %}
</h5>
{% if "desc" in cmds[k] %}
<p>
{{ cmds[k].desc }}
</p>
{% endif %}
{% if "cmd" in cmds[k] %}
<pre>{{ cmds[k].cmd }}</pre>
{% else %}
{% if "subcmds" in cmds[k] %}
{% endif %}
{% endif %}
{% if "cmd" in cmds[k] %}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% if vers == 2 %}
<ul class="list-unstyled">
{% for k in keys %}
<li>
{% if "cmd" in cmds[k] %}
<a href="{{k}}">
{% endif %}
<h5>
{% if "title" in cmds[k] %} {{cmds[k]["title"] }} {% else %} {{k}} {% endif %}
</h5>
{% if "desc" in cmds[k] %}
<p>
{{ cmds[k].desc }}
</p>
{% endif %}
{% if "cmd" in cmds[k] %}
<pre>{{ cmds[k].cmd }}</pre>
{% else %}
{% if "subcmds" in cmds[k] %}
{% endif %}
{% endif %}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
<div style="white-space: pre-wrap;font:Courier, monospace; font-size:small; width:50em;background:#DDF">{{out.decode('utf-8')}}</div>
<div style="white-space: pre-wrap;font:Courier, monospace; font-size:small; width:50em;background:#DDF">{{out.decode('utf-8')}}</div>
</div>
</div>
</div>
</body>
</div>
</body>