Files
disknext/ee/__init__.py
于小丘 ccadfe57cd
All checks were successful
Test / test (push) Successful in 1m45s
feat: migrate ORM base to sqlmodel-ext, add file viewers and WOPI integration
- Migrate SQLModel base classes, mixins, and database management to
  external sqlmodel-ext package; remove sqlmodels/base/, sqlmodels/mixin/,
  and sqlmodels/database.py
- Add file viewer/editor system with WOPI protocol support for
  collaborative editing (OnlyOffice, Collabora)
- Add enterprise edition license verification module (ee/)
- Add Dockerfile multi-stage build with Cython compilation support
- Add new dependencies: sqlmodel-ext, cryptography, whatthepatch

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:23:17 +08:00

43 lines
992 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
DiskNext Enterprise Edition (EE) 模块
通过 ``try: from ee import init_ee`` 检测是否存在。
CE 版本中此目录不存在ImportError 被 main.py 捕获。
"""
from loguru import logger as l
from utils.conf import appmeta
_ee_initialized: bool = False
def is_pro() -> bool:
"""当前实例是否以 Pro 版本运行。"""
return _ee_initialized
async def init_ee() -> None:
"""
初始化企业版功能。
1. 加载并验证许可证
2. 设置 appmeta.IsPro = True
3. 标记 EE 已初始化
许可证无效或缺失时抛出异常,阻止应用启动。
"""
global _ee_initialized
from ee.service.license_service import load_and_validate_license
payload = await load_and_validate_license()
appmeta.IsPro = True
_ee_initialized = True
l.info(
f"Pro 版本已激活 — 域名: {payload.domain}, "
f"过期: {payload.expires_at.isoformat()}, "
f"功能: {payload.features}"
)