feat(newapi): 添加 NEWAPI 上传功能及服务管理接口

- 新增 `newapi_upload.py` 文件,包含上传到 NEWAPI 的功能。
- 在数据库模型中添加 `NewapiService` 表及相关字段。
- 更新 CRUD 操作以支持 NEWAPI 服务的创建、更新、查询和删除。
- 添加新的 API 路由以管理 NEWAPI 服务。
- 前端实现批量上传和单个账号上传到 NEWAPI 的功能。
- 更新相关页面以支持 NEWAPI 服务的选择和管理。
This commit is contained in:
Jay Hsueh
2026-03-24 17:46:33 +08:00
parent 99a6d6cc04
commit 05e480a756
14 changed files with 814 additions and 4 deletions
+22
View File
@@ -136,6 +136,7 @@
<a href="#" class="dropdown-item" id="batch-upload-cpa-item">☁️ 上传到 CPA</a>
<a href="#" class="dropdown-item" id="batch-upload-sub2api-item">🔗 上传到 Sub2API</a>
<a href="#" class="dropdown-item" id="batch-upload-tm-item">🚀 上传到 Team Manager</a>
<a href="#" class="dropdown-item" id="batch-upload-newapi-item">🧩 上传到 NEWAPI</a>
</div>
</div>
<button class="btn btn-danger" id="batch-delete-btn" disabled>
@@ -170,6 +171,7 @@
<th style="width: 120px;">邮箱服务</th>
<th style="width: 80px;">状态</th>
<th style="width: 80px;">CPA</th>
<th style="width: 80px;">NEWAPI</th>
<th style="width: 80px;">订阅</th>
<th style="width: 140px;">最后刷新</th>
<th style="width: 160px;">操作</th>
@@ -277,6 +279,26 @@
</div>
</div>
<!-- NEWAPI 服务选择模态框 -->
<div class="modal" id="newapi-service-modal">
<div class="modal-content" style="max-width: 480px;">
<div class="modal-header">
<h3>🧩 选择 NEWAPI 服务</h3>
<button class="modal-close" id="close-newapi-modal">&times;</button>
</div>
<div class="modal-body">
<p style="color: var(--text-muted); margin-bottom: 12px; font-size: 0.9rem;">选择要上传到的 NEWAPI 服务,或自动选择第一个启用的服务。</p>
<div id="newapi-service-list" style="display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto;">
<div style="text-align: center; color: var(--text-muted);">加载中...</div>
</div>
</div>
<div class="modal-footer" style="padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end;">
<button class="btn btn-secondary" id="newapi-use-auto-btn">自动选择</button>
<button class="btn btn-secondary" id="cancel-newapi-modal-btn">取消</button>
</div>
</div>
</div>
<script src="/static/js/utils.js?v={{ static_version }}"></script>
<script src="/static/js/accounts.js?v={{ static_version }}"></script>
</body>