[PR #202] [MERGED] feat(api-potluck): 插件 - API 大锅饭 - 升级 V1.0.1 #299

Closed
opened 2026-02-27 07:18:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/202
Author: @leonaii
Created: 1/9/2026
Status: Merged
Merged: 1/9/2026
Merged by: @justlovemaki

Base: mainHead: main


📝 Commits (1)

  • 7edfdb1 feat(api-potluck): 插件 - API 大锅饭 - 升级 V1.0.1

📊 Changes

10 files changed (+4085 additions, -967 deletions)

View changed files

📝 .gitignore (+2 -1)
configs/api-potluck-data.json.example (+29 -0)
configs/api-potluck-keys.json.example (+16 -0)
📝 src/plugins/api-potluck/api-routes.js (+569 -47)
📝 src/plugins/api-potluck/index.js (+18 -9)
📝 src/plugins/api-potluck/key-manager.js (+229 -18)
📝 src/plugins/api-potluck/middleware.js (+1 -1)
src/plugins/api-potluck/user-data-manager.js (+721 -0)
📝 static/potluck-user.html (+1709 -801)
📝 static/potluck.html (+791 -90)

📄 Description

概述

本次更新为 API 大锅饭插件增加了配置热更新、凭证资源包管理、批量操作功能,并重构了管理端和用户端的 UI 样式。

主要变更

🔧 配置管理

  • 所有配置统一存储在 api-potluck-data.jsonconfig 字段
  • 支持热更新:defaultDailyLimitbonusPerCredentialbonusValidityDayspersistInterval
  • 管理端新增配置卡片和修改弹框

🎁 资源包系统

  • 用户上传健康凭证可获得资源包额度
  • 每日限额用尽后自动消耗资源包
  • 资源包有有效期限制,过期自动清理
  • 使用 SimpleMutex 保证并发安全

批量操作

  • 应用限额:将默认限额批量应用到所有 Key
  • 应用资源包:批量同步所有用户的资源包状态
  • 操作前有自定义确认弹框,提示风险

🎨 UI 重构

  • 管理端 potluck.html:统一深色主题,新增配置卡片、资源包显示、响应式优化
  • 用户端 potluck-user.html:统计卡片重构(每日用量、资源包、累计调用),凭证列表按添加时间倒序

🔌 API 新增

  • GET/PUT /api/potluck/config - 配置管理
  • POST /api/potluck/keys/apply-limit - 批量应用限额
  • POST /api/potluck/keys/apply-bonus - 批量同步资源包
  • POST /api/potluck/keys/:id/regenerate - 重新生成 Key
  • GET /api/potluckuser/credentials - 获取用户凭证列表
  • POST /api/potluckuser/credentials/check-all - 批量检查凭证健康状态
  • POST /api/potluckuser/regenerate-key - 用户重置自己的 Key

文件变更

文件 变更类型
src/plugins/api-potluck/user-data-manager.js 新增
src/plugins/api-potluck/key-manager.js 修改
src/plugins/api-potluck/api-routes.js 修改
src/plugins/api-potluck/index.js 修改
src/plugins/api-potluck/middleware.js 修改
static/potluck.html 修改
static/potluck-user.html 修改
configs/api-potluck-data.json.example 新增
configs/api-potluck-keys.json.example 新增
.gitignore 修改

兼容性

  • 向后兼容:自动迁移旧 Key 数据(添加 bonusRemaining 字段)
  • 配置文件不存在时使用默认值

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/justlovemaki/AIClient-2-API/pull/202 **Author:** [@leonaii](https://github.com/leonaii) **Created:** 1/9/2026 **Status:** ✅ Merged **Merged:** 1/9/2026 **Merged by:** [@justlovemaki](https://github.com/justlovemaki) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`7edfdb1`](https://github.com/justlovemaki/AIClient-2-API/commit/7edfdb14101ff067e15858e75de48c3b79f15c77) feat(api-potluck): 插件 - API 大锅饭 - 升级 V1.0.1 ### 📊 Changes **10 files changed** (+4085 additions, -967 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -1) ➕ `configs/api-potluck-data.json.example` (+29 -0) ➕ `configs/api-potluck-keys.json.example` (+16 -0) 📝 `src/plugins/api-potluck/api-routes.js` (+569 -47) 📝 `src/plugins/api-potluck/index.js` (+18 -9) 📝 `src/plugins/api-potluck/key-manager.js` (+229 -18) 📝 `src/plugins/api-potluck/middleware.js` (+1 -1) ➕ `src/plugins/api-potluck/user-data-manager.js` (+721 -0) 📝 `static/potluck-user.html` (+1709 -801) 📝 `static/potluck.html` (+791 -90) </details> ### 📄 Description ## 概述 本次更新为 API 大锅饭插件增加了配置热更新、凭证资源包管理、批量操作功能,并重构了管理端和用户端的 UI 样式。 ## 主要变更 ### 🔧 配置管理 - 所有配置统一存储在 `api-potluck-data.json` 的 `config` 字段 - 支持热更新:`defaultDailyLimit`、`bonusPerCredential`、`bonusValidityDays`、`persistInterval` - 管理端新增配置卡片和修改弹框 ### 🎁 资源包系统 - 用户上传健康凭证可获得资源包额度 - 每日限额用尽后自动消耗资源包 - 资源包有有效期限制,过期自动清理 - 使用 SimpleMutex 保证并发安全 ### ⚡ 批量操作 - **应用限额**:将默认限额批量应用到所有 Key - **应用资源包**:批量同步所有用户的资源包状态 - 操作前有自定义确认弹框,提示风险 ### 🎨 UI 重构 - 管理端 `potluck.html`:统一深色主题,新增配置卡片、资源包显示、响应式优化 - 用户端 `potluck-user.html`:统计卡片重构(每日用量、资源包、累计调用),凭证列表按添加时间倒序 ### 🔌 API 新增 - `GET/PUT /api/potluck/config` - 配置管理 - `POST /api/potluck/keys/apply-limit` - 批量应用限额 - `POST /api/potluck/keys/apply-bonus` - 批量同步资源包 - `POST /api/potluck/keys/:id/regenerate` - 重新生成 Key - `GET /api/potluckuser/credentials` - 获取用户凭证列表 - `POST /api/potluckuser/credentials/check-all` - 批量检查凭证健康状态 - `POST /api/potluckuser/regenerate-key` - 用户重置自己的 Key ## 文件变更 | 文件 | 变更类型 | |------|----------| | `src/plugins/api-potluck/user-data-manager.js` | 新增 | | `src/plugins/api-potluck/key-manager.js` | 修改 | | `src/plugins/api-potluck/api-routes.js` | 修改 | | `src/plugins/api-potluck/index.js` | 修改 | | `src/plugins/api-potluck/middleware.js` | 修改 | | `static/potluck.html` | 修改 | | `static/potluck-user.html` | 修改 | | `configs/api-potluck-data.json.example` | 新增 | | `configs/api-potluck-keys.json.example` | 新增 | | `.gitignore` | 修改 | ## 兼容性 - ✅ 向后兼容:自动迁移旧 Key 数据(添加 `bonusRemaining` 字段) - ✅ 配置文件不存在时使用默认值 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 07:18:52 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#299
No description provided.