Beispiel #1
0
 def __init__(self, port='', password='', motdFilePath=None, isolateRooms=False, salt=None,
              disableReady=False, disableChat=False, maxChatMessageLength=constants.MAX_CHAT_MESSAGE_LENGTH,
              maxUsernameLength=constants.MAX_USERNAME_LENGTH, statsDbFile=None):
     self.isolateRooms = isolateRooms
     print(getMessage("welcome-server-notification").format(syncplay.version))
     self.port = port
     if password:
         password = password.encode('utf-8')
         password = hashlib.md5(password).hexdigest()
     self.password = password
     if salt is None:
         salt = RandomStringGenerator.generate_server_salt()
         print(getMessage("no-salt-notification").format(salt))
     self._salt = salt
     self._motdFilePath = motdFilePath
     self.disableReady = disableReady
     self.disableChat = disableChat
     self.maxChatMessageLength = maxChatMessageLength if maxChatMessageLength is not None else constants.MAX_CHAT_MESSAGE_LENGTH
     self.maxUsernameLength = maxUsernameLength if maxUsernameLength is not None else constants.MAX_USERNAME_LENGTH
     if not isolateRooms:
         self._roomManager = RoomManager()
     else:
         self._roomManager = PublicRoomManager()
     if statsDbFile is not None:
         self._statsDbHandle = DBManager(statsDbFile)
         self._statsRecorder = StatsRecorder(self._statsDbHandle, self._roomManager)
         statsDelay = 5*(int(self.port)%10 + 1)
         self._statsRecorder.startRecorder(statsDelay)
     else:
         self._statsDbHandle = None
Beispiel #2
0
 def __init__(self,
              port='',
              password='',
              motdFilePath=None,
              roomsDbFile=None,
              permanentRoomsFile=None,
              isolateRooms=False,
              salt=None,
              disableReady=False,
              disableChat=False,
              maxChatMessageLength=constants.MAX_CHAT_MESSAGE_LENGTH,
              maxUsernameLength=constants.MAX_USERNAME_LENGTH,
              statsDbFile=None,
              tlsCertPath=None):
     self.isolateRooms = isolateRooms
     syncplay.messages.setLanguage(syncplay.messages.getInitialLanguage())
     print(
         getMessage("welcome-server-notification").format(syncplay.version))
     self.port = port
     if password:
         password = password.encode('utf-8')
         password = hashlib.md5(password).hexdigest()
     self.password = password
     if salt is None:
         salt = RandomStringGenerator.generate_server_salt()
         print(getMessage("no-salt-notification").format(salt))
     self._salt = salt
     self._motdFilePath = motdFilePath
     self.roomsDbFile = roomsDbFile
     self.disableReady = disableReady
     self.disableChat = disableChat
     self.maxChatMessageLength = maxChatMessageLength if maxChatMessageLength is not None else constants.MAX_CHAT_MESSAGE_LENGTH
     self.maxUsernameLength = maxUsernameLength if maxUsernameLength is not None else constants.MAX_USERNAME_LENGTH
     self.permanentRoomsFile = permanentRoomsFile if permanentRoomsFile is not None and os.path.isfile(
         permanentRoomsFile) else None
     self.permanentRooms = self.loadListFromMultilineTextFile(
         self.permanentRoomsFile
     ) if self.permanentRoomsFile is not None else []
     if not isolateRooms:
         self._roomManager = RoomManager(self.roomsDbFile,
                                         self.permanentRooms)
     else:
         self._roomManager = PublicRoomManager()
     if statsDbFile is not None:
         self._statsDbHandle = StatsDBManager(statsDbFile)
         self._statsRecorder = StatsRecorder(self._statsDbHandle,
                                             self._roomManager)
         statsDelay = 5 * (int(self.port) % 10 + 1)
         self._statsRecorder.startRecorder(statsDelay)
     else:
         self._statsDbHandle = None
     if tlsCertPath is not None:
         self.certPath = tlsCertPath
         self._TLSattempts = 0
         self._allowTLSconnections(self.certPath)
     else:
         self.certPath = None
         self.options = None
         self.serverAcceptsTLS = False
Beispiel #3
0
 def __init__(self, password='', motdFilePath=None, isolateRooms=False, salt=None, disableReady=False):
     print getMessage("welcome-server-notification").format(syncplay.version)
     if password:
         password = hashlib.md5(password).hexdigest()
     self.password = password
     if salt is None:
         salt = RandomStringGenerator.generate_server_salt()
         print getMessage("no-salt-notification").format(salt)
     self._salt = salt
     self._motdFilePath = motdFilePath
     self.disableReady = disableReady
     if not isolateRooms:
         self._roomManager = RoomManager()
     else:
         self._roomManager = PublicRoomManager()
Beispiel #4
0
 def __init__(self, password='', motdFilePath=None, isolateRooms=False, salt=None, disableReady=False,disableChat=False, maxChatMessageLength=constants.MAX_CHAT_MESSAGE_LENGTH):
     self.isolateRooms = isolateRooms
     print getMessage("welcome-server-notification").format(syncplay.version)
     if password:
         password = hashlib.md5(password).hexdigest()
     self.password = password
     if salt is None:
         salt = RandomStringGenerator.generate_server_salt()
         print getMessage("no-salt-notification").format(salt)
     self._salt = salt
     self._motdFilePath = motdFilePath
     self.disableReady = disableReady
     self.disableChat = disableChat
     self.maxChatMessageLength = maxChatMessageLength
     if not isolateRooms:
         self._roomManager = RoomManager()
     else:
         self._roomManager = PublicRoomManager()
Beispiel #5
0
 def __init__(self, port='', password='', motdFilePath=None, isolateRooms=False, salt=None,
              disableReady=False, disableChat=False, maxChatMessageLength=constants.MAX_CHAT_MESSAGE_LENGTH,
              maxUsernameLength=constants.MAX_USERNAME_LENGTH, statsDbFile=None, tlsCertPath=None):
     self.isolateRooms = isolateRooms
     print(getMessage("welcome-server-notification").format(syncplay.version))
     self.port = port
     if password:
         password = password.encode('utf-8')
         password = hashlib.md5(password).hexdigest()
     self.password = password
     if salt is None:
         salt = RandomStringGenerator.generate_server_salt()
         print(getMessage("no-salt-notification").format(salt))
     self._salt = salt
     self._motdFilePath = motdFilePath
     self.disableReady = disableReady
     self.disableChat = disableChat
     self.maxChatMessageLength = maxChatMessageLength if maxChatMessageLength is not None else constants.MAX_CHAT_MESSAGE_LENGTH
     self.maxUsernameLength = maxUsernameLength if maxUsernameLength is not None else constants.MAX_USERNAME_LENGTH
     if not isolateRooms:
         self._roomManager = RoomManager()
     else:
         self._roomManager = PublicRoomManager()
     if statsDbFile is not None:
         self._statsDbHandle = DBManager(statsDbFile)
         self._statsRecorder = StatsRecorder(self._statsDbHandle, self._roomManager)
         statsDelay = 5*(int(self.port)%10 + 1)
         self._statsRecorder.startRecorder(statsDelay)
     else:
         self._statsDbHandle = None
     if tlsCertPath is not None:
         self.certPath = tlsCertPath
         self._TLSattempts = 0
         self._allowTLSconnections(self.certPath)
     else:
         self.certPath = None
         self.options = None
         self.serverAcceptsTLS = False