mirror of
https://github.com/cnlimiter/codex-register.git
synced 2026-07-12 07:51:21 +08:00
feat(newapi): 添加 NEWAPI 上传功能及服务管理接口
- 新增 `newapi_upload.py` 文件,包含上传到 NEWAPI 的功能。 - 在数据库模型中添加 `NewapiService` 表及相关字段。 - 更新 CRUD 操作以支持 NEWAPI 服务的创建、更新、查询和删除。 - 添加新的 API 路由以管理 NEWAPI 服务。 - 前端实现批量上传和单个账号上传到 NEWAPI 的功能。 - 更新相关页面以支持 NEWAPI 服务的选择和管理。
This commit is contained in:
@@ -201,7 +201,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 上传服务设置(CPA + Sub2API + Team Manager) -->
|
||||
<!-- 上传服务设置(CPA + Sub2API + Team Manager + NEWAPI) -->
|
||||
<div class="tab-content" id="upload-tab">
|
||||
<!-- CPA 服务管理 -->
|
||||
<div class="card" style="margin-top: var(--spacing-lg);">
|
||||
@@ -281,6 +281,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-top: var(--spacing-lg);">
|
||||
<div class="card-header">
|
||||
<h3>🧩 NEWAPI 服务</h3>
|
||||
<button class="btn btn-primary btn-sm" id="add-newapi-service-btn">+ 添加服务</button>
|
||||
</div>
|
||||
<div class="card-body" style="padding: 0;">
|
||||
<div class="table-container">
|
||||
<table class="data-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:150px;">名称</th>
|
||||
<th>API URL</th>
|
||||
<th style="width:80px;">状态</th>
|
||||
<th style="width:60px;text-align:center;">优先级</th>
|
||||
<th style="width:220px;">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="newapi-services-table">
|
||||
<tr><td colspan="5" style="text-align:center;color:var(--text-muted);padding:20px;">加载中...</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Team Manager 服务编辑模态框 -->
|
||||
@@ -423,6 +448,50 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal" id="newapi-service-edit-modal">
|
||||
<div class="modal-content" style="max-width: 500px;">
|
||||
<div class="modal-header">
|
||||
<h3 id="newapi-service-modal-title">添加 NEWAPI 服务</h3>
|
||||
<button class="modal-close" id="close-newapi-service-modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="newapi-service-form">
|
||||
<input type="hidden" id="newapi-service-id">
|
||||
<div class="form-group">
|
||||
<label for="newapi-service-name">名称 *</label>
|
||||
<input type="text" id="newapi-service-name" placeholder="例如: 自建 New API" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="newapi-service-url">API URL *</label>
|
||||
<input type="text" id="newapi-service-url" placeholder="https://newapi.example.com" required>
|
||||
<p class="hint">填写 New API 根地址;连接测试为 <code>GET /api/user/login</code>,请求头 <code>Authorization: Bearer</code>(与<a href="https://docs.newapi.pro/zh/docs/api/management/auth" target="_blank" rel="noopener">鉴权说明</a>一致,Token 来自系统访问令牌)</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="newapi-service-key">Root Token / API Key *</label>
|
||||
<input type="password" id="newapi-service-key" placeholder="编辑时留空则保持原值" autocomplete="new-password">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group">
|
||||
<label for="newapi-service-priority">优先级</label>
|
||||
<input type="number" id="newapi-service-priority" value="0" min="0">
|
||||
<p class="hint">数字越小优先级越高</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label> </label>
|
||||
<label style="margin-top:10px;display:flex;align-items:center;gap:8px;">
|
||||
<input type="checkbox" id="newapi-service-enabled" checked> 启用
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">💾 保存</button>
|
||||
<button type="button" class="btn btn-secondary" id="cancel-newapi-service-btn">取消</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Outlook 配置 -->
|
||||
<div class="tab-content" id="outlook-tab">
|
||||
<div class="card">
|
||||
|
||||
Reference in New Issue
Block a user