- 新增 SystemNotification 模型,实现系统通知的数据存储 - 管理后台新增通知相关接口,支持通知的增删改查 - 用户端新增接口,获取最新激活通知并支持标记已读 - 在前端首页添加全局通知弹窗,实现通知自动轮询及已读同步 - 生成历史记录中兼容支持图片缩略图及新旧图片格式 - 优化后台图片同步逻辑,新增缩略图生成与存储 - 支持上传参考图的拖拽、粘贴、多文件上传及排序功能 - 增加购买积分页面入口及菜单项,调整菜单结构 - 日志系统由 Redis 列表迁移为有序集合,保留 30 天日志 - 优化日志页面样式,提升可读性及滚动体验 - 调整部分模板布局为自定义滚动条容器,增强视觉一致性
30 lines
684 B
Python
30 lines
684 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
TYPE_CHECKING = False
|
|
if TYPE_CHECKING:
|
|
from typing import Any, NoReturn, TypeGuard
|
|
|
|
from ._typing import StrOrBytesPath
|
|
|
|
|
|
def is_path(f: Any) -> TypeGuard[StrOrBytesPath]:
|
|
return isinstance(f, (bytes, str, os.PathLike))
|
|
|
|
|
|
class DeferredError:
|
|
def __init__(self, ex: BaseException):
|
|
self.ex = ex
|
|
|
|
def __getattr__(self, elt: str) -> NoReturn:
|
|
raise self.ex
|
|
|
|
@staticmethod
|
|
def new(ex: BaseException) -> Any:
|
|
"""
|
|
Creates an object that raises the wrapped exception ``ex`` when used,
|
|
and casts it to :py:obj:`~typing.Any` type.
|
|
"""
|
|
return DeferredError(ex)
|