mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 20:55:49 +00:00
Gulpify build pipeline (#3145)
* Gulpify build pipeline * Update build frontend script * Fixes * Limit service worker to latest build * Use shorthand * Fix hassio build
This commit is contained in:
@@ -1,30 +1,7 @@
|
||||
"""Frontend for Home Assistant."""
|
||||
import os
|
||||
from user_agents import parse
|
||||
|
||||
FAMILY_MIN_VERSION = {
|
||||
'Chrome': 55, # Async/await
|
||||
'Chrome Mobile': 55,
|
||||
'Firefox': 52, # Async/await
|
||||
'Firefox Mobile': 52,
|
||||
'Opera': 42, # Async/await
|
||||
'Edge': 15, # Async/await
|
||||
'Safari': 10.1, # Async/await
|
||||
}
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def where():
|
||||
"""Return path to the frontend."""
|
||||
return os.path.dirname(__file__)
|
||||
|
||||
|
||||
def version(useragent):
|
||||
"""Get the version for given user agent."""
|
||||
useragent = parse(useragent)
|
||||
|
||||
# on iOS every browser uses the Safari engine
|
||||
if useragent.os.family == 'iOS':
|
||||
return useragent.os.version[0] >= FAMILY_MIN_VERSION['Safari']
|
||||
|
||||
version = FAMILY_MIN_VERSION.get(useragent.browser.family)
|
||||
return version and useragent.browser.version[0] >= version
|
||||
return Path(__file__).parent
|
||||
|
||||
Reference in New Issue
Block a user