mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 03:34:15 +02:00
[wgem] checking for fixes (not installing the fix yet )
This commit is contained in:
@@ -15,3 +15,4 @@ ELECTRON_DOWNLOAD_URL = 'https://github.com/electron/electron/releases/download/
|
|||||||
ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{version}/SHASUMS256.txt'
|
ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{version}/SHASUMS256.txt'
|
||||||
URL_ENVIRONMENT_SETTINGS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/environment.yml'
|
URL_ENVIRONMENT_SETTINGS = 'https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/environment.yml'
|
||||||
DESKTOP_ENTRY_PATH_PATTERN = DESKTOP_ENTRIES_DIR + '/bauh.web.{name}.desktop'
|
DESKTOP_ENTRY_PATH_PATTERN = DESKTOP_ENTRIES_DIR + '/bauh.web.{name}.desktop'
|
||||||
|
URL_FIX_PATTERN = "https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/fix/{url}.js"
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ from bauh.api.abstract.disk import DiskCacheLoader
|
|||||||
from bauh.api.abstract.handler import ProcessWatcher
|
from bauh.api.abstract.handler import ProcessWatcher
|
||||||
from bauh.api.abstract.model import SoftwarePackage, PackageAction, PackageSuggestion, PackageUpdate, PackageHistory
|
from bauh.api.abstract.model import SoftwarePackage, PackageAction, PackageSuggestion, PackageUpdate, PackageHistory
|
||||||
from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, SingleSelectComponent, \
|
from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOption, SingleSelectComponent, \
|
||||||
SelectViewType, TextInputComponent
|
SelectViewType
|
||||||
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
|
from bauh.gems.web import INSTALLED_PATH, nativefier, DESKTOP_ENTRY_PATH_PATTERN, URL_FIX_PATTERN
|
||||||
from bauh.gems.web.environment import EnvironmentUpdater
|
from bauh.gems.web.environment import EnvironmentUpdater
|
||||||
from bauh.gems.web.model import WebApplication
|
from bauh.gems.web.model import WebApplication
|
||||||
|
|
||||||
@@ -81,6 +81,15 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
|
|
||||||
return icon_url
|
return icon_url
|
||||||
|
|
||||||
|
def _get_fix_for(self, url_no_protocol: str) -> str:
|
||||||
|
res = self.http_client.get(URL_FIX_PATTERN.format(url=url_no_protocol))
|
||||||
|
|
||||||
|
if res:
|
||||||
|
return res.text
|
||||||
|
|
||||||
|
def _strip_url_protocol(self, url: str) -> str:
|
||||||
|
return RE_PROTOCOL_STRIP.split(url)[1].strip().lower()
|
||||||
|
|
||||||
def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_url: bool = False) -> SearchResult:
|
def search(self, words: str, disk_loader: DiskCacheLoader, limit: int = -1, is_url: bool = False) -> SearchResult:
|
||||||
res = SearchResult([], [], 0)
|
res = SearchResult([], [], 0)
|
||||||
|
|
||||||
@@ -89,9 +98,9 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
if is_url:
|
if is_url:
|
||||||
url = words[0:-1] if words.endswith('/') else words
|
url = words[0:-1] if words.endswith('/') else words
|
||||||
|
|
||||||
url_no_protocol = RE_PROTOCOL_STRIP.split(url)[1].strip().lower()
|
url_no_protocol = self._strip_url_protocol(url)
|
||||||
|
|
||||||
installed_matches = [app for app in installed if RE_PROTOCOL_STRIP.split(app.url)[1].strip().lower() == url_no_protocol]
|
installed_matches = [app for app in installed if self._strip_url_protocol(app.url)== url_no_protocol]
|
||||||
|
|
||||||
if installed_matches:
|
if installed_matches:
|
||||||
res.installed.extend(installed_matches)
|
res.installed.extend(installed_matches)
|
||||||
@@ -266,6 +275,13 @@ class WebApplicationManager(SoftwareManager):
|
|||||||
app_dir = '{}/{}'.format(INSTALLED_PATH, app_name_id)
|
app_dir = '{}/{}'.format(INSTALLED_PATH, app_name_id)
|
||||||
counter += 1
|
counter += 1
|
||||||
|
|
||||||
|
watcher.change_substatus(self.i18n['web.install.substatus.checking_fixes'])
|
||||||
|
fix = self._get_fix_for(url_no_protocol=self._strip_url_protocol(pkg.url))
|
||||||
|
|
||||||
|
if fix:
|
||||||
|
watcher.print('Fix found for {}'.format(pkg.url))
|
||||||
|
print(fix)
|
||||||
|
|
||||||
watcher.change_substatus(self.i18n['web.install.substatus.call_nativefier'].format(bold('nativefier')))
|
watcher.change_substatus(self.i18n['web.install.substatus.call_nativefier'].format(bold('nativefier')))
|
||||||
installed = handler.handle_simple(nativefier.install(url=pkg.url, name=pkg_name, output_dir=app_dir,
|
installed = handler.handle_simple(nativefier.install(url=pkg.url, name=pkg_name, output_dir=app_dir,
|
||||||
electron_version=self.env_settings['electron']['version'],
|
electron_version=self.env_settings['electron']['version'],
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ web.install.nativefier.error.inner_dir=The app installation directory was not fo
|
|||||||
web.install.substatus.call_nativefier=Running {}
|
web.install.substatus.call_nativefier=Running {}
|
||||||
web.install.substatus.shortcut=Generating a menu shortcut
|
web.install.substatus.shortcut=Generating a menu shortcut
|
||||||
web.install.substatus.options=Waiting for the installation options
|
web.install.substatus.options=Waiting for the installation options
|
||||||
|
web.install.substatus.checking_fixes=Checking if there are published fixes
|
||||||
web.install.option.single.label=Single
|
web.install.option.single.label=Single
|
||||||
web.install.option.single.tip=It will not allow the app to be opened again if it is already opened
|
web.install.option.single.tip=It will not allow the app to be opened again if it is already opened
|
||||||
web.install.option.max.label=Open maximized
|
web.install.option.max.label=Open maximized
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ web.install.nativefier.error.inner_dir=O diretório de instalação do aplicativ
|
|||||||
web.install.substatus.call_nativefier=Executando {}
|
web.install.substatus.call_nativefier=Executando {}
|
||||||
web.install.substatus.shortcut=Criando um atalho no menu
|
web.install.substatus.shortcut=Criando um atalho no menu
|
||||||
web.install.substatus.options=Aguardando as opções de instalação
|
web.install.substatus.options=Aguardando as opções de instalação
|
||||||
|
web.install.substatus.checking_fixes=Verificando se há correções publicadas
|
||||||
web.install.option.single.label=Único
|
web.install.option.single.label=Único
|
||||||
web.install.option.single.tip=Não permitirá que o aplicativo seja aberto novamente caso o mesmo já esteja
|
web.install.option.single.tip=Não permitirá que o aplicativo seja aberto novamente caso o mesmo já esteja
|
||||||
web.install.option.max.label=Abrir maximizado
|
web.install.option.max.label=Abrir maximizado
|
||||||
|
|||||||
17
bauh/gems/web/resources/suggestions.yml
Normal file
17
bauh/gems/web/resources/suggestions.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
youtube:
|
||||||
|
url: https://youtube.com
|
||||||
|
|
||||||
|
facebook:
|
||||||
|
url: https://facebook.com
|
||||||
|
|
||||||
|
outlook:
|
||||||
|
url: https://outlook.live.com
|
||||||
|
options:
|
||||||
|
- allow_urls
|
||||||
|
|
||||||
|
twitch:
|
||||||
|
url: https://twitch.tv
|
||||||
|
|
||||||
|
whatsapp:
|
||||||
|
url: https://web.whatsapp.com
|
||||||
|
icon_url:
|
||||||
Reference in New Issue
Block a user