diff --git a/app/commands.py b/app/commands.py index 01cfc24..0f3ed7e 100644 --- a/app/commands.py +++ b/app/commands.py @@ -50,7 +50,7 @@ def init_accounts(): @click.argument('player') @with_appcontext def load_property(zone, player): - + """shoves property data into db""" char = CharacterInfo.query.filter(CharacterInfo.name == player).first() if not char: print("Character not Found") @@ -97,6 +97,7 @@ def load_property(zone, player): @click.command("gen_image_cache") def gen_image_cache(): + """generates image cache""" luclient = pathlib.Path('app/luclient/res') files = [path for path in luclient.rglob("*.dds") if path.is_file()] @@ -114,6 +115,7 @@ def gen_image_cache(): @click.command("gen_model_cache") def gen_model_cache(): + """generate model obj cache""" luclient = pathlib.Path('app/luclient/res') files = [path for path in luclient.rglob("*.lxfml") if path.is_file()] pool = Pool(processes=4) @@ -135,6 +137,7 @@ def convert_lxfml_to_obj(file, lod): return def get_cache_file(path): + """helper""" # convert to list so that we can change elements parts = list(path.parts) diff --git a/app/log.py b/app/log.py index 5fb5ce8..16397fd 100644 --- a/app/log.py +++ b/app/log.py @@ -21,12 +21,12 @@ def command(): return render_template('logs/command.html.j2') -@log_blueprint.route('/errors') +@log_blueprint.route('/system') @gm_level(8) -def error(): +def system(): with open('nexus_dashboard.log', 'r') as file: logs = '
'.join(file.read().split('\n')[-100:]) - return render_template('logs/error.html.j2', logs=logs) + return render_template('logs/system.html.j2', logs=logs) @log_blueprint.route('/audits') diff --git a/app/moderation.py b/app/moderation.py index 1471ba5..38b66ba 100644 --- a/app/moderation.py +++ b/app/moderation.py @@ -1,4 +1,4 @@ -from flask import render_template, Blueprint, redirect, url_for, request, abort, flash, current_app +from flask import render_template, Blueprint, redirect, url_for, request, flash, current_app from flask_user import login_required from app.models import PetNames, db, CharacterXML, CharacterInfo from datatables import ColumnDT, DataTables @@ -126,7 +126,7 @@ def get_pets(status="all"): return data -@scheduler.task("cron", id="pet_name_maintenance", second="*", timezone="UTC") +@scheduler.task("cron", id="pet_name_maintenance", hour="*", timezone="UTC") def pet_name_maintenance(): with scheduler.app.app_context(): # associate pet names to characters diff --git a/app/reports.py b/app/reports.py index 4b3921e..bb7a332 100644 --- a/app/reports.py +++ b/app/reports.py @@ -60,17 +60,21 @@ def gen_item_report(): report_data={} for char_xml in char_xmls: - character_json = xmltodict.parse( - char_xml.xml_data, - attr_prefix="attr_" - ) - for inv in character_json["obj"]["inv"]["items"]["in"]: - if "i" in inv.keys() and type(inv["i"]) == list and (int(inv["attr_t"])==0 or int(inv["attr_t"])==0): - for item in inv["i"]: - if item["attr_l"] in report_data: - report_data[item["attr_l"]] = report_data[item["attr_l"]] + int(item["attr_c"]) - else: - report_data[item["attr_l"]] = int(item["attr_c"]) + try: + character_json = xmltodict.parse( + char_xml.xml_data, + attr_prefix="attr_" + ) + for inv in character_json["obj"]["inv"]["items"]["in"]: + if "i" in inv.keys() and type(inv["i"]) == list and (int(inv["attr_t"])==0 or int(inv["attr_t"])==0): + for item in inv["i"]: + if item["attr_l"] in report_data: + report_data[item["attr_l"]] = report_data[item["attr_l"]] + int(item["attr_c"]) + else: + report_data[item["attr_l"]] = int(item["attr_c"]) + except Exception as e: + current_app.logger.error(f"REPORT::ITEMS - ERROR PARSING CHARACTER {char_xml.id}") + current_app.logger.error(f"REPORT::ITEMS - {e}") new_report = Reports( data=report_data, @@ -110,11 +114,15 @@ def gen_currency_report(): report_data={} for character in characters: - character_json = xmltodict.parse( - character.xml_data, - attr_prefix="attr_" - ) - report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_cc"]) + try: + character_json = xmltodict.parse( + character.xml_data, + attr_prefix="attr_" + ) + report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_cc"]) + except Exception as e: + current_app.logger.error(f"REPORT::CURRENCY - ERROR PARSING CHARACTER {char_xml.id}") + current_app.logger.error(f"REPORT::CURRENCY - {e}") new_report = Reports( data=report_data, @@ -154,11 +162,15 @@ def gen_uscore_report(): report_data={} for character in characters: - character_json = xmltodict.parse( - character.xml_data, - attr_prefix="attr_" - ) - report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_ls"]) + try: + character_json = xmltodict.parse( + character.xml_data, + attr_prefix="attr_" + ) + report_data[CharacterInfo.query.filter(CharacterInfo.id==character.id).first().name] = int(character_json["obj"]["char"]["attr_ls"]) + except Exception as e: + current_app.logger.error(f"REPORT::U-SCORE - ERROR PARSING CHARACTER {char_xml.id}") + current_app.logger.error(f"REPORT::U-SCORE - {e}") new_report = Reports( data=report_data, diff --git a/app/settings.py b/app/settings.py index 8e4a66a..6be74f0 100644 --- a/app/settings.py +++ b/app/settings.py @@ -25,7 +25,7 @@ USER_REQUIRE_RETYPE_PASSWORD = True # Prompt for `retype password` USER_ENABLE_USERNAME = True # Register and Login with username # Email Related Settings -USER_ENABLE_EMAIL = True # Register with Email WILL - DISABLE OTHER THINGS TOO +USER_ENABLE_EMAIL = False # Register with Email WILL - DISABLE OTHER THINGS TOO USER_ENABLE_CONFIRM_EMAIL = True # Force users to confirm their email USER_ENABLE_INVITE_USER = False # Allow users to be invited USER_REQUIRE_INVITATION = False # Only invited users may - WILL DISABLE REGISTRATION diff --git a/app/templates/header.html.j2 b/app/templates/header.html.j2 index 0e35694..2264f82 100644 --- a/app/templates/header.html.j2 +++ b/app/templates/header.html.j2 @@ -69,14 +69,12 @@ Command Log Activity Log Audit Log - Error Log + System Log {% endif %} {% endif %} - - {% if current_user.is_authenticated and current_user.gm_level == 9 and config.REQUIRE_PLAY_KEY %} {# Play Keys #} Play Keys diff --git a/app/templates/logs/error.html.j2 b/app/templates/logs/system.html.j2 similarity index 100% rename from app/templates/logs/error.html.j2 rename to app/templates/logs/system.html.j2