diff --git a/README.md b/README.md index 38d2f844416dd8d4a65e709a1ec01df7380d08c7..2f3bf0098db21477746d7ddc8db9f6d39dd97b02 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@

logo

-

Dash-FastAPI-Admin v2.0.0

+

Dash-FastAPI-Admin v2.0.1

基于Dash+FastAPI前后端分离的纯Python快速开发框架

- + diff --git a/dash-fastapi-backend/.env.dev b/dash-fastapi-backend/.env.dev index 931468f1096f726bd88dbb1a2aa9cabf9c363034..67e44f0840a6da79d93a4fbbc93510cdf5e2321e 100644 --- a/dash-fastapi-backend/.env.dev +++ b/dash-fastapi-backend/.env.dev @@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 9099 # 应用版本 -APP_VERSION= '2.0.0' +APP_VERSION= '2.0.1' # 应用是否开启热重载 APP_RELOAD = true # 应用是否开启IP归属区域查询 diff --git a/dash-fastapi-backend/.env.prod b/dash-fastapi-backend/.env.prod index c812b1de72b24e2da5e5ba58fd280248c85436ae..545c3dbd3b66df1b9cfeaa7dcffec558f747af62 100644 --- a/dash-fastapi-backend/.env.prod +++ b/dash-fastapi-backend/.env.prod @@ -10,7 +10,7 @@ APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 9099 # 应用版本 -APP_VERSION= '2.0.0' +APP_VERSION= '2.0.1' # 应用是否开启热重载 APP_RELOAD = false # 应用是否开启IP归属区域查询 diff --git a/dash-fastapi-frontend/.env.dev b/dash-fastapi-frontend/.env.dev index ee7e0e7544a43d1cf1336f054def2168891e58ef..876a5a5dcacbe5225b9248eb88850a64f3b64e26 100644 --- a/dash-fastapi-frontend/.env.dev +++ b/dash-fastapi-frontend/.env.dev @@ -15,6 +15,8 @@ APP_SECRET_KEY = 'Dash-FastAPI-Admin' APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 8088 +# 应用版本 +APP_VERSION= '2.0.1' # 应用是否开启debug模式 APP_DEBUG = true # flask-compress压缩配置 diff --git a/dash-fastapi-frontend/.env.prod b/dash-fastapi-frontend/.env.prod index cf86c049daa1e2cebe6b44629c4506d06efff3f4..4cbc4fa1dfb6f50693e84b9da3d4eb0fe77af112 100644 --- a/dash-fastapi-frontend/.env.prod +++ b/dash-fastapi-frontend/.env.prod @@ -15,6 +15,8 @@ APP_SECRET_KEY = 'Dash-FastAPI-Admin' APP_HOST = '0.0.0.0' # 应用端口 APP_PORT = 8088 +# 应用版本 +APP_VERSION= '2.0.1' # 应用是否开启debug模式 APP_DEBUG = false # flask-compress压缩配置 diff --git a/dash-fastapi-frontend/server.py b/dash-fastapi-frontend/server.py index 853fe10e6ce1d579cadf6b3d7e348de3bfd0bc8d..e1bca53ee20d6edcc36a5cc40307d06faf02b574 100644 --- a/dash-fastapi-frontend/server.py +++ b/dash-fastapi-frontend/server.py @@ -46,7 +46,7 @@ def get_user_agent_info(): '用户使用IE内核', ) return "

请不要使用IE浏览器或360浏览器兼容模式

" - if bw_version < 71: + if bw == 'Chrome' and bw_version < 71: logger.warning( '[sys]请求人:{}||请求IP:{}||请求方法:{}||请求Data:{}', session.get('name'), diff --git a/dash-fastapi-frontend/utils/common_util.py b/dash-fastapi-frontend/utils/common_util.py index c7c80db538eb4168073fa5bf897cac825d7850f3..0dfae700deeed46b2f68245642b17960fd7fec9e 100644 --- a/dash-fastapi-frontend/utils/common_util.py +++ b/dash-fastapi-frontend/utils/common_util.py @@ -1,6 +1,32 @@ +from copy import deepcopy from typing import Dict, List, Union +class FilterUtil: + """ + 过滤工具类 + """ + + @classmethod + def fliter_params(cls, params_name: Union[str, List[str]], fliter_dict: Dict): + """ + 过滤字典数据中指定名称的参数 + + :param params_name: 需要过滤的参数名称 + :param fliter_dict: 需要过滤的字典数据 + :return: 过滤后的字典数据 + """ + copy_dict = deepcopy(fliter_dict) + if isinstance(params_name, str) and params_name in copy_dict: + copy_dict.pop(params_name) + elif isinstance(params_name, list): + for name in params_name: + if name in copy_dict: + copy_dict.pop(name) + + return copy_dict + + class ValidateUtil: """ 校验工具类 diff --git a/dash-fastapi-frontend/utils/request.py b/dash-fastapi-frontend/utils/request.py index 4ad69d6c5f48eb83e748c51eadb14e0a899a353d..684c209bd17d41c281dd5dac2e8e7db8dd01ce8c 100644 --- a/dash-fastapi-frontend/utils/request.py +++ b/dash-fastapi-frontend/utils/request.py @@ -11,6 +11,7 @@ from config.exception import ( ServiceWarning, ) from utils.cache_util import CacheManager +from utils.common_util import FilterUtil from utils.log_util import logger @@ -127,7 +128,18 @@ def api_request( if CacheManager.get('user_info') else None ) - request_params = ','.join([str(x) for x in data_list if x]) + request_params = ','.join( + [ + str( + FilterUtil.fliter_params( + params_name=['password', 'old_password', 'new_password'], + fliter_dict=x, + ) + ) + for x in data_list + if x + ] + ) log_message = LogMessage( request_user, remote_addr, diff --git a/dash-fastapi-frontend/wsgi.py b/dash-fastapi-frontend/wsgi.py index 4e50b7779111425dcb51975ae720aab0cdcec458..8bf1713abb5cc11aeb4371db698e2de8bfd2d6c6 100644 --- a/dash-fastapi-frontend/wsgi.py +++ b/dash-fastapi-frontend/wsgi.py @@ -5,5 +5,7 @@ from config.env import AppConfig serve( app.server, host=AppConfig.app_host, - port=AppConfig.app_port + port=AppConfig.app_port, + trusted_proxy='*', + trusted_proxy_headers='x-forwarded-for', )