mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
[fix][web] not able to inject javascript fixes
This commit is contained in:
10
CHANGELOG.md
10
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/).
|
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
|
## [0.8.4] - 2020-02-21
|
||||||
### Improvements
|
### Improvements
|
||||||
- UI
|
- UI
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__version__ = '0.8.4'
|
__version__ = '0.8.5'
|
||||||
__app_name__ = 'bauh'
|
__app_name__ = 'bauh'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||||||
WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home())
|
WEB_PATH = '{}/.local/share/bauh/web'.format(Path.home())
|
||||||
INSTALLED_PATH = '{}/installed'.format(WEB_PATH)
|
INSTALLED_PATH = '{}/installed'.format(WEB_PATH)
|
||||||
ENV_PATH = '{}/env'.format(WEB_PATH)
|
ENV_PATH = '{}/env'.format(WEB_PATH)
|
||||||
|
FIXES_PATH = '{}/fixes'.format(WEB_PATH)
|
||||||
NODE_DIR_PATH = '{}/node'.format(ENV_PATH)
|
NODE_DIR_PATH = '{}/node'.format(ENV_PATH)
|
||||||
NODE_PATHS = {NODE_DIR_PATH + '/bin'}
|
NODE_PATHS = {NODE_DIR_PATH + '/bin'}
|
||||||
NODE_BIN_PATH = '{}/bin/node'.format(NODE_DIR_PATH)
|
NODE_BIN_PATH = '{}/bin/node'.format(NODE_DIR_PATH)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ from bauh.commons.config import save_config
|
|||||||
from bauh.commons.html import bold
|
from bauh.commons.html import bold
|
||||||
from bauh.commons.system import ProcessHandler, get_dir_size, get_human_size_str
|
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, \
|
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.config import read_config
|
||||||
from bauh.gems.web.environment import EnvironmentUpdater, EnvironmentComponent
|
from bauh.gems.web.environment import EnvironmentUpdater, EnvironmentComponent
|
||||||
from bauh.gems.web.model import WebApplication
|
from bauh.gems.web.model import WebApplication
|
||||||
@@ -597,13 +597,18 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
|
|
||||||
watcher.change_substatus(self.i18n['web.install.substatus.checking_fixes'])
|
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 = 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:
|
if fix:
|
||||||
# just adding the fix as an installation option. The file will be written later
|
# just adding the fix as an installation option. The file will be written later
|
||||||
self.logger.info('Fix found for {}'.format(pkg.url))
|
self.logger.info('Fix found for {}'.format(pkg.url))
|
||||||
watcher.print('Fix found for {}'.format(pkg.url))
|
watcher.print('Fix found for {}'.format(pkg.url))
|
||||||
install_options.append('--inject={}'.format(fix_path))
|
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:
|
# if a custom icon is defined for an app suggestion:
|
||||||
icon_path, icon_bytes = None, None
|
icon_path, icon_bytes = None, None
|
||||||
@@ -652,12 +657,6 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
shutil.rmtree(app_dir)
|
shutil.rmtree(app_dir)
|
||||||
os.rename(temp_dir, 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
|
# persisting the custom suggestion icon in the defitive directory
|
||||||
if icon_bytes:
|
if icon_bytes:
|
||||||
self.logger.info("Writting the final custom suggestion icon at {}".format(icon_path))
|
self.logger.info("Writting the final custom suggestion icon at {}".format(icon_path))
|
||||||
|
|||||||
Reference in New Issue
Block a user