Commit Graph

71 Commits

Author SHA1 Message Date
wzxjohn
252aff1203 Merge branch 'alpha' into feature/simple_stripe 2025-07-16 10:39:11 +08:00
t0ng7u
3338b1f598 feat: implement backend channel duplication & streamline frontend copy flow
Add a dedicated backend endpoint to clone an existing channel (including its key) and
replace all previous front-end cloning logic with a single API call.

Backend
• controller/channel.go
  – add CopyChannel: safely clone a channel, reset balance/usage, append name suffix,
    preserve key, create abilities, return new ID.
  – supports optional query params: `suffix`, `reset_balance`.
• router/api-router.go
  – register POST /api/channel/copy/:id (secured by AdminAuth).
• model interaction uses BatchInsertChannels to ensure transactional integrity.

Frontend
• ChannelsTable.js
  – simplify copySelectedChannel: call /api/channel/copy/{id} and refresh list.
  – remove complex field-manipulation & key-fetching logic.
  – improved error handling.

Security & stability
• All cloning done server-side; sensitive key never exposed to client.
• Route inherits existing admin middleware.
• Graceful JSON responses with detailed error messages.
2025-07-14 21:54:53 +08:00
wzxjohn
81d474ba3c feat: add stripe pay api support 2025-07-10 16:29:38 +08:00
t0ng7u
1ad9c97d7c 🗑️ feat(token): implement batch token deletion API & front-end integration
• Back-end
  • model/token.go
    • Add `BatchDeleteTokens(ids []int, userId int)` – transactional DB removal + async Redis cache cleanup.
  • controller/token.go
    • Introduce `TokenBatch` DTO and `DeleteTokenBatch` handler calling the model layer; returns amount deleted.
  • router/api-router.go
    • Register `POST /api/token/batch` route (user-scoped).

• Front-end (TokensTable.js)
  • Replace per-token deletion loops with single request to `/api/token/batch`.
  • Display dynamic i18n message: “Deleted {{count}} tokens!”.
  • Add modal confirmation:
    • Title “Batch delete token”.
    • Content “Are you sure you want to delete the selected {{count}} tokens?”.
  • UI/UX tweaks
    • Responsive button group (flex-wrap, mobile line-break).
    • Clear `selectedKeys` after refresh / successful deletion to avoid ghost selections.

• i18n
  • Ensure placeholder style matches translation keys (`{{count}}`).

This commit delivers efficient, scalable token management and an improved user experience across devices.
2025-06-22 16:35:30 +08:00
Apple\Apple
8748425aa2 🚀 feat(ratio-sync): major refactor & UX overhaul for Upstream Ratio Sync 2025-06-19 08:57:34 +08:00
Apple\Apple
bccb87fef3 feat: Add controller/console_migrate.go providing /api/option/migrate_console_setting endpoint for one-off data migration. 2025-06-14 01:05:09 +08:00
Apple\Apple
f5e3617cf7 🎫 feat: Enhance redemption code expiry handling & improve UI responsiveness
Backend
• Introduced `validateExpiredTime` helper in `controller/redemption.go`; reused in both Add & Update endpoints to enforce “expiry time must not be earlier than now”, eliminating duplicated checks
• Removed `RedemptionCodeStatusExpired` constant and all related references – expiry is now determined exclusively by the `expired_time` field for simpler, safer state management
• Simplified `DeleteInvalidRedemptions`: deletes codes that are `used` / `disabled` or `enabled` but already expired, without relying on extra status codes
• Controller no longer mutates `status` when listing or fetching redemption codes; clients derive expiry status from timestamp

Frontend
• Added reusable `isExpired` helper in `RedemptionsTable.js`; leveraged for:
  – status rendering (orange “Expired” tag)
  – action-menu enable/disable logic
  – row styling
• Removed duplicated inline expiry logic, improving readability and performance
• Adjusted toolbar layout: on small screens the “Clear invalid codes” button now wraps onto its own line, while “Add” & “Copy” remain grouped

Result
The codebase is now more maintainable, secure, and performant with no redundant constants, centralized validation, and cleaner UI behaviour across devices.
2025-06-13 20:51:20 +08:00
Apple\Apple
5f4d6648f7 ⏱️ feat: implement uptime monitoring
Introduce application uptime monitoring to improve observability and reliability.

• Add UptimeService to track process start time and expose uptime in seconds
• Create /health/uptime endpoint returning the current uptime in JSON format
• Integrate uptime metric into existing health-check middleware
• Update README with instructions for consuming the new endpoint
• Add unit tests covering UptimeService and new health route

This change enables operations teams and dashboards to programmatically
determine how long the service has been running, facilitating automated
alerts and trend analysis.
2025-06-11 02:28:36 +08:00
RedwindA
c4f664f376 🎨 feat(channel): add endpoint to retrieve models by tag 2025-06-08 01:16:27 +08:00
CaIon
f33ebc8e2c feat: Implement system setup functionality 2025-04-03 18:57:15 +08:00
wzxjohn
bdb1a2fcb9 feat: add oidc support 2025-03-11 15:52:03 +08:00
1808837298@qq.com
0aa30ed3f6 feat: Add new model management features
- Implement `/api/channel/models_enabled` endpoint to retrieve enabled models
- Add `EnabledListModels` handler in controller
- Create new `ModelRatioNotSetEditor` component for managing unset model ratios
- Update router to include new models_enabled route
- Add internationalization support for new model management UI
- Include GPT-4.5 preview model in OpenAI model list
2025-02-28 21:13:30 +08:00
1808837298@qq.com
0fcd243f56 feat: Add user notification settings with quota warning and multiple notification methods
- Implement user notification settings with email and webhook options
- Add new user settings for quota warning threshold and notification preferences
- Create backend API and database support for user notification configuration
- Enhance frontend personal settings with notification configuration UI
- Support custom notification email and webhook URL
- Add service layer for sending user notifications
2025-02-18 14:54:21 +08:00
CalciumIon
fe944b3c8d fix: oauth bind 2024-12-27 18:32:11 +08:00
CalciumIon
fe29ca04d5 feat: Implement batch tagging functionality for channels
- Added a new endpoint to batch set tags for multiple channels, allowing users to update tags efficiently.
- Introduced a new `BatchSetChannelTag` function in the controller to handle incoming requests and validate parameters.
- Updated the `BatchSetChannelTag` method in the model to manage database transactions and ensure data integrity during tag updates.
- Enhanced the ChannelsTable component in the frontend to support batch tag setting, including UI elements for user interaction.
- Updated localization files to include new translation keys related to batch operations and tag settings.
2024-12-25 14:19:00 +08:00
CalciumIon
b46efdc8c2 feat: Add FetchModels endpoint and refactor FetchUpstreamModels
- Introduced a new `FetchModels` endpoint to retrieve model IDs from a specified base URL and API key, enhancing flexibility for different channel types.
- Refactored `FetchUpstreamModels` to simplify base URL handling and improve error messages during response parsing.
- Updated API routes to include the new endpoint and adjusted the frontend to utilize the new fetch mechanism for model lists.
- Removed outdated checks for channel type in the frontend, streamlining the model fetching process.
2024-12-24 18:02:08 +08:00
CalciumIon
325de98738 feat: 渠道标签分组 2024-11-19 01:13:18 +08:00
seefs001
12de1faca9 feat: integrate Linux DO OAuth authentication 2024-11-10 23:56:22 +08:00
1808837298@qq.com
347cbf63bb fix: 修复用户可选分组不能选择用户分组 (close #528) 2024-10-14 16:22:22 +08:00
CalciumIon
4a02eb1b7f feat: 令牌分组 2024-09-18 05:19:49 +08:00
Xiangyuan Liu
05a4646b44 feat: suno api 支持
feat: 调试 suno

feat: 补充suno 文档
2024-06-13 10:35:48 +08:00
1808837298@qq.com
f723ff9ba0 feat: 增加重置模型倍率功能 (close #62) 2024-05-24 15:28:16 +08:00
bubu
35349a8f9a 添加同步上游模型列表按钮:添加提示以及支持已有渠道获取 2024-05-21 22:16:20 +08:00
CaIon
191fe6ea64 feat: 完善模型价格获取逻辑 2024-05-15 23:56:26 +08:00
CaIon
97acc9e5c4 feat: add pricing page 2024-05-13 23:02:35 +08:00
CaIon
e355c24725 feat: 填入相关模型 2024-05-12 19:07:33 +08:00
CaIon
80695f3c05 feat: vite 2024-03-23 19:09:09 +08:00
1808837298@qq.com
5ddb37c12f feat: add "/api/status/test" 2024-03-04 19:32:59 +08:00
Ehco
9a97408b29 Merge branch 'main' into telegram-login 2024-03-03 19:42:06 +08:00
1808837298@qq.com
ad47a3376f fix: 修复添加和编辑渠道无可选择模型 2024-03-03 15:53:48 +08:00
sljeff
a3bab7537b feat: telegram login and bind 2024-03-02 17:15:52 +08:00
CaIon
3c91d7539c feat: able to fix channels 2024-01-10 13:23:43 +08:00
CaIon
b45f3b1844 feat: 完善数据看板选择时间区间 2024-01-07 19:47:35 +08:00
CaIon
dd0abc9447 feat: 新增数据看板 2024-01-07 18:31:14 +08:00
CaIon
a12421ebe2 添加批量删除渠道功能 2023-12-14 16:35:03 +08:00
CaIon
3eb7843b2e 完善个人中心 2023-11-21 16:35:51 +08:00
CaIon
f0ba2fecc2 登录支持人机验证 2023-11-06 22:11:05 +08:00
CaIon
ba7e6324d3 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	README.md
#	go.mod
#	go.sum
#	model/log.go
#	web/src/App.js
#	web/src/components/ChannelsTable.js
2023-10-16 17:31:26 +08:00
JustSong
63bd941d99 feat: able to delete all disabled channels 2023-10-14 17:25:48 +08:00
JustSong
cfd3093b95 feat: able to delete all manually disabled channels (close #539) 2023-10-02 13:06:27 +08:00
CaIon
8a8202ae0f fix: enable cors for token routers and dashboard routers 2023-09-18 01:42:04 +08:00
CaIon
23d9554415 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	controller/log.go
#	controller/relay-audio.go
#	controller/relay-image.go
#	controller/relay-text.go
#	controller/relay.go
#	middleware/distributor.go
#	model/log.go
#	web/src/components/OperationSetting.js
2023-09-17 20:59:12 +08:00
JustSong
39328d65c2 feat: able to delete logs now (close #486) 2023-09-17 17:09:56 +08:00
CaIon
ac97409a3e Merge remote-tracking branch 'origin/main'
# Conflicts:
#	web/src/components/PersonalSetting.js
2023-09-15 18:01:06 +08:00
JustSong
8c779729c7 fix: fix oauth2 state not checking 2023-09-15 00:24:20 +08:00
CaIon
57edbac346 feat: 删除无用功能 2023-09-10 01:13:12 +08:00
CaIon
e60239c93d Merge remote-tracking branch 'origin/main'
# Conflicts:
#	controller/relay-text.go
#	go.mod
#	web/src/components/PersonalSetting.js
#	web/src/components/TokensTable.js
#	web/src/pages/Home/index.js
2023-08-25 00:51:02 +08:00
CaIon
68b24da6a6 add epay 2023-08-14 22:16:32 +08:00
JustSong
dbb5c5f505 fix: no need to check turnstile when process deletion 2023-08-06 22:28:07 +08:00
ckt
9412966b2c feat: able to delete account by self (#294)
* feat: support account deletion

* chore: update style

---------

Co-authored-by: JustSong <songquanpeng@foxmail.com>
2023-07-23 13:37:32 +08:00