mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Warn the user if an unsupported, deprecated or unknown browser is detected. Fixes #5399
This commit is contained in:
parent
ee29e64039
commit
74b3495542
@ -15,6 +15,7 @@ New features
|
||||
| `Issue #5263 <https://redmine.postgresql.org/issues/5263>`_ - Added support of Foreign Tables to the Schema Diff.
|
||||
| `Issue #5264 <https://redmine.postgresql.org/issues/5264>`_ - Added support of Packages, Sequences and Synonyms to the Schema Diff.
|
||||
| `Issue #5353 <https://redmine.postgresql.org/issues/5353>`_ - Added an option to prevent a browser tab being opened at startup.
|
||||
| `Issue #5399 <https://redmine.postgresql.org/issues/5399>`_ - Warn the user if an unsupported, deprecated or unknown browser is detected.
|
||||
|
||||
Housekeeping
|
||||
************
|
||||
|
@ -359,6 +359,9 @@ UPGRADE_CHECK_KEY = 'pgadmin4'
|
||||
CA_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
||||
"cacert.pem")
|
||||
|
||||
# Check if the detected browser is supported
|
||||
CHECK_SUPPORTED_BROWSER = True
|
||||
|
||||
##########################################################################
|
||||
# Storage Manager storage url config settings
|
||||
# If user sets STORAGE_DIR to empty it will show all volumes if platform
|
||||
|
@ -543,6 +543,41 @@ def index():
|
||||
base_url=None
|
||||
)
|
||||
|
||||
# Check the browser is a support version
|
||||
# NOTE: If the checks here are updated, make sure the supported versions
|
||||
# at https://www.pgadmin.org/faq/#11 are updated to match!
|
||||
if config.CHECK_SUPPORTED_BROWSER:
|
||||
browser = request.user_agent.browser
|
||||
version = request.user_agent.version and int(
|
||||
request.user_agent.version.split('.')[0])
|
||||
|
||||
browser_name = None
|
||||
browser_known = True
|
||||
if browser == 'chrome' and version < 72:
|
||||
browser_name = 'Chrome'
|
||||
elif browser == 'firefox' and version < 65:
|
||||
browser_name = 'Firefox'
|
||||
elif browser == 'edge' and version < 44:
|
||||
browser_name = 'Edge'
|
||||
elif browser == 'safari' and version < 12:
|
||||
browser_name = 'Safari'
|
||||
elif browser == 'msie':
|
||||
browser_name = 'Internet Explorer'
|
||||
elif browser != 'chrome' and browser != 'firefox' and \
|
||||
browser != 'edge' and browser != 'safari':
|
||||
browser_name = browser
|
||||
browser_known = False
|
||||
|
||||
if browser_name is not None:
|
||||
msg = render_template(
|
||||
MODULE_NAME + "/browser.html",
|
||||
version=version,
|
||||
browser=browser_name,
|
||||
known=browser_known
|
||||
)
|
||||
|
||||
flash(msg, 'warning')
|
||||
|
||||
# Get the current version info from the website, and flash a message if
|
||||
# the user is out of date, and the check is enabled.
|
||||
if config.UPGRADE_CHECK_ENABLED:
|
||||
|
13
web/pgadmin/browser/templates/browser/browser.html
Normal file
13
web/pgadmin/browser/templates/browser/browser.html
Normal file
@ -0,0 +1,13 @@
|
||||
{% if known %}
|
||||
<p>{{ _('Your browser was detected as <strong>{0}</strong> version
|
||||
<strong>{1}</strong>, which is either deprecated or not supported by
|
||||
pgAdmin 4.').format(browser, version) }}</p>
|
||||
{% else %}
|
||||
<p>{{ _('Your browser was detected as <strong>{0}</strong> version
|
||||
<strong>{1}</strong>, which pgAdmin has not been tested with. pgAdmin may
|
||||
not work as expected, and any issues reported when using this browser may
|
||||
not be fixed.').format(browser, version) }}</p>
|
||||
{% endif %}
|
||||
<p>{{ _('Please visit the <a class="alert-link"
|
||||
href="https://www.pgadmin.org/faq/#11" target="_new">FAQ</a> to see the
|
||||
supported browsers.') }}</p>
|
Loading…
Reference in New Issue
Block a user