fix common

This commit is contained in:
ivan deng
2023-05-23 18:49:20 +08:00
parent 852b5afe1d
commit 099ea7682d
3 changed files with 18 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ class AppController(http.Controller):
# 返回这个图片的base64编码
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):
# https://github.com/selwin/python-user-agents
ua_string = request.httprequest.headers.get('User-Agent')

View File

@@ -130,6 +130,7 @@ def get_ua_type():
# 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
# 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
# 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/
@@ -142,7 +143,8 @@ def get_ua_type():
# web 表示普通浏览器,后续更深入处理
utype = 'web'
# 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'
elif 'MicroMessenger' in ua:

View File

@@ -19,6 +19,8 @@ patch(UserMenu.prototype, "app_odoo_customize.UserMenu", {
this.app_lang_list = session.app_lang_list;
//todo: 演习 shortCutsItem 中的用法,当前是直接 xml 写了展现
userMenuRegistry.add("refresh_current", refresh_current, {'force': true});
if (session.app_show_lang) {
userMenuRegistry.add("separator1", separator1, {'force': true})
}
@@ -166,3 +168,15 @@ function odooAccountItem(env) {
sequence: 60,
};
}
function refresh_current(env) {
return {
type: "item",
id: "refresh_current",
description: env._t("Refresh Page"),
callback: () => {
location.reload();
},
sequence: 58,
};
}