mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
fix common
This commit is contained in:
@@ -28,7 +28,7 @@ class AppController(http.Controller):
|
|||||||
# 返回这个图片的base64编码
|
# 返回这个图片的base64编码
|
||||||
return base64.b64encode(BytesIO(response.content).read())
|
return base64.b64encode(BytesIO(response.content).read())
|
||||||
|
|
||||||
@http.route(['/my/ua', '/web/ua', '/web/ua/show'], auth='public', methods=['GET'])
|
@http.route(['/my/ua', '/wxa/ua', '/web/ua', '/web/ua/show'], auth='public', methods=['GET'])
|
||||||
def app_ua_show(self):
|
def app_ua_show(self):
|
||||||
# https://github.com/selwin/python-user-agents
|
# https://github.com/selwin/python-user-agents
|
||||||
ua_string = request.httprequest.headers.get('User-Agent')
|
ua_string = request.httprequest.headers.get('User-Agent')
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ def get_ua_type():
|
|||||||
# MicroMessenger: Mozilla/5.0 (Linux; Android 10; ELE-AL00 Build/HUAWEIELE-AL00; wv)
|
# MicroMessenger: Mozilla/5.0 (Linux; Android 10; ELE-AL00 Build/HUAWEIELE-AL00; wv)
|
||||||
# AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2767 MMWEBSDK/20210302 Mobile Safari/537.36 MMWEBID/6689 MicroMessenger/8.0.2.1860(0x2800023B) Process/appbrand2 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64
|
# AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2767 MMWEBSDK/20210302 Mobile Safari/537.36 MMWEBID/6689 MicroMessenger/8.0.2.1860(0x2800023B) Process/appbrand2 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64
|
||||||
# MiniProgramEnv/android
|
# MiniProgramEnv/android
|
||||||
|
# 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_7_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.37(0x18002529) NetType/WIFI Language/zh_CN'
|
||||||
# 微信浏览器,开发工具,小程序,iphone
|
# 微信浏览器,开发工具,小程序,iphone
|
||||||
# Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1
|
# Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1
|
||||||
# wechatdevtools/1.03.2011120 MicroMessenger/7.0.4 Language/zh_CN webview/
|
# wechatdevtools/1.03.2011120 MicroMessenger/7.0.4 Language/zh_CN webview/
|
||||||
@@ -142,7 +143,8 @@ def get_ua_type():
|
|||||||
# web 表示普通浏览器,后续更深入处理
|
# web 表示普通浏览器,后续更深入处理
|
||||||
utype = 'web'
|
utype = 'web'
|
||||||
# todo: 引入现成 py lib,处理企业微信
|
# todo: 引入现成 py lib,处理企业微信
|
||||||
if 'MicroMessenger' in ua and 'webdebugger' not in ua and ('MiniProgramEnv' in ua or 'wechatdevtools' in ua):
|
if 'MicroMessenger' in ua and 'webdebugger' not in ua \
|
||||||
|
and ('miniProgram' in ua or 'MiniProgram' in ua or 'MiniProgramEnv' in ua or 'wechatdevtools' in ua):
|
||||||
# 微信小程序及开发者工具
|
# 微信小程序及开发者工具
|
||||||
utype = 'wxapp'
|
utype = 'wxapp'
|
||||||
elif 'MicroMessenger' in ua:
|
elif 'MicroMessenger' in ua:
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ patch(UserMenu.prototype, "app_odoo_customize.UserMenu", {
|
|||||||
this.app_lang_list = session.app_lang_list;
|
this.app_lang_list = session.app_lang_list;
|
||||||
//todo: 演习 shortCutsItem 中的用法,当前是直接 xml 写了展现
|
//todo: 演习 shortCutsItem 中的用法,当前是直接 xml 写了展现
|
||||||
|
|
||||||
|
userMenuRegistry.add("refresh_current", refresh_current, {'force': true});
|
||||||
|
|
||||||
if (session.app_show_lang) {
|
if (session.app_show_lang) {
|
||||||
userMenuRegistry.add("separator1", separator1, {'force': true})
|
userMenuRegistry.add("separator1", separator1, {'force': true})
|
||||||
}
|
}
|
||||||
@@ -166,3 +168,15 @@ function odooAccountItem(env) {
|
|||||||
sequence: 60,
|
sequence: 60,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refresh_current(env) {
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
id: "refresh_current",
|
||||||
|
description: env._t("Refresh Page"),
|
||||||
|
callback: () => {
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
sequence: 58,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user