def __init__(self, hostname, gui, session, home: str, proxy: bool = True) -> None: """ The hostname, gui and session objects are used to coordinate with the various other layers of the application: the location of the SecureDrop proxy, the user interface and SqlAlchemy local storage respectively. """ check_dir_permissions(home) super().__init__() self.hostname = hostname # Location of the SecureDrop server. self.gui = gui # Reference to the UI window. self.api = None # Reference to the API for secure drop proxy. self.session = session # Reference to the SqlAlchemy session. self.message_thread = None # thread responsible for fetching messages self.reply_thread = None # thread responsible for fetching replies self.home = home # used for finding DB in sync thread self.api_threads = {} # Contains active threads calling the API. self.sync_flag = os.path.join(home, 'sync_flag') self.data_dir = os.path.join(self.home, 'data') # File data. self.timer = None # call timeout timer self.proxy = proxy
def __init__(self, hostname: str, gui, session_maker: sessionmaker, home: str, proxy: bool = True, qubes: bool = True) -> None: """ The hostname, gui and session objects are used to coordinate with the various other layers of the application: the location of the SecureDrop proxy, the user interface and SqlAlchemy local storage respectively. """ check_dir_permissions(home) super().__init__() # Controller is unauthenticated by default self.__is_authenticated = False # used for finding DB in sync thread self.home = home # boolean flag for whether or not the client is operating behind a proxy self.proxy = proxy # boolean flag for whether the client is running within Qubes # (regardless of proxy state, to support local dev in an AppVM) self.qubes = qubes # Location of the SecureDrop server. self.hostname = hostname # Reference to the UI window. self.gui = gui # Reference to the API for secure drop proxy. self.api = None # type: sdclientapi.API # Reference to the SqlAlchemy `sessionmaker` and `session` self.session_maker = session_maker self.session = session_maker() # Queue that handles running API job self.api_job_queue = ApiJobQueue(self.api, self.session_maker) self.api_job_queue.paused.connect(self.on_queue_paused) # Contains active threads calling the API. self.api_threads = {} # type: Dict[str, Dict] self.gpg = GpgHelper(home, self.session_maker, proxy) self.export = Export() self.sync_flag = os.path.join(home, 'sync_flag') # File data. self.data_dir = os.path.join(self.home, 'data')
def __init__(self, hostname, gui, session, home: str, proxy: bool = True) -> None: """ The hostname, gui and session objects are used to coordinate with the various other layers of the application: the location of the SecureDrop proxy, the user interface and SqlAlchemy local storage respectively. """ check_dir_permissions(home) super().__init__() # Controller is unauthenticated by default self.__is_authenticated = False # used for finding DB in sync thread self.home = home # boolean flag for whether or not the client is operating behind a proxy self.proxy = proxy # Location of the SecureDrop server. self.hostname = hostname # Reference to the UI window. self.gui = gui # Reference to the API for secure drop proxy. self.api = None # type: sdclientapi.API # Contains active threads calling the API. self.api_threads = {} # type: Dict[str, Dict] # Reference to the SqlAlchemy session. self.session = session # thread responsible for fetching messages self.message_thread = None self.message_sync = MessageSync(self.api, self.home, self.proxy) # thread responsible for fetching replies self.reply_thread = None self.reply_sync = ReplySync(self.api, self.home, self.proxy) self.sync_flag = os.path.join(home, 'sync_flag') # File data. self.data_dir = os.path.join(self.home, 'data') self.gpg = GpgHelper(home, proxy)
def __init__(self, hostname, gui, session, home: str) -> None: """ The hostname, gui and session objects are used to coordinate with the various other layers of the application: the location of the SecureDrop proxy, the user interface and SqlAlchemy local storage respectively. """ check_dir_permissions(home) super().__init__() self.hostname = hostname # Location of the SecureDrop server. self.gui = gui # Reference to the UI window. self.api = None # Reference to the API for secure drop proxy. self.session = session # Reference to the SqlAlchemy session. self.api_thread = None # Currently active API call thread. self.sync_flag = os.path.join(home, 'sync_flag')