Commit 3c96fb54 authored by PidgeyL's avatar PidgeyL
Browse files

output of console in admin pannel

parent 55820613
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import urllib
import random
import signal
import logging
import subprocess
from io import TextIOWrapper
from logging.handlers import RotatingFileHandler

@@ -474,9 +475,14 @@ def admin():
@app.route('/admin/updatedb')
@login_required
def updatedb():
    os.system("python3 " + os.path.join(_runPath, "../sbin/db_updater.py -civ"))
    output = str(subprocess.check_output(["python3", os.path.join(_runPath, "../sbin/db_updater.py"), "-civ"]),'utf-8')
    oList=[x for x in output.split("\r") if not x.startswith("Preparing")]
    output=oList[0]

    #output = os.system("python3 " + os.path.join(_runPath, "../sbin/db_updater.py -civ"))
    status = ["db_updated", "success"]
    return render_template('admin.html', status=status, stats=adminStats())
    return render_template('admin.html', status=status, stats=adminStats(), updateOutput=output)


@app.route('/admin/whitelist/import', methods=['POST'])
@login_required
+1 −5
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
                Logged in succesfully
              {% elif status[0] == 'db_updated' %}
                Database update finished
                <div class=well"><pre>{{updateOutput}}</pre></div>
              {% elif (status[0] == 'wl_imported') or (status[0] == 'bl_imported') %}
                {{ list }} import finished
              {% elif (status[0] == 'wl_already_filled') or (status[0] == 'bl_already_filled') %}
@@ -69,11 +70,6 @@
              {% endif %}
              </div>
          </div>
          <!-- Warning note -->
          <div class="alert alert-warning">
            <span class="glyphicon glyphicon-warning-sign"></span>
            Always verify the result of your administrative tasks in the console!
          </div>
          <div id='stats' class="well well-small">
            <div>
              <span>Database info for database <b>{{stats['dbName']}}</b></span>