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

2
.gitignore vendored
View File

@@ -3,4 +3,6 @@
*.pyc *.pyc
*.cfg *.cfg
*.bak *.bak
*.log
env/* env/*
bin/*

View File

@@ -57,13 +57,16 @@ def reload():
return render_index("Commands in cmds.cfg reloaded") return render_index("Commands in cmds.cfg reloaded")
@app.route("/<string:cmd>") @app.route("/<string:k>")
def cm(cmd): def cm(k):
if cmd in keys: if k in keys:
if "vers" in cfg and cfg.vers == 2: 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: else:
c=cmds[cmd] c=cmds[k]
return run_cmd(c) return run_cmd(c)
else: 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> <html>
<head> <head>
<title>{{title}}</title> <title>{{title}}</title>
@@ -9,49 +10,49 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h1>{{title}}</h1> <h1>{{title}}</h1>
{% if vers == 1 %} {% if vers == 1 %}
<ul> <ul>
{% for k in keys %} {% for k in keys %}
<li> <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> <div style="white-space: pre-wrap;font:Courier, monospace; font-size:small; width:50em;background:#DDF">{{out.decode('utf-8')}}</div>
{% 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> </div>
</div> </div>
</div> </div>
</body> </body>

View File

@@ -1,3 +1,4 @@
flask flask
config config
uwsgi uwsgi
PyYAML