- 修改linux环境的logger依赖包
- 修正CSS火狐浏览器的兼容问题
- 修改Python版本要求为3.9及以上
This commit is contained in:
luojiaaoo 2025-03-09 00:04:11 +08:00
parent a377184e8c
commit 9ef60f0844
8 changed files with 61 additions and 41 deletions

3
.gitignore vendored
View File

@ -162,4 +162,5 @@ cython_debug/
#.idea/
# Custom
.__*.lock
.__*.lock
app.db

View File

@ -5,9 +5,9 @@
<p align="center">
<a href="https://gitee.com/luojiaaoo/DashGo"><img src="https://gitee.com/luojiaaoo/DashGo/badge/star.svg?theme=dark"></a>
<a href="https://github.com/luojiaaoo/Plotly-DashGo"><img src="https://img.shields.io/github/stars/luojiaaoo/Plotly-DashGo?style=social"></a>
<a href="https://gitee.com/luojiaaoo/DashGo"><img src="https://img.shields.io/badge/DashGo-v1.0.0-brightgreen.svg"></a>
<a href="https://gitee.com/luojiaaoo/DashGo"><img src="https://img.shields.io/badge/DashGo-v1.0.1-brightgreen.svg"></a>
<img src="https://img.shields.io/badge/license-MIT-blue.svg">
<img src="https://img.shields.io/badge/python-≥3.8-blue">
<img src="https://img.shields.io/badge/python-≥3.9-blue">
<img src="https://img.shields.io/badge/MySQL-≥5.7-blue">
<img src="https://img.shields.io/badge/Sqlite-blue">
</p>

View File

@ -1,4 +1,4 @@
ConcurrentLogHandler==0.9.1
concurrent_log_handler==0.9.25
dash==2.18.2
feffery_antd_components==0.3.15
feffery_utils_components==0.2.0rc27
@ -16,4 +16,4 @@ otpauth==2.1.1
Flask-Compress==1.15
orjson==3.10.7
psutil==6.0.0
PyMySQL==1.1.1
PyMySQL==1.1.1

View File

@ -2,10 +2,14 @@ from server import app
from common.utilities import util_jwt
from dash_view.pages import main, login
from common.utilities.util_menu_access import MenuAccess
from flask import session
from common.exception import NotFoundUserException
from config.access_factory import AccessFactory
from common.utilities.util_logger import Log
import sys
# 检查Python运行版本
if sys.version_info < (3, 9):
raise Exception("Python version must above 3.9 !!")
logger = Log.get_logger(__name__)
# 启动检查权限

View File

@ -0,0 +1,22 @@
from flask import request
from user_agents import parse
from typing import Literal, Optional
from dataclasses import dataclass
browser_type = Literal['Chrome', 'Firefox', 'Safari', 'IE', 'Edge', 'Opera', 'Other']
@dataclass
class BrowserInfo:
type: browser_type
version: Optional[int]
ip: str
def get_browser_info() -> BrowserInfo:
request_addr = request.remote_addr
user_string = str(request.user_agent)
user_agent = parse(user_string)
bw: browser_type = user_agent.browser.family
version: Optional[int] = user_agent.browser.version[0] if user_agent.browser.version else None
return BrowserInfo(type=bw.lower(), version=version, ip=request_addr)

View File

@ -1,10 +1,5 @@
import logging
import os
if os.name == 'nt':
from concurrent_log_handler import ConcurrentRotatingFileHandler
else:
from cloghandler import ConcurrentRotatingFileHandler
from concurrent_log_handler import ConcurrentRotatingFileHandler
from config.dashgo_conf import LogConf
# logging.error("An error occurred: %s", e, exc_info=True)

View File

@ -2,6 +2,7 @@ import feffery_antd_components as fac
from dash_view.framework.aside import render_aside_content
from dash_view.framework.head import render_head_content
from dash_view.framework.func import render_func_content
from common.utilities.util_browser import get_browser_info
from common.utilities.util_menu_access import MenuAccess
import feffery_utils_components as fuc
from i18n import t__default
@ -74,25 +75,26 @@ def render_content(menu_access: MenuAccess):
className={
'width': '100%',
'height': 'calc(100vh - 50px)',
# 美化滚动条
### 美化滚动条
'& .ant-tabs-content-holder': {
'height': '100%',
'overflow': 'auto',
'&::-webkit-scrollbar': {'width': '8px'},
'&::-webkit-scrollbar-track': {'background': '#fff', 'border-radius': '10px'},
'&::-webkit-scrollbar-thumb': {'background': 'rgba(144,147,153,.2)', 'border-radius': '10px'},
'&::-webkit-scrollbar-thumb:hover': {'background': 'rgba(144,147,153,.4)'},
},
'& .ant-tabs-content-holder > .ant-tabs-content': {
'height': '100%',
},
'& .ant-tabs-content-holder > .ant-tabs-content > .ant-tabs-tabpane': {
'height': '100%',
'paddingBottom': '8px',
},
'& .ant-tabs-nav': {
'margin': '8px 0 8px 0',
'scrollbar-width': 'thin',
'scrollbar-color': 'rgba(144,147,153,.2) #fff',
},
**(
{
'& .ant-tabs-content-holder::-webkit-scrollbar': {'width': '8px'},
'& .ant-tabs-content-holder::-webkit-scrollbar-track': {'background': '#fff', 'border-radius': '10px'},
'& .ant-tabs-content-holder::-webkit-scrollbar-thumb': {'background': 'rgba(144,147,153,.2)', 'border-radius': '10px'},
'& .ant-tabs-content-holder::-webkit-scrollbar-thumb:hover': {'background': 'rgba(144,147,153,.4)'},
}
if get_browser_info().type != 'firefox'
else {}
), ## 火狐浏览器不支持通过伪类自定义滚动条样式
'& .ant-tabs-content-holder > .ant-tabs-content': {'height': '100%'},
'& .ant-tabs-content-holder > .ant-tabs-content > .ant-tabs-tabpane': {'height': '100%', 'paddingBottom': '8px'},
'& .ant-tabs-nav': {'margin': '8px 0 8px 0'},
},
),
className={'height': 'calc(100vh - 50px)'},

View File

@ -1,6 +1,5 @@
from flask import request, redirect, send_from_directory, abort
from config.dashgo_conf import ShowConf, FlaskConf, CommonConf, PathProj
from user_agents import parse
from common.utilities.util_logger import Log
from common.exception import global_exception_handler
from common.utilities.util_dash import CustomDash
@ -57,16 +56,13 @@ def ban_admin():
# 获取用户浏览器信息
@server.before_request
def get_user_agent_info():
request_addr = request.remote_addr
user_string = str(request.user_agent)
user_agent = parse(user_string)
bw = user_agent.browser.family
if user_agent.browser.version != ():
bw_version = user_agent.browser.version[0]
if bw == 'IE':
return "<h1 style='color: red'>IP:{}, {}</h1>".format(request_addr, t__other('请不要使用IE内核浏览器'))
elif bw == 'Chrome' and bw_version < 88:
return "<h1 style='color: red'>IP:{}, {}</h1>".format(
request_addr,
t__other('Chrome内核版本号太低请升级浏览器'),
)
from common.utilities.util_browser import get_browser_info
browser_info = get_browser_info()
if browser_info.type == 'ie':
return "<h1 style='color: red'>IP:{}, {}</h1>".format(browser_info.ip, t__other('请不要使用IE内核浏览器'))
elif browser_info.type == 'chrome' and browser_info.version < 88:
return "<h1 style='color: red'>IP:{}, {}</h1>".format(
browser_info.ip,
t__other('Chrome内核版本号太低请升级浏览器'),
)