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: else:
c=cmds[cmd] c=cmds[k]
else:
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,20 +10,19 @@
<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> <a href="{{k}}">{{k}}</a>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
{% if vers == 2 %}
<ul class="list-unstyled"> {% if vers == 2 %}
<ul class="list-unstyled">
{% for k in keys %} {% for k in keys %}
<li> <li>
{% if "cmd" in cmds[k] %} {% if "cmd" in cmds[k] %}
@@ -42,16 +42,17 @@
{% if "subcmds" in cmds[k] %} {% if "subcmds" in cmds[k] %}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if "cmd" in cmds[k] %}
</a> </a>
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% 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> </div>
</div> </div>
</body> </body>

View File

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