diff --git a/CHANGELOG.md b/CHANGELOG.md index 6baf20ef..29dc04c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ 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.8.5] - 2020-03- +### Fixes +- Web + - not able to inject javascript fixes ( WhatsApp Web not working) [#74](https://github.com/vinifmor/bauh/issues/74) + +### i18n +- Russian ( ru ): + - [leoneii](https://github.com/leoneii) - PRs: [#66](https://github.com/vinifmor/bauh/pull/66), [#67](https://github.com/vinifmor/bauh/pull/67), [#68](https://github.com/vinifmor/bauh/pull/68) + - [mountain-biker85](https://github.com/mountain-biker85) - PRs: [#70](https://github.com/vinifmor/bauh/pull/70), [#71](https://github.com/vinifmor/bauh/pull/71), [#72](https://github.com/vinifmor/bauh/pull/72), [#73](https://github.com/vinifmor/bauh/pull/73) + ## [0.8.4] - 2020-02-21 ### Improvements - UI diff --git a/bauh/__init__.py b/bauh/__init__.py index 8ffa3003..07a0597f 100644 --- a/bauh/__init__.py +++ b/bauh/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.8.4' +__version__ = '0.8.5' __app_name__ = 'bauh' import os diff --git a/bauh/gems/web/__init__.py b/bauh/gems/web/__init__.py index 1b3572ed..5fdeca49 100644 --- a/bauh/gems/web/__init__.py +++ b/bauh/gems/web/__init__.py @@ -8,6 +8,7 @@ ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home()) INSTALLED_PATH = '{}/installed'.format(WEB_PATH) ENV_PATH = '{}/env'.format(WEB_PATH) +FIXES_PATH = '{}/fixes'.format(WEB_PATH) NODE_DIR_PATH = '{}/node'.format(ENV_PATH) NODE_PATHS = {NODE_DIR_PATH + '/bin'} NODE_BIN_PATH = '{}/bin/node'.format(NODE_DIR_PATH) diff --git a/bauh/gems/web/controller.py b/bauh/gems/web/controller.py index 79169730..88ce8c56 100644 --- a/bauh/gems/web/controller.py +++ b/bauh/gems/web/controller.py @@ -29,7 +29,7 @@ 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 from bauh.gems.web import INSTALLED_PATH, nativefier, DESKTOP_ENTRY_PATH_PATTERN, URL_FIX_PATTERN, ENV_PATH, UA_CHROME, \ - SEARCH_INDEX_FILE, SUGGESTIONS_CACHE_FILE, ROOT_DIR, CONFIG_FILE, TEMP_PATH + SEARCH_INDEX_FILE, SUGGESTIONS_CACHE_FILE, ROOT_DIR, CONFIG_FILE, TEMP_PATH, FIXES_PATH from bauh.gems.web.config import read_config from bauh.gems.web.environment import EnvironmentUpdater, EnvironmentComponent from bauh.gems.web.model import WebApplication @@ -597,13 +597,18 @@ class WebApplicationManager(SoftwareManager): watcher.change_substatus(self.i18n['web.install.substatus.checking_fixes']) fix = self._get_fix_for(url_no_protocol=self._strip_url_protocol(pkg.url)) - fix_path = '{}/fix.js'.format(app_dir) + fix_path = '{}/{}.js'.format(FIXES_PATH, app_id) if fix: # just adding the fix as an installation option. The file will be written later self.logger.info('Fix found for {}'.format(pkg.url)) watcher.print('Fix found for {}'.format(pkg.url)) install_options.append('--inject={}'.format(fix_path)) + Path(FIXES_PATH).mkdir(exist_ok=True, parents=True) + + self.logger.info('Writting JS fix at {}'.format(fix_path)) + with open(fix_path, 'w+') as f: + f.write(fix) # if a custom icon is defined for an app suggestion: icon_path, icon_bytes = None, None @@ -652,12 +657,6 @@ class WebApplicationManager(SoftwareManager): shutil.rmtree(app_dir) os.rename(temp_dir, app_dir) - # injecting a fix - if fix: - self.logger.info('Writting JS fix at {}'.format(fix_path)) - with open(fix_path, 'w+') as f: - f.write(fix) - # persisting the custom suggestion icon in the defitive directory if icon_bytes: self.logger.info("Writting the final custom suggestion icon at {}".format(icon_path))