Commit graph

186 commits

Author SHA1 Message Date
deeplow
82ac22e837
remove hardcoded 'docker' logging reference
Closes #122 as this was the last remaining hardcoded docker
reference where the code also applied to podman.
2022-09-15 12:17:22 +01:00
deeplow
57e455bbf1
remove "container" from container.py method names
Container-related methods recently moved to container.py no longer
need to have 'container' in their name as they are within the
container scope already.

Additonally it made it awkward to call from another module:

    from .. import container
    container.get_container_runtime()
2022-09-15 12:09:38 +01:00
deeplow
6202c0dba9
deduplicate container-tech-checking logic
The logic for detecting if we were are running on docker or podman
and identifying its respective binary were scattered across the
codebase. This centralizes it all in container.py
2022-09-15 12:09:37 +01:00
deeplow
a822870853
move global_common container logic to container.py
Container-specific methods in global_common class were basically
static methods. So it made sense to move these to container.py
2022-09-15 12:09:34 +01:00
deeplow
272281a29e
move to util: get_subprocess_startupinfo 2022-09-15 10:40:36 +01:00
deeplow
ce57fc0449
move get_resource_path to util.py
static methods that are used application-wide should belong to
the utilities python file.

inspired by @gmarmstrong's PR #166 on refactoring global_common
methods to be static and have a dzutil.py
2022-09-15 09:24:11 +01:00
deeplow
01a5e3b7ca
fix type hints for gui-common (CI would fail)
CI fails: https://app.circleci.com/pipelines/github/freedomofpress/dangerzone/397/workflows/cba836ed-98df-41f8-8f34-abcde5a8c015/jobs/1538
2022-09-13 13:17:20 +01:00
deeplow
f44e6521b6
better handle QFileDialog.getOpenFileName filename 2022-08-22 12:28:39 +01:00
deeplow
e0b3c5b599
resolve naming conflict: QWidget.update()
QWidget.update() is already a built-in Qt method [1]. This method
was unintentionally being overriden. Renamed it to update_progress
to fix it.

[1]: https://doc.qt.io/qtforpython-5/PySide2/QtWidgets/QWidget.html#PySide2.QtWidgets.PySide2.QtWidgets.QWidget.update
2022-08-22 11:13:37 +01:00
deeplow
75ce244195
type hint application wrapper monkeypatch
ignore method assignment. Currently mypy cannot check this.
Related upstream issues:
  - https://github.com/python/mypy/issues/2427
  - https://github.com/python/mypy/issues/708
2022-08-22 11:13:35 +01:00
deeplow
201bf5ec03
simplify ansi disabling on mac (removing type issues) 2022-08-22 11:12:20 +01:00
deeplow
46a62c1669
fix type hints with commonn input/output filename
Input_filename and output_filename could be None or Str. This lead
to typing issues where the static analysis type hint tool could not
check that the type colisions would not happen in runtime.

So the logic was replaced by throwing a runtime exception if either
of these valiables is ever used without first having been set.
2022-08-22 11:12:16 +01:00
deeplow
dcc0b269cd
fix typing for filename in gui_main (is optional) 2022-08-22 11:10:04 +01:00
deeplow
b1c039c4a4
add type hinting to systray (avoid circular imports) 2022-08-22 11:09:11 +01:00
deeplow
78daf75638
add type hint to GuiCommon app argument 2022-08-22 10:49:04 +01:00
deeplow
665e4d54f7
add type hints (1st pass: non problematic cases) 2022-08-22 10:33:28 +01:00
deeplow
d579a47a84
add type hints (1st pass: non problematic cases) 2022-08-22 10:33:23 +01:00
deeplow
4d8e4c53e3
sort imports with isort linter 2022-08-22 10:15:26 +01:00
deeplow
67d91be81a
replace prints with logging
fixes #144: printing non-ascii characters in a macOS application
opened directly from finder would sometimes lead to an error
message in /var/log/system.log similar to this:

  Failed to execute script 'dangerzone' due to unhandled exception:
  'ascii' codec can't encode character '\u201c' in position 1:
  ordinal not in range(128)
2022-08-18 12:07:23 +01:00
Micah Lee
ccb5d85afa
Fix "open with" Dangerzone in macOS 2021-12-14 10:21:42 -08:00
Micah Lee
d90097e7af
In GUI only use OCR if the OCR box is checked 2021-12-13 11:32:41 -08:00
Micah Lee
369ffe6cea
Allow opening external links in the WaitingWidget label 2021-11-30 14:59:05 -08:00
Micah Lee
89cf07d2b1
Remove obsolete status bar action 2021-11-30 09:59:05 -08:00
Micah Lee
8d40555bf5
Prevent background windows from popping up for subprocess calls in Windows 2021-11-29 14:55:31 -08:00
Micah Lee
e6d90a5729
Show more details on failure 2021-11-24 12:35:43 -08:00
Micah Lee
7c4f35e0f8
Delete old function in global_common, and remove useless stuff from container.convert 2021-11-23 16:20:51 -08:00
Micah Lee
edbd3aa88a
Set the path in macOS, so it can find /usr/local/bin/docker 2021-11-23 16:16:55 -08:00
Micah Lee
a7e0c3994d
Finish Docker Desktop flow 2021-11-22 15:02:29 -08:00
Micah Lee
a54e19fe11
Get WaitingWidget to properly check for and install the image 2021-11-22 14:37:53 -08:00
Micah Lee
42ce884419
Work on changing the WaitingWidget to check for Docker 2021-11-22 14:06:31 -08:00
Micah Lee
d1c33bfcf5
Begin ripping out VM logic, go back to Docker Desktop for Mac 2021-11-22 13:36:21 -08:00
Micah Lee
112291f82a
Remove unused dependencies 2021-11-22 11:37:05 -08:00
Micah Lee
47d6eb0d8b
Build vpnkit and hyperkit from source, remove Docker Desktop dependency to build, and add --allow-vm-login flag 2021-11-18 11:47:51 -08:00
Micah Lee
46681bc771 Start making Windows VM work with virtualbox 2021-08-09 14:05:07 -07:00
Micah Lee
173f31ff41 Start porting VM to Windows 2021-08-09 12:04:17 -07:00
Micah Lee
b82ffa2cac
Make it so windows remember if waiting has finished 2021-08-06 13:10:56 -07:00
Micah Lee
ea47a2e92c
Fix error message user interface 2021-08-06 12:58:02 -07:00
Micah Lee
7c756c194e
Add progress bar 2021-08-05 15:36:09 -07:00
Micah Lee
2c9787ff99
Rename TasksWidget to ConvertWidget 2021-08-05 15:08:51 -07:00
Micah Lee
450320de6f
Make GUI use the new container too 2021-08-04 16:41:47 -07:00
Micah Lee
4a2c92e911
Move just the single task into its own ConvertThread object 2021-08-04 15:20:38 -07:00
Micah Lee
0b1a5b2c2a
Show waiting widget when installing the containre in Linux too 2021-08-04 15:13:48 -07:00
Micah Lee
4a4deeb64f
Add support for non-VM containers again 2021-08-04 15:02:49 -07:00
Micah Lee
588206a9e8
Start implementing built-in container in Linux, without a VM 2021-08-04 14:42:46 -07:00
Micah Lee
ee5acf64b2
Make converter handle failure properly 2021-07-30 13:01:54 -07:00
Micah Lee
5cf97b9c73
Properly close window 2021-07-27 11:23:03 -07:00
Micah Lee
acaa7a9cd1
Work with dark theme 2021-07-27 11:14:41 -07:00
Micah Lee
7fcd10e404
Move main window content into widget, and either show content or the waiting widget, but never both 2021-07-27 11:06:20 -07:00
Micah Lee
9fcb304545
Lockdown ssh, and also temporarily comment out deleting containers on ISO build 2021-07-27 10:54:17 -07:00
Micah Lee
2c2f87593c
Keep ssh tunnel open with autossh, and give root user ssh keys so unprivileged user cant access the host 2021-07-14 11:36:13 -07:00
Micah Lee
3f76211459
Fix open in Preview for macOS 2021-07-02 13:48:20 -07:00
Micah Lee
488dca4a71
Totally refactor how tasks work and how dangerzone-container works so that there is a single --convert task 2021-07-02 13:32:23 -07:00
Micah Lee
fe63689320
Remove restart from systray and replace it with new window 2021-07-02 10:17:46 -07:00
Micah Lee
0b1d8f6a3e
Skip file open events in dev mode 2021-07-02 10:10:01 -07:00
Micah Lee
ed4586a051
Suppress output from all the VM subprocesses, and make the waiting for VM output nicer 2021-07-02 10:09:34 -07:00
Micah Lee
2904d44aad
Start making it possible to execute podman inside the VM 2021-07-01 16:45:25 -07:00
Micah Lee
c7bd8a317a
Move the MainWindow widgets into the same file, and move the vm object into global_common 2021-07-01 16:06:36 -07:00
Micah Lee
e81e6ccc6c
Remove everything related to updating the container image 2021-07-01 15:56:12 -07:00
Micah Lee
1f1bb2b353
Successfully wait for VM to start, and then move on in the UI 2021-07-01 15:52:19 -07:00
Micah Lee
29a148d211
Successfully set up reverse ssh forward system, allowing the host to run commands on the guest over ssh 2021-07-01 15:32:07 -07:00
Micah Lee
1c39895206
Refactor how VM image is created to split it into different files, and write ssh-to-host.py script 2021-07-01 11:02:08 -07:00
Micah Lee
da75559e3a
Start working on ssh reverse tunnel stuff 2021-06-30 16:21:40 -07:00
Micah Lee
9158d02669
Successfully boot VM 2021-06-30 14:27:26 -07:00
Micah Lee
d9d352a680
Fix removing PDF viewer search in Mac, and make the waiting widget look better 2021-06-30 12:31:33 -07:00
Micah Lee
2dd509f980
To allow the Apple sandbox, disable finding PDF viewers on Mac 2021-06-30 12:02:45 -07:00
Micah Lee
d7cd8584f2
Split Vm class from SysTray, and make it launch hyperkit 2021-06-30 10:45:38 -07:00
Micah Lee
e8f7d96f90
Fix building VM ISO, and start implementing start_vm 2021-06-29 17:37:00 -07:00
Micah Lee
7b2211fc1f
Rename rip_docker to install/vm-builder, and start making a build script that uses it 2021-06-29 17:01:47 -07:00
Micah Lee
cf28d47ffc
Merge branch 'master' into 118_rip_docker_desktop 2021-06-29 16:52:25 -07:00
Micah Lee
f4739e749a
Start adding systray 2021-06-29 16:52:10 -07:00
Micah Lee
e3dc7988e9
Make strip-ansi Mac-only 2021-06-22 13:40:08 -07:00
Micah Lee
d3d417ee84 Strip ANSI colors from Mac GUI output to preventing crashing, and fix Mac docker path 2021-06-22 13:34:15 -07:00
Micah Lee
f8381749c3
Improve terminal colors on light-colored terminal backgrounds 2021-06-22 10:49:51 -07:00
Micah Lee
d24d593094
Rip out everything required to make dangerzone-container run with root privs 2021-06-17 14:16:27 -07:00
Micah Lee
3c0dc74407 Change subprocess bullet character in one more places 2021-06-17 12:16:02 -07:00
Micah Lee
13adda0af5 Change subprocess bullet character to ">" to remove all the headaches 2021-06-17 11:40:38 -07:00
Micah Lee
77ac8e7d54 Switch subprocess bullet in GUI too 2021-06-17 11:22:41 -07:00
Micah Lee
04dcf72313 Don't display ANSI art banner in GUI mode because it prevents the app from opening in macOS from Finder 2021-06-17 11:17:55 -07:00
Micah Lee
3105a2c229 Change a bunch of stuff so Windows will work again 2021-06-16 16:55:25 -07:00
Micah Lee
05f00ca53f
Fix bugs with testing if docker is ready 2021-06-10 14:46:31 -07:00
Micah Lee
429d1e3f08
Display banner and pretty terminal output in GUI mode too 2021-06-10 12:03:24 -07:00
Micah Lee
38ea24393a
Beautiful CLI colors and formatting 2021-06-10 11:39:26 -07:00
Micah Lee
46c73329a5
Switch from termcolor to colorama 2021-06-10 10:24:28 -07:00
Micah Lee
73d412501c
Move the ConvertToPixels task validation into global_common so the CLI and GUI can share it 2021-06-09 16:32:06 -07:00
Micah Lee
8aaf7ebcf1
Start implementing CLI args, and start with validating custom containers and pulling the latest container 2021-06-09 16:15:19 -07:00
Micah Lee
6ff68f88ea
Refactor dangerzone to move GUI code into its own module 2021-06-09 15:24:03 -07:00