1. 新增 api-potluck 模块,支持 API 密钥认证和用量记录 2. 在 request-handler.js 中集成大锅饭路由和认证中间件 3. 在 common.js 中添加用量记录调用逻辑 4. 新增 potluck.html 静态页面和配置文件 api-potluck-keys.json
33 lines
587 B
JavaScript
33 lines
587 B
JavaScript
/**
|
|
* API 大锅饭 - 模块入口
|
|
* 导出所有功能供外部使用
|
|
*/
|
|
|
|
// Key 管理
|
|
export {
|
|
createKey,
|
|
listKeys,
|
|
getKey,
|
|
deleteKey,
|
|
updateKeyLimit,
|
|
resetKeyUsage,
|
|
toggleKey,
|
|
updateKeyName,
|
|
validateKey,
|
|
incrementUsage,
|
|
getStats,
|
|
KEY_PREFIX,
|
|
DEFAULT_DAILY_LIMIT
|
|
} from './key-manager.js';
|
|
|
|
// 中间件
|
|
export {
|
|
extractPotluckKey,
|
|
isPotluckRequest,
|
|
potluckAuthMiddleware,
|
|
recordPotluckUsage,
|
|
sendPotluckError
|
|
} from './middleware.js';
|
|
|
|
// API 路由
|
|
export { handlePotluckApiRoutes } from './api-routes.js';
|