From d8924341d7a7b1d766fb4fc5541b8faf853ba235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Wed, 12 Feb 2020 11:35:57 -0300 Subject: [PATCH] [fix][web] not able to launch applications for the root user --- CHANGELOG.md | 8 +++++++- bauh/gems/web/controller.py | 6 +++--- bauh/gems/web/model.py | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8a25e44..adaec800 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - architecture dependencies are displayed on the info window as well - UI: - **Settings** available as a tray action as well - - minor fixes and improvements + - minor improvements + +### Fixes +- Web: + - not able to launch applications for the root user - handling internet timeout errors +- minor fixes + ## [0.8.2] - 2020-01-31 ### Features diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py index a8eaef11..f15f214f 100644 --- a/bauh/gems/web/controller.py +++ b/bauh/gems/web/controller.py @@ -24,7 +24,7 @@ from bauh.api.abstract.model import SoftwarePackage, PackageAction, PackageSugge from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, SingleSelectComponent, \ SelectViewType, TextInputComponent, FormComponent, FileChooserComponent, ViewComponent, PanelComponent from bauh.api.constants import DESKTOP_ENTRIES_DIR -from bauh.commons import resource +from bauh.commons import resource, user from bauh.commons.config import save_config from bauh.commons.html import bold from bauh.commons.system import ProcessHandler, get_dir_size, get_human_size_str @@ -707,7 +707,7 @@ class WebApplicationManager(SoftwareManager): Icon={icon} Exec={exec_path} {categories} - """.format(name=pkg.name, exec_path=pkg.get_exec_path(), + """.format(name=pkg.name, exec_path=pkg.get_command(), desc=pkg.description or pkg.url, icon=pkg.get_disk_icon_path(), categories='Categories={}'.format(';'.join(pkg.categories)) if pkg.categories else '') @@ -876,7 +876,7 @@ class WebApplicationManager(SoftwareManager): return True def launch(self, pkg: WebApplication): - subprocess.Popen(pkg.get_exec_path()) + subprocess.Popen(pkg.get_command()) def get_screenshots(self, pkg: SoftwarePackage) -> List[str]: pass diff --git a/bauh/gems/web/model.py b/bauh/gems/web/model.py index 572e3127..2cf19680 100644 --- a/bauh/gems/web/model.py +++ b/bauh/gems/web/model.py @@ -4,7 +4,7 @@ from pathlib import Path from typing import List from bauh.api.abstract.model import SoftwarePackage -from bauh.commons import resource +from bauh.commons import resource, user from bauh.gems.web import ROOT_DIR @@ -47,6 +47,10 @@ class WebApplication(SoftwarePackage): if self.installation_dir: return '{}/{}'.format(self.installation_dir, self.id) + def get_command(self) -> str: + if self.installation_dir: + return '{}{}'.format(self.get_exec_path(), '--no-sandbox' if user.is_root() else '') + def get_type(self): return 'web'