Skip to content

Commit

Permalink
Use the Qubes isolation provider from CLI/GUI
Browse files Browse the repository at this point in the history
Autodetect in the CLI/GUI if we should run the conversion in disposable
qubes.
  • Loading branch information
deeplow authored and apyrgio committed Jun 21, 2023
1 parent baeab9d commit 5191556
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions dangerzone/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
from colorama import Back, Fore, Style

from . import args, errors
from .conversion.common import running_on_qubes
from .document import ARCHIVE_SUBDIR, SAFE_EXTENSION
from .isolation_provider.container import Container
from .isolation_provider.dummy import Dummy
from .isolation_provider.qubes import Qubes
from .logic import DangerzoneCore
from .util import get_version

Expand Down Expand Up @@ -63,6 +65,8 @@ def cli_main(

if getattr(sys, "dangerzone_dev", False) and dummy_conversion:
dangerzone = DangerzoneCore(Dummy())
elif running_on_qubes():
dangerzone = DangerzoneCore(Qubes())
else:
dangerzone = DangerzoneCore(Container(enable_timeouts=enable_timeouts))

Expand Down
5 changes: 5 additions & 0 deletions dangerzone/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
from PySide2 import QtCore, QtGui, QtWidgets

from .. import args, errors
from ..conversion.common import running_on_qubes
from ..document import Document
from ..isolation_provider.container import Container
from ..isolation_provider.dummy import Dummy
from ..isolation_provider.qubes import Qubes
from ..util import get_resource_path, get_version
from .logic import DangerzoneGui
from .main_window import MainWindow
Expand Down Expand Up @@ -100,6 +102,9 @@ def gui_main(
if getattr(sys, "dangerzone_dev", False) and dummy_conversion:
dummy = Dummy()
dangerzone = DangerzoneGui(app, isolation_provider=dummy)
elif running_on_qubes():
qubes = Qubes()
dangerzone = DangerzoneGui(app, isolation_provider=qubes)
else:
container = Container(enable_timeouts=enable_timeouts)
dangerzone = DangerzoneGui(app, isolation_provider=container)
Expand Down
7 changes: 5 additions & 2 deletions dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from ..document import SAFE_EXTENSION, Document
from ..isolation_provider.container import Container, NoContainerTechException
from ..isolation_provider.dummy import Dummy
from ..isolation_provider.qubes import Qubes
from ..util import get_resource_path, get_subprocess_startupinfo, get_version
from .logic import Alert, DangerzoneGui

Expand Down Expand Up @@ -71,8 +72,10 @@ def __init__(self, dangerzone: DangerzoneGui) -> None:
self.waiting_widget: WaitingWidget = WaitingWidgetContainer(self.dangerzone)
self.waiting_widget.finished.connect(self.waiting_finished)

elif isinstance(self.dangerzone.isolation_provider, Dummy):
# Don't wait with dummy converter
elif isinstance(self.dangerzone.isolation_provider, Dummy) or isinstance(
self.dangerzone.isolation_provider, Qubes
):
# Don't wait with dummy converter and on Qubes.
self.waiting_widget = WaitingWidget()
self.dangerzone.is_waiting_finished = True

Expand Down

0 comments on commit 5191556

Please sign in to comment.