mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'tweak/fix-imports' into 'dev'
Tidy imports & dep auto-installer See merge request crafty-controller/crafty-commander!199
This commit is contained in:
commit
4cc617fd0d
@ -1,6 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from app.classes.models.crafty_permissions import crafty_permissions, Enum_Permissions_Crafty
|
from app.classes.models.crafty_permissions import crafty_permissions, Enum_Permissions_Crafty
|
||||||
from app.classes.models.users import ApiKeys
|
from app.classes.models.users import ApiKeys
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -3,7 +3,6 @@ import logging
|
|||||||
from app.classes.models.roles import roles_helper
|
from app.classes.models.roles import roles_helper
|
||||||
from app.classes.models.server_permissions import server_permissions
|
from app.classes.models.server_permissions import server_permissions
|
||||||
from app.classes.models.users import users_helper
|
from app.classes.models.users import users_helper
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -4,7 +4,6 @@ from app.classes.models.server_permissions import server_permissions, Enum_Perm
|
|||||||
from app.classes.models.users import users_helper, ApiKeys
|
from app.classes.models.users import users_helper, ApiKeys
|
||||||
from app.classes.models.roles import roles_helper
|
from app.classes.models.roles import roles_helper
|
||||||
from app.classes.models.servers import servers_helper
|
from app.classes.models.servers import servers_helper
|
||||||
|
|
||||||
from app.classes.shared.main_models import db_helper
|
from app.classes.shared.main_models import db_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -2,15 +2,13 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from app.classes.controllers.roles_controller import Roles_Controller
|
||||||
from app.classes.models.servers import servers_helper
|
from app.classes.models.servers import servers_helper
|
||||||
from app.classes.models.users import users_helper, ApiKeys
|
from app.classes.models.users import users_helper, ApiKeys
|
||||||
from app.classes.models.server_permissions import server_permissions, Enum_Permissions_Server
|
from app.classes.models.server_permissions import server_permissions, Enum_Permissions_Server
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.main_models import db_helper
|
from app.classes.shared.main_models import db_helper
|
||||||
|
|
||||||
from app.classes.controllers.roles_controller import Roles_Controller
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Servers_Controller:
|
class Servers_Controller:
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
from app.classes.shared.authentication import authentication
|
|
||||||
|
|
||||||
from app.classes.models.users import users_helper
|
from app.classes.models.users import users_helper
|
||||||
from app.classes.models.crafty_permissions import crafty_permissions, Enum_Permissions_Crafty
|
from app.classes.models.crafty_permissions import crafty_permissions, Enum_Permissions_Crafty
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
from app.classes.shared.authentication import authentication
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -8,12 +8,11 @@ import logging.config
|
|||||||
import uuid
|
import uuid
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.minecraft.bedrock_ping import BedrockPing
|
from app.classes.minecraft.bedrock_ping import BedrockPing
|
||||||
|
from app.classes.shared.console import console
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Server:
|
class Server:
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.description = data.get('description')
|
self.description = data.get('description')
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import sys
|
|
||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
@ -6,11 +5,10 @@ import shutil
|
|||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.controllers.servers_controller import Servers_Controller
|
from app.classes.controllers.servers_controller import Servers_Controller
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
|
||||||
from app.classes.models.server_permissions import server_permissions
|
from app.classes.models.server_permissions import server_permissions
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -18,10 +16,7 @@ try:
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
except ModuleNotFoundError as err:
|
except ModuleNotFoundError as err:
|
||||||
logger.critical(f"Import Error: Unable to load {err.name} module", exc_info=True)
|
helper.auto_installer_fix(err)
|
||||||
console.critical(f"Import Error: Unable to load {err.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
class ServerJars:
|
class ServerJars:
|
||||||
|
|
||||||
|
@ -4,15 +4,13 @@ import datetime
|
|||||||
import base64
|
import base64
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
from app.classes.models.management import Host_Stats
|
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
from app.classes.models.servers import servers_helper
|
|
||||||
from app.classes.minecraft.mc_ping import ping
|
from app.classes.minecraft.mc_ping import ping
|
||||||
|
from app.classes.models.management import Host_Stats
|
||||||
|
from app.classes.models.servers import servers_helper
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Stats:
|
class Stats:
|
||||||
|
|
||||||
def __init__(self, controller):
|
def __init__(self, controller):
|
||||||
|
@ -1,26 +1,20 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.permission_helper import permission_helper
|
from app.classes.shared.permission_helper import permission_helper
|
||||||
|
|
||||||
from app.classes.models.users import Users, ApiKeys
|
from app.classes.models.users import Users, ApiKeys
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, IntegerField, DoesNotExist
|
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, IntegerField, DoesNotExist
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
@ -1,31 +1,24 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.main_models import db_helper
|
|
||||||
|
|
||||||
from app.classes.models.users import Users, users_helper
|
from app.classes.models.users import Users, users_helper
|
||||||
from app.classes.models.servers import Servers
|
from app.classes.models.servers import Servers
|
||||||
from app.classes.models.server_permissions import server_permissions
|
from app.classes.models.server_permissions import server_permissions
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
from app.classes.shared.main_models import db_helper
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, IntegerField, DateTimeField, FloatField, TextField, AutoField, BooleanField
|
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, IntegerField, DateTimeField, FloatField, TextField, AutoField, BooleanField
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
@ -1,24 +1,19 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from peewee import SqliteDatabase, Model, CharField, DoesNotExist, AutoField, DateTimeField
|
from peewee import SqliteDatabase, Model, CharField, DoesNotExist, AutoField, DateTimeField
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
@ -1,33 +1,25 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.permission_helper import permission_helper
|
|
||||||
|
|
||||||
from app.classes.models.servers import Servers
|
from app.classes.models.servers import Servers
|
||||||
from app.classes.models.roles import Roles
|
from app.classes.models.roles import Roles
|
||||||
from app.classes.models.users import User_Roles, users_helper, ApiKeys, Users
|
from app.classes.models.users import User_Roles, users_helper, ApiKeys, Users
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
from app.classes.shared.permission_helper import permission_helper
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, CompositeKey, JOIN
|
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, CompositeKey, JOIN
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
|
||||||
#************************************************************************************************
|
#************************************************************************************************
|
||||||
# Role Servers Class
|
# Role Servers Class
|
||||||
#************************************************************************************************
|
#************************************************************************************************
|
||||||
|
@ -1,24 +1,19 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.main_models import db_helper
|
from app.classes.shared.main_models import db_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, AutoField, DateTimeField, BooleanField, IntegerField, FloatField
|
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, AutoField, DateTimeField, BooleanField, IntegerField, FloatField
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
@ -1,27 +1,21 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
from app.classes.shared.console import console
|
|
||||||
|
|
||||||
from app.classes.models.roles import Roles, roles_helper
|
from app.classes.models.roles import Roles, roles_helper
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, AutoField, DateTimeField, BooleanField, CompositeKey, DoesNotExist, JOIN
|
from peewee import SqliteDatabase, Model, ForeignKeyField, CharField, AutoField, DateTimeField, BooleanField, CompositeKey, DoesNotExist, JOIN
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
@ -2,14 +2,17 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from typing import Optional, Dict, Any, Tuple
|
from typing import Optional, Dict, Any, Tuple
|
||||||
|
|
||||||
import jwt
|
|
||||||
from jwt import PyJWTError
|
|
||||||
|
|
||||||
from app.classes.models.users import users_helper, ApiKeys
|
from app.classes.models.users import users_helper, ApiKeys
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
try:
|
||||||
|
import jwt
|
||||||
|
from jwt import PyJWTError
|
||||||
|
|
||||||
|
except ModuleNotFoundError as e:
|
||||||
|
helper.auto_installer_fix(e)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Authentication:
|
class Authentication:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -6,10 +6,10 @@ import logging
|
|||||||
|
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class MainPrompt(cmd.Cmd):
|
class MainPrompt(cmd.Cmd):
|
||||||
|
|
||||||
def __init__(self, tasks_manager, migration_manager):
|
def __init__(self, tasks_manager, migration_manager):
|
||||||
|
@ -2,18 +2,16 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from colorama import init
|
from colorama import init
|
||||||
from termcolor import colored
|
from termcolor import colored
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
print(f"Import Error: Unable to load {e.name} module")
|
|
||||||
from app.classes.shared.installer import installer
|
logger = logging.getLogger(__name__)
|
||||||
installer.do_install()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
class Console:
|
class Console:
|
||||||
|
|
||||||
|
@ -1,21 +1,11 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import pathlib
|
import pathlib
|
||||||
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
from app.classes.shared.console import console
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
try:
|
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
|
||||||
|
|
||||||
except ModuleNotFoundError as err:
|
|
||||||
logger.critical(f"Import Error: Unable to load {err.name} module", exc_info=True)
|
|
||||||
console.critical(f"Import Error: Unable to load {err.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
class FileHelpers:
|
class FileHelpers:
|
||||||
allowed_quotes = [
|
allowed_quotes = [
|
||||||
"\"",
|
"\"",
|
||||||
|
@ -18,23 +18,23 @@ from datetime import datetime
|
|||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
import psutil
|
import psutil
|
||||||
from requests import get
|
|
||||||
|
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
|
from app.classes.shared.installer import installer
|
||||||
from app.classes.shared.file_helpers import file_helper
|
from app.classes.shared.file_helpers import file_helper
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
logger = logging.getLogger(__name__)
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
|
from requests import get
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
from argon2 import PasswordHasher
|
from argon2 import PasswordHasher
|
||||||
|
|
||||||
except ModuleNotFoundError as err:
|
except ModuleNotFoundError as err:
|
||||||
logger.critical(f"Import Error: Unable to load {err.name} module", exc_info=True)
|
helper.auto_installer_fix(err)
|
||||||
console.critical(f"Import Error: Unable to load {err.name} module")
|
|
||||||
sys.exit(1)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Helpers:
|
class Helpers:
|
||||||
allowed_quotes = [
|
allowed_quotes = [
|
||||||
@ -61,6 +61,12 @@ class Helpers:
|
|||||||
self.passhasher = PasswordHasher()
|
self.passhasher = PasswordHasher()
|
||||||
self.exiting = False
|
self.exiting = False
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def auto_installer_fix(ex):
|
||||||
|
logger.critical(f"Import Error: Unable to load {ex.name} module", exc_info=True)
|
||||||
|
print(f"Import Error: Unable to load {ex.name} module")
|
||||||
|
installer.do_install()
|
||||||
|
|
||||||
def float_to_string(self, gbs: int):
|
def float_to_string(self, gbs: int):
|
||||||
s = str(float(gbs) * 1000).rstrip("0").rstrip(".")
|
s = str(float(gbs) * 1000).rstrip("0").rstrip(".")
|
||||||
return s
|
return s
|
||||||
|
@ -6,7 +6,6 @@ import time
|
|||||||
import logging
|
import logging
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from peewee import DoesNotExist
|
|
||||||
|
|
||||||
from app.classes.controllers.crafty_perms_controller import Crafty_Perms_Controller
|
from app.classes.controllers.crafty_perms_controller import Crafty_Perms_Controller
|
||||||
from app.classes.controllers.management_controller import Management_Controller
|
from app.classes.controllers.management_controller import Management_Controller
|
||||||
@ -14,23 +13,25 @@ from app.classes.controllers.users_controller import Users_Controller
|
|||||||
from app.classes.controllers.roles_controller import Roles_Controller
|
from app.classes.controllers.roles_controller import Roles_Controller
|
||||||
from app.classes.controllers.server_perms_controller import Server_Perms_Controller
|
from app.classes.controllers.server_perms_controller import Server_Perms_Controller
|
||||||
from app.classes.controllers.servers_controller import Servers_Controller
|
from app.classes.controllers.servers_controller import Servers_Controller
|
||||||
|
|
||||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||||
from app.classes.models.users import helper_users
|
from app.classes.models.users import helper_users
|
||||||
from app.classes.models.management import helpers_management
|
from app.classes.models.management import helpers_management
|
||||||
from app.classes.models.servers import servers_helper
|
from app.classes.models.servers import servers_helper
|
||||||
|
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.server import Server
|
from app.classes.shared.server import Server
|
||||||
from app.classes.shared.file_helpers import file_helper
|
from app.classes.shared.file_helpers import file_helper
|
||||||
|
|
||||||
from app.classes.minecraft.server_props import ServerProps
|
from app.classes.minecraft.server_props import ServerProps
|
||||||
from app.classes.minecraft.serverjars import server_jar_obj
|
from app.classes.minecraft.serverjars import server_jar_obj
|
||||||
from app.classes.minecraft.stats import Stats
|
from app.classes.minecraft.stats import Stats
|
||||||
|
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
|
try:
|
||||||
|
from peewee import DoesNotExist
|
||||||
|
|
||||||
|
except ModuleNotFoundError as err:
|
||||||
|
helper.auto_installer_fix(err)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Controller:
|
class Controller:
|
||||||
|
@ -1,30 +1,25 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from app.classes.models.users import Users, users_helper
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
|
|
||||||
from app.classes.models.users import Users, users_helper
|
|
||||||
|
|
||||||
# To disable warning about unused import ; Users is imported from here in other places
|
# To disable warning about unused import ; Users is imported from here in other places
|
||||||
#pylint: disable=self-assigning-variable
|
# pylint: disable=self-assigning-variable
|
||||||
Users = Users
|
Users = Users
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
peewee_logger = logging.getLogger('peewee')
|
|
||||||
peewee_logger.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
from peewee import SqliteDatabase, fn
|
from peewee import SqliteDatabase, fn
|
||||||
from playhouse.shortcuts import model_to_dict
|
from playhouse.shortcuts import model_to_dict
|
||||||
|
|
||||||
except ModuleNotFoundError as err:
|
except ModuleNotFoundError as err:
|
||||||
logger.critical(f"Import Error: Unable to load {err.name} module", exc_info=True)
|
helper.auto_installer_fix(err)
|
||||||
console.critical(f"Import Error: Unable to load {err.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
database = SqliteDatabase(helper.db_path, pragmas={
|
logger = logging.getLogger(__name__)
|
||||||
|
peewee_logger = logging.getLogger('peewee')
|
||||||
|
peewee_logger.setLevel(logging.INFO)
|
||||||
|
database = SqliteDatabase(helper.db_path, pragmas = {
|
||||||
'journal_mode': 'wal',
|
'journal_mode': 'wal',
|
||||||
'cache_size': -1024 * 10})
|
'cache_size': -1024 * 10})
|
||||||
|
|
||||||
|
@ -6,14 +6,11 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import peewee
|
import peewee
|
||||||
from playhouse.migrate import (
|
from playhouse.migrate import (
|
||||||
@ -23,10 +20,9 @@ try:
|
|||||||
)
|
)
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical("Import Error: Unable to load {} module".format(
|
helper.auto_installer_fix(e)
|
||||||
e.name), exc_info=True)
|
|
||||||
console.critical("Import Error: Unable to load {} module".format(e.name))
|
logger = logging.getLogger(__name__)
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
MIGRATE_TABLE = 'migratehistory'
|
MIGRATE_TABLE = 'migratehistory'
|
||||||
MIGRATE_TEMPLATE = '''# Generated by database migrator
|
MIGRATE_TEMPLATE = '''# Generated by database migrator
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import datetime
|
import datetime
|
||||||
@ -9,35 +8,29 @@ import logging.config
|
|||||||
import subprocess
|
import subprocess
|
||||||
import html
|
import html
|
||||||
import tempfile
|
import tempfile
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
|
||||||
#TZLocal is set as a hidden import on win pipeline
|
|
||||||
from tzlocal import get_localzone
|
|
||||||
|
|
||||||
|
from app.classes.minecraft.stats import Stats
|
||||||
|
from app.classes.minecraft.mc_ping import ping, ping_bedrock
|
||||||
from app.classes.models.servers import Server_Stats, servers_helper
|
from app.classes.models.servers import Server_Stats, servers_helper
|
||||||
from app.classes.models.management import management_helper
|
from app.classes.models.management import management_helper
|
||||||
from app.classes.models.users import users_helper
|
from app.classes.models.users import users_helper
|
||||||
from app.classes.models.server_permissions import server_permissions
|
from app.classes.models.server_permissions import server_permissions
|
||||||
|
|
||||||
from app.classes.minecraft.stats import Stats
|
|
||||||
from app.classes.minecraft.mc_ping import ping, ping_bedrock
|
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
from app.classes.shared.translation import translation
|
from app.classes.shared.translation import translation
|
||||||
from app.classes.shared.file_helpers import file_helper
|
from app.classes.shared.file_helpers import file_helper
|
||||||
|
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import psutil
|
import psutil
|
||||||
|
#TZLocal is set as a hidden import on win pipeline
|
||||||
|
from tzlocal import get_localzone
|
||||||
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ServerOutBuf:
|
class ServerOutBuf:
|
||||||
lines = {}
|
lines = {}
|
||||||
|
@ -1,35 +1,29 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import asyncio
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
from tzlocal import get_localzone
|
|
||||||
|
|
||||||
|
from app.classes.controllers.users_controller import Users_Controller
|
||||||
|
from app.classes.minecraft.serverjars import server_jar_obj
|
||||||
|
from app.classes.models.management import management_helper
|
||||||
|
from app.classes.models.users import users_helper
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
|
|
||||||
from app.classes.web.tornado_handler import Webserver
|
from app.classes.web.tornado_handler import Webserver
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
from app.classes.minecraft.serverjars import server_jar_obj
|
|
||||||
from app.classes.models.management import management_helper
|
|
||||||
from app.classes.controllers.users_controller import Users_Controller
|
|
||||||
from app.classes.models.users import users_helper
|
|
||||||
|
|
||||||
logger = logging.getLogger('apscheduler')
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
from tzlocal import get_localzone
|
||||||
from apscheduler.events import EVENT_JOB_EXECUTED
|
from apscheduler.events import EVENT_JOB_EXECUTED
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from apscheduler.triggers.cron import CronTrigger
|
from apscheduler.triggers.cron import CronTrigger
|
||||||
|
|
||||||
except ModuleNotFoundError as err:
|
except ModuleNotFoundError as err:
|
||||||
logger.critical(f"Import Error: Unable to load {err.name} module", exc_info=True)
|
helper.auto_installer_fix(err)
|
||||||
console.critical(f"Import Error: Unable to load {err.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
logger = logging.getLogger('apscheduler')
|
||||||
scheduler_intervals = { 'seconds',
|
scheduler_intervals = { 'seconds',
|
||||||
'minutes',
|
'minutes',
|
||||||
'hours',
|
'hours',
|
||||||
|
@ -3,22 +3,25 @@ import html
|
|||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import tornado.web
|
|
||||||
import tornado.escape
|
|
||||||
import bleach
|
|
||||||
|
|
||||||
|
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
|
||||||
from app.classes.shared.translation import translation
|
from app.classes.shared.translation import translation
|
||||||
from app.classes.shared.server import ServerOutBuf
|
from app.classes.shared.server import ServerOutBuf
|
||||||
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
|
||||||
|
try:
|
||||||
|
import bleach
|
||||||
|
import tornado.web
|
||||||
|
import tornado.escape
|
||||||
|
|
||||||
|
except ModuleNotFoundError as ex:
|
||||||
|
helper.auto_installer_fix(ex)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class AjaxHandler(BaseHandler):
|
class AjaxHandler(BaseHandler):
|
||||||
|
|
||||||
def render_page(self, template, page_data):
|
def render_page(self, template, page_data):
|
||||||
|
@ -3,8 +3,7 @@ import re
|
|||||||
|
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
bearer_pattern = re.compile(r'^Bearer', flags=re.IGNORECASE)
|
bearer_pattern = re.compile(r'^Bearer', flags=re.IGNORECASE)
|
||||||
|
|
||||||
class ApiHandler(BaseHandler):
|
class ApiHandler(BaseHandler):
|
||||||
@ -17,7 +16,7 @@ class ApiHandler(BaseHandler):
|
|||||||
def access_denied(self, user, reason=''):
|
def access_denied(self, user, reason=''):
|
||||||
if reason:
|
if reason:
|
||||||
reason = ' because ' + reason
|
reason = ' because ' + reason
|
||||||
log.info("User %s from IP %s was denied access to the API route " + self.request.path + reason, user, self.get_remote_ip())
|
logger.info("User %s from IP %s was denied access to the API route " + self.request.path + reason, user, self.get_remote_ip())
|
||||||
self.finish(self.return_response(403, {
|
self.finish(self.return_response(403, {
|
||||||
'error':'ACCESS_DENIED',
|
'error':'ACCESS_DENIED',
|
||||||
'info':'You were denied access to the requested resource'
|
'info':'You were denied access to the requested resource'
|
||||||
@ -25,7 +24,7 @@ class ApiHandler(BaseHandler):
|
|||||||
|
|
||||||
def authenticate_user(self) -> bool:
|
def authenticate_user(self) -> bool:
|
||||||
try:
|
try:
|
||||||
log.debug("Searching for specified token")
|
logger.debug("Searching for specified token")
|
||||||
|
|
||||||
api_token = self.get_argument('token', '')
|
api_token = self.get_argument('token', '')
|
||||||
if api_token is None and self.request.headers.get('Authorization'):
|
if api_token is None and self.request.headers.get('Authorization'):
|
||||||
@ -34,10 +33,10 @@ class ApiHandler(BaseHandler):
|
|||||||
api_token = self.get_cookie('token')
|
api_token = self.get_cookie('token')
|
||||||
user_data = self.controller.users.get_user_by_api_token(api_token)
|
user_data = self.controller.users.get_user_by_api_token(api_token)
|
||||||
|
|
||||||
log.debug("Checking results")
|
logger.debug("Checking results")
|
||||||
if user_data:
|
if user_data:
|
||||||
# Login successful! Check perms
|
# Login successful! Check perms
|
||||||
log.info(f"User {user_data['username']} has authenticated to API")
|
logger.info(f"User {user_data['username']} has authenticated to API")
|
||||||
# TODO: Role check
|
# TODO: Role check
|
||||||
|
|
||||||
return True # This is to set the "authenticated"
|
return True # This is to set the "authenticated"
|
||||||
@ -46,7 +45,7 @@ class ApiHandler(BaseHandler):
|
|||||||
self.access_denied("unknown", "the user provided an invalid token")
|
self.access_denied("unknown", "the user provided an invalid token")
|
||||||
return False
|
return False
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.warning("An error occured while authenticating an API user: %s", e)
|
logger.warning("An error occured while authenticating an API user: %s", e)
|
||||||
self.finish(self.return_response(403, {
|
self.finish(self.return_response(403, {
|
||||||
'error':'ACCESS_DENIED',
|
'error':'ACCESS_DENIED',
|
||||||
'info':'An error occured while authenticating the user'
|
'info':'An error occured while authenticating the user'
|
||||||
|
@ -4,17 +4,21 @@ from typing import (
|
|||||||
List,
|
List,
|
||||||
Optional, Tuple, Dict, Any
|
Optional, Tuple, Dict, Any
|
||||||
)
|
)
|
||||||
import tornado.web
|
|
||||||
import bleach
|
|
||||||
|
|
||||||
from app.classes.shared.authentication import authentication
|
|
||||||
from app.classes.shared.main_controller import Controller
|
|
||||||
|
|
||||||
from app.classes.models.users import ApiKeys
|
from app.classes.models.users import ApiKeys
|
||||||
|
from app.classes.shared.authentication import authentication
|
||||||
|
from app.classes.shared.main_controller import Controller
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
|
try:
|
||||||
|
import tornado.web
|
||||||
|
import bleach
|
||||||
|
|
||||||
|
except ModuleNotFoundError as e:
|
||||||
|
helper.auto_installer_fix(e)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class BaseHandler(tornado.web.RequestHandler):
|
class BaseHandler(tornado.web.RequestHandler):
|
||||||
|
|
||||||
nobleach = {bool, type(None)}
|
nobleach = {bool, type(None)}
|
||||||
|
@ -1,19 +1,22 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import tornado.web
|
|
||||||
import tornado.escape
|
|
||||||
import bleach
|
|
||||||
|
|
||||||
|
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.file_helpers import file_helper
|
from app.classes.shared.file_helpers import file_helper
|
||||||
|
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
|
||||||
|
try:
|
||||||
|
import bleach
|
||||||
|
import tornado.web
|
||||||
|
import tornado.escape
|
||||||
|
|
||||||
|
except ModuleNotFoundError as e:
|
||||||
|
helper.auto_installer_fix(e)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FileHandler(BaseHandler):
|
class FileHandler(BaseHandler):
|
||||||
|
|
||||||
def render_page(self, template, page_data):
|
def render_page(self, template, page_data):
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
import logging
|
import logging
|
||||||
import requests
|
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
|
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
|
||||||
|
except ModuleNotFoundError as e:
|
||||||
|
helper.auto_installer_fix(e)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class HTTPHandler(BaseHandler):
|
class HTTPHandler(BaseHandler):
|
||||||
|
@ -5,27 +5,28 @@ from typing import Dict, Any, Tuple
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import bleach
|
|
||||||
import libgravatar
|
|
||||||
import requests
|
|
||||||
|
|
||||||
import tornado.web
|
|
||||||
import tornado.escape
|
|
||||||
from tornado import iostream
|
|
||||||
|
|
||||||
#TZLocal is set as a hidden import on win pipeline
|
|
||||||
from tzlocal import get_localzone
|
|
||||||
from cron_validator import CronValidator
|
|
||||||
|
|
||||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||||
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
|
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
|
||||||
from app.classes.models.management import management_helper
|
from app.classes.models.management import management_helper
|
||||||
|
|
||||||
from app.classes.shared.authentication import authentication
|
from app.classes.shared.authentication import authentication
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
|
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
|
|
||||||
|
try:
|
||||||
|
import bleach
|
||||||
|
import libgravatar
|
||||||
|
import requests
|
||||||
|
import tornado.web
|
||||||
|
import tornado.escape
|
||||||
|
from tornado import iostream
|
||||||
|
#TZLocal is set as a hidden import on win pipeline
|
||||||
|
from tzlocal import get_localzone
|
||||||
|
from cron_validator import CronValidator
|
||||||
|
|
||||||
|
except ModuleNotFoundError as ex:
|
||||||
|
helper.auto_installer_fix(ex)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class PanelHandler(BaseHandler):
|
class PanelHandler(BaseHandler):
|
||||||
|
@ -1,23 +1,18 @@
|
|||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from app.classes.models.users import Users
|
||||||
from app.classes.shared.authentication import authentication
|
from app.classes.shared.authentication import authentication
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.main_models import fn
|
from app.classes.shared.main_models import fn
|
||||||
|
|
||||||
from app.classes.models.users import Users
|
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import bleach
|
import bleach
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class PublicHandler(BaseHandler):
|
class PublicHandler(BaseHandler):
|
||||||
|
|
||||||
|
@ -1,30 +1,24 @@
|
|||||||
import sys
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import libgravatar
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
from app.classes.minecraft.serverjars import server_jar_obj
|
||||||
|
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.file_helpers import file_helper
|
from app.classes.shared.file_helpers import file_helper
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
from app.classes.models.crafty_permissions import Enum_Permissions_Crafty
|
|
||||||
from app.classes.minecraft.serverjars import server_jar_obj
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tornado.web
|
import tornado.web
|
||||||
import tornado.escape
|
import tornado.escape
|
||||||
import bleach
|
import bleach
|
||||||
|
import libgravatar
|
||||||
|
import requests
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class ServerHandler(BaseHandler):
|
class ServerHandler(BaseHandler):
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
from typing import ( Optional )
|
from typing import ( Optional )
|
||||||
import tornado.web
|
|
||||||
|
try:
|
||||||
|
import tornado.web
|
||||||
|
|
||||||
|
except ModuleNotFoundError as e:
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
helper.auto_installer_fix(e)
|
||||||
|
|
||||||
class CustomStaticHandler(tornado.web.StaticFileHandler):
|
class CustomStaticHandler(tornado.web.StaticFileHandler):
|
||||||
def validate_absolute_path(self, root: str, absolute_path: str) -> Optional[str]:
|
def validate_absolute_path(self, root: str, absolute_path: str) -> Optional[str]:
|
||||||
|
@ -4,7 +4,21 @@ import json
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
from app.classes.shared.translation import translation
|
||||||
|
from app.classes.shared.console import console
|
||||||
|
from app.classes.shared.helpers import helper
|
||||||
|
from app.classes.web.file_handler import FileHandler
|
||||||
|
from app.classes.web.public_handler import PublicHandler
|
||||||
|
from app.classes.web.panel_handler import PanelHandler
|
||||||
|
from app.classes.web.default_handler import DefaultHandler
|
||||||
|
from app.classes.web.server_handler import ServerHandler
|
||||||
|
from app.classes.web.ajax_handler import AjaxHandler
|
||||||
|
from app.classes.web.api_handler import ServersStats, NodeStats
|
||||||
|
from app.classes.web.websocket_handler import SocketHandler
|
||||||
|
from app.classes.web.static_handler import CustomStaticHandler
|
||||||
|
from app.classes.web.upload_handler import UploadHandler
|
||||||
|
from app.classes.web.http_handler import HTTPHandler, HTTPHandlerPage
|
||||||
|
from app.classes.web.status_handler import StatusHandler
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tornado.web
|
import tornado.web
|
||||||
@ -14,26 +28,11 @@ try:
|
|||||||
import tornado.escape
|
import tornado.escape
|
||||||
import tornado.locale
|
import tornado.locale
|
||||||
import tornado.httpserver
|
import tornado.httpserver
|
||||||
from app.classes.web.file_handler import FileHandler
|
|
||||||
from app.classes.web.public_handler import PublicHandler
|
|
||||||
from app.classes.web.panel_handler import PanelHandler
|
|
||||||
from app.classes.web.default_handler import DefaultHandler
|
|
||||||
from app.classes.web.server_handler import ServerHandler
|
|
||||||
from app.classes.web.ajax_handler import AjaxHandler
|
|
||||||
from app.classes.web.api_handler import ServersStats, NodeStats
|
|
||||||
from app.classes.web.websocket_handler import SocketHandler
|
|
||||||
from app.classes.web.static_handler import CustomStaticHandler
|
|
||||||
from app.classes.web.upload_handler import UploadHandler
|
|
||||||
from app.classes.web.http_handler import HTTPHandler, HTTPHandlerPage
|
|
||||||
from app.classes.web.status_handler import StatusHandler
|
|
||||||
from app.classes.shared.translation import translation
|
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.shared.helpers import helper
|
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Webserver:
|
class Webserver:
|
||||||
|
|
||||||
|
@ -2,23 +2,24 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import tornado.options
|
from app.classes.models.server_permissions import Enum_Permissions_Server
|
||||||
import tornado.web
|
|
||||||
import tornado.httpserver
|
|
||||||
|
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
from app.classes.shared.console import console
|
||||||
from app.classes.shared.main_controller import Controller
|
from app.classes.shared.main_controller import Controller
|
||||||
|
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
from app.classes.web.base_handler import BaseHandler
|
from app.classes.web.base_handler import BaseHandler
|
||||||
|
|
||||||
from app.classes.models.server_permissions import Enum_Permissions_Server
|
try:
|
||||||
|
import tornado.web
|
||||||
|
import tornado.options
|
||||||
|
import tornado.httpserver
|
||||||
|
|
||||||
|
except ModuleNotFoundError as ex:
|
||||||
|
helper.auto_installer_fix(ex)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Class&Function Defination
|
# Class & Function Defination
|
||||||
MAX_STREAMED_SIZE = 1024 * 1024 * 1024
|
MAX_STREAMED_SIZE = 1024 * 1024 * 1024
|
||||||
|
|
||||||
@tornado.web.stream_request_body
|
@tornado.web.stream_request_body
|
||||||
|
@ -1,24 +1,19 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
|
||||||
from urllib.parse import parse_qsl
|
from urllib.parse import parse_qsl
|
||||||
|
|
||||||
from app.classes.shared.authentication import authentication
|
from app.classes.shared.authentication import authentication
|
||||||
from app.classes.shared.helpers import helper
|
from app.classes.shared.helpers import helper
|
||||||
from app.classes.shared.console import console
|
|
||||||
from app.classes.web.websocket_helper import websocket_helper
|
from app.classes.web.websocket_helper import websocket_helper
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tornado.websocket
|
import tornado.websocket
|
||||||
|
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.critical(f"Import Error: Unable to load {e.name} module", exc_info=True)
|
helper.auto_installer_fix(e)
|
||||||
console.critical(f"Import Error: Unable to load {e.name} module")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SocketHandler(tornado.websocket.WebSocketHandler):
|
class SocketHandler(tornado.websocket.WebSocketHandler):
|
||||||
page = None
|
page = None
|
||||||
|
Loading…
Reference in New Issue
Block a user