コード例 #1
0
ファイル: tsuserver.py プロジェクト: Qubrick/tsuserver3
 def __init__(self):
     self.config = None
     self.allowed_iniswaps = None
     self.load_config()
     self.load_iniswaps()
     self.client_manager = ClientManager(self)
     self.area_manager = AreaManager(self)
     self.ban_manager = BanManager()
     self.software = 'tsuserver3'
     self.version = 'tsuserver3dev'
     self.release = 3
     self.major_version = 1
     self.minor_version = 1
     self.ipid_list = {}
     self.hdid_list = {}
     self.char_list = None
     self.char_pages_ao1 = None
     self.music_list = None
     self.music_list_ao2 = None
     self.music_pages_ao1 = None
     self.backgrounds = None
     self.load_characters()
     self.load_music()
     self.load_backgrounds()
     self.load_ids()
     self.district_client = None
     self.ms_client = None
     self.rp_mode = False
     logger.setup_logger(debug=self.config['debug'])
コード例 #2
0
    def __init__(self):
        self.software = 'tsuserver3'
        self.release = 3
        self.major_version = 3
        self.minor_version = 0

        self.config = None
        self.allowed_iniswaps = []
        self.char_list = None
        self.char_emotes = None
        self.char_pages_ao1 = None
        self.music_list = []
        self.music_list_ao2 = None
        self.music_pages_ao1 = None
        self.bglock = False
        self.backgrounds = None
        self.zalgo_tolerance = None
        self.ipRange_bans = []
        self.geoIpReader = None
        self.useGeoIp = False

        try:
            self.geoIpReader = geoip2.database.Reader('./storage/GeoLite2-ASN.mmdb')
            self.useGeoIp = True
            # on debian systems you can use /usr/share/GeoIP/GeoIPASNum.dat if the geoip-database-extra package is installed
        except FileNotFoundError:
            self.useGeoIp = False
            pass

        self.ms_client = None

        try:
            self.load_config()
            self.area_manager = AreaManager(self)
            self.load_iniswaps()
            self.load_characters()
            self.load_music()
            self.load_backgrounds()
            self.load_ipranges()
            self.load_gimps()
            self.load_prompts()
            self.load_miscdata()
            self.save_miscdata()
        except yaml.YAMLError as exc:
            print('There was a syntax error parsing a configuration file:')
            print(exc)
            print('Please revise your syntax and restart the server.')
            sys.exit(1)
        except OSError as exc:
            print('There was an error opening or writing to a file:')
            print(exc)
            sys.exit(1)
        except Exception as exc:
            print('There was a configuration error:')
            print(exc)
            print('Please check sample config files for the correct format.')
            sys.exit(1)

        self.client_manager = ClientManager(self)
        server.logger.setup_logger(debug=self.config['debug'])
コード例 #3
0
ファイル: tsuserver.py プロジェクト: Iamgoofball/tsuserver3
 def __init__(self):
     self.config = None
     self.allowed_iniswaps = None
     self.loaded_ips = {}
     self.load_config()
     self.load_iniswaps()
     self.client_manager = ClientManager(self)
     self.area_manager = AreaManager(self)
     self.serverpoll_manager = ServerpollManager(self)
     self.ban_manager = BanManager()
     self.software = 'tsuserver3'
     self.version = 'tsuserver3dev'
     self.release = 3
     self.major_version = 2
     self.minor_version = 0
     self.char_list = None
     self.char_pages_ao1 = None
     self.music_list = None
     self.music_list_ao2 = None
     self.music_pages_ao1 = None
     self.backgrounds = None
     self.data = None
     self.features = set()
     self.load_characters()
     self.load_music()
     self.load_backgrounds()
     self.load_data()
     self.load_ids()
     self.enable_features()
     self.district_client = None
     self.ms_client = None
     self.rp_mode = False
     logger.setup_logger(debug=self.config['debug'],
                         log_size=self.config['log_size'],
                         log_backups=self.config['log_backups'])
コード例 #4
0
    def _listener_handler(self, data):
        res = None
        try:
            port, freePort = self.port_manager.request_port()

            clientManager = None
            def terminateClient():
                nonlocal clientManager
                nonlocal freePort

                freePort()
                self._client_managers.remove(clientManager)

            clientManager = ClientManager(port, terminateClient, data)
            clientManager.start()

            self._client_managers.append(
                clientManager
            )

            res = Response(ResponseTypes.accept, {
                "port": port,
                "data": clientManager.initialResponse
            })
        except Exception as err:
            res = Response(ResponseTypes.reject, {
                "message": str(err)
            })
        
        return res.toDict()
コード例 #5
0
    def __init__(self):
        self.software = 'tsuserver3'
        self.release = 3
        self.major_version = 3
        self.minor_version = 0

        self.config = None
        self.allowed_iniswaps = []
        self.char_list = None
        self.char_emotes = None
        self.char_pages_ao1 = None
        self.music_list = []
        self.music_list_ao2 = None
        self.music_pages_ao1 = None
        self.bglock = False
        self.backgrounds = None
        self.zalgo_tolerance = None
        self.ipRange_bans = []
        self.geoIpReader = None
        self.useGeoIp = False

        try:
            self.geoIpReader = geoip2.database.Reader(
                './storage/GeoLite2-ASN.mmdb')
            self.useGeoIp = True
            # on debian systems you can use /usr/share/GeoIP/GeoIPASNum.dat if the geoip-database-extra package is installed
        except FileNotFoundError:
            self.useGeoIp = False
            pass

        self.ms_client = None

        try:
            self.load_config()
            self.area_manager = AreaManager(self)
            self.load_iniswaps()
            self.load_characters()
            self.load_music()
            self.load_backgrounds()
            self.load_ipranges()
        except yaml.YAMLError as exc:
            print('There was a syntax error parsing a configuration file:')
            print(exc)
            print('Please revise your syntax and restart the server.')
            # Truly idiotproof
            if os.name == 'nt':
                input('(Press Enter to exit)')
            sys.exit(1)

        self.client_manager = ClientManager(self)
        server.logger.setup_logger(debug=self.config['debug'])
コード例 #6
0
    def __init__(self):
        self.release = 3
        self.major_version = 'DR'
        self.minor_version = '190622b'
        self.software = 'tsuserver{}'.format(self.get_version_string())
        self.version = 'tsuserver{}dev'.format(self.get_version_string())

        logger.log_print('Launching {}...'.format(self.software))

        logger.log_print('Loading server configurations...')
        self.config = None
        self.global_connection = None
        self.shutting_down = False
        self.loop = None

        self.allowed_iniswaps = None
        self.default_area = 0
        self.load_config()
        self.load_iniswaps()
        self.char_list = list()
        self.load_characters()
        self.client_manager = ClientManager(self)
        self.area_manager = AreaManager(self)
        self.ban_manager = BanManager(self)

        self.ipid_list = {}
        self.hdid_list = {}
        self.char_pages_ao1 = None
        self.music_list = None
        self.music_list_ao2 = None
        self.music_pages_ao1 = None
        self.backgrounds = None
        self.load_music()
        self.load_backgrounds()
        self.load_ids()
        self.district_client = None
        self.ms_client = None
        self.rp_mode = False
        self.user_auth_req = False
        self.client_tasks = dict()
        self.active_timers = dict()
        self.showname_freeze = False
        self.commands = importlib.import_module('server.commands')
        logger.setup_logger(debug=self.config['debug'])
コード例 #7
0
    def __init__(self):
        self.software = 'tsuserver3'
        self.release = 3
        self.major_version = 3
        self.minor_version = 0

        self.config = None
        self.allowed_iniswaps = []
        self.char_list = None
        self.char_emotes = None
        self.char_pages_ao1 = None
        self.music_list = None
        self.music_list_ao2 = None
        self.music_pages_ao1 = None
        self.backgrounds = None
        self.zalgo_tolerance = None

        self.ms_client = None

        try:
            self.load_config()
            self.area_manager = AreaManager(self)
            self.load_iniswaps()
            self.load_characters()
            self.load_music()
            self.load_backgrounds()
        except yaml.YAMLError as exc:
            print('There was a syntax error parsing a configuration file:')
            print(exc)
            print('Please revise your syntax and restart the server.')
            # Truly idiotproof
            if os.name == 'nt':
                input('(Press Enter to exit)')
            sys.exit(1)

        self.client_manager = ClientManager(self)
        server.logger.setup_logger(debug=self.config['debug'])
コード例 #8
0
    def __init__(self):
        self.software = 'KFO-Server'
        self.release = 3
        self.major_version = 3
        self.minor_version = 0

        self.config = None
        self.censors = None
        self.allowed_iniswaps = []
        self.char_list = None
        self.char_emotes = None
        self.char_pages_ao1 = None
        self.music_list = []
        self.music_list_ao2 = None
        self.music_pages_ao1 = None
        self.backgrounds = None
        self.zalgo_tolerance = None
        self.ipRange_bans = []
        self.geoIpReader = None
        self.useGeoIp = False
        self.supported_features = [
            'yellowtext', 'customobjections', 'prezoom', 'flipping',
            'fastloading', 'noencryption', 'deskmod', 'evidence',
            'modcall_reason', 'cccc_ic_support', 'casing_alerts', 'arup',
            'looping_sfx', 'additive', 'effects'
        ]

        try:
            self.geoIpReader = geoip2.database.Reader(
                './storage/GeoLite2-ASN.mmdb')
            self.useGeoIp = True
            # on debian systems you can use /usr/share/GeoIP/GeoIPASNum.dat if the geoip-database-extra package is installed
        except FileNotFoundError:
            self.useGeoIp = False
            pass

        self.ms_client = None

        try:
            self.load_config()
            self.load_censors()
            self.load_iniswaps()
            self.load_characters()
            self.load_music()
            self.load_backgrounds()
            self.load_ipranges()
            self.hub_manager = HubManager(self)
        except yaml.YAMLError as exc:
            print('There was a syntax error parsing a configuration file:')
            print(exc)
            print('Please revise your syntax and restart the server.')
            sys.exit(1)
        except OSError as exc:
            print('There was an error opening or writing to a file:')
            print(exc)
            sys.exit(1)
        except Exception as exc:
            print('There was a configuration error:')
            print(exc)
            print('Please check sample config files for the correct format.')
            sys.exit(1)

        self.client_manager = ClientManager(self)
        server.logger.setup_logger(debug=self.config['debug'])

        self.webhooks = Webhooks(self)
        self.bridgebot = None
コード例 #9
0
    def __init__(self):
        self.software = "KFO-Server"
        self.release = 3
        self.major_version = 3
        self.minor_version = 0

        self.config = None
        self.censors = None
        self.allowed_iniswaps = []
        self.char_list = None
        self.char_emotes = None
        self.music_list = []
        self.backgrounds = None
        self.zalgo_tolerance = None
        self.ipRange_bans = []
        self.geoIpReader = None
        self.useGeoIp = False
        self.supported_features = [
            "yellowtext",
            "customobjections",
            "prezoom",
            "flipping",
            "fastloading",
            "noencryption",
            "deskmod",
            "evidence",
            "modcall_reason",
            "cccc_ic_support",
            "casing_alerts",
            "arup",
            "looping_sfx",
            "additive",
            "effects",
            "expanded_desk_mods",
            "y_offset",
        ]
        self.command_aliases = {}

        try:
            self.geoIpReader = geoip2.database.Reader(
                "./storage/GeoLite2-ASN.mmdb")
            self.useGeoIp = True
            # on debian systems you can use /usr/share/GeoIP/GeoIPASNum.dat if the geoip-database-extra package is installed
        except FileNotFoundError:
            self.useGeoIp = False

        self.ms_client = None
        sys.setrecursionlimit(50)
        try:
            self.load_config()
            self.load_command_aliases()
            self.load_censors()
            self.load_iniswaps()
            self.load_characters()
            self.load_music()
            self.load_backgrounds()
            self.load_ipranges()
            self.hub_manager = HubManager(self)
        except yaml.YAMLError as exc:
            print("There was a syntax error parsing a configuration file:")
            print(exc)
            print("Please revise your syntax and restart the server.")
            sys.exit(1)
        except OSError as exc:
            print("There was an error opening or writing to a file:")
            print(exc)
            sys.exit(1)
        except Exception as exc:
            print("There was a configuration error:")
            print(exc)
            print("Please check sample config files for the correct format.")
            sys.exit(1)

        self.client_manager = ClientManager(self)
        server.logger.setup_logger(debug=self.config["debug"])

        self.webhooks = Webhooks(self)
        self.bridgebot = None
コード例 #10
0
ファイル: test_client_manager.py プロジェクト: caulagi/py-ras
 def setUpClass(cls):
     cls.cm = ClientManager()
     cls.loop = asyncio.get_event_loop()