feat: 新增xq0031_xq0032 ERP报表导出插件,完成功能与基建更新
1. 新增xq0031_xq0032插件:包含前后端源码、打包脚本、配置文件与插件元数据 2. 新增内网文件服务器组件:exe、启停脚本、打包脚本与配置 3. 新增敏感凭证RSA加密下发能力与存储结构 4. 新增大文件源管理表与相关API 5. 优化登录流程与会话管理,新增Chrome自动化安装工具链 6. 清理废弃插件与示例代码 7. 更新版本号至1.1.3,完善安装包与.gitignore配置
This commit is contained in:
@@ -11,7 +11,6 @@ import secrets
|
||||
import threading
|
||||
import time
|
||||
import uuid
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Request, Response
|
||||
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||
@@ -84,6 +83,14 @@ def _dingtalk_establish(account: str, nickname: str, dingtalk_uid: str, response
|
||||
_sync_licensing(acct)
|
||||
except Exception as _exc: # noqa: BLE001 同步失败不影响登录本身
|
||||
_LOGGER.warning("登录后同步离线授权票据失败:%s", _exc)
|
||||
# 登录后刷新该账号敏感凭证(管理员可拉到;员工被服务端 403 拒绝 → 走本地缓存,无害)
|
||||
try:
|
||||
from webhost.backend.core import creds_sync
|
||||
_creds = creds_sync.load(acct)
|
||||
if _creds:
|
||||
config.apply_creds(_creds)
|
||||
except Exception as _exc: # noqa: BLE001 刷新失败不影响登录本身
|
||||
_LOGGER.warning("登录后敏感凭证刷新失败:%s", _exc)
|
||||
return {"ok": True, "account": acct, "is_admin": bool(r.get("is_admin")),
|
||||
"created": bool(r.get("created")), "must_change_pwd": bool(r.get("must_change_pwd"))}
|
||||
|
||||
@@ -131,21 +138,20 @@ def admin_dingtalk_inline_qr(request: Request) -> dict:
|
||||
|
||||
@router.get("/api/auth/dingtalk")
|
||||
def auth_dingtalk_url() -> dict:
|
||||
"""生成并返回钉钉扫码授权 URL(redirect_uri=本机 /auth/done)。前端「钉钉登录」当前窗口跳转该 URL。"""
|
||||
if not config.DINGTALK_APP_KEY:
|
||||
raise HTTPException(503, "未配置钉钉开放平台应用(DINGTALK_APP_KEY)")
|
||||
"""生成并返回钉钉扫码授权 URL(redirect_uri=本机 /auth/done),URL 由控制面代理构造。
|
||||
|
||||
执行机无需任何钉钉应用凭证(凭证只在控制面);前端「钉钉登录」当前窗口跳转该 URL,
|
||||
扫码后浏览器自动回跳本机 /auth/done。
|
||||
"""
|
||||
if not config.CONTROLPLANE_URL:
|
||||
raise HTTPException(503, "未配置中心机地址(CONTROLPLANE_URL)")
|
||||
state = _login_state_new()
|
||||
redirect_uri = f"http://localhost:{config.PORT}/auth/done"
|
||||
login_url = "https://login.dingtalk.com/oauth2/challenge.htm?" + urlencode({
|
||||
"redirect_uri": redirect_uri,
|
||||
"response_type": "code",
|
||||
"client_id": config.DINGTALK_APP_KEY,
|
||||
"scope": "openid",
|
||||
"prompt": "consent",
|
||||
"state": state})
|
||||
return {"url": login_url, "state": state}
|
||||
r = _cp_call(
|
||||
"GET", "/api/dingtalk/login-url",
|
||||
params={"back": redirect_uri, "state": state},
|
||||
headers=({"X-API-Token": config.CONTROLPLANE_TOKEN} if config.CONTROLPLANE_TOKEN else {}))
|
||||
return {"url": r.get("url") or "", "state": state}
|
||||
|
||||
|
||||
@router.get("/auth/done")
|
||||
|
||||
Reference in New Issue
Block a user