Update application_controller.rb
This commit is contained in:
parent
a895216bda
commit
263c85486c
@ -2,41 +2,28 @@ class ApplicationController < ActionController::Base
|
||||
include SeoConcern
|
||||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
||||
# allow_browser versions: :modern
|
||||
allow_browser versions: :modern do |config|
|
||||
# 通用移动浏览器
|
||||
config.allow(/Mobile Safari/) # iOS Safari
|
||||
config.allow(/Chrome\/[\d.]+/) # Chrome 内核浏览器
|
||||
|
||||
# 国内主流浏览器
|
||||
config.allow(/Quark\/[\d.]+/) # 夸克浏览器
|
||||
config.allow(/HuaweiBrowser\/[\d.]+/) # 华为浏览器
|
||||
config.allow(/MiuiBrowser\/[\d.]+/) # 小米浏览器
|
||||
config.allow(/VivoBrowser\/[\d.]+/) # vivo浏览器
|
||||
config.allow(/OppoBrowser\/[\d.]+/) # OPPO浏览器
|
||||
config.allow(/UCBrowser\/[\d.]+/) # UC浏览器
|
||||
config.allow(/QQBrowser\/[\d.]+/) # QQ浏览器
|
||||
config.allow(/MicroMessenger\/[\d.]+/) # 微信内置浏览器
|
||||
config.allow(/Alipay/) # 支付宝内置浏览器
|
||||
config.allow(/BaiduBoxApp/) # 百度 App
|
||||
config.allow(/baiduboxapp/i) # 百度 App (小写)
|
||||
config.allow(/SogouMobile/) # 搜狗移动浏览器
|
||||
config.allow(/Weibo/) # 微博内置浏览器
|
||||
config.allow(/DingTalk/) # 钉钉内置浏览器
|
||||
config.allow(/ToutiaoMicroApp/) # 今日头条小程序
|
||||
config.allow(/BytedanceWebview/) # 字节跳动系浏览器
|
||||
config.allow(/ArkWeb/) # 鸿蒙浏览器
|
||||
|
||||
# 调试日志(开发环境)
|
||||
if Rails.env.development?
|
||||
config.on_failure do |browser|
|
||||
Rails.logger.info <<~INFO
|
||||
Browser blocked:
|
||||
Name: #{browser.name}
|
||||
Version: #{browser.version}
|
||||
User Agent: #{browser.ua}
|
||||
INFO
|
||||
end
|
||||
end
|
||||
allow_browser versions: :modern,
|
||||
patterns: [
|
||||
/Mobile Safari/,
|
||||
/Chrome\/[\d.]+/,
|
||||
/Quark\/[\d.]+/,
|
||||
/HuaweiBrowser\/[\d.]+/,
|
||||
/MiuiBrowser\/[\d.]+/,
|
||||
/VivoBrowser\/[\d.]+/,
|
||||
/OppoBrowser\/[\d.]+/,
|
||||
/UCBrowser\/[\d.]+/,
|
||||
/QQBrowser\/[\d.]+/,
|
||||
/MicroMessenger\/[\d.]+/,
|
||||
/Alipay/,
|
||||
/BaiduBoxApp/,
|
||||
/baiduboxapp/i,
|
||||
/SogouMobile/,
|
||||
/Weibo/,
|
||||
/DingTalk/,
|
||||
/ToutiaoMicroApp/,
|
||||
/BytedanceWebview/,
|
||||
/ArkWeb/
|
||||
]
|
||||
end
|
||||
before_action :set_locale
|
||||
after_action :track_action
|
||||
|
Loading…
Reference in New Issue
Block a user