[wgem] improved tray mode i18n | more suggestions

This commit is contained in:
Vinícius Moreira
2019-12-16 13:44:51 -03:00
parent 3fdf07bb7d
commit f7f1f32eb3
5 changed files with 59 additions and 12 deletions

View File

@@ -19,3 +19,4 @@ ELECTRON_SHA256_URL = 'https://github.com/electron/electron/releases/download/v{
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'
URL_FIX_PATTERN = "https://raw.githubusercontent.com/vinifmor/bauh-files/master/web/fix/{url}.js"
UA_CHROME = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36'

View File

@@ -23,8 +23,7 @@ from bauh.api.abstract.view import MessageType, MultipleSelectComponent, InputOp
from bauh.api.constants import DESKTOP_ENTRIES_DIR
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, environment, \
ENV_PATH
from bauh.gems.web import INSTALLED_PATH, nativefier, DESKTOP_ENTRY_PATH_PATTERN, URL_FIX_PATTERN, ENV_PATH, UA_CHROME
from bauh.gems.web.environment import EnvironmentUpdater
from bauh.gems.web.model import WebApplication
@@ -43,7 +42,7 @@ except:
RE_PROTOCOL_STRIP = re.compile(r'[a-zA-Z]+://')
RE_SEVERAL_SPACES = re.compile(r'\s+')
RE_SYMBOLS_SPLIT = re.compile(r'[\-|_\s]')
RE_SYMBOLS_SPLIT = re.compile(r'[\-|_\s:]')
class WebApplicationManager(SoftwareManager):
@@ -90,8 +89,12 @@ class WebApplicationManager(SoftwareManager):
if icon_url and not icon_url.startswith('http'):
icon_url = url + (icon_url if icon_url.startswith('/') else '/{}'.format(icon_url))
if icon_url:
return icon_url
if not icon_url:
icon_tag = soup.head.find('meta', attrs={"property": 'og:image'})
icon_url = icon_tag.get('content') if icon_tag else None
if 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))
@@ -120,7 +123,7 @@ class WebApplicationManager(SoftwareManager):
if installed_matches:
res.installed.extend(installed_matches)
else:
url_res = self.http_client.get(url, headers={'Accept-language': self._get_lang_header()}, ignore_ssl=True, single_call=True)
url_res = self.http_client.get(url, headers={'Accept-language': self._get_lang_header(), 'User-Agent': UA_CHROME}, ignore_ssl=True, single_call=True)
if url_res:
soup = BeautifulSoup(url_res.text, 'lxml', parse_only=SoupStrainer('head'))

View File

@@ -32,8 +32,8 @@ web.install.option.allow_urls.tip=It allows the application to internally open a
web.install.option.tray.label=Tray mode
web.install.option.tray.off.label=Off
web.install.option.tray.off.tip=Off
web.install.option.tray.default.label=Default
web.install.option.tray.default.tip=The app icon will be attached to the system tray allowing it to be quickly opened
web.install.option.tray.default.label=Open and attach
web.install.option.tray.default.tip=The app icon will be attached to the system tray after being opened
web.install.option.tray.min.label=Start minimized
web.install.option.tray.min.tip=The app will be started minimized as an icon in the system tray
web.install.option.category.none=none

View File

@@ -32,8 +32,8 @@ web.install.option.allow_urls.tip=Permite que o aplicativo abra internamente end
web.install.option.tray.label=Modo bandeja
web.install.option.tray.off.label=Desligado
web.install.option.tray.off.tip=Desligado
web.install.option.tray.default.label=Padrão
web.install.option.tray.default.tip=O ícone do aplicativo será anexado a bandeja do sistema permitindo que o mesma seja rapidamente aberto
web.install.option.tray.default.label=Abrir e anexar
web.install.option.tray.default.tip=O ícone do aplicativo será anexado a bandeja do sistema após aberto
web.install.option.tray.min.label=Iniciar minimizado
web.install.option.tray.min.tip=O aplicativo será iniciado minimizado como um ícone da bandeja do sistema
web.install.option.category.none=nenhuma

View File

@@ -1,29 +1,72 @@
youtube:
name: YouTube
url: https://youtube.com
category: Network
facebook:
name: Facebook
url: https://facebook.com
category: Network
options:
- tray_min
outlook:
name: Outlook
url: https://outlook.live.com
category: Network
options:
- allow_urls
twitch:
name: Twitch
url: https://twitch.tv
category: Network
whatsapp:
name: WhatsApp
url: https://web.whatsapp.com
category: Network
options:
- tray_min
telegram:
url: https://web.whatsapp.com
name: Telegram
url: https://web.telegram.org
category: Network
options:
- tray_min
slack:
name: Slack
url: https://slack.com
category: Network
options:
- tray_min
- tray_min
hangouts:
name: Hangouts
url: https://hangouts.google.com
category: Network
options:
- tray_min
office:
name: Microsoft Office
url: https://office.com
category: office
options:
- allow_urls
reddit:
name: Reddit
url: https://reddit.com
category: network
options:
- tray_min
google-drive:
name: Drive
url: https://drive.google.com
category: Utility
options:
- tray_min