Skip to content

Commit

Permalink
0.9.24
Browse files Browse the repository at this point in the history
  • Loading branch information
vinifmor authored Dec 17, 2021
2 parents ad249b2 + 8c4c699 commit e626041
Show file tree
Hide file tree
Showing 58 changed files with 508 additions and 294 deletions.
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,45 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.9.24] 2021-12-17
### Features
- Web
- new custom action button to install apps (to improve usability since some users don't know about how to install Web apps through the search bar)
<p align="center">
<img src="https://raw.githubusercontent.com/vinifmor/bauh-files/master/pictures/releases/0.9.24/install_web_app.png">
</p>
- using the new Web environment specifications downloaded from [bauh-files](https://github.com/vinifmor/bauh-files/blob/master/web/env/v2/environment.yml)

### Improvements
- General
- handling http redirect errors
- memory usage improvements when retrieving available custom actions
- code refactoring

- AppImage
- not enabled for non-x86_64 systems

- Web
- using custom installation properties by Electron version if required (available on **bauh-files**). e.g: custom User-Agent for WhatsApp Web on Electron 13.6.X.
- checking for javascript fixes based on the Electron version (saved on disk as `~/.local/share/bauh/web/fixes/electron_{branch}/{app_name}.js`)
- handling http redirect errors
- installation form title
- default pre-selected installation category is now "Network" (Internet)

- UI
- only displaying a confirmation dialog for custom actions that start immediately
- not depending on system's confirmation dialog icon

### Fixes
- Web
- wrong spelling (i18n)

- UI
- crashing when resizing with floats instead of integers [#216](https://github.com/vinifmor/bauh/issues/216)
- crashing when using floats for spinner components [#217](https://github.com/vinifmor/bauh/issues/217)
- crashing for custom actions that can request a system backup (e.g: Arch -> Quick system upgrade)
- initialization panel's lower components positioning

## [0.9.23] 2021-12-10
### Features
- General
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ will be generated at `~/.local/share/bauh/web/env` (or `/usr/local/share/bauh/we
- It supports DRM protected content through a custom Electron implementation provided by [castLabs](https://github.com/castlabs/electron-releases). nativefier handles the switch between the official Electron and the custom.
- The isolated environment is created based on the settings defined in [environment.yml](https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/env/v1/environment.yml)
(downloaded during runtime).
- Some applications require Javascript fixes to properly work. If there is a known fix, bauh will download the file from [fix](https://github.com/vinifmor/bauh-files/tree/master/web/fix) and
attach it to the generated app.
- Some applications require Javascript fixes to properly work. If there is a known fix, bauh will download the file from [fix](https://github.com/vinifmor/bauh-files/tree/master/web/env/v2/fix) and
attach it to the generated app. The fix files are saved on the disk following the pattern `~/.local/share/bauh/web/fixes/electron_{branch}/{app_name}.js` (or `/usr/local/share/bauh/web/fixes/...` for **root**)
- The installed applications are located at `~/.local/share/bauh/installed` (or `/usr/local/share/bauh/web/installed` for **root**).
- A desktop entry / menu shortcut will be generated for the installed applications at `~/.local/share/applications` (or `/usr/share/applications` for **root**)
- If the Tray Mode **Start Minimized** is defined during the installation setup, a desktop entry will be also generated at `~/.config/autostart` (or `/etc/xdg/autostart` for **root**)
Expand Down
2 changes: 1 addition & 1 deletion bauh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.9.23'
__version__ = '0.9.24'
__app_name__ = 'bauh'

import os
Expand Down
8 changes: 4 additions & 4 deletions bauh/api/abstract/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from abc import ABC, abstractmethod
from enum import Enum
from pathlib import Path
from typing import List, Set, Type, Tuple, Optional
from typing import List, Set, Type, Tuple, Optional, Generator

import yaml

Expand Down Expand Up @@ -382,11 +382,11 @@ def save_settings(self, component: ViewComponent) -> Tuple[bool, Optional[List[s
"""
pass

def get_custom_actions(self) -> List[CustomSoftwareAction]:
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]:
"""
:return: custom actions
:return: generates available custom actions
"""
pass
yield from ()

def fill_sizes(self, pkgs: List[SoftwarePackage]):
pass
Expand Down
9 changes: 6 additions & 3 deletions bauh/api/abstract/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Optional
from typing import List, Optional, Iterable

from bauh.api.paths import CACHE_DIR

Expand All @@ -11,7 +11,8 @@ def __init__(self, i18n_label_key: str, i18n_status_key: str, icon_path: str, ma
requires_root: bool, manager: "SoftwareManager" = None,
backup: bool = False, refresh: bool = True,
i18n_confirm_key: str = None,
requires_internet: bool = False):
requires_internet: bool = False,
requires_confirmation: bool = True):
"""
:param i18n_label_key: the i18n key that will be used to display the action name
:param i18n_status_key: the i18n key that will be used to display the action name being executed
Expand All @@ -23,6 +24,7 @@ def __init__(self, i18n_label_key: str, i18n_status_key: str, icon_path: str, ma
:param refresh: if the a full app refresh should be done if the action succeeds
:param i18n_confirm_key: action confirmation message
:param requires_internet: if the action requires internet connection to be executed
:param requires_confirmation: if a confirmation popup should be displayed to the user before calling the action
"""
self.i18n_label_key = i18n_label_key
self.i18n_status_key = i18n_status_key
Expand All @@ -34,6 +36,7 @@ def __init__(self, i18n_label_key: str, i18n_status_key: str, icon_path: str, ma
self.refresh = refresh
self.i18n_confirm_key = i18n_confirm_key
self.requires_internet = requires_internet
self.requires_confirmation = requires_confirmation

def __hash__(self):
return self.i18n_label_key.__hash__() + self.i18n_status_key.__hash__() + self.manager_method.__hash__()
Expand Down Expand Up @@ -199,7 +202,7 @@ def get_publisher(self) -> str:
"""
pass

def get_custom_supported_actions(self) -> List[CustomSoftwareAction]:
def get_custom_actions(self) -> Optional[Iterable[CustomSoftwareAction]]:
"""
:return: custom supported actions
"""
Expand Down
4 changes: 2 additions & 2 deletions bauh/api/abstract/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ def get_tab(self, id_: str) -> TabComponent:

class RangeInputComponent(InputViewComponent):

def __init__(self, id_: str, label: str, tooltip: str, min_value: float, max_value: float,
step_value: float, value: float = None, max_width: int = None):
def __init__(self, id_: str, label: str, tooltip: str, min_value: int, max_value: int,
step_value: int, value: Optional[int] = None, max_width: int = None):
super(RangeInputComponent, self).__init__(id_=id_)
self.label = label
self.tooltip = tooltip
Expand Down
21 changes: 16 additions & 5 deletions bauh/api/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ def get(self, url: str, params: dict = None, headers: dict = None, allow_redirec
except Exception as e:
if isinstance(e, requests.exceptions.ConnectionError):
self.logger.error('Internet seems to be off')
raise
raise e
elif isinstance(e, requests.exceptions.TooManyRedirects):
self.logger.warning(f"Too many redirects for GET -> {url}")
raise e
elif e.__class__ in (requests.exceptions.MissingSchema, requests.exceptions.InvalidSchema):
self.logger.warning(f"The URL '{url}' has an invalid schema")
raise e

self.logger.error("Could not retrieve data from '{}'".format(url))
traceback.print_exc()
Expand Down Expand Up @@ -100,9 +106,14 @@ def get_content_length(self, url: str, session: bool = True) -> Optional[str]:

def exists(self, url: str, session: bool = True, timeout: int = 5) -> bool:
params = {'url': url, 'allow_redirects': True, 'verify': False, 'timeout': timeout}
if session:
res = self.session.head(**params)
else:
res = self.session.get(**params)

try:
if session:
res = self.session.head(**params)
else:
res = self.session.get(**params)
except requests.exceptions.TooManyRedirects:
self.logger.warning(f"{url} seems to exist, but too many redirects have happened")
return True

return res.status_code in (200, 403)
45 changes: 26 additions & 19 deletions bauh/gems/appimage/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import datetime
from math import floor
from pathlib import Path
from typing import Set, Type, List, Tuple, Optional
from typing import Set, Type, List, Tuple, Optional, Iterable, Generator

from colorama import Fore
from packaging.version import parse as parse_version
Expand All @@ -27,7 +27,7 @@
from bauh.commons import resource
from bauh.commons.boot import CreateConfigFile
from bauh.commons.html import bold
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, run_cmd, SimpleProcess
from bauh.commons.system import SystemProcess, new_subprocess, ProcessHandler, SimpleProcess
from bauh.gems.appimage import query, INSTALLATION_DIR, APPIMAGE_SHARED_DIR, ROOT_DIR, \
APPIMAGE_CONFIG_DIR, UPDATES_IGNORED_FILE, util, get_default_manual_installation_file_dir, DATABASE_APPS_FILE, \
DATABASE_RELEASES_FILE, APPIMAGE_CACHE_DIR, get_icon_path, DOWNLOAD_DIR
Expand Down Expand Up @@ -78,24 +78,13 @@ def __init__(self, context: ApplicationContext):
self.logger = context.logger
self.file_downloader = context.file_downloader
self.configman = AppImageConfigManager()
self.custom_actions = [CustomSoftwareAction(i18n_label_key='appimage.custom_action.install_file',
i18n_status_key='appimage.custom_action.install_file.status',
manager=self,
manager_method='install_file',
icon_path=resource.get_path('img/appimage.svg', ROOT_DIR),
requires_root=False),
CustomSoftwareAction(i18n_label_key='appimage.custom_action.update_db',
i18n_status_key='appimage.custom_action.update_db.status',
manager=self,
manager_method='update_database',
icon_path=resource.get_path('img/appimage.svg', ROOT_DIR),
requires_root=False,
requires_internet=True)]
self.custom_app_actions = [CustomSoftwareAction(i18n_label_key='appimage.custom_action.manual_update',
self._custom_actions: Optional[Iterable[CustomSoftwareAction]] = None
self.custom_app_actions = (CustomSoftwareAction(i18n_label_key='appimage.custom_action.manual_update',
i18n_status_key='appimage.custom_action.manual_update.status',
manager_method='update_file',
requires_root=False,
icon_path=resource.get_path('img/upgrade.svg', ROOT_DIR))]
icon_path=resource.get_path('img/upgrade.svg', ROOT_DIR),
requires_confirmation=False),)

def install_file(self, root_password: str, watcher: ProcessWatcher) -> bool:
file_chooser = FileChooserComponent(label=self.i18n['file'].capitalize(),
Expand Down Expand Up @@ -692,6 +681,9 @@ def _is_sqlite3_available(self) -> bool:
return bool(shutil.which('sqlite3'))

def can_work(self) -> Tuple[bool, Optional[str]]:
if not self.context.is_system_x86_64():
return False, self.i18n['message.requires_architecture'].format(arch=bold('x86_64'))

if not self._is_sqlite3_available():
return False, self.i18n['missing_dep'].format(dep=bold('sqlite3'))

Expand Down Expand Up @@ -859,8 +851,23 @@ def save_settings(self, component: PanelComponent) -> Tuple[bool, Optional[List[
except:
return False, [traceback.format_exc()]

def get_custom_actions(self) -> List[CustomSoftwareAction]:
return self.custom_actions
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]:
if self._custom_actions is None:
self._custom_actions = (CustomSoftwareAction(i18n_label_key='appimage.custom_action.install_file',
i18n_status_key='appimage.custom_action.install_file.status',
manager=self,
manager_method='install_file',
icon_path=resource.get_path('img/appimage.svg', ROOT_DIR),
requires_root=False,
requires_confirmation=False),
CustomSoftwareAction(i18n_label_key='appimage.custom_action.update_db',
i18n_status_key='appimage.custom_action.update_db.status',
manager=self,
manager_method='update_database',
icon_path=resource.get_path('img/appimage.svg', ROOT_DIR),
requires_root=False,
requires_internet=True))
yield from self._custom_actions

def get_upgrade_requirements(self, pkgs: List[AppImage], root_password: str, watcher: ProcessWatcher) -> UpgradeRequirements:
to_update = []
Expand Down
6 changes: 3 additions & 3 deletions bauh/gems/appimage/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re
from io import StringIO
from typing import List, Optional
from typing import List, Optional, Iterable

from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction
from bauh.commons import resource
Expand All @@ -19,7 +19,7 @@ def __init__(self, name: str = None, description: str = None, github: str = None
url_download: str = None, url_icon: str = None, url_screenshot: str = None, license: str = None, author: str = None,
categories=None, icon_path: str = None, installed: bool = False,
url_download_latest_version: str = None, local_file_path: str = None, imported: bool = False,
i18n: I18n = None, install_dir: str = None, custom_actions: List[CustomSoftwareAction] = None, updates_ignored: bool = False,
i18n: I18n = None, install_dir: str = None, custom_actions: Optional[Iterable[CustomSoftwareAction]] = None, updates_ignored: bool = False,
symlink: str = None, **kwargs):
super(AppImage, self).__init__(id=name, name=name, version=version, latest_version=version,
icon_url=url_icon, license=license, description=description,
Expand Down Expand Up @@ -108,7 +108,7 @@ def get_name_tooltip(self) -> str:

return self.name

def get_custom_supported_actions(self) -> List[CustomSoftwareAction]:
def get_custom_actions(self) -> Optional[Iterable[CustomSoftwareAction]]:
if self.imported:
return self.custom_actions

Expand Down
4 changes: 2 additions & 2 deletions bauh/gems/appimage/resources/locale/ca
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ appimage.config.database.expiration.tip=It defines the period (in minutes) in wh
appimage.config.suggestions.expiration=Suggestions expiration
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
appimage.custom_action.install_file=Install AppImage file
appimage.custom_action.install_file.details=Installation details
appimage.custom_action.install_file.details=AppImage installation details
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
appimage.custom_action.install_file.invalid_name=You must define a name for the application
appimage.custom_action.install_file.status=Installing AppImage file
appimage.custom_action.manual_update=Upgrade file
appimage.custom_action.manual_update.details=Upgrade details
appimage.custom_action.manual_update.details=AppImage upgrade details
appimage.custom_action.manual_update.status=Upgrading
appimage.custom_action.update_db=Update database
appimage.custom_action.update_db.status=Updating database
Expand Down
4 changes: 2 additions & 2 deletions bauh/gems/appimage/resources/locale/de
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ appimage.config.database.expiration.tip=It defines the period (in minutes) in wh
appimage.config.suggestions.expiration=Suggestions expiration
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
appimage.custom_action.install_file=Install AppImage file
appimage.custom_action.install_file.details=Installation details
appimage.custom_action.install_file.details=AppImage installation details
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
appimage.custom_action.install_file.invalid_name=You must define a name for the application
appimage.custom_action.install_file.status=Installing AppImage file
appimage.custom_action.manual_update=Upgrade file
appimage.custom_action.manual_update.details=Upgrade details
appimage.custom_action.manual_update.details=AppImage upgrade details
appimage.custom_action.manual_update.status=Upgrading
appimage.custom_action.update_db=Update database
appimage.custom_action.update_db.status=Updating database
Expand Down
4 changes: 2 additions & 2 deletions bauh/gems/appimage/resources/locale/en
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ appimage.config.database.expiration.tip=It defines the period (in minutes) in wh
appimage.config.suggestions.expiration=Suggestions expiration
appimage.config.suggestions.expiration.tip=It defines the period (in hours) in which the suggestions stored in disc will be considered up to date. Use 0 if you always want to update them.
appimage.custom_action.install_file=Install AppImage file
appimage.custom_action.install_file.details=Installation details
appimage.custom_action.install_file.details=AppImage installation details
appimage.custom_action.install_file.invalid_file=You must define a valid AppImage file
appimage.custom_action.install_file.invalid_name=You must define a name for the application
appimage.custom_action.install_file.status=Installing AppImage file
appimage.custom_action.manual_update=Upgrade file
appimage.custom_action.manual_update.details=Upgrade details
appimage.custom_action.manual_update.details=AppImage upgrade details
appimage.custom_action.manual_update.status=Upgrading
appimage.custom_action.update_db=Update database
appimage.custom_action.update_db.status=Updating database
Expand Down
Loading

0 comments on commit e626041

Please sign in to comment.