Skip to content

Commit

Permalink
- Fix Bottles install always trying to install MangoHud flatpak
Browse files Browse the repository at this point in the history
- Add error handling for Mullvad not having any available keys
- Add Gnome Loupe (new image viewer) to utilities
- Remove JetBrains IDEs from favorite apps list
- VPN connections are now configured first
  • Loading branch information
virtual-meme-machine committed Nov 19, 2023
1 parent 49a7496 commit 180bb42
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/options/application_flatpaks.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"operation_type": "flatpak",
"operation_args": [
"com.usebottles.bottles",
"org.freedesktop.Platform.VulkanLayer.MangoHud//22.08"
"org.freedesktop.Platform.VulkanLayer.MangoHud"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions resources/options/vpn_scripts.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
]
},
{
"name": "Mullvad VPN",
"description": "Configures and enables a WireGuard connection to Mullvad VPN",
"name": "Mullvad",
"description": "Configures and enables a WireGuard connection to Mullvad",
"documentation_link": "[Mullvad Website](https://mullvad.net)",
"default_state": false,
"category": "vpn",
Expand Down
1 change: 1 addition & 0 deletions src/scripts/set_app_picker_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"org.gnome.Connections.desktop",
"org.gnome.DiskUtility.desktop",
"org.gnome.eog.desktop",
"org.gnome.Loupe.desktop",
"org.gnome.Evince.desktop",
"org.gnome.FileRoller.desktop",
"org.gnome.font-viewer.desktop",
Expand Down
2 changes: 0 additions & 2 deletions src/scripts/set_favorite_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"org.signal.Signal.desktop",
"org.jitsi.jitsi-meet.desktop",
"com.vscodium.codium.desktop",
"jetbrains-pycharm.desktop",
"jetbrains-rider.desktop",
"com.usebottles.bottles.desktop",
"steam.desktop",
"com.spotify.Client.desktop",
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/vpn/mullvad.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def execute():
capture_output=True,
check=True,
text=True).stdout.strip()
if "Account does not exist" in server_address:
raise ConnectionError("Unable to retrieve server address from Mullvad API")
if "Account does not exist" in server_address or "KEY_LIMIT_REACHED" in server_address:
raise ConnectionError(f"Unable to retrieve server address: {server_address}")

endpoint_data: dict = json.loads(subprocess.run(["/usr/bin/curl", "-LsS",
"https://api.mullvad.net/public/relays/wireguard/v1/"],
Expand Down
2 changes: 1 addition & 1 deletion src/utils/flatpak_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __get_flatpak_list() -> list[str]:
"""
flatpak_list: list[str] = []

output = subprocess.run([FLATPAK_EXEC, "list", "--app", "--columns=application"],
output = subprocess.run([FLATPAK_EXEC, "list", "--columns=application"],
capture_output=True,
check=True,
text=True).stdout.strip()
Expand Down
18 changes: 17 additions & 1 deletion src/workflows/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import utils.dnf_utils as dnf_utils
import utils.flatpak_utils as flatpak_utils
from data.Category import Category
from data.OperationType import OperationType
from data.OptionStore import OptionStore
from data.OptionToggle import OptionToggle
from utils.caffeine_utils import activate_caffeine, deactivate_caffeine, deactivate_caffeine_exit
from utils.platform_utils import set_gsettings_values
from utils.print_utils import print_header
Expand All @@ -23,6 +25,7 @@ def setup(option_store: OptionStore):
package_install_rpmfusion_list: list[str] = []
package_remove_list: list[str] = []
script_list: list[str] = []
vpn_list: list[OptionToggle] = []

# Process selected options
for option_list in option_store.get_options_active().values():
Expand All @@ -38,7 +41,10 @@ def setup(option_store: OptionStore):
elif option.operation_type is OperationType.PACKAGE_REMOVE:
package_remove_list.extend(option.operation_args)
elif option.operation_type is OperationType.SCRIPT:
script_list.extend(option.operation_args)
if option.category is Category.VPN:
vpn_list.append(option)
else:
script_list.extend(option.operation_args)

# Check if any packages from RPMFusion are marked for install
enable_rpmfusion = False
Expand All @@ -58,6 +64,16 @@ def setup(option_store: OptionStore):
print_header("Prompting for Authentication")
set_sudo_password()

# Configure VPN connections
for vpn_option in vpn_list:
print_header(f"Configuring VPN Connection: '{vpn_option.name}'")
for vpn_script in vpn_option.operation_args:
try:
load_script(vpn_script).execute()
except (ConnectionError, CalledProcessError) as err:
print(f"VPN configuration failed, {err}")
deactivate_caffeine_exit()

# Install packages
if package_install_list:
print_header("Installing Packages")
Expand Down

0 comments on commit 180bb42

Please sign in to comment.