Compare commits

...
376 Commits
Author SHA1 Message Date
jinghui 8529ac2e60 docs: 更新部署镜像 tag 至 v1.5.1 2026-11-14 01:01:10 +08:00
jinghui 7f47841fdc feat(submission): 移除技能/插件提交入口,仅保留 MCP 服务
release / release (release) Canceled after 0s
2026-11-14 00:54:47 +08:00
jinghui f5b45af30a docs: README 增加国内镜像部署章节(docker run + docker-compose 两种方式)
release / release (release) Canceled after 0s
2026-11-13 22:07:52 +08:00
jinghui 851d45a573 feat(console): 用户中心新增发布 MCP 服务入口与我的提交记录
- 侧边栏新增「发布 MCP 服务」入口(Rocket 图标)跳转 /submit,补 zh-CN 翻译键
- /submit 新增「我的提交记录」:登录后展示自己的提交列表(类型/时间/状态徽章/审核备注),提交成功自动刷新
- 修复登录判断:改读 zustand store 的 user_token(原读 localStorage['user_token'],
  网页登录只写 zustand 不写该键,导致所有网页用户提交时误报「请先登录后再提交」)
- 列表加载改为按接口返回判定登录态(token 失效自动清空记录)
2026-11-13 22:07:50 +08:00
jinghui b7a10ca678 feat(ui): 站点货币单位由美元改为人民币
release / release (release) Canceled after 0s
- currency.ts: formatCurrency/formatPrice/formatBalance/getCurrencySymbol 默认币种
  USD→CNY,Intl locale en-US→zh-CN,显示为 ¥ 而非 CN¥
- 平台配置与管理后台默认 currency: USD→CNY
- 硬编码 $ 符号处(商品价格/余额表/充值弹窗/控制台营收/主题 Demo)全部改 ¥
- i18n: 'Minimum recharge amount is $1' key 改为 ¥1(中英同步)
- 说明: 易支付 exchange_rate=1,余额数值即人民币,仅改显示符号不改数值
2026-11-13 18:53:57 +08:00
jinghui 8f0796c031 fix(payment): epay异步回调免鉴权 + Dockerfile构建代理参数
release / release (release) Canceled after 0s
- /api/payment/callback_epay 与 refund_callback_epay 加入 NO_AUTH 白名单,
  易支付异步notify无用户token,此前被401拦截导致订单无法回执
- Dockerfile 增加 HTTP(S)_PROXY 构建参数,受限网络可构建
2026-11-13 18:16:29 +08:00
jinghui 721a2be32b feat(payment): integrate epay (易支付) gateway for CNY recharges
release / release (release) Canceled after 0s
- new EpayClient: V1 md5 signing, submit.php page pay, api.php order query
- create/verify epay payment links with CNY exchange-rate conversion
- signed async notify handler (/admin/payment/callback_epay) with amount
  check plus idempotent crediting, and a gateway query fallback
- epay channel config form, channel row and payment_method enum extended
- RechargeModal: send payment_method (was payment_channel, so every recharge
  fell through to Stripe and 500'd) and re-enable the channel picker
- payment config encryption key moved to a local .env, never committed
2026-11-13 15:17:05 +08:00
jinghui 1fbb6711f2 feat(submission): auto-publish approved submissions and expose review tab
- approving a submission now creates the McpService/McpToolApi records
- and records the published service id back on the submission
- review console folded into the admin console as a Submissions tab
- submit page rewritten around the shared submission API
2026-11-13 15:17:05 +08:00
jinghui d18adf035b feat(billing): per-service and platform-wide free call limits
release / release (release) Canceled after 0s
- mcp_service.free_daily_limit: per service, per user per day (NULL/0 = unlimited)
- sys_config free_global_daily_limit: applies to every free service
- effective limit = smaller of the two, so a service without its own value
  still inherits the global one
- admin: Pricing tab input, System Settings > Business > Free Call Limits
- submission review pages and endpoints (scaffolding, not yet published end to end)
- allow LAN IPs in http_utils, add docker-compose.yml
2026-11-13 10:20:25 +08:00
Dot.L 2fd6272bbd Update release.yaml 2026-10-26 19:02:45 +08:00
Liujian 470d53cad6 feat(mcp): support MCP 0728 stateless JSON-RPC protocol and pin mcp SDK version
- Implement stateless HTTP JSON-RPC request handling (discover, tools/list, tools/call)
- Support extracting apikey from Authorization and X-Api-Key headers
- Pin mcp dependency to '>=1.12.0,<2.0.0' to prevent breaking changes in v2.x
- Update docker-compose image tag and volume config
2026-10-26 18:57:48 +08:00
Liujian f2b61bae7d Change the mysql-connector-python dependency to pymysql 2026-05-18 11:00:07 +08:00
Dot.L 588f2770b7 Merge pull request #167 from xpack-ai/feature/fix-billing-transaction
Feature/fix billing transaction
2026-04-01 17:23:01 +08:00
Liujian ad743d6ab7 Cancel the _update_wallet_cache method from being included in transactions 2026-03-30 18:17:27 +08:00
Liujian 6145d0b005 _update_wallet_cache is also included in transactions. 2026-03-30 18:01:08 +08:00
Dot.L d147fcb070 Merge pull request #166 from xpack-ai/feature/fix-billing-transaction
Feature/fix billing transaction
2026-03-30 16:40:17 +08:00
Liujian 6196b93e97 The billing processor adds transaction processing and retry mechanisms. 2026-03-30 16:00:58 +08:00
Liujian b51933d625 Fixed the issue where access remained even after the API key was deleted. 2026-03-30 15:59:49 +08:00
Liujian 40ff118798 Handling billing transactions 2026-03-27 18:36:28 +08:00
Dot.L d470677abe Merge pull request #155 from xpack-ai/revert-154-dev
Revert "Dev"
2026-03-11 15:59:28 +08:00
Dot.L 6eac3c6100 Revert "Dev" 2026-03-11 15:56:53 +08:00
Dot.L d22513730a Merge pull request #154 from xpack-ai/dev
Dev
2026-03-11 15:56:36 +08:00
Dot.L 613cece94b Merge pull request #153 from xpack-ai/open-base
user service add update_password
2026-03-11 15:25:00 +08:00
Liujian 5cd1c12323 user service add update_password 2026-03-11 15:13:28 +08:00
Dot.L dcf73b25bf Merge pull request #152 from xpack-ai/open-base
update temp_mcp_service_repository.py
2026-03-11 11:37:35 +08:00
Liujian 64a67e9c8d update temp_mcp_service_repository.py 2026-03-11 11:36:30 +08:00
Dot.L b6160af3c5 Merge pull request #150 from xpack-ai/open-base
mcp service add sort and category_id
2026-03-11 10:57:22 +08:00
Liujian 2ea41dfb75 mcp service add sort and category_id 2026-03-11 10:56:54 +08:00
Dot.L cbcc419f0b Merge pull request #149 from xpack-ai/open-base
update tenant_id type
2026-03-10 18:42:45 +08:00
Liujian 687949beb2 update tenant_id type 2026-03-10 18:41:49 +08:00
Dot.L fedaa5f5df Merge pull request #148 from xpack-ai/open-base
update sys_config index
2026-03-10 16:19:17 +08:00
Liujian c272c87e1f update sys_config index 2026-03-10 16:18:34 +08:00
Dot.L 8a052ff910 Merge pull request #147 from xpack-ai/open-base
The concept of a tenant is added as the foundation of the SaaS code.
2026-03-10 15:37:05 +08:00
Liujian d1c7a4b8c0 The concept of a tenant is added as the foundation of the SaaS code. 2026-03-10 15:33:57 +08:00
Dot.L 1a104338e8 Merge pull request #144 from xpack-ai/feature/1.4-liujian
Feature/1.4 liujian
2026-02-28 16:02:01 +08:00
Liujian 5dd47b2d01 Redis client methods supplement 2026-02-28 15:53:35 +08:00
Dot.L a28de60b1c Merge pull request #143 from xpack-ai/feature/1.4-liujian
Adjustment of some interface permissions
2026-02-26 10:29:38 +08:00
Liujian e4a807b2a0 Delete Print code 2026-02-26 10:28:18 +08:00
Liujian d0e7ed2771 Remove authentication checks from /api/common/config and /api/common/homepage 2026-02-26 10:26:00 +08:00
Dot.L 05c0088f1b Merge pull request #142 from xpack-ai/feature/1.4-liujian
Adjust the streamable-http initialization connection waiting logic
2026-02-25 15:23:08 +08:00
Liujian 7f66cfd21e Adjust the streamable-http initialization connection waiting logic 2026-02-25 15:22:10 +08:00
Dot.L 05b48f3656 Merge pull request #141 from xpack-ai/feature/1.4-liujian
Fix: Removed permission verification from the user information retrie…
2026-02-25 15:18:58 +08:00
Liujian 07fe83b7b5 Fix: Removed permission verification from the user information retrieval interface. 2026-02-25 15:18:19 +08:00
Dot.L 5fa1cd741e Merge pull request #140 from xpack-ai/feature/1.4-liujian
Adjust the streamable-http initialization connection waiting timeout
2026-02-25 11:24:50 +08:00
Liujian 3e1d986c1c Adjust the streamable-http initialization connection waiting timeout 2026-02-25 11:24:23 +08:00
Dot.L 2cf95fd1c1 Merge pull request #139 from xpack-ai/feature/1.4-liujian
Adjust the streamable-http initialization connection waiting logic
2026-02-25 11:13:53 +08:00
Liujian 09b6811391 Adjust the streamable-http initialization connection waiting logic 2026-02-25 11:13:18 +08:00
Dot.L 08d326dc1f Merge pull request #138 from xpack-ai/feature/1.4-liujian
fix: Handle None message in custom MCP event store during priming event
2026-02-24 16:28:17 +08:00
Dot.L fb23d62fb2 Merge pull request #137 from xpack-ai/feature/1.4-liujian
fix: Handle None message in custom MCP event store during priming event
2026-02-24 15:16:14 +08:00
Liujian 79400146ea fix: Handle None message in custom MCP event store during priming event 2026-02-24 15:15:09 +08:00
Dot.L 503b3bf078 Merge pull request #136 from xpack-ai/feature/1.4-liujian
API adds user role verification
2026-02-23 19:10:38 +08:00
Dot.L eb4ecff6ed Merge pull request #135 from xpack-ai/feature/1.4-liujian
API adds user role verification
2026-02-14 11:24:00 +08:00
Liujian 7f8947f070 Modify payment-related interface permissions 2026-02-14 11:23:50 +08:00
Liujian 6dca9b08cc API adds user role verification 2026-02-14 10:03:22 +08:00
lcx 06034cf46e Merge remote-tracking branch 'origin/feature/cx-1.4' 2026-02-06 15:53:17 +08:00
ningyv ffdf931cad Merge pull request #134 from xpack-ai/feature/cx-1.4
chore: upgrade Next.js version
2026-02-06 15:36:06 +08:00
lcx 24e59f18d0 chore: upgrade Next.js version 2026-02-06 15:35:16 +08:00
lcx 5a538863b1 Merge remote-tracking branch 'origin/feature/cx-1.4' into dev 2026-02-06 14:49:55 +08:00
lcx f468fe270f chore: upgrade Next.js version 2026-02-06 14:49:10 +08:00
lcx 4cc8b87de5 chore: upgrade Next.js version 2026-02-06 14:44:28 +08:00
Dot.L f6e0130035 Merge pull request #132 from xpack-ai/feature/1.4-liujian
MySQL reconnection mechanism optimization
2026-02-05 13:43:56 +08:00
Dot.L d351afb732 Merge pull request #131 from xpack-ai/feature/1.4-liujian
Version 1.4 development completed
2026-02-03 10:18:43 +08:00
Liujian fab064975d MySQL reconnection mechanism optimization 2026-02-03 10:00:02 +08:00
ningyv 30a06d74d6 Merge pull request #130 from xpack-ai/feature/cx-1.4
Feature/cx 1.4
2026-02-02 17:56:01 +08:00
Dot.L 6f882845c2 Merge pull request #129 from xpack-ai/feature/1.4-liujian
Optimize return prompt words
2026-01-29 18:26:34 +08:00
Liujian 33d66e7d3b Optimize return prompt words 2026-01-29 18:26:06 +08:00
ningyv 5654f83644 Merge pull request #128 from xpack-ai/feature/cx-1.4
feat: 1.4 - List supports search
2026-01-29 18:13:24 +08:00
lcx b7c67cc44f feat: 1.4 - List supports search 2026-01-29 18:12:35 +08:00
Dot.L 6d15420b08 Merge pull request #127 from xpack-ai/feature/1.4-liujian
Optimize return prompt words
2026-01-29 18:07:56 +08:00
Liujian 32562b9c25 Optimize return prompt words 2026-01-29 18:07:28 +08:00
Dot.L 5469eca450 Merge pull request #126 from xpack-ai/feature/1.4-liujian
Optimize return prompt words
2026-01-29 17:51:28 +08:00
ningyv 94fd46c8ca Merge pull request #125 from xpack-ai/feature/cx-1.4
feat: 1.4 - List supports search
2026-01-29 17:51:15 +08:00
Liujian ffc09b7b83 Optimize return prompt words 2026-01-29 17:50:59 +08:00
lcx f4bd572fff feat: 1.4 - List supports search 2026-01-29 17:49:57 +08:00
Dot.L 57bd964d22 Merge pull request #124 from xpack-ai/feature/1.4-liujian
Optimize return prompt words
2026-01-29 16:31:00 +08:00
Liujian 3c4e2be1dd Optimize return prompt words 2026-01-29 16:30:30 +08:00
Dot.L aac3a187d1 Merge pull request #123 from xpack-ai/feature/1.4-liujian
Added logic to disable IP login after repeated login failures
2026-01-28 19:18:17 +08:00
Liujian c0ec39f1d6 Merge remote-tracking branch 'origin/dev' into feature/1.4-liujian
# Conflicts:
#	services/admin_service/controllers/auth.py
2026-01-28 19:17:58 +08:00
Liujian 22fa608220 Added logic to disable IP login after repeated login failures 2026-01-28 19:14:07 +08:00
Dot.L e20dacde6b Merge pull request #122 from xpack-ai/feature/1.4-liujian
1. Optimized the issue of duplicate names in newly created resource g…
2026-01-28 17:24:33 +08:00
Liujian fef2e2a1f7 1. Optimized the issue of duplicate names in newly created resource groups
2. Fixed the issue of new users not being bound to the default resource group after logging in
2026-01-28 17:23:56 +08:00
ningyv 3cb1cca751 Merge pull request #121 from xpack-ai/feature/cx-1.4
Feature/cx 1.4
2026-01-28 15:59:37 +08:00
lcx 71807c0c67 feat: 1.4 - List supports search 2026-01-28 15:58:48 +08:00
lcx 14e6b5c23b feat: 1.4 - List supports search 2026-01-28 15:47:26 +08:00
Dot.L 64d5b2abfc Merge pull request #120 from xpack-ai/feature/1.4-liujian
finish 1.4 api
2026-01-28 13:57:59 +08:00
Liujian fdbb077293 Merge remote-tracking branch 'origin/dev' into feature/1.4-liujian
# Conflicts:
#	services/admin_service/services/user_wallet_history_service.py
2026-01-28 13:57:45 +08:00
Liujian 10809113f4 finish 1.4 api 2026-01-28 13:56:14 +08:00
ningyv f592178d83 Merge pull request #119 from xpack-ai/hotfix/ui-cx
Hotfix/UI cx
2026-01-16 17:38:10 +08:00
ningyv db9a5d571c Merge pull request #118 from xpack-ai/hotfix/ui-cx
fix: Limit resource group name length to 255 characters or less
2026-01-16 17:35:08 +08:00
lcx 1ebac24a3b fix: Limit resource group name length to 255 characters or less 2026-01-16 17:34:09 +08:00
Dot.L 875a7bf906 Merge pull request #117 from xpack-ai/feature/1.3-liujian
Bug fixes and prompt optimizations.
2026-01-16 17:12:45 +08:00
Liujian bf79191194 Optimize the error message for login failures. 2026-01-16 17:10:02 +08:00
Liujian 24ee3078d8 fix bug: Failed to set SQLAlchemy list cache for key xpack:resource_group: id:.... 'list' object has no attribute '__table__'"} 2026-01-16 17:09:10 +08:00
Liujian 302277bad2 fix bug: OpenAPI requestBody Not Parsed for MCP Tools 2026-01-16 17:08:47 +08:00
Dot.L 6724801d60 Merge pull request #116 from xpack-ai/feature/1.3-liujian
Feature/1.3 liujian
2026-01-15 15:19:20 +08:00
Dot.L 51338373e7 Merge pull request #115 from xpack-ai/feature/1.3-liujian
Fixed an issue where deletion failed when there were no users in the …
2026-01-08 11:21:57 +08:00
Liujian aa2fd609c6 Fixed an issue where deletion failed when there were no users in the resource group. 2026-01-08 11:20:51 +08:00
Dot.L 46bdf470c8 Merge pull request #114 from xpack-ai/feature/1.3-liujian
Fixed an issue where deletion failed when there were no users in the …
2026-01-08 11:16:11 +08:00
Liujian 6b758c3acd Fixed an issue where deletion failed when there were no users in the resource group. 2026-01-08 11:13:35 +08:00
Dot.L 1589d6ef0a Merge pull request #113 from xpack-ai/feature/1.3-liujian
fix bug: Issues with duplicate data in resource group list pagination.
2026-01-07 18:09:07 +08:00
Liujian d55cc3e216 fix bug: Issues with duplicate data in resource group list pagination. 2026-01-07 18:08:26 +08:00
ningyv e1c59da804 Merge pull request #112 from xpack-ai/hotfix/ui-cx
fix: prevent "Deny All" resource group from being set as default
2026-01-07 17:41:17 +08:00
lcx 60c9698cdd fix: prevent "Deny All" resource group from being set as default 2026-01-07 17:39:50 +08:00
Dot.L 11de1de3b1 Merge pull request #111 from xpack-ai/feature/1.3-liujian
fix bug: Deleting MCP Service causes errors in all associated Resourc…
2026-01-07 17:08:42 +08:00
Liujian c16bab66ee fix bug: Deleting MCP Service causes errors in all associated Resource Groups 2026-01-07 17:08:12 +08:00
ningyv ec3bef1cae Merge pull request #110 from xpack-ai/hotfix/ui-cx
Hotfix/UI cx
2026-01-07 16:57:03 +08:00
lcx 060bcf7f73 fix: prevent "Allow All" resource group from being set as default 2026-01-07 16:49:59 +08:00
Dot.L 8394afe581 Merge pull request #109 from xpack-ai/feature/1.3-liujian
Feature/1.3 liujian
2026-01-05 14:30:22 +08:00
ningyv 85140f8bdc Merge pull request #108 from xpack-ai/feature/1.3-cx
Feature/1.3 cx
2026-01-05 14:03:07 +08:00
ningyv 595994de8c Merge pull request #107 from xpack-ai/feature/1.3-cx
feat: add MCP service tag filtering, transaction record viewing, and …
2026-01-05 11:53:15 +08:00
lcx ff725d766f feat: add MCP service tag filtering, transaction record viewing, and various optimizations 2026-01-05 11:52:27 +08:00
ningyv c7bbd0589c Merge pull request #106 from xpack-ai/feature/1.3-cx
feat: add MCP service tag filtering, transaction record viewing, and…
2026-01-04 19:03:39 +08:00
lcx cbfc4310b5 feat: add MCP service tag filtering, transaction record viewing, and various optimizations 2026-01-04 19:02:42 +08:00
ningyv 6f83fc7a88 Merge pull request #105 from xpack-ai/feature/1.3-cx
feat: add MCP service tag filtering, transaction record viewing, and …
2025-12-31 11:38:41 +08:00
lcx 714e19a4fc feat: add MCP service tag filtering, transaction record viewing, and various optimizations 2025-12-31 11:36:57 +08:00
Dot.L 64d559dd31 Merge pull request #104 from xpack-ai/feature/1.3-liujian
Change the balance_after field to balance
2025-12-30 18:44:06 +08:00
Liujian 50637087ae Change the balance_after field to balance 2025-12-30 18:43:35 +08:00
Dot.L d9fe780665 Merge pull request #103 from xpack-ai/feature/1.3-liujian
Change the balance_after field to balance
2025-12-30 18:41:51 +08:00
Liujian fa23805b5c Change the balance_after field to balance 2025-12-30 18:41:18 +08:00
ningyv 9d5d1ce2c5 Merge pull request #102 from xpack-ai/feature/1.3-cx
feat: add MCP service tag filtering, transaction record viewing, and …
2025-12-30 18:29:36 +08:00
lcx d6dea1f1e8 feat: add MCP service tag filtering, transaction record viewing, and various optimizations 2025-12-30 18:28:25 +08:00
Dot.L f9c8a74849 Merge pull request #101 from xpack-ai/feature/1.3-liujian
The transaction list now includes "balance" and "description" fields.
2025-12-30 15:09:03 +08:00
Liujian 915a2bcf9e The transaction list now includes "balance" and "description" fields. 2025-12-30 15:08:19 +08:00
Dot.L b23662d76a Merge pull request #100 from xpack-ai/feature/1.3-liujian
The system settings support setting the tag_bar_display variable.
2025-12-29 15:44:40 +08:00
Liujian 77ca12045d The system settings support setting the tag_bar_display variable. 2025-12-29 15:43:10 +08:00
Dot.L 4f27baf93a Merge pull request #99 from xpack-ai/feature/1.3-liujian
Feature/1.3 liujian
2025-12-29 14:20:19 +08:00
Liujian 88325a0ba9 1. Users can view transaction data on the client side.
2. The MCP service list supports tag filtering.
2025-12-29 14:19:26 +08:00
Dot.L 276817e624 Merge pull request #98 from xpack-ai/feature/scripts
update frontend_build.sh
2025-12-23 14:51:31 +08:00
Liujian 3a622c452a update frontend_build.sh 2025-12-23 14:50:53 +08:00
Liujian e26e6a7f24 fix: domain check error 2025-12-23 14:16:04 +08:00
Liujian 4d590bdb80 update start script 2025-12-22 17:24:46 +08:00
ningyv 2ee39124b0 Merge pull request #97 from xpack-ai/feat/resource-group-management
Feat/resource group management
2025-12-22 16:58:54 +08:00
ningyv 20f09ce044 Merge pull request #96 from xpack-ai/feat/resource-group-management
chore: upgrade Next.js to version 15.5.9
2025-12-22 16:51:55 +08:00
lcx 65128b1d2a chore: upgrade Next.js to version 15.5.9 2025-12-22 16:51:03 +08:00
ningyv cb93e5c5aa Merge pull request #95 from xpack-ai/feat/resource-group-management
chore: upgrade Next.js to version 15.5.9
2025-12-22 16:26:50 +08:00
lcx 5ce7cc4a2a chore: upgrade Next.js to version 15.5.9 2025-12-22 16:25:07 +08:00
Dot.L 6d33d99d94 Merge pull request #94 from xpack-ai/feature/resource_group
update 1.2.0 upgrade sql
2025-12-22 13:48:08 +08:00
Liujian 15fe7b4aff update 1.2.0 upgrade sql 2025-12-22 13:47:41 +08:00
Dot.L 8f340cb3d5 Merge pull request #93 from xpack-ai/feature/resource_group
Resource group functionality complete
2025-12-22 11:08:57 +08:00
Liujian dab04242e6 Resource group service list sorted in descending order of creation time 2025-12-22 11:07:54 +08:00
ningyv a1740ab227 Merge pull request #92 from xpack-ai/feat/resource-group-management
Feat/resource group management
2025-12-19 18:30:05 +08:00
Dot.L ae57e5b431 Merge pull request #91 from xpack-ai/feature/resource_group
Feature/resource group
2025-12-18 15:50:24 +08:00
Liujian 8abc7469cd fix: service configuration information reset when "Update from OpenAPI" 2025-12-18 15:43:18 +08:00
Liujian 2309de4025 1. fix: charge fees even if the call tool fails due to MCP service not being available/under maintenance.
2. fix: OpenAPI requestBody Not Parsed for MCP Tools
2025-12-18 15:19:32 +08:00
ningyv 06b71995f3 Merge pull request #90 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-18 15:19:19 +08:00
lcx c675b273a8 feat: resource-group-management 2025-12-18 15:18:23 +08:00
ningyv 52c135a7c6 Merge pull request #89 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-18 14:19:56 +08:00
lcx fbb06d3c53 feat: resource-group-management 2025-12-18 14:17:32 +08:00
Dot.L 2c5c28c74f Merge pull request #88 from xpack-ai/feature/resource_group
fix bug
2025-12-18 11:29:37 +08:00
Liujian ab04738aff fix bug 2025-12-18 11:28:50 +08:00
ningyv 1eb0e23971 Merge pull request #87 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-18 11:21:26 +08:00
lcx 0ae8a4037d feat: resource-group-management 2025-12-18 11:20:07 +08:00
Dot.L a0c2bfe9a6 Merge pull request #86 from xpack-ai/feature/resource_group
fix bug
2025-12-18 11:10:28 +08:00
Liujian 5fa4d25e44 fix bug 2025-12-18 11:10:00 +08:00
ningyv 9f55110fb3 Merge pull request #85 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-18 10:32:49 +08:00
lcx 5fd1025340 feat: resource-group-management 2025-12-18 10:31:56 +08:00
Dot.L 01cbdbe5b0 Merge pull request #84 from xpack-ai/feature/resource_group
fix bug
2025-12-17 19:07:44 +08:00
Liujian a744f5a6c4 1. fix: No reject when input domain with special character like "test_domain.com"
2. fix: When updating service with "Update from OpenAPI" in Tools Management tab, Tool URL is removed, when reloading it is displayed again.
2025-12-17 19:05:44 +08:00
ningyv 0e58492387 Merge pull request #83 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-17 18:47:54 +08:00
lcx d518efb843 feat: resource-group-management 2025-12-17 18:46:49 +08:00
Dot.L 8fabe93710 Merge pull request #82 from xpack-ai/feature/resource_group
Feature/resource group
2025-12-17 14:44:48 +08:00
Liujian 924bee4a96 Optimize login failure message 2025-12-17 14:44:16 +08:00
Liujian 2dcd42a546 MCP calls introduce resource group restrictions. 2025-12-17 14:33:31 +08:00
Liujian f416f4c278 Merge remote-tracking branch 'origin/dev' into feature/resource_group 2025-12-17 14:13:07 +08:00
ningyv 1b6d3bc5bd Merge pull request #81 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-16 18:40:16 +08:00
lcx 5d30306ad7 feat: resource-group-management 2025-12-16 18:39:04 +08:00
Dot.L 127327e226 Merge pull request #80 from xpack-ai/feature/resource_group
fix api: /api/web/mcp_service_info
2025-12-16 17:57:41 +08:00
Liujian c82718e155 fix api: /api/web/mcp_service_info 2025-12-16 17:56:38 +08:00
Dot.L 6ad1e01814 Merge pull request #79 from xpack-ai/feature/resource_group
Add an accessible service ID field to user information.
2025-12-16 17:44:51 +08:00
Liujian 1c6773a95b Add an accessible service ID field to user information. 2025-12-16 17:44:25 +08:00
ningyv b74a042f75 Merge pull request #78 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-16 15:48:13 +08:00
lcx c5a020c65c feat: resource-group-management 2025-12-16 15:47:11 +08:00
ningyv 61004e4686 Merge pull request #77 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-16 15:37:06 +08:00
lcx ff870630fa feat: resource-group-management 2025-12-16 15:36:16 +08:00
Dot.L 1da7e2a618 Merge pull request #76 from xpack-ai/feature/resource_group
Newly registered users use the default resource group.
2025-12-16 15:03:45 +08:00
Liujian de4b1bef32 Newly registered users use the default resource group. 2025-12-16 14:56:18 +08:00
Dot.L f5ba03ca33 Merge pull request #75 from xpack-ai/feature/resource_group
Added API:/api/mcp/service/resource_group/list/unbind
2025-12-16 14:46:19 +08:00
Liujian b00fca810d Added API:/api/mcp/service/resource_group/list/unbind 2025-12-16 14:45:45 +08:00
Dot.L 132f26e565 Merge pull request #74 from xpack-ai/feature/resource_group
Added API: /api/resource_group/service/list/unbind
2025-12-16 14:33:19 +08:00
Liujian c5854a1d6f Added API: /api/resource_group/service/list/unbind 2025-12-16 14:31:28 +08:00
ningyv d0caf957fe Merge pull request #73 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-16 14:30:17 +08:00
lcx fc3f633141 feat: resource-group-management 2025-12-16 14:29:18 +08:00
ningyv ada170e525 Merge pull request #72 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-16 14:20:53 +08:00
lcx 95ec31d5c0 feat: resource-group-management 2025-12-16 14:19:42 +08:00
Dot.L a6242af7b1 Merge pull request #71 from xpack-ai/feature/resource_group
fix: fail to delete resource group
2025-12-16 13:55:06 +08:00
Liujian 028de0338e fix: fail to delete resource group 2025-12-16 13:54:36 +08:00
Dot.L e6a197e709 Merge pull request #70 from xpack-ai/feature/resource_group
Service binding resource group related interfaces completed
2025-12-16 11:18:00 +08:00
Liujian 61a313d8ff Service binding resource group related interfaces completed 2025-12-16 11:16:56 +08:00
ningyv bbe94deedb Merge pull request #69 from xpack-ai/feat/resource-group-management
feat:  resource-group-management
2025-12-15 19:19:58 +08:00
lcx 5c90b8e1ca feat: resource-group-management 2025-12-15 18:52:37 +08:00
Dot.L 23f3c07d6b Merge pull request #68 from xpack-ai/feature/resource_group
update api: /api/mcp/service/list/simple
2025-12-15 18:15:47 +08:00
Liujian 27f76d5cf0 update api: /api/mcp/service/list/simple 2025-12-15 18:14:51 +08:00
Dot.L 732fefeb7e Merge pull request #67 from xpack-ai/feature/resource_group
update api: /api/resource_group_info
2025-12-15 18:08:57 +08:00
Liujian 6fb71a48fe update api: /api/resource_group_info 2025-12-15 18:08:16 +08:00
Dot.L 3daa8eaec1 Merge pull request #66 from xpack-ai/feature/resource_group
Added default resource groups: allow all and deny all
2025-12-15 17:59:08 +08:00
Liujian 811618d8e6 Added default resource groups: allow all and deny all 2025-12-15 17:58:33 +08:00
Dot.L 67819ad4d6 Merge pull request #65 from xpack-ai/feature/resource_group
finish resource group api
2025-12-15 16:55:36 +08:00
Liujian 6405713314 finish resource group api 2025-12-15 16:54:37 +08:00
riverLethe 60a6318663 fix:set mcp server edit rules, server id and server name change rule is max length 255 2025-12-11 18:14:32 +08:00
riverLethe 3e83446a2c fix:set mcp server edit rules, server id and server name change rule is max length 255 2025-12-11 18:14:04 +08:00
Dot.L d725e9d896 Merge pull request #64 from xpack-ai/feature/mcp
Check if base_url is valid
2025-12-08 10:17:17 +08:00
riverLethe 68c4b2fcc2 Merge branch 'main' of https://github.com/xpack-ai/XPack-MCP-Market 2025-12-08 09:08:25 +08:00
riverLethe 96db00418c feat:Add more constraints for server name, server ID, and api endpoint. 2025-12-08 09:08:09 +08:00
Liujian 2def6457fe Merge remote-tracking branch 'origin/main' into feature/mcp 2025-12-07 15:54:19 +08:00
Liujian b9123d68a0 Check if base_url is valid 2025-12-07 15:51:32 +08:00
Dot.L ebbf9b22da Merge pull request #63 from xpack-ai/feature/mcp
Bug fixes and improved prompts
2025-12-07 14:09:15 +08:00
Liujian eace543d74 Check if the price is a positive number. 2025-12-07 14:03:32 +08:00
Liujian 73cd1a01a0 Fix: Issue where billing continued even after calling the mcp tool failed. 2025-12-07 13:46:21 +08:00
Liujian 8186b4c0b5 fix: User Dashboard - AuthKey Analytics: display Total spending discrepancy 2025-12-06 00:50:36 +09:00
Liujian 5023e4494c fix: The balance field has an incorrect data type; it should be Decimal. 2025-12-05 23:50:41 +09:00
Liujian e2d360d5de fix: Balance Doubled When Depositing Funds 2025-12-05 22:57:44 +09:00
Liujian 948046948a fix:Relate to transaction_id value when admin recharge for user 2025-12-05 21:50:48 +09:00
Liujian 4e3fd1afaf fix: login failed 2025-12-05 12:17:49 +09:00
Liujian e2ae502b48 fix bug:Admin upload image should support format GIF, SVG to update logo 2025-12-05 11:02:07 +09:00
Liujian 6561435a38 Merge remote-tracking branch 'origin/main' into feature/mcp 2025-12-05 10:59:48 +09:00
Liujian 1846aafc1e fix bug:
1. Service_type do not set after add server
2. Issue relate pricing when "Update from OpenAPI"
3. Failed to set SQLAlchemy cache for key Error
4. Request Body Logging in Internal Service
5. Deleted API Key Remains Valid for 5 Minutes
2025-12-05 10:27:19 +09:00
riverLethe 54654b386d feat: Upgrade Next.js and refine password/amount restrictions
This commit addresses several key updates and fixes:

1.  **Security Update:** Upgraded Next.js to fix the vulnerability identified as **CVE-2025-55182**.
2.  **Password Policy:** Globally adjusted the password requirement for "change password" operations to a minimum length of **6 characters**.
3.  **Validation Improvement:** Enhanced validation logic for amount fields during MCP (Multi-Currency Purchase/Payment, assuming this acronym) creation to ensure proper limits and constraints are applied.
2025-12-04 17:43:59 +08:00
Dot.L 755d48a2f8 Merge pull request #61 from xpack-ai/feature/mcp
Update client IP acquisition logic
2025-11-26 18:02:54 +08:00
Liujian 284880a170 Update client IP acquisition logic 2025-11-26 18:02:10 +08:00
Dot.L 950b516081 Merge pull request #60 from xpack-ai/feature/mcp
Email captcha rate limiting fix && CORS tightening via configuration
2025-11-26 17:08:41 +08:00
Liujian 0088a7b447 Merge remote-tracking branch 'origin/main' into feature/mcp 2025-11-26 17:00:29 +08:00
Liujian 19f646c318 Email captcha rate limiting fix && CORS tightening via configuration 2025-11-26 16:58:54 +08:00
Dot.L 115ac5caf7 Merge pull request #59 from xpack-ai/feature/mcp
repairing potential risks
2025-11-26 16:39:29 +08:00
Liujian 798082934e Merge remote-tracking branch 'origin/main' into feature/mcp 2025-11-26 16:21:40 +08:00
Liujian a017b0fa93 repairing potential risks 2025-11-26 16:16:23 +08:00
Liujian 877dbb6a4e MCP session keys use client fingerprints to distinguish requests from different clients. 2025-11-26 15:09:35 +08:00
Dot.L 523265e550 Merge pull request #58 from xpack-ai/feature/mcp
Payment information encryption and  wait for the initial connection to initialize successfully before processing the request
2025-11-14 18:11:01 +08:00
Liujian 5d2db84d75 update env example 2025-11-14 17:47:31 +08:00
Liujian 4826859152 Payment information encryption 2025-11-14 16:58:08 +08:00
Liujian 92f8b68f0e A new connection recovery mechanism has been added in the event of a network outage. 2025-11-14 15:50:39 +08:00
Liujian 87a4b6e2de Wait for the initial connection to initialize successfully before processing the request. 2025-11-14 15:50:00 +08:00
Dot.L 58d30344f5 Merge pull request #57 from xpack-ai/feature/mcp
Completed: OutputSchema functionality added to the MCP tools list.
2025-11-07 17:23:54 +08:00
Liujian a6064035bd Completed: OutputSchema functionality added to the MCP tools list. 2025-11-07 17:23:24 +08:00
Dot.L 141fb4758f Merge pull request #56 from xpack-ai/feature/mcp
fix bug: API enabled status error when updating service Swagger docum…
2025-11-07 16:56:07 +08:00
Liujian 5450027bbc fix bug: API enabled status error when updating service Swagger documentation 2025-11-07 16:53:25 +08:00
riverLethe 721a213bbf fix:hidden server length in marketpalce card panel 2025-11-07 14:03:38 +08:00
Dot.L 9ce81f5012 Merge pull request #55 from xpack-ai/feature/mcp
MCP tool list response adds outputSchema
2025-11-07 10:32:07 +08:00
Liujian a28f3bb680 MCP tool list response adds outputSchema 2025-11-07 10:31:29 +08:00
Dot.L 14e45235b4 Merge pull request #54 from xpack-ai/feature/synchronize_saas
update mcp session gc logic
2025-10-23 17:55:51 +08:00
Liujian 6a69d678fd update mcp session gc logic 2025-10-23 17:55:24 +08:00
Dot.L 48ba7ffd96 Merge pull request #53 from xpack-ai/feature/synchronize_saas
Translate Chinese into English
2025-10-22 23:21:23 +08:00
Liujian faa1f552e6 Translate Chinese into English 2025-10-22 23:20:57 +08:00
riverLethe b2bd2e30dd feat/ui:The server configuration allows switching between Streamable HTTP and SSE. 2025-10-22 19:59:49 +08:00
Dot.L e25e119ba1 Merge pull request #52 from xpack-ai/feature/synchronize_saas
support streamable http
2025-10-22 19:14:26 +08:00
Liujian eb1811fa3a support streamable http 2025-10-22 19:01:11 +08:00
Dot.L ee65da1665 Merge pull request #51 from xpack-ai/feature/synchronize_saas
Update Deployment Tutorial
2025-10-20 18:22:42 +08:00
Liujian bda95f756a Update Deployment Tutorial 2025-10-20 17:15:03 +08:00
Liujian ae7b6d20e4 Update Deployment Tutorial 2025-10-20 17:11:52 +08:00
Liujian 0d1dff05d6 Merge remote-tracking branch 'origin/main' into feature/synchronize_saas 2025-10-20 15:17:02 +08:00
riverLethe 434518b2b3 feat/op:uploads path use rewrite 2025-10-20 14:57:33 +08:00
Dot.L 3321efc3d4 Merge pull request #50 from xpack-ai/feature/synchronize_saas
Update Deployment Tutorial
2025-10-20 13:42:35 +08:00
Liujian 0313ced503 Update Deployment Tutorial 2025-10-20 09:19:15 +08:00
riverLethe d17e5e95dd feat/ui:concole stats top server support to show deleted item 2025-10-17 19:11:35 +08:00
Dot.L 41f9d74c5e Merge pull request #49 from xpack-ai/feature/synchronize_saas
fix drop service bug
2025-10-17 18:53:49 +08:00
Liujian 7f17b22896 fix drop service bug 2025-10-17 18:53:15 +08:00
Dot.L 186ba8ca81 Merge pull request #48 from xpack-ai/feature/synchronize_saas
Feature/synchronize saas
2025-10-17 18:38:51 +08:00
Liujian 777649f82b Delete service using software deletion 2025-10-17 18:36:58 +08:00
Liujian f042cdf911 Add annotations and translate Chinese into English 2025-10-17 16:26:14 +08:00
Liujian 7c75c07216 fix: redis cache bug 2025-10-17 15:26:01 +08:00
riverLethe 33549167d9 fix/op:if user not input api endpoint when update mcp server,need to disable save 2025-10-17 15:04:21 +08:00
Liujian 0ae689f9fe Merge remote-tracking branch 'origin/main' into feature/synchronize_saas 2025-10-17 13:47:47 +08:00
Dot.L 21c72f17ba Merge pull request #47 from xpack-ai/feature/synchronize_saas
update billing message logic
2025-10-17 13:38:22 +08:00
Liujian 76e8dbc083 update billing message logic 2025-10-17 13:37:58 +08:00
Dot.L 96abfc2752 Merge pull request #46 from xpack-ai/feature/synchronize_saas
fix mcp bug
2025-10-17 11:46:29 +08:00
Liujian a992866058 fix mcp bug 2025-10-17 11:46:08 +08:00
Dot.L 39db3d9a94 Merge pull request #45 from xpack-ai/feature/synchronize_saas
fix mcp bug
2025-10-17 10:37:45 +08:00
Liujian c71a416046 fix mcp bug 2025-10-17 10:36:24 +08:00
Dot.L 9a605cc9f0 Merge pull request #44 from xpack-ai/feature/synchronize_saas
Feature/synchronize saas
2025-10-17 10:27:21 +08:00
Liujian e8aaeefe85 update mcp param key 2025-10-17 10:13:19 +08:00
riverLethe 51d41bc3d4 feat/ui:update translation json 2025-10-17 10:04:49 +08:00
Liujian c1b224af46 Merge remote-tracking branch 'origin/main' into feature/synchronize_saas 2025-10-16 17:44:14 +08:00
riverLethe 521c1b7a07 feat:1.1 UI/UX 2025-10-16 17:35:45 +08:00
Dot.L 3c9b037ba7 Merge pull request #43 from xpack-ai/feature/synchronize_saas
Feature/synchronize saas
2025-10-16 16:55:30 +08:00
Liujian f3a1107838 update create user bug 2025-10-16 16:55:09 +08:00
Liujian d53fe311a3 update sql 2025-10-16 15:54:20 +08:00
Dot.L 407081adfc Merge pull request #42 from xpack-ai/feature/synchronize_saas
fix system config bug
2025-10-16 15:29:27 +08:00
Liujian 09704af14a fix system config bug 2025-10-16 15:28:52 +08:00
Dot.L 46d5040068 Merge pull request #41 from xpack-ai/feature/synchronize_saas
fix stats analystic bug
2025-10-16 14:52:14 +08:00
Liujian 3faa35e970 fix stats analystic bug 2025-10-16 14:51:47 +08:00
Dot.L a0e7662f76 Merge pull request #40 from xpack-ai/feature/synchronize_saas
finish stats analytics api
2025-10-16 11:17:08 +08:00
Liujian d49144afe9 finish stats analytics api 2025-10-16 11:16:41 +08:00
Dot.L 81637440d6 Merge pull request #39 from xpack-ai/feature/synchronize_saas
fix  bug
2025-10-16 10:03:37 +08:00
Liujian c949aac528 fix bug 2025-10-16 10:03:10 +08:00
Dot.L 5e08cd2ff5 Merge pull request #38 from xpack-ai/feature/synchronize_saas
Synchronize mcp service api
2025-10-15 14:50:30 +08:00
Liujian c790fbef51 Synchronize mcp service api 2025-10-15 14:49:20 +08:00
Dot.L bb9dd11869 Merge pull request #37 from xpack-ai/feature/synchronize_saas
Feature/synchronize saas
2025-10-14 18:04:42 +08:00
Liujian a0b827b32e Synchronize system configuration related APIs 2025-10-14 18:04:02 +08:00
riverLethe 7e135f4949 fix:fetch platform config error will influence project build bug 2025-10-09 09:15:36 +08:00
Dot.L 4d230db82b Merge pull request #36 from xpack-ai/feature/ui-1.0.2
feat/ui-1.0.2:when about page content is empty,need to hide about nav…
2025-10-07 09:05:51 +08:00
riverLethe 4b773063a0 feat/ui-1.0.2:when about page content is empty,need to hide about navigation 2025-09-28 14:20:04 +08:00
riverLethe 92aa83cb71 feat/ui-1.0.2:when about page content is empty,need to hide about navigation 2025-09-28 14:19:29 +08:00
Dot.L f98ff6bf44 Update admin user login address in README 2025-09-17 13:43:43 +08:00
JackLiu 22aa1c34c7 Update README-zh-tw.md for clarity in billing section 2025-08-28 11:30:08 +09:00
JackLiu 680ae27dd1 Update language links in README-zh-tw.md 2025-08-28 11:29:28 +09:00
JackLiu 4bb91c38ae Add language links to README-zh-cn.md 2025-08-28 11:29:18 +09:00
JackLiu 6cdcb98dd5 Update Korean README with additional language links 2025-08-28 11:28:52 +09:00
JackLiu d0e48f8ae2 Update language links in README-ja.md 2025-08-28 11:28:35 +09:00
JackLiu 3693d984c5 Update language links in README-fr.md 2025-08-28 11:28:22 +09:00
JackLiu 4782b2ee8f Update language links in README-es.md 2025-08-28 11:27:58 +09:00
JackLiu c2c64a2d29 Update language links in README-de.md 2025-08-28 11:27:43 +09:00
JackLiu 2734841b2a Update README.md 2025-08-28 11:27:00 +09:00
JackLiu 86344c5bc0 new lang readme 2025-08-28 11:25:44 +09:00
JackLiu a3ab01cc46 Update README.md 2025-08-15 09:32:03 +08:00
JackLiu 265ed78835 Update README.md 2025-08-06 10:54:53 +08:00
Liujian ead0689b81 add wxpay 2025-08-01 18:27:19 +08:00
Liujian 5f621308ea add wxpay 2025-08-01 18:26:40 +08:00
lethe 49627d2449 fix/ui-1.0.0:api fetch error need to throw 2025-07-31 18:06:01 +08:00
Liujian 31e3b6b0a8 Change the frequency count to amount count 2025-07-31 17:25:23 +08:00
lethe 695580d844 feat/ui-1.0.0:dashboard analysis change times to amount 2025-07-31 17:16:41 +08:00
Dot.L 9c7462f3ed Merge pull request #32 from xpack-ai/feature/0.3-backend
overview qiniu file
2025-07-31 15:18:27 +08:00
Dot.L 4c03a25f9b Merge pull request #31 from xpack-ai/feature/0.3-backend
add version-1.0.1.sql
2025-07-31 15:17:50 +08:00
Liujian cc2d66be11 overview qiniu file 2025-07-31 15:16:57 +08:00
Liujian 754d8e596e add version-1.0.1.sql 2025-07-31 15:14:45 +08:00
Dot.L 97fdd892ed Merge pull request #29 from xpack-ai/feature/0.3-backend
Feature/0.3 backend
2025-07-31 11:42:54 +08:00
Liujian fc46e7b354 fix: pay channel bug 2025-07-31 11:41:49 +08:00
lethe 02fd02ceef hotfix/ui-1.0.0:fixed validate login method disabled check,check if at least one login method is enabled 2025-07-31 11:37:51 +08:00
lethe ed1391fc84 fix/ui-1.0.0:if not setting smtp config,when user change login method is email and code,go to setting need to go to email-admin route 2025-07-31 11:31:58 +08:00
lethe 4e57c9d0b1 fix/ui-1.0.0:if faq and top navigation empty,should auto add new empty item 2025-07-31 11:18:52 +08:00
Liujian a37d13604d Merge remote-tracking branch 'origin/main' into feature/0.3-backend 2025-07-31 11:15:00 +08:00
JackLiu 19267e14c2 Update README-zh-cn.md 2025-07-31 09:36:37 +08:00
Dot.L 660c83e0c7 Merge pull request #28 from xpack-ai/feature/0.3-backend
update init sql
2025-07-31 09:35:45 +08:00
Liujian ea3174e0fe update init sql 2025-07-31 09:35:13 +08:00
JackLiu e01a0cb249 Update README.md 2025-07-31 09:29:56 +08:00
JackLiu 890d1d8bf3 Update README-zh-cn.md 2025-07-31 09:28:45 +08:00
Dot.L b7197fb35d Merge pull request #27 from xpack-ai/feature/0.3-backend
update qiniu upload script
2025-07-30 21:11:11 +08:00
Liujian 8751aa9ef6 update qiniu upload script 2025-07-30 21:10:30 +08:00
Dot.L 35cb02a035 Merge pull request #26 from xpack-ai/feature/0.3-backend
update qiniu upload script
2025-07-30 21:05:32 +08:00
Liujian beba80a14c update qiniu upload script 2025-07-30 21:04:51 +08:00
Dot.L 2c1b17a947 Merge pull request #25 from xpack-ai/feature/0.3-backend
update qiniu upload script
2025-07-30 21:00:22 +08:00
Liujian 71322c2d9d update qiniu upload script 2025-07-30 20:58:26 +08:00
Dot.L d93a3f9af3 Merge pull request #24 from xpack-ai/feature/0.3-backend
update qiniu upload script
2025-07-30 20:50:36 +08:00
Liujian 55457532cc update qiniu upload script 2025-07-30 20:49:42 +08:00
Dot.L 9b953048b3 Merge pull request #23 from xpack-ai/feature/0.3-backend
fix bug
2025-07-30 20:12:18 +08:00
Liujian 913006ba02 fix bug 2025-07-30 20:10:03 +08:00
Dot.L 3a38426b13 Merge pull request #22 from xpack-ai/feature/0.3-backend
Support smooth upgrade
2025-07-30 19:52:46 +08:00
Liujian e42e5ad752 Support smooth upgrade 2025-07-30 19:48:13 +08:00
lethe c69ed103dc feature/ui:delete X-Frame-Options and delete platform basic info limit 2025-07-30 18:28:58 +08:00
Dot.L 6cd52f0d92 Merge pull request #21 from xpack-ai/feature/0.3-backend
Fix mcp token billing bug
2025-07-30 16:51:12 +08:00
Liujian be7033e9a2 Fix mcp token billing bug 2025-07-30 16:50:25 +08:00
lethe 8946be619d feature/ui:1.0 feature,like mcp price method support use token and set more config about home page 2025-07-30 15:59:10 +08:00
Dot.L 2262a7f49a Merge pull request #20 from xpack-ai/feature/0.3-backend
fix mcp service
2025-07-30 15:57:42 +08:00
Liujian 11264d302d fix mcp service 2025-07-30 15:57:10 +08:00
lidongjie 6a18812572 Merge branch 'main' of https://github.com/xpack-ai/XPack-MCP-Market 2025-07-30 15:54:18 +08:00
lidongjie 401b35cd10 fix: update service ID reference to use slug name 2025-07-30 15:54:10 +08:00
Dot.L f44102bdb7 Merge pull request #19 from xpack-ai/feature/0.3-backend
fix:bug
2025-07-30 15:48:18 +08:00
Liujian 29a779648d fix:bug 2025-07-30 15:46:49 +08:00
Dot.L 20eabea48f Merge pull request #18 from xpack-ai/feature/0.3-backend
fix:bug
2025-07-30 15:40:59 +08:00
Liujian 919285e716 fix:bug 2025-07-30 15:39:52 +08:00
Dot.L 01d1411d49 Merge pull request #17 from xpack-ai/feature/0.3-backend
support token calculate
2025-07-30 14:14:00 +08:00
Liujian 6cb7ca9902 support token calculate 2025-07-30 14:11:24 +08:00
Dot.L 3012d27aae Merge pull request #16 from xpack-ai/feature/0.3-backend
tmp commit
2025-07-30 13:37:50 +08:00
Liujian dd3a784cb5 tmp commit 2025-07-30 13:36:50 +08:00
Dot.L 518d5f55c5 Merge pull request #15 from xpack-ai/feature/0.3-backend
Feature/0.3 backend
2025-07-30 11:36:30 +08:00
Liujian 923496735e Support billing based on input and output tokens 2025-07-30 11:35:51 +08:00
Liujian 20903eeab5 Support billing based on input and output tokens 2025-07-30 11:33:27 +08:00
lidongjie 4016bb9d52 Merge branch 'feature/platform-reporting' 2025-07-30 10:49:19 +08:00
lidongjie bf9071122b feat: Add platform reporting service with fail-safe design
- Add PlatformReportService for reporting platform info to XPack official platform
- Implement non-blocking background reporting to avoid impacting main operations
- Add comprehensive error handling and timeout management
- Integrate platform reporting into system configuration update workflow
- Ensure reporting failures do not affect core business logic
- Support both synchronous and asynchronous reporting modes
- Add proper logging with appropriate levels for monitoring
2025-07-30 10:48:52 +08:00
Dot.L 3ff0b743a6 Merge pull request #14 from xpack-ai/feature/0.3-backend
fix bug
2025-07-30 10:40:17 +08:00
Liujian 360e2cd20d fix bug 2025-07-30 10:38:56 +08:00
Dot.L e12f6c0db5 Merge pull request #13 from xpack-ai/feature/0.3-backend
finish API development
2025-07-29 18:42:11 +08:00
Liujian ec96465a96 finish API development 2025-07-29 18:40:38 +08:00
Dot.L 920eb9154e Merge pull request #12 from xpack-ai/feature/0.3-backend
add alipay callback
2025-07-29 18:12:44 +08:00
Liujian a224445038 add alipay callback 2025-07-29 17:55:17 +08:00
Dot.L 1c3e40d337 Merge pull request #11 from xpack-ai/feature/0.3-backend
add alipay callback url
2025-07-29 10:31:57 +08:00
Liujian 44d0768296 add alipay callback url 2025-07-29 10:31:19 +08:00
Dot.L e9ae97762b Merge pull request #10 from xpack-ai/feature/0.3-backend
support alipay
2025-07-28 19:57:16 +08:00
Liujian 26b8147f94 support alipay 2025-07-28 19:56:47 +08:00
JackLiu e4f97e1014 Update README.md 2025-07-28 16:59:00 +08:00
Dot.L d3efa08da2 Merge pull request #9 from xpack-ai/feature/0.3-backend
Support manual addition of balance
2025-07-28 16:40:27 +08:00
Liujian ede3d5c2a3 Support manual addition of balance 2025-07-28 16:39:54 +08:00
Dot.L 42665d13a7 Merge pull request #8 from xpack-ai/feature/0.3-backend
update /api/common/homepage
2025-07-28 13:45:37 +08:00
Liujian c4bbf09a19 update /api/common/homepage 2025-07-28 13:42:10 +08:00
Dot.L ba3a4fe2a2 Merge pull request #7 from xpack-ai/feature/0.3-backend
add homepage api
2025-07-28 12:02:14 +08:00
Liujian 496b9fa380 add homepage api 2025-07-28 12:01:18 +08:00
Liujian 80b3118f3a update version 2025-07-28 11:18:31 +08:00
riverLethe c4f56df03b feat/ui:set product mcp service name 2025-07-25 23:59:01 +08:00
357 changed files with 28720 additions and 20445 deletions

No files matched your search

+17 -2
View File
@@ -6,7 +6,7 @@ MYSQL_PASSWORD=mysql_ZTdhRB
MYSQL_DB=xpack
# 服务端口配置
API_PORT=8000
API_PORT=8002
ADMIN_PORT=8001
# 调试配置
@@ -24,4 +24,19 @@ RABBITMQ_HOST=xpack-rabbitmq
RABBITMQ_PORT=5672
RABBITMQ_USER=rabbitmq
RABBITMQ_PASSWORD=rabbitmq_Gs123dA
RABBITMQ_VHOST=/
RABBITMQ_VHOST=/
# Billing queue / retry settings
BILLING_QUEUE_NAME=billing.api.calls
# Max retry attempts (excluding initial consumption)
BILLING_RETRY_TIMES=3
# Base delay seconds for exponential backoff: base * 2^retry_count
BILLING_RETRY_BASE_DELAY_SECONDS=30
# Max delay seconds cap
BILLING_RETRY_MAX_DELAY_SECONDS=1800
# Payment config encryption key (Base64-encoded 32-byte random value for AES-GCM)
# Quick generation: python -c "import os,base64; print(base64.b64encode(os.urandom(32)).decode())"
PAYMENT_CONFIG_SECRET_KEY=uyyhfMJ+xpEE+IC5mPigpscekkR2ucz6Sj7sHYLhJQA=
# Optional: key ID used to support key rotation identification
PAYMENT_CONFIG_KEY_ID=default
+26 -25
View File
@@ -1,36 +1,37 @@
# XPack 开源版本 - Copilot 编程指导
# XPack Open Source Edition - Copilot Programming Guidelines
## 项目架构
## Project Architecture
### 服务依赖
- `admin_service` 和 `api_service` 相互独立,都依赖 `common`
- 遵循分层架构:Controller → Service → Repository
### Service Dependencies
- `admin_service` and `api_service` are independent of each other, both depend on `common`
- Follow layered architecture: Controller → Service → Repository
### 目录结构
### Directory Structure
```
services/
├── admin_service/ # 管理端服务
├── api_service/ # API服务
└── common/ # 公共模块
├── admin_service/ # Admin service
├── api_service/ # API service
└── common/ # Common modules
```
## 编码规范
## Coding Standards
### 代码风格
- 遵循 PEP 8,使用类型注解和 docstring
- 命名:函数/变量用 `snake_case`,类用 `PascalCase`
- 导入:优先使用 `services/common`,避免跨服务导入
### Code Style
- Follow PEP 8, use type annotations and docstrings
- Naming: use `snake_case` for functions/variables, `PascalCase` for classes
- Imports: prioritize `services/common`, avoid cross-service imports
### 日志要求
- **必须使用英文**,使用 `services/common/logging_config.py`
- 格式:`logger.info("Action completed: {context}")`
- 避免敏感信息,包含必要上下文
### Logging Requirements
- **Must use English**, use `services/common/logging_config.py`
- Format: `logger.info("Action completed: {context}")`
- Avoid sensitive information, include necessary context
### 错误处理
- 使用 `services/common/error_msg.py` 定义的错误消息
- 统一异常处理和日志记录
### Error Handling
- Use error messages defined in `services/common/error_msg.py`
- Unified exception handling and logging
## 开发建议
- 有适当的日志记录(英文格式,统一格式)
- 添加方法级别英文注释,需要简洁
- 添加的注释一律使用英文
## Development Guidelines
- Think and analyze requirements first, wait for user confirmation before writing code
- Include appropriate logging (English format, consistent style)
- Add method-level English comments, keep them concise
- All comments must be written in English
+3 -3
View File
@@ -20,7 +20,7 @@ jobs:
node-version: '22.16'
- name: Pnpm install and build
run: |
npm install -g pnpm
npm install -g pnpm@9
./scripts/frontend_build.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
@@ -32,7 +32,7 @@ jobs:
- name: Setup qshell
uses: foxundermoon/setup-qshell@v5
with:
version: '2.9.0'
version: '2.13.0'
- name: build
run: |
cd scripts && ./docker_build.sh ${{ secrets.DOCKER_USERNAME }}
@@ -43,4 +43,4 @@ jobs:
QINIU_BUCKET: ${{ secrets.QINIU_BUCKET }}
QINIU_NAME: ${{ secrets.QINIU_NAME }}
run: cd scripts && ./docker_publish.sh ${{ secrets.DOCKER_USERNAME }} upload_qiniu
+4
View File
@@ -41,3 +41,7 @@ htmlcov/
local_settings.py
/.secrets
/uploads/
/.vercel/
# Local deployment data
mysql-data/
+1
View File
@@ -0,0 +1 @@
/mcp.json
+328
View File
@@ -0,0 +1,328 @@
# XPack
![b1](https://github.com/user-attachments/assets/3d50cd9a-9d28-4ec8-bb5f-d3668475b49e)
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** ist der erste Open‑Source‑MCP‑Marktplatz der Welt – damit erstellen und verkaufen Sie Ihre MCP‑Services in wenigen Minuten.
<br>
✨ Was XPack bietet
- ✅ **OpenAPI → MCP‑Servicekonfiguration per One‑Click**
- 🧾 **SEO‑optimierte Startseite & Service‑Seiten**
- 💳 **Integriertes Billing (pro Aufruf oder nach Token‑Verbrauch)**
- 👥 **Benutzerkontenverwaltung**
- 🛠 **Unterstützung für Stripe‑Zahlungen**
- 🔐 **Anmeldung via E‑Mail & Google OAuth**
Alles ist Open Source unter **Apache 2.0** – bereit für den kommerziellen Einsatz.
<br>
# ✨ Schnellstart
😍 Die Bereitstellung ist extrem einfach. Mit **einem einzigen Befehl** ist Ihr MCP‑Marktplatz in 10 Minuten online.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![In 10 Minuten Ihren MCP‑Marktplatz deployen](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
# 📸 Funktionen
![b2](https://github.com/user-attachments/assets/c8cc89a4-ab5f-4c90-8c97-9207b5c9f5c1)
![b3](https://github.com/user-attachments/assets/16f74c8a-b35e-40a7-8471-a5736de8e904)
![b4](https://github.com/user-attachments/assets/fc76c215-7544-4267-bc6f-22a719edec00)
![b5](https://github.com/user-attachments/assets/db40ea77-58c3-472d-ba94-35dc9716a980)
<br>
## 🖥️ Systemanforderungen
### ✅ Empfohlene Hardware
- **CPU**: 8 Kerne
- **Arbeitsspeicher**: 16 GB
- **Speicher**: 200 GB
- **Betriebssystem**: Linux
- **Architektur**: AMD64
### ✅ Mindestanforderungen
- **CPU**: 2 Kerne
- **Arbeitsspeicher**: 4 GB
- **Speicher**: 200 GB
- **Betriebssystem**: Linux / macOS
- **Architektur**: AMD64 / ARM64
<br>
## 📦 Laufzeitabhängigkeiten
Für **XPack‑MCP‑Market** werden folgende Dienste benötigt (selbst gehostet oder containerisiert):
| Komponente | Mindestversion |
|---|---|
| **MySQL** | ≥ 5.7.x |
| **Redis** | ≥ 6.2.x |
| **RabbitMQ**| ≥ 4.0 |
Stellen Sie sicher, dass diese Dienste verfügbar und korrekt konfiguriert sind, bevor Sie das Backend starten.
<br>
## 💿 Bereitstellung
😍 So einfach: Mit **einem Befehl** ist Ihr MCP‑Marktplatz in 10 Minuten bereit.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
<details>
<summary><h4>🔖 Docker‑Compose‑Bereitstellung</h4></summary>
Für diese Methode benötigen Sie [Docker](https://docs.docker.com/engine/install/) und [Docker Compose](https://docs.docker.com/compose/install/standalone/).
1. `docker-compose.yml` bearbeiten
```
vi docker-compose.yml
```
<br>
2. Konfiguration anpassen (Beispiel: [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml))
```
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /var/lib/xpack/mysql:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market
container_name: xpack-mcp-market
privileged: true
restart: always
networks:
- xpack
ports:
- "8000:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
ports:
- 6379:6379
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
image: rabbitmq:4.1.2-alpine
container_name: xpack-rabbitmq
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
```
<br>
3. XPack‑MCP‑Market starten
```
docker-compose up -d
```
<br>
4. Im Browser über Port 8000 öffnen
* **Admin‑Login**: http://{IP}:8000/admin-signin
* **Benutzer**: admin
* **Passwort**: 123456789
</details>
<details>
<summary><h4>🔖 Build</h4></summary>
1. Repository klonen
```
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
```
2. Projektordner öffnen
```
cd XPack-MCP-Market
```
### Frontend‑Build
> Voraussetzungen:
> - Node >= 22.x
> - Pnpm >= 10.x
1. Build‑Skript ausführen
```
cd scripts && ./frontend_build.sh && cd ../
```
Der Frontend‑Code wird nach `frontend/out` gebaut.
2. UI starten
```
cd frontend/out && node server.js
```
### Backend‑Build
> Voraussetzungen:
> - Python >= 3.11
#### Mit `uv` (empfohlen)
1. Virtuelle Umgebung erstellen
```
uv venv
```
2. Aktivieren
```
source .venv/bin/activate
```
3. Abhängigkeiten installieren
```
uv pip install -r requirements.txt
```
4. Umgebungsdatei kopieren
```
cp .env.example .env
```
5. Variablen anpassen
```
vi .env
```
6. Admin‑Backend starten
**Vordergrund**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
```
**Hintergrund**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
```
7. API‑→‑MCP‑Service starten
**Vordergrund**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
```
**Hintergrund**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
```
### Docker‑Build
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
```
</details>
# 📸 Screenshots
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/5f71bfcf-c128-42ab-8077-3f2ede549f80" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/d7c0b40d-182e-47a6-bcdf-bd36970f5ee6" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/ae40f659-87ad-42d4-8379-b47a48eb6a29" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/1049f4e5-ec3f-4520-8480-6d6432d6f5d2" />
<br>
# 🧾 Lizenz
XPack‑MCP‑Market steht unter der **Apache‑2.0‑Lizenz**.
Details finden Sie in der Datei [LICENSE](./LICENSE).
<br>
# 📬 Kontakt
- 🌐 Website: [https://xpack.ai](https://xpack.ai)
- 📧 E‑Mail: [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord: [Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 Partner
- [Cursor](https://www.cursor.com/): KI‑gestützter Code‑Editor mit Vorschlägen für die nächste Änderung, tiefem Codeverständnis und Bearbeitung in natürlicher Sprache – für mehr Produktivität.
- [Dify](https://dify.ai/): Führende agentische KI‑Plattform mit Workflows, RAG, Integrationen und Observability; unterstützt zahlreiche LLMs und Plugins.
- [Trae](https://www.trae.ai/): KI‑native IDE mit Chat‑Interface, die „The Real AI Engineer“ verkörpert – erleichtert Code‑Generierung und ‑Assistenz, steigert Qualität und Effizienz.
- [Windsurf](https://windsurf.com/): Neues IDE‑Konzept mit KI‑Features wie „Cascade“, „Windsurf Tab“ und „Memories“ für tiefes Codeverständnis und reibungslosen Flow.
- [Coze](https://www.coze.com/): Nächste Generation der No‑Code‑Plattform von ByteDance für KI‑Apps und Chatbots – mit Workflows, proprietären Daten, Plugins und Wissensbasen.
- [Claude Code](https://www.anthropic.com/claude-code): CLI‑Tool von Anthropic mit Claude Opus 4 direkt im Terminal; Datei‑/Projekt‑übergreifende Änderungen, Befehlsausführung, IDE‑Integration.
- [Flowith](https://flowith.io/): Canvas‑basierter KI‑Arbeitsraum für Produktivität und Deep Work mit Multi‑Thread‑Agenten.
- [OpenManus](https://github.com/FoundationAgents/OpenManus): Open‑Source‑Framework zum Aufbau allgemeiner KI‑Agenten; Multi‑Agent‑Fähigkeiten, LLM‑APIs und Browser‑Automatisierung integriert.
- [Fellou](https://fellou.ai/): „Agentic Browser“, der im Auftrag des Nutzers handelt – automatisiert Recherche und Erkenntnisse, mit Integrationen wie Notion/LinkedIn.
- [Genspark](https://www.genspark.ai/): All‑in‑One‑KI‑Begleiter (AI Slides, Sheets, Chat) mit personalisierten Tools und AI Pods zur Inhaltsgenerierung aus vielfältigen Quellen.
- [TEN](https://github.com/TEN-framework/ten-framework): Open‑Source‑Framework für Echtzeit, multimodale Sprach‑Agenten – inkl. Avatar, MCP‑Integration, Hardware‑Kommunikation und Bildschirmfreigabe‑Erkennung.
- [APIPark](https://apipark.com/): Open‑Source‑Entwicklerportal und All‑in‑One‑LLM‑Gateway – einheitliche APIs, Load‑Balancing, Traffic‑Kontrolle, semantischer Cache, Prompt‑Management und Data Masking.
- [ChatGPT](https://chatgpt.com/): Von OpenAI entwickelter KI‑Chatbot auf Basis großer Sprachmodelle – kontextbewusste Dialoge, Follow‑ups, Integrationen und Produktivitätsfunktionen.
- [LangChain](https://www.langchain.com/): Plattform für robuste Agenten‑/LLM‑Apps (LangGraph, LangSmith, LangGraph Platform) – Code‑Generierung, Automatisierung und AI Search.
- [LEMON AI](https://lemonai.cc/): Erster Full‑Stack, Open‑Source, agentischer KI‑Framework – inkl. integriertem Code‑Interpreter‑VM‑Sandbox für sichere Ausführung.
- [LobeChat](https://lobehub.com/): Persönliches LLM‑Produktivitätstool zum Aufbau persönlicher Agenten und Profi‑Teams; reiches Plugin‑Ökosystem, Wissensbasis, Bild/Audio‑Funktionen.
- [VS Code](https://code.visualstudio.com/): Weit verbreiteter, kostenloser Open‑Source‑Editor mit großer Erweiterbarkeit und KI‑Funktionen wie „Agent Mode“ und intelligenten Edit‑Vorschlägen.
- [XRoute](https://xroute.ai): Vereinheitlichte Schnittstelle für LLMs – bessere Preise, höhere Durchsätze, kein Abo nötig.
- [MemU](https://github.com/NevaMind-AI/memU): Open‑Source‑Memory‑Framework für KI‑Companions.
+329
View File
@@ -0,0 +1,329 @@
# XPack
![b1](https://github.com/user-attachments/assets/3d50cd9a-9d28-4ec8-bb5f-d3668475b49e)
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** es el primer marketplace MCP de código abierto del mundo: crea y vende tus propios servicios MCP en cuestión de minutos.
<br>
✨ Con XPack puedes:
- ✅ **Generar con un clic la configuración OpenAPI → MCP**
- 🧾 **Portada y páginas de servicio optimizadas para SEO**
- 💳 **Facturación integrada (por llamada o por uso de tokens)**
- 👥 **Gestión de cuentas de usuario**
- 🛠 **Pagos con Stripe**
- 🔐 **Inicio de sesión con correo y Google OAuth**
Todo es open source bajo **Apache 2.0**, listo para uso comercial.
<br>
# ✨ Inicio rápido
😍 Poner XPack en marcha es facilísimo. Con **un solo comando** tendrás tu marketplace MCP online en 10 minutos.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![Cómo desplegar tu marketplace MCP en 10 minutos](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
# 📸 Funcionalidades
![b2](https://github.com/user-attachments/assets/c8cc89a4-ab5f-4c90-8c97-9207b5c9f5c1)
![b3](https://github.com/user-attachments/assets/16f74c8a-b35e-40a7-8471-a5736de8e904)
![b4](https://github.com/user-attachments/assets/fc76c215-7544-4267-bc6f-22a719edec00)
![b5](https://github.com/user-attachments/assets/db40ea77-58c3-472d-ba94-35dc9716a980)
<br>
## 🖥️ Requisitos del sistema
### ✅ Hardware recomendado
- **CPU**: 8 núcleos
- **Memoria**: 16 GB
- **Almacenamiento**: 200 GB
- **Sistema operativo**: Linux
- **Arquitectura**: AMD64
### ✅ Mínimos
- **CPU**: 2 núcleos
- **Memoria**: 4 GB
- **Almacenamiento**: 200 GB
- **Sistema operativo**: Linux / macOS
- **Arquitectura**: AMD64 / ARM64
<br>
## 📦 Dependencias de ejecución
**XPack-MCP-Market** requiere los siguientes servicios (autogestionados o en contenedores):
| Componente | Versión mínima |
|---|---|
| **MySQL** | ≥ 5.7.x |
| **Redis** | ≥ 6.2.x |
| **RabbitMQ**| ≥ 4.0 |
Asegúrate de que estos servicios estén disponibles y correctamente configurados antes de arrancar el backend.
<br>
## 💿 Despliegue
😍 Así de simple: con **un comando** tendrás tu marketplace MCP listo en 10 minutos.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
<details>
<summary><h4>🔖 Despliegue con Docker-Compose</h4></summary>
Para este método, instala [Docker](https://docs.docker.com/engine/install/) y [Docker Compose](https://docs.docker.com/compose/install/standalone/).
1. Edita `docker-compose.yml`
```
vi docker-compose.yml
```
<br>
2. Ajusta la configuración (archivo de referencia: [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml))
```
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /var/lib/xpack/mysql:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market
container_name: xpack-mcp-market
privileged: true
restart: always
networks:
- xpack
ports:
- "8000:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
ports:
- 6379:6379
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
image: rabbitmq:4.1.2-alpine
container_name: xpack-rabbitmq
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
```
<br>
3. Arranca XPack-MCP-Market
```
docker-compose up -d
```
<br>
4. Accede por el puerto 3000 en el navegador
* **Inicio de sesión admin**: http://{IP}:3000/admin-signin
* **Usuario**: admin
* **Contraseña**: 123456789
</details>
<details>
<summary><h4>🔖 Compilación (Build)</h4></summary>
1. Clona el repositorio
```
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
```
2. Entra al proyecto
```
cd XPack-MCP-Market
```
### Build del frontend
> Requisitos:
> - Node >= 22.x
> - Pnpm >= 10.x
1. Ejecuta el script de build
```
cd scripts && ./frontend_build.sh && cd ../
```
El código compilado quedará en `frontend/out`.
2. Inicia la interfaz
```
cd frontend/out && node server.js
```
### Build del backend
> Requisitos:
> - Python >= 3.11
#### Con `uv` (recomendado)
1. Crea el entorno virtual
```
uv venv
```
2. Actívalo
```
source .venv/bin/activate
```
3. Instala dependencias
```
uv pip install -r requirements.txt
```
4. Copia el archivo de entorno
```
cp .env.example .env
```
5. Edita las variables
```
vi .env
```
6. Inicia el servicio de administración
**Primer plano**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
```
**Segundo plano**
````
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
```
7. Inicia el servicio API → MCP
**Primer plano**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
```
**Segundo plano**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
```
### Build de Docker
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
```
</details>
# 📸 Capturas
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/5f71bfcf-c128-42ab-8077-3f2ede549f80" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/d7c0b40d-182e-47a6-bcdf-bd36970f5ee6" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/ae40f659-87ad-42d4-8379-b47a48eb6a29" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/1049f4e5-ec3f-4520-8480-6d6432d6f5d2" />
<br>
# 🧾 Licencia
XPack-MCP-Market se publica bajo **Apache 2.0**.
Consulta [LICENSE](./LICENSE) para más detalles.
<br>
# 📬 Contacto
- 🌐 Sitio web: [https://xpack.ai](https://xpack.ai)
- 📧 Correo: [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord: [Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 Socios
- [Cursor](https://www.cursor.com/): editor de código con IA integrada en el flujo de trabajo; sugerencias contextuales, comprensión profunda del repositorio y edición en lenguaje natural.
- [Dify](https://dify.ai/): plataforma líder para desarrollo de IA agentica; cubre flujos de agentes, RAG, integraciones y observabilidad; compatible con múltiples LLMs y plugins.
- [Trae](https://www.trae.ai/): IDE nativo de IA que apunta a “The Real AI Engineer”; interfaz conversacional con generación y asistencia de código para mejorar calidad y eficiencia.
- [Windsurf](https://windsurf.com/): nuevo IDE impulsado por IA con “Cascade”, “Windsurf Tab” y “Memories” para un entendimiento profundo del código y un flujo continuo.
- [Coze](https://www.coze.com/): plataforma de ByteDance para crear apps y chatbots con IA sin código; workflows, datos propios, plugins y bases de conocimiento.
- [Claude Code](https://www.anthropic.com/claude-code): herramienta CLI de Anthropic que integra Claude Opus 4 en la terminal; edición multiarchivo, ejecución de comandos e integración con IDEs y test.
- [Flowith](https://flowith.io/): espacio de trabajo de creación con interfaz de lienzo y agentes avanzados; optimiza productividad y trabajo profundo.
- [OpenManus](https://github.com/FoundationAgents/OpenManus): framework open source para construir agentes generales; multiactor y con integración de APIs LLM y automatización de navegador.
- [Fellou](https://fellou.ai/): “navegador agéntico” que actúa por ti; automatiza la recolección de información y entrega de insights; integra con Notion/LinkedIn.
- [Genspark](https://www.genspark.ai/): compañero de IA todo en uno (AI Slides, Sheets, Chat); herramientas personalizadas y AI Pods para generar contenido desde múltiples fuentes.
- [TEN](https://github.com/TEN-framework/ten-framework): framework open source para agentes de voz multimodales en tiempo real; avatar, integración MCP, comunicación hardware y detección de pantalla.
- [APIPark](https://apipark.com/): portal de desarrolladores API open source y pasarela LLM todo en uno; API unificadas, balanceo de carga, control de tráfico, caché semántico, gestión de prompts y enmascaramiento de datos.
- [ChatGPT](https://chatgpt.com/): chatbot de OpenAI basado en LLMs; diálogo natural, comprensión de contexto, seguimiento de conversación e integración con múltiples plataformas.
- [LangChain](https://www.langchain.com/): plataforma para desarrollar agentes y apps LLM confiables (LangGraph, LangSmith, LangGraph Platform); generación de código, automatización y búsqueda con IA.
- [LEMON AI](https://lemonai.cc/): primer framework agentico full‑stack, open source; incluye sandbox VM del intérprete de código para ejecución segura.
- [LobeChat](https://lobehub.com/): herramienta de productividad LLM personal; permite crear agentes personales y equipos profesionales; plugins, base de conocimiento, visión y voz.
- [VS Code](https://code.visualstudio.com/): editor de código open source extensible, con funciones de IA como sugerencias inteligentes y “modo agente”.
- [XRoute](https://xroute.ai): interfaz unificada para LLMs; mejores precios, mejor throughput, sin suscripción.
- [MemU](https://github.com/NevaMind-AI/memU): framework de memoria open source para compañeros de IA.
+328
View File
@@ -0,0 +1,328 @@
# XPack
![b1](https://github.com/user-attachments/assets/3d50cd9a-9d28-4ec8-bb5f-d3668475b49e)
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** est le premier marketplace MCP open‑source au monde. Créez et vendez vos services MCP en quelques minutes.
<br>
✨ Avec XPack, vous pouvez :
- ✅ **Générer en un clic la configuration OpenAPI → MCP**
- 🧾 **Page d’accueil et pages service optimisées pour le SEO**
- 💳 **Facturation intégrée (par appel ou à l’usage de jetons)**
- 👥 **Gestion des comptes utilisateurs**
- 🛠 **Prise en charge des paiements Stripe**
- 🔐 **Connexion via e‑mail et Google OAuth**
Tout est open source sous **Apache 2.0**, prêt pour un usage commercial.
<br>
# ✨ Démarrage rapide
😍 Déployer XPack est ultra simple. **Une seule commande** suffit pour mettre votre marketplace MCP en ligne en 10 minutes.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![Déployer votre marketplace MCP en 10 minutes](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
# 📸 Fonctionnalités
![b2](https://github.com/user-attachments/assets/c8cc89a4-ab5f-4c90-8c97-9207b5c9f5c1)
![b3](https://github.com/user-attachments/assets/16f74c8a-b35e-40a7-8471-a5736de8e904)
![b4](https://github.com/user-attachments/assets/fc76c215-7544-4267-bc6f-22a719edec00)
![b5](https://github.com/user-attachments/assets/db40ea77-58c3-472d-ba94-35dc9716a980)
<br>
## 🖥️ Configuration système requise
### ✅ Configuration recommandée
- **CPU** : 8 cœurs
- **Mémoire** : 16 Go
- **Stockage** : 200 Go
- **Système** : Linux
- **Architecture** : AMD64
### ✅ Configuration minimale
- **CPU** : 2 cœurs
- **Mémoire** : 4 Go
- **Stockage** : 200 Go
- **Système** : Linux / macOS
- **Architecture** : AMD64 / ARM64
<br>
## 📦 Dépendances d’exécution
**XPack‑MCP‑Market** nécessite les services suivants (auto‑hébergés ou en conteneur) :
| Composant | Version minimale |
|---|---|
| **MySQL** | ≥ 5.7.x |
| **Redis** | ≥ 6.2.x |
| **RabbitMQ**| ≥ 4.0 |
Assurez‑vous que ces services sont disponibles et correctement configurés avant de lancer le backend.
<br>
## 💿 Déploiement
😍 Tellement simple : **une commande** pour déployer votre marketplace MCP en 10 minutes.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
<details>
<summary><h4>🔖 Déploiement avec Docker‑Compose</h4></summary>
Pour cette méthode, installez [Docker](https://docs.docker.com/engine/install/) et [Docker Compose](https://docs.docker.com/compose/install/standalone/).
1. Éditez `docker-compose.yml`
```
vi docker-compose.yml
```
<br>
2. Modifiez la configuration (exemple de référence : [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml))
```
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /var/lib/xpack/mysql:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market
container_name: xpack-mcp-market
privileged: true
restart: always
networks:
- xpack
ports:
- "8000:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
ports:
- 6379:6379
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
image: rabbitmq:4.1.2-alpine
container_name: xpack-rabbitmq
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
```
<br>
3. Démarrez XPack‑MCP‑Market
```
docker-compose up -d
```
<br>
4. Accédez à l’interface sur le port 8000
* **Connexion admin** : http://{IP}:8000/admin-signin
* **Utilisateur** : admin
* **Mot de passe** : 123456789
</details>
<details>
<summary><h4>🔖 Build</h4></summary>
1. Clonez le dépôt
```
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
```
2. Ouvrez le projet
```
cd XPack-MCP-Market
```
### Build frontend
> Prérequis :
> - Node >= 22.x
> - Pnpm >= 10.x
1. Lancez le script de build
```
cd scripts && ./frontend_build.sh && cd ../
```
Le frontend compilé est disponible dans `frontend/out`.
2. Démarrez l’interface
```
cd frontend/out && node server.js
```
### Build backend
> Prérequis :
> - Python >= 3.11
#### Avec `uv` (recommandé)
1. Créez l’environnement virtuel
```
uv venv
```
2. Activez‑le
```
source .venv/bin/activate
```
3. Installez les dépendances
```
uv pip install -r requirements.txt
```
4. Copiez le fichier d’environnement
```
cp .env.example .env
```
5. Modifiez les variables
```
vi .env
```
6. Démarrez le service d’administration
**Premier plan**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
```
**Arrière‑plan**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
```
7. Démarrez le service API → MCP
**Premier plan**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
```
**Arrière‑plan**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
```
### Build Docker
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
```
</details>
# 📸 Captures d’écran
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/5f71bfcf-c128-42ab-8077-3f2ede549f80" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/d7c0b40d-182e-47a6-bcdf-bd36970f5ee6" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/ae40f659-87ad-42d4-8379-b47a48eb6a29" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/1049f4e5-ec3f-4520-8480-6d6432d6f5d2" />
<br>
# 🧾 Licence
XPack‑MCP‑Market est publié sous **Apache 2.0**.
Pour plus d’informations, consultez le fichier [LICENSE](./LICENSE).
<br>
# 📬 Contact
- 🌐 Site web : [https://xpack.ai](https://xpack.ai)
- 📧 E‑mail : [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord : [Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 Partenaires
- [Cursor](https://www.cursor.com/) : éditeur de code propulsé par l’IA, intégré au flux de travail, avec propositions d’édition, compréhension profonde du code et édition en langage naturel.
- [Dify](https://dify.ai/) : principale plateforme de développement d’IA agentique, couvrant workflows d’agents, RAG, intégrations et observabilité, avec prise en charge de nombreux LLM et plugins.
- [Trae](https://www.trae.ai/) : IDE natif IA visant “The Real AI Engineer”, interface conversationnelle, génération et assistance de code pour améliorer qualité et productivité.
- [Windsurf](https://windsurf.com/) : IDE nouvelle génération exploitant l’IA avec “Cascade”, “Windsurf Tab” et “Memories” pour une compréhension profonde et un flux ininterrompu.
- [Coze](https://www.coze.com/) : plateforme ByteDance pour créer des chatbots et apps IA sans code, avec workflows, données propriétaires, plugins, bases de connaissances et modèles prêts à l’emploi.
- [Claude Code](https://www.anthropic.com/claude-code) : outil CLI d’Anthropic intégrant Claude Opus 4 dans le terminal, avec édition multi‑fichiers, exécution de commandes et intégration IDE/tests.
- [Flowith](https://flowith.io/) : espace de création basé sur un canvas multi‑fils, optimisé pour la productivité et le deep work via des agents avancés.
- [OpenManus](https://github.com/FoundationAgents/OpenManus) : framework open‑source pour bâtir des agents IA généraux, multi‑agents, intégrable avec des API LLM et l’automatisation navigateur.
- [Fellou](https://fellou.ai/) : “navigateur agentique” qui agit pour l’utilisateur, automatisant la collecte d’infos et la synthèse, avec intégrations Notion/LinkedIn.
- [Genspark](https://www.genspark.ai/) : compagnon IA tout‑en‑un (AI Slides, Sheets, Chat), outils personnalisés et AI Pods pour générer du contenu à partir de multiples sources.
- [TEN](https://github.com/TEN-framework/ten-framework) : framework open‑source pour agents vocaux multimodaux en temps réel, avec avatar, intégration MCP, communication matérielle et détection d’écran.
- [APIPark](https://apipark.com/) : portail développeur API open‑source et passerelle LLM tout‑en‑un, avec API unifiées, répartition de charge, contrôle de trafic, cache sémantique, gestion de prompts et masquage de données.
- [ChatGPT](https://chatgpt.com/) : chatbot d’OpenAI fondé sur des LLM, dialogues naturels, compréhension du contexte, intégrations variées et fonctions avancées de productivité.
- [LangChain](https://www.langchain.com/) : plateforme robuste pour développer agents et apps LLM (LangGraph, LangSmith, LangGraph Platform), pour génération de code, automatisation et recherche IA.
- [LEMON AI](https://lemonai.cc/) : premier framework IA agentique full‑stack open‑source, avec bac à sable VM d’interpréteur de code pour une exécution sécurisée.
- [LobeChat](https://lobehub.com/) : outil de productivité LLM personnel, pour créer des agents personnels/équipes, avec vaste écosystème de plugins, base de connaissances et fonctions image/voix.
- [VS Code](https://code.visualstudio.com/) : éditeur de code open‑source très populaire et extensible, compatible avec de nombreuses langues et doté de fonctions IA comme le “mode agent”.
- [XRoute](https://xroute.ai) : interface unifiée pour les LLM, meilleurs prix, meilleur débit, sans abonnement.
- [MemU](https://github.com/NevaMind-AI/memU) : framework mémoire open‑source pour compagnons IA.
+328
View File
@@ -0,0 +1,328 @@
# XPack
![b1](https://github.com/user-attachments/assets/3d50cd9a-9d28-4ec8-bb5f-d3668475b49e)
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** は世界初のオープンソース MCP マーケットプレイスです。数分で自分の MCP サービスを作成して販売できます。
<br>
✨ XPack でできること
- ✅ **OpenAPI → MCP サービス設定をワンクリック生成**
- 🧾 **SEO に強いトップページ + MCP サービスページ**
- 💳 **内蔵課金(リクエスト数 / トークン消費ベース)**
- 👥 **ユーザーアカウント管理**
- 🛠 **Stripe 決済対応**
- 🔐 **Email & Google OAuth サインイン対応**
すべて **Apache 2.0** のオープンソース。商用利用も安心です。
<br>
# ✨ クイックスタート
😍 導入はとても簡単。**1 行のコマンド**で、10 分であなたの MCP マーケットを立ち上げられます。
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![10分で MCP マーケットをデプロイする方法](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
# 📸 機能
![b2](https://github.com/user-attachments/assets/c8cc89a4-ab5f-4c90-8c97-9207b5c9f5c1)
![b3](https://github.com/user-attachments/assets/16f74c8a-b35e-40a7-8471-a5736de8e904)
![b4](https://github.com/user-attachments/assets/fc76c215-7544-4267-bc6f-22a719edec00)
![b5](https://github.com/user-attachments/assets/db40ea77-58c3-472d-ba94-35dc9716a980)
<br>
## 🖥️ システム要件
### ✅ 推奨ハードウェア
- **CPU**: 8 コア
- **メモリ**: 16 GB
- **ストレージ**: 200 GB
- **OS**: Linux
- **アーキテクチャ**: AMD64
### ✅ 最低要件
- **CPU**: 2 コア
- **メモリ**: 4 GB
- **ストレージ**: 200 GB
- **OS**: Linux / macOS
- **アーキテクチャ**: AMD64 / ARM64
<br>
## 📦 実行時依存関係
**XPack-MCP-Market** を実行するには、以下のサービス(セルフホストまたはコンテナ)が必要です。
| コンポーネント | 最低バージョン |
|---|---|
| **MySQL** | ≥ 5.7.x |
| **Redis** | ≥ 6.2.x |
| **RabbitMQ**| ≥ 4.0 |
これらのサービスが利用可能で、正しく設定されていることを確認してください。
<br>
## 💿 デプロイ
😍 導入はとても簡単。**1 行のコマンド**で、10 分であなたの MCP マーケットを立ち上げられます。
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
<details>
<summary><h4>🔖 Docker-Compose デプロイ</h4></summary>
この方法でインストールするには、[Docker](https://docs.docker.com/engine/install/) と [Docker Compose](https://docs.docker.com/compose/install/standalone/) が必要です。
1. `docker-compose.yml` を編集
```
vi docker-compose.yml
```
<br>
2. 設定を変更します。元のファイルは [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml) を参照してください。
```
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /var/lib/xpack/mysql:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market
container_name: xpack-mcp-market
privileged: true
restart: always
networks:
- xpack
ports:
- "8000:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
ports:
- 6379:6379
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
image: rabbitmq:4.1.2-alpine
container_name: xpack-rabbitmq
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
```
<br>
3. XPack-MCP-Market を起動
```
docker-compose up -d
```
<br>
4. ブラウザでポート 8000 にアクセス
* **管理画面ログイン**: http://{IP}:8000/admin-signin
* **管理ユーザー**: admin
* **管理パスワード**: 123456789
</details>
<details>
<summary><h4>🔖 ビルド</h4></summary>
1. リポジトリをクローン
```
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
```
2. プロジェクトへ移動
```
cd XPack-MCP-Market
```
### フロントエンドビルド
> 要件:
> - Node >= 22.x
> - Pnpm >= 10.x
1. ビルドスクリプトを実行
```
cd scripts && ./frontend_build.sh && cd ../
```
ビルド後、フロントエンドは `frontend/out` に出力されます。
2. UI を起動
```
cd frontend/out && node server.js
```
### バックエンドビルド
> 要件:
> - Python >= 3.11
#### `uv` を使用(推奨)
1. 仮想環境を作成
```
uv venv
```
2. 仮想環境を有効化
```
source .venv/bin/activate
```
3. 依存関係をインストール
```
uv pip install -r requirements.txt
```
4. 環境変数ファイルをコピー
```
cp .env.example .env
```
5. 環境変数を編集
```
vi .env
```
6. 管理用バックエンドサービスを起動
**フォアグラウンド**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
```
**バックグラウンド**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
```
7. API → MCP サービスを起動
**フォアグラウンド**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
```
**バックグラウンド**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
```
### Docker ビルド
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
```
</details>
# 📸 スクリーンショット
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/5f71bfcf-c128-42ab-8077-3f2ede549f80" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/d7c0b40d-182e-47a6-bcdf-bd36970f5ee6" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/ae40f659-87ad-42d4-8379-b47a48eb6a29" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/1049f4e5-ec3f-4520-8480-6d6432d6f5d2" />
<br>
# 🧾 ライセンス
XPack-MCP-Market は **Apache 2.0** ライセンスで提供されています。
詳細は [LICENSE](./LICENSE) をご覧ください。
<br>
# 📬 お問い合わせ
- 🌐 Website: [https://xpack.ai](https://xpack.ai)
- 📧 Email: [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord:[Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 パートナー
- [Cursor](https://www.cursor.com/): Cursor は AI をエディタに統合し、次の編集候補、コードベースの深い理解、自然言語での編集などを提供する AI コードエディタです。開発効率を高めます。
- [Dify](https://dify.ai/): Dify はエージェンティック AI 開発プラットフォームのリーダーで、エージェントワークフロー、RAG、各種統合、可観測性など、AI アプリ構築に必要な一式を提供します。多数の LLM とプラグインに対応。
- [Trae](https://www.trae.ai/): Trae は「真の AI エンジニア」を体現することを目指した AI ネイティブ IDE。チャットベースの UI でコード生成や支援を行い、品質と生産性を向上させます。
- [Windsurf](https://windsurf.com/): Windsurf は AI を活用した新しい IDE。深いコード理解のための「Cascade」、賢い補完「Windsurf Tab」、コードベースの記憶「Memories」などを備え、開発の流れを途切れさせません。
- [Coze](https://www.coze.com/): Coze は ByteDance の次世代 AI アプリ/チャットボット開発プラットフォーム。ノーコードのビルダー、ワークフロー、独自データ接続、プラグイン/ナレッジベースで簡単に強力なボットを作成できます。
- [Claude Code](https://www.anthropic.com/claude-code): Claude Code は Anthropic の CLI ツール。ターミナルに Claude Opus 4 を組み込み、リポジトリ横断編集、コマンド実行、IDE 連携、テスト連携などを実現します。
- [Flowith](https://flowith.io/): Flowith はキャンバス型 UI の AI ワークスペース。マルチスレッドのエージェント体験で知識変換と深い作業に最適化し、従来のチャット型を越える体験を提供します。
- [OpenManus](https://github.com/FoundationAgents/OpenManus): OpenManus は汎用 AI エージェント構築のための OSS フレームワーク。複数エージェントに対応し、LLM API やブラウザ自動化ツールと統合可能です。
- [Fellou](https://fellou.ai/): Fellou は行動まで担う「エージェンティックブラウザ」。情報収集から洞察提示までを自動化し、Notion/LinkedIn などとも連携します。
- [Genspark](https://www.genspark.ai/): Genspark は AI Slides / Sheets / Chat などを備えたオールインワンの AI コンパニオン。AI Pods による多様なコンテンツ生成が可能です。
- [TEN](https://github.com/TEN-framework/ten-framework): TEN(The Embodied Narrator)はリアルタイム・マルチモーダル音声エージェントの OSS。アバター、MCP 連携、ハードウェア通信、画面共有検出などを備えます。
- [APIPark](https://apipark.com/): APIPark は OSS のエンタープライズ API デベロッパーポータルかつオールインワン LLM ゲートウェイ。統一 API、負荷分散、トラフィック制御、セマンティックキャッシュ、プロンプト管理、マスキング等で安全・安定運用を実現。
- [ChatGPT](https://chatgpt.com/): ChatGPT は OpenAI の対話型 AI。高度な言語理解と生成で、追質問対応や各種プラットフォーム統合を通じて生産性を高めます。
- [LangChain](https://www.langchain.com/): LangChain は堅牢なエージェント/LLM アプリ開発プラットフォーム。LangGraph / LangSmith / LangGraph Platform により、コード生成、自動化、AI 検索を横断的に支援します。
- [LEMON AI](https://lemonai.cc/): Lemon AI はフルスタックなオープンソース・エージェンティック AI フレームワーク。安全な実行のための組み込み Code Interpreter VM サンドボックスを備えます。
- [LobeChat](https://lobehub.com/): LobeHub の LobeChat は個人向け LLM 生産性ツール。個人エージェント/チーム構築、豊富なプラグイン、知識ベース、画像/音声対応などを提供します。
- [VS Code](https://code.visualstudio.com/): Visual Studio Code は拡張性が高い OSS エディタ。多言語対応と AI 機能(次の編集候補、エージェントモード等)を備えます。
- [XRoute](https://xroute.ai): 複数 LLM を単一インターフェースで扱えるゲートウェイ。より良い価格とスループット、サブスクリプション不要を提供します。
- [MemU](https://github.com/NevaMind-AI/memU): MemU は AI コンパニオン向けのオープンソース記憶フレームワークです。
+328
View File
@@ -0,0 +1,328 @@
# XPack
![b1](https://github.com/user-attachments/assets/3d50cd9a-9d28-4ec8-bb5f-d3668475b49e)
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** 는 세계 최초의 오픈 소스 MCP 마켓플레이스입니다. 몇 분 만에 나만의 MCP 서비스를 만들고 판매하세요.
<br>
✨ XPack으로 할 수 있는 일
- ✅ **OpenAPI → MCP 서비스 설정을 원클릭으로 생성**
- 🧾 **SEO 친화적 홈페이지 + 서비스 상세 페이지**
- 💳 **내장 과금(요청 수 / 토큰 사용량 기준)**
- 👥 **사용자 계정 관리**
- 🛠 **Stripe 결제 지원**
- 🔐 **이메일 & Google OAuth 로그인 지원**
모든 코드는 **Apache 2.0** 라이선스로 공개되어 있으며, 상업적 사용이 가능합니다.
<br>
# ✨ 빠른 시작
😍 정말 간단합니다. **한 줄 명령어**로 10분 만에 MCP 마켓을 배포할 수 있습니다.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![10분 만에 MCP 마켓 배포하기](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
# 📸 기능
![b2](https://github.com/user-attachments/assets/c8cc89a4-ab5f-4c90-8c97-9207b5c9f5c1)
![b3](https://github.com/user-attachments/assets/16f74c8a-b35e-40a7-8471-a5736de8e904)
![b4](https://github.com/user-attachments/assets/fc76c215-7544-4267-bc6f-22a719edec00)
![b5](https://github.com/user-attachments/assets/db40ea77-58c3-472d-ba94-35dc9716a980)
<br>
## 🖥️ 시스템 요구 사항
### ✅ 권장 하드웨어
- **CPU**: 8코어
- **메모리**: 16 GB
- **스토리지**: 200 GB
- **운영체제**: Linux
- **아키텍처**: AMD64
### ✅ 최소 사양
- **CPU**: 2코어
- **메모리**: 4 GB
- **스토리지**: 200 GB
- **운영체제**: Linux / macOS
- **아키텍처**: AMD64 / ARM64
<br>
## 📦 런타임 의존성
**XPack-MCP-Market** 실행에는 다음 서비스가 필요합니다(셀프 호스팅 또는 컨테이너).
| 구성 요소 | 최소 버전 |
|---|---|
| **MySQL** | ≥ 5.7.x |
| **Redis** | ≥ 6.2.x |
| **RabbitMQ**| ≥ 4.0 |
실행 전에 위 서비스가 준비되어 있고 올바르게 설정되었는지 확인하세요.
<br>
## 💿 배포
😍 **한 줄 명령어**로 10분 만에 MCP 마켓을 배포할 수 있습니다.
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
<details>
<summary><h4>🔖 Docker-Compose 배포</h4></summary>
이 방법을 사용하려면 [Docker](https://docs.docker.com/engine/install/) 와 [Docker Compose](https://docs.docker.com/compose/install/standalone/) 가 필요합니다.
1. `docker-compose.yml` 편집
```
vi docker-compose.yml
```
<br>
2. 설정 변경(원본 예시는 [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml) 참고)
```
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /var/lib/xpack/mysql:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market
container_name: xpack-mcp-market
privileged: true
restart: always
networks:
- xpack
ports:
- "8000:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
ports:
- 6379:6379
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
image: rabbitmq:4.1.2-alpine
container_name: xpack-rabbitmq
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
```
<br>
3. XPack-MCP-Market 시작
```
docker-compose up -d
```
<br>
4. 브라우저에서 8000 포트로 접속
* **관리자 로그인 주소**: http://{IP}:8000/admin-signin
* **관리자 계정**: admin
* **관리자 비밀번호**: 123456789
</details>
<details>
<summary><h4>🔖 빌드</h4></summary>
1. 리포지토리 클론
```
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
```
2. 프로젝트 디렉토리로 이동
```
cd XPack-MCP-Market
```
### 프런트엔드 빌드
> 요구 사항:
> - Node >= 22.x
> - Pnpm >= 10.x
1. 빌드 스크립트 실행
```
cd scripts && ./frontend_build.sh && cd ../
```
빌드가 완료되면 `frontend/out` 디렉터리에 생성됩니다.
2. UI 서버 시작
```
cd frontend/out && node server.js
```
### 백엔드 빌드
> 요구 사항:
> - Python >= 3.11
#### `uv` 사용(권장)
1. 가상 환경 생성
```
uv venv
```
2. 가상 환경 활성화
```
source .venv/bin/activate
```
3. 의존성 설치
```
uv pip install -r requirements.txt
```
4. 환경 변수 파일 복사
```
cp .env.example .env
```
5. 환경 변수 편집
```
vi .env
```
6. 관리자 백엔드 서비스 시작
**포그라운드**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
```
**백그라운드**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
```
7. API → MCP 서비스 시작
**포그라운드**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
```
**백그라운드**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
```
### Docker 빌드
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
```
</details>
# 📸 스크린샷
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/5f71bfcf-c128-42ab-8077-3f2ede549f80" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/d7c0b40d-182e-47a6-bcdf-bd36970f5ee6" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/ae40f659-87ad-42d4-8379-b47a48eb6a29" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/1049f4e5-ec3f-4520-8480-6d6432d6f5d2" />
<br>
# 🧾 라이선스
XPack-MCP-Market 는 **Apache 2.0** 라이선스로 배포됩니다.
자세한 내용은 [LICENSE](./LICENSE) 를 확인하세요.
<br>
# 📬 문의
- 🌐 Website: [https://xpack.ai](https://xpack.ai)
- 📧 Email: [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord: [Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 파트너
- [Cursor](https://www.cursor.com/): Cursor는 AI를 에디터에 직접 통합하여 다음 편집 제안, 코드베이스 심층 이해, 자연어 편집 등을 제공하는 AI 코드 에디터입니다.
- [Dify](https://dify.ai/): Dify는 에이전틱 AI 개발 플랫폼으로, 에이전트 워크플로우, RAG, 통합, 가시성 등 AI 앱 구축에 필요한 모든 것을 제공합니다. 다양한 LLM과 플러그인을 지원합니다.
- [Trae](https://www.trae.ai/): Trae는 “The Real AI Engineer”를 표방하는 AI 네이티브 IDE로, 챗 기반 인터페이스로 코드 생성/도움을 제공하며 품질과 효율을 높입니다.
- [Windsurf](https://windsurf.com/): Windsurf는 AI 기반의 새로운 IDE입니다. 깊은 코드 이해를 위한 “Cascade”, 지능형 자동완성 “Windsurf Tab”, 코드 기억 “Memories” 등을 제공합니다.
- [Coze](https://www.coze.com/): Coze는 ByteDance의 차세대 AI 애플리케이션/챗봇 개발 플랫폼으로, 노코드 빌더와 워크플로우, 독자 데이터 연동, 플러그인·지식베이스로 손쉽게 강력한 봇을 만들 수 있습니다.
- [Claude Code](https://www.anthropic.com/claude-code): Claude Code는 터미널에 Claude Opus 4를 내장하는 CLI 도구로, 파일 편집/명령 실행/다중 파일 변경/IDE 통합을 지원합니다.
- [Flowith](https://flowith.io/): Flowith는 캔버스 기반 UI의 AI 작업 공간으로, 멀티 스레드형 에이전트 경험을 통해 지식 변환과 몰입 작업을 최적화합니다.
- [OpenManus](https://github.com/FoundationAgents/OpenManus): OpenManus는 범용 AI 에이전트 구축을 위한 오픈소스 프레임워크입니다. 다중 에이전트와 LLM/브라우저 자동화를 통합할 수 있습니다.
- [Fellou](https://fellou.ai/): Fellou는 사용자 대신 행동하는 “에이전틱 브라우저”로, 정보 수집부터 인사이트 제공까지 자동화하며 Notion/LinkedIn 등과도 연동됩니다.
- [Genspark](https://www.genspark.ai/): Genspark는 AI Slides/Sheets/Chat을 포함한 올인원 AI 동반자 제품으로, AI Pods를 통해 다양한 소스에서 콘텐츠를 생성합니다.
- [TEN](https://github.com/TEN-framework/ten-framework): TEN(The Embodied Narrator)은 실시간 멀티모달 음성 에이전트를 위한 오픈소스 프레임워크로, 아바타, MCP 연동, 하드웨어 통신, 화면 공유 감지 등을 제공합니다.
- [APIPark](https://apipark.com/): APIPark는 오픈소스 엔터프라이즈 API 개발자 포털이자 올인원 LLM 게이트웨이로, 통합 API 시그니처, 로드밸런싱, 트래픽 제어, 의미적 캐시, 프롬프트 관리, 데이터 마스킹 등을 지원합니다.
- [ChatGPT](https://chatgpt.com/): ChatGPT는 OpenAI가 개발한 대화형 AI로, 맥락 이해와 생성 능력을 바탕으로 후속 질문 처리와 다양한 플랫폼 통합을 지원합니다.
- [LangChain](https://www.langchain.com/): LangChain은 신뢰성 있는 에이전트/LLM 앱 개발 플랫폼으로, LangGraph/LangSmith/LangGraph Platform을 통해 코드 생성, 자동화, AI 검색을 지원합니다.
- [LEMON AI](https://lemonai.cc/): Lemon AI는 풀스택 오픈소스 에이전틱 AI 프레임워크로, 안전한 실행을 위한 내장 Code Interpreter VM 샌드박스를 제공합니다.
- [LobeChat](https://lobehub.com/): LobeChat은 개인 LLM 생산성 도구로, 개인 에이전트/전문 팀 구축, 플러그인 생태계, 지식 베이스, 이미지/음성 기능 등을 제공합니다.
- [VS Code](https://code.visualstudio.com/): Visual Studio Code는 확장성이 뛰어난 오픈소스 코드 에디터로, 다양한 언어를 지원하고 지능형 다음 편집 제안 및 “에이전트 모드” 같은 AI 기능을 갖추고 있습니다.
- [XRoute](https://xroute.ai): 여러 LLM을 단일 인터페이스로 제공하는 게이트웨이로, 더 나은 가격/처리량을 제공하며 구독이 필요 없습니다.
- [MemU](https://github.com/NevaMind-AI/memU): MemU는 AI 컴패니언을 위한 오픈소스 메모리 프레임워크입니다.
+23 -11
View File
@@ -4,22 +4,34 @@
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** 是一款轻量级、开源的 MCP(Model Context Protocol)服务市场框架。
它可以将任何符合 OpenAPI 规范的接口快速转换为 MCP 服务,并帮助你在数分钟内搭建自己的 API 商店。
**XPack** 是全球首个开源 MCP 交易平台,帮助你在10分钟内快速搭建自己的 MCP 商店并立刻开始销售 MCP 服务。
<br>
✨ 使用 XPack,你可以:
- ✅ **一键将 OpenAPI 转换为 MCP 服务配置**
- 🧾 **自动生成 SEO 友好的主页和服务页**
- 💳 **内置调用计费功能(支持按次收费)**
- 👥 **用户账户体系与管理后台**
- 🛠 **内置 Stripe 支付集成**
- 🔐 **支持邮箱 & Google 登录认证**
- ✅ 一键将 OpenAPI 转换为 MCP 服务并且为 MCP 定价
- 🧾 自动生成 SEO 友好的主页和服务页
- 💳 内置计费功能(支持按次、按Token收费)
- 👥 管理注册用户、充值、交易记录等
- 🛠 集成 Stripe 支付
- 🔐 邮箱 & Google 登录认证
- 📊 用户调用统计
本项目基于 **Apache 2.0 协议开源**,可放心用于商业用途。
@@ -27,7 +39,7 @@
# ✨ 快速开始
😍 只需一行命令,即可在 10 分钟内部署你的 MCP 服务市场:
😍 只需一行命令,即可在 10 分钟内部署你的 MCP 交易平台:
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
@@ -88,7 +100,7 @@ curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
支持系统包括:
- CentOS 7.9 / 8.5
- Ubuntu 20.04 / 22.04
- Ubuntu 20.04 / 22.04 / 24.04
- Debian 12.4
- 阿里云 Linux 2.1903 / 3.2104
@@ -113,7 +125,7 @@ curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
docker-compose up -d
```
4. 打开浏览器访问 `http://localhost:3000` 使用平台
4. 打开浏览器访问 `http://localhost:8000` 使用平台
</details>
+329
View File
@@ -0,0 +1,329 @@
# XPack
![b1](https://github.com/user-attachments/assets/3d50cd9a-9d28-4ec8-bb5f-d3668475b49e)
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** 是全球首個開源的 MCP 市集,讓你在幾分鐘內就能建立並販售自己的 MCP 服務。
<br>
✨ 使用 XPack 你可以:
- ✅ **一鍵將 OpenAPI 轉為 MCP 服務**
- 🧾 **SEO 友善的首頁與服務頁**
- 💳 **內建計費(按调用次數或 Token 使用量)**
- 👥 **使用者帳號管理**
- 🛠 **支援 Stripe 金流**
- 🔐 **支援 Email 與 Google OAuth 登入**
所有原始碼皆採用 **Apache 2.0** 授權,商用無虞。
<br>
# ✨ 快速開始
😍 部署非常簡單,以 **一行指令** 即可在 10 分鐘內架起你的 MCP 市集。
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![10 分鐘部署你的 MCP 市集](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
# 📸 功能
![b2](https://github.com/user-attachments/assets/c8cc89a4-ab5f-4c90-8c97-9207b5c9f5c1)
![b3](https://github.com/user-attachments/assets/16f74c8a-b35e-40a7-8471-a5736de8e904)
![b4](https://github.com/user-attachments/assets/fc76c215-7544-4267-bc6f-22a719edec00)
![b5](https://github.com/user-attachments/assets/db40ea77-58c3-472d-ba94-35dc9716a980)
<br>
## 🖥️ 系統需求
### ✅ 建議硬體
- **CPU**:8 核心
- **記憶體**:16 GB
- **儲存空間**:200 GB
- **作業系統**:Linux
- **架構**:AMD64
### ✅ 最低需求
- **CPU**:2 核心
- **記憶體**:4 GB
- **儲存空間**:200 GB
- **作業系統**:Linux / macOS
- **架構**:AMD64 / ARM64
<br>
## 📦 執行相依
**XPack-MCP-Market** 需要以下服務(自架或容器化):
| 元件 | 最低版本 |
|---|---|
| **MySQL** | ≥ 5.7.x |
| **Redis** | ≥ 6.2.x |
| **RabbitMQ**| ≥ 4.0 |
請先確保上述服務已可用且設定正確,再啟動後端。
<br>
## 💿 部署
😍 就這麼簡單:用 **一行指令**,10 分鐘內完成部署。
```bash
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
<details>
<summary><h4>🔖 以 Docker-Compose 部署</h4></summary>
使用此方法前,請先安裝 [Docker](https://docs.docker.com/engine/install/) 與 [Docker Compose](https://docs.docker.com/compose/install/standalone/)。
1. 編輯 `docker-compose.yml`
```
vi docker-compose.yml
```
<br>
2. 修改設定,可參考原始檔 [docker-compose.yml](https://github.com/xpack-ai/XPack-MCP-Market/blob/main/scripts/docker-compose.yml)
```
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /var/lib/xpack/mysql:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market
container_name: xpack-mcp-market
privileged: true
restart: always
networks:
- xpack
ports:
- "8000:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
ports:
- 6379:6379
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
image: rabbitmq:4.1.2-alpine
container_name: xpack-rabbitmq
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
```
<br>
3. 啟動 XPack-MCP-Market
```
docker-compose up -d
```
<br>
4. 瀏覽器透過 8000 埠連線
* **管理員登入**:http://{IP}:8000/admin-signin
* **帳號**:admin
* **密碼**:123456789
</details>
<details>
<summary><h4>🔖 建置</h4></summary>
1. 取得原始碼
```
git clone https://github.com/xpack-ai/XPack-MCP-Market.git
```
2. 進入專案資料夾
```
cd XPack-MCP-Market
```
### 前端建置
> 需求:
> - Node >= 22.x
> - Pnpm >= 10.x
1. 執行建置腳本
```
cd scripts && ./frontend_build.sh && cd ../
```
完成後產出於 `frontend/out`。
2. 啟動 UI
```
cd frontend/out && node server.js
```
### 後端建置
> 需求:
> - Python >= 3.11
#### 使用 `uv`(建議)
1. 建立虛擬環境
```
uv venv
```
2. 啟用虛擬環境
```
source .venv/bin/activate
```
3. 安裝相依
```
uv pip install -r requirements.txt
```
4. 複製環境變數檔
```
cp .env.example .env
```
5. 編輯環境變數
```
vi .env
```
6. 啟動管理後端服務
**前景**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload
```
**背景**
```
uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reload &
```
7. 啟動 API → MCP 服務
**前景**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload
```
**背景**
```
uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload &
```
### Docker 建置
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
```
</details>
# 📸 螢幕截圖
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/5f71bfcf-c128-42ab-8077-3f2ede549f80" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/d7c0b40d-182e-47a6-bcdf-bd36970f5ee6" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/ae40f659-87ad-42d4-8379-b47a48eb6a29" />
<img width="1415" height="797" alt="image" src="https://github.com/user-attachments/assets/1049f4e5-ec3f-4520-8480-6d6432d6f5d2" />
<br>
# 🧾 授權
XPack-MCP-Market 以 **Apache 2.0** 授權釋出。
詳情請見 [LICENSE](./LICENSE)。
<br>
# 📬 聯絡方式
- 🌐 Website: [https://xpack.ai](https://xpack.ai)
- 📧 Email: [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord:[Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 合作夥伴
- [Cursor](https://www.cursor.com/): Cursor 是一款將 AI 深度整合進編輯器的工具,提供下一步編輯建議、對程式碼庫的深度理解與自然語言編輯,顯著提升生產力。
- [Dify](https://dify.ai/): Dify 為領先的代理式(Agentic)AI 開發平台,涵蓋代理流程、RAG、整合與可觀測性等完整能力,支援多種 LLM 與外掛。
- [Trae](https://www.trae.ai/): Trae 是 AI 原生 IDE,以對話式介面協助產生與改寫程式碼,提升品質與效率。
- [Windsurf](https://windsurf.com/): Windsurf 為新一代 AI IDE,具備「Cascade」深度理解、「Windsurf Tab」智慧補全與「Memories」程式碼記憶等功能。
- [Coze](https://www.coze.com/): Coze 是 ByteDance 推出的次世代 AI 應用/聊天機器人平台,透過無程式碼工作流、外掛與知識庫,輕鬆建立強大的 Bot。
- [Claude Code](https://www.anthropic.com/claude-code): Claude Code 是 Anthropic 的 CLI 工具,將 Claude Opus 4 直接帶到終端機,可跨檔案編輯、執行指令並與 IDE/測試整合。
- [Flowith](https://flowith.io/): Flowith 是以畫布為核心的 AI 工作空間,透過多執行緒代理體驗,優化知識轉換與深度工作。
- [OpenManus](https://github.com/FoundationAgents/OpenManus): OpenManus 是用於構建通用 AI 代理的開源框架,支援多代理與 LLM API、瀏覽器自動化整合。
- [Fellou](https://fellou.ai/): Fellou 是能主動代辦任務的「Agentic Browser」,自動化資料蒐集與洞察產出,並和 Notion/LinkedIn 等常用工具整合。
- [Genspark](https://www.genspark.ai/): Genspark 是全方位 AI 夥伴(AI Slides、Sheets、Chat),以個人化工具與 AI Pods 從多來源生成內容。
- [TEN](https://github.com/TEN-framework/ten-framework): TEN(The Embodied Narrator)為即時多模態語音代理的開源框架,支援虛擬分身、MCP 整合、硬體通訊與畫面偵測。
- [APIPark](https://apipark.com/): APIPark 是開源企業級 API 開發者入口與整合式 LLM 閘道,提供統一 API 介面、負載平衡、流量控制、語意快取、提示管理與資料遮罩。
- [ChatGPT](https://chatgpt.com/): ChatGPT 是 OpenAI 的對話式 AI,具備進階語言理解與生成能力,支援追問、情境保留與多平台整合。
- [LangChain](https://www.langchain.com/): LangChain 是開發可靠代理與 LLM 應用的平台,涵蓋 LangGraph、LangSmith 與 LangGraph Platform 等產品。
- [LEMON AI](https://lemonai.cc/): Lemon AI 是首個全端、開源的 Agentic AI 框架,內建 Code Interpreter VM 沙盒以確保安全執行。
- [LobeChat](https://lobehub.com/): LobeChat 為個人 LLM 生產力工具,支援個人/團隊代理、外掛生態、知識庫與影像/語音功能。
- [VS Code](https://code.visualstudio.com/): Visual Studio Code 是高延展性的開源編輯器,支援多語言並內建多項 AI 功能(如下一步編輯建議與代理模式)。
- [XRoute](https://xroute.ai): 提供統一介面的 LLM 閘道,具更佳價格與吞吐量,無需訂閱。
- [MemU](https://github.com/NevaMind-AI/memU): MemU 是面向 AI 夥伴的開源記憶框架。
+115 -10
View File
@@ -3,19 +3,30 @@
<p align="center">
<a href="/README.md">English</a>
|
<a href="/README-fr.md">Français</a>
|
<a href="/README-de.md">Deutsch</a>
|
<a href="/README-es.md">Español</a>
|
<a href="/README-ja.md">日本語</a>
|
<a href="/README-ko.md">한국어</a>
|
<a href="/README-zh-tw.md">繁體中文</a>
|
<a href="/README-zh-cn.md">简体中文</a>
</p>
**XPack** is a lightweight, open-source marketplace framework for MCP (Model Context Protocol) services.
It allows you to transform any OpenAPI into a monetizable MCP service and build your own API store in just minutes.
**XPack** is the world’s first open-source MCP marketplace, to quickly create and sell your own MCP services in just minutes.
<br>
✨ With XPack, you can:
- ✅ **One-click OpenAPI → MCP service config**
- 🧾 **SEO-friendly homepage + mcp service page**
- 💳 **Built-in billing (per-call)**
- 💳 **Built-in billing (per-call or token usage)**
- 👥 **User account management**
- 🛠 **Support Stripe Payment**
- 🔐 **Support Email & Google OAuth Sign in**
@@ -32,6 +43,9 @@ Everything is open-source and licensed under **Apache 2.0** — ready for commer
curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
[![Learn how to deploy your mcp market in 10 minutes](https://github.com/user-attachments/assets/8881d724-b6aa-47b7-bbd7-b587ef541957)](https://www.youtube.com/watch?v=XHJXyvDevd8)
<br>
@@ -127,8 +141,7 @@ curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
networks:
- xpack
ports:
- "3000:3000"
- "8002:8002"
- "8000:80" # Map port 8000 of the container to port 80 of the host, if you want to access XPack-MCP-Market in your browser at port 8000
depends_on:
- xpack-mysql
- xpack-redis
@@ -176,9 +189,9 @@ curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
<br>
4. Access `XPack-MCP-Market` in your browser at port 3000
4. Access `XPack-MCP-Market` in your browser at port 8000
* **Admin User Login Address**: http://{IP}:3000/admin-signin
* **Admin User Login Address**: http://{IP}:8000/admin
* **Admin User**: admin
* **Admin Password**: 123456789
</details>
@@ -199,8 +212,16 @@ curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
> Requirements:
> - Node >= 22.x
> - Pnpm >= 10.x
1. Execute the frontend build script
1. Configure environment variable NEXT_PUBLIC_API_URL:
```
vi frontend/.env
```
File content:
```
NEXT_PUBLIC_API_URL=http://127.0.0.1:8001
```
2. Execute the frontend build script
```
cd scripts && ./frontend_build.sh && cd ../
```
@@ -256,7 +277,7 @@ curl -sSO https://xpack.ai/install/quick-start.sh; bash quick-start.sh
```
### Docker Build
```
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.0.0 -f ./scripts/Dockerfile ./
docker build -t xpack-mcp-market --build-arg APP=xpack-mcp-market --build-arg VERSION=1.1.0 -f ./scripts/Dockerfile ./
```
</details>
@@ -281,3 +302,87 @@ For details, please see the [LICENSE](./LICENSE) file.
- 🌐 Website: [https://xpack.ai](https://xpack.ai)
- 📧 Email: [contact@xpack.com](mailto:contact@xpack.com)
- 💬 Discord:[Link](https://discord.gg/cyZfcdCXkW)
<br>
# 🤝 Partner
- [Cursor](https://www.cursor.com/): Cursor is an AI-powered code editor that integrates artificial intelligence directly into the coding workflow, offering features like intelligent next edit suggestions, deep codebase understanding for relevant answers, and natural language editing to streamline development tasks and boost developer productivity.
- [Dify](https://dify.ai/): Dify is a leading Agentic AI Development Platform that provides a comprehensive suite of tools for building and extending AI applications, offering everything needed for agentic workflows, RAG pipelines, integrations, and observability, while allowing users to amplify their applications with various global Large Language Models (LLMs) and versatile plugins.
- [Trae](https://www.trae.ai/): Trae is an AI-native Integrated Development Environment (IDE) product that aims to embody the concept of “The Real AI Engineer” through intelligent productivity, seamlessly integrating into the development process to enhance quality and efficiency, featuring a chat-based interaction interface and supporting code generation and assistance.
- [Windsurf](https://windsurf.com/): Windsurf is an AI code editor designed to provide a seamless and limitless flow for developers, introducing a new purpose-built IDE that leverages AI to enhance coding with features like "Cascade" for deep codebase understanding, "Windsurf Tab" for intelligent autocompletion, and "Memories" for remembering important aspects of the codebase.
- [Coze](https://www.coze.com/): Coze is a next-generation AI application and chatbot development platform by ByteDance, empowering users to easily create and deploy powerful AI chatbots across various platforms with a no-code bot builder, integrated workflow logic, access to proprietary data, and simplified creation through pre-built plugins, knowledge bases, and workflows.
- [Claude Code](https://www.anthropic.com/claude-code): Claude Code is a command-line AI tool by Anthropic that embeds the Claude Opus 4 model directly into the user’s terminal, providing deep codebase awareness, the ability to edit files and execute commands, and making coordinated changes across multiple files, all while integrating seamlessly with popular IDEs and leveraging existing test suites.
- [Flowith](https://flowith.io/): Flowith is an AI creation workspace designed to revolutionize productivity and deep work by transforming knowledge and streamlining tasks through a multi-thread interface powered by advanced AI agents, offering an intuitive canvas-based user experience unlike traditional chat-based AI tools, and including a 24/7 operational version for complex tasks.
- [OpenManus](https://github.com/FoundationAgents/OpenManus): OpenManus is an open-source framework dedicated to building general AI agents, aiming to provide a platform where users can create and deploy their own agents without an invite code, supporting multi-agent capabilities, and requiring configuration for Large Language Model (LLM) APIs while integrating with browser automation tools.
- [Fellou](https://fellou.ai/): Fellou is an innovative Agentic Browser designed to transcend traditional web browsing by actively performing actions on behalf of the user, automating the entire process of information gathering and insight delivery, and excelling in in-depth research with seamless integrations with popular tools like Notion and LinkedIn.
- [Genspark](https://www.genspark.ai/): Genspark is an ultimate all-in-one AI companion offering a comprehensive suite of tools like AI Slides, AI Sheets, and AI Chat, designed to enhance various aspects of productivity and content creation, with personalized tools and AI Pods for generating content from diverse sources.
- [TEN](https://github.com/TEN-framework/ten-framework): TEN (The Embodied Narrator) is an open-source framework for building real-time, multimodal conversational voice AI agents, including components like TEN Framework, TEN Turn Detection, TEN Agent, TMAN Designer, and TEN Portal, offering features like Real-time Avatar, seamless MCP integration, real-time hardware communication, and vision/screenshare detection.
- [APIPark](https://apipark.com/): APIPark is an open-source enterprise API developer portal and an all-in-one LLM gateway, providing fine-grained, visual management of LLMs in production environments with features like unified API signatures, load balancing, traffic control, intelligent semantic caching, flexible prompt management, and data masking, ensuring safer and more stable LLM calls.
- [ChatGPT](https://chatgpt.com/): ChatGPT is an AI chatbot developed by OpenAI, built upon large language models like GPT-3.5 and GPT-4, designed to generate human-like conversational dialogue, understand context, answer follow-up questions, and integrate with various platforms for enhanced productivity through advanced language understanding, generation, and multilingual capabilities.
- [LangChain](https://www.langchain.com/): LangChain is a robust platform engineered for the development of reliable agents and Large Language Model (LLM) applications, offering a comprehensive product suite that seamlessly integrates various tools across the entire application development lifecycle, including LangGraph, LangSmith, and the LangGraph Platform, with functionalities for code generation, automation, and AI Search.
- [LEMON AI](https://lemonai.cc/): Lemon AI is the first Full-stack, Open-source, Agentic AI framework, offering a fully local alternative to platforms like Manus & Genspark AI. It features an integrated Code Interpreter VM sandbox for safe execution.
- [LobeChat](https://lobehub.com/): LobeHub offers LobeChat, a personal LLM productivity tool designed to elevate the user experience beyond traditional chatbots by empowering individuals to build personal AI agents and professional teams, supporting a wide array of LLMs, offering a simple chat interface, visual recognition, voice interaction, a rich plugin ecosystem, and knowledge base functionalities.
- [VS Code](https://code.visualstudio.com/): Visual Studio Code (VS Code) is a widely popular, free, and open-source code editor by Microsoft, renowned for its extensibility and customization, supporting vast programming languages, and integrating AI capabilities like intelligent next edit suggestions and an advanced “agent mode” for complex tasks, with broad compatibility with various AI models.
- [XRoute](https://xroute.ai): The Unified Interface For LLMs, provides better prices, better throughput, and no subscription.
- [MemU](https://github.com/NevaMind-AI/memU): MemU is an open-source memory framework for AI companions
---
## 国内镜像部署(本项目维护,随 Release 更新)
镜像已双渠道发布,任选其一拉取:
- 公网:`gitea.88531.cn/jinghui/xpack-mcp-market:v1.5.1`、`jpccr.ccs.tencentyun.com/jinghui/xpack-mcp-market:v1.5.1`
- 内网:`192.168.68.19:3200/jinghui/xpack-mcp-market:v1.5.1`
### 方式一:docker-compose(推荐,带齐全部服务参数)
```bash
git clone http://192.168.68.19:3200/jinghui/xpack-mcp.git && cd xpack-mcp
# 1) 把 docker-compose.yml 中 xpack-mcp-market 服务的 image 改为公网镜像:
# image: xpackai/xpack-mcp-market:zhcn
# → image: gitea.88531.cn/jinghui/xpack-mcp-market:v1.5.1
# 2) 准备环境变量(支付渠道加密密钥,必须改掉示例值)
cp .env.example .env && vim .env # 修改 PAYMENT_CONFIG_SECRET_KEY 为自己的 32 字节随机串
docker compose up -d # 启动 mysql/redis/rabbitmq/market 四个容器
```
注意事项:
- `PAYMENT_CONFIG_SECRET_KEY` 缺失时 compose 会直接报错拒绝启动(`.env` 不可删);
- 数据库账号、Redis 密码、RabbitMQ 密码在 compose 里已固定,改任何一项都要同步改应用配置;
- 数据目录 `./mysql-data` 与容器网络 `172.101.0.0/24` 不要与已有环境冲突。
### 方式二:docker run(主站单容器)
前置:MySQL 8.0.37 / Redis 7.2.4 / RabbitMQ 4.1.2 已就绪,且容器与依赖服务同一网络(应用默认按主机名 `xpack-mysql`、`xpack-redis`、`xpack-rabbitmq` 连接)。
```bash
docker run -d --name xpack-mcp-market \
--restart always --privileged \
-p 8010:80 \
-e PAYMENT_CONFIG_SECRET_KEY='<32字节随机串>' \
-e PAYMENT_CONFIG_KEY_ID=default \
--network <依赖服务所在网络> \
gitea.88531.cn/jinghui/xpack-mcp-market:v1.5.1
```
+68
View File
@@ -0,0 +1,68 @@
version: '3'
services:
xpack-mysql:
image: mysql:8.0.37
privileged: true
restart: always
container_name: xpack-mysql
hostname: xpack-mysql
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
ports:
- "33306:3306"
environment:
- MYSQL_ROOT_PASSWORD=mysql_ZTdhRB
- MYSQL_DATABASE=xpack
volumes:
- /vol3/1000/HD3/docker/xpack-mcp/mysql-data:/var/lib/mysql
networks:
- xpack
xpack-mcp-market:
image: xpackai/xpack-mcp-market:zhcn
container_name: xpack-mcp-market
privileged: true
restart: always
environment:
# AES-256-GCM key protecting payment channel config (epay merchant key, stripe secret).
# Lives here rather than in the image so the sample key shipped in .env.example
# can never decrypt this deployment's config.
- PAYMENT_CONFIG_SECRET_KEY=${PAYMENT_CONFIG_SECRET_KEY:?PAYMENT_CONFIG_SECRET_KEY not set - copy .env.example to .env}
- PAYMENT_CONFIG_KEY_ID=default
networks:
- xpack
ports:
- "8010:80"
depends_on:
- xpack-mysql
- xpack-redis
- xpack-rabbitmq
xpack-redis:
container_name: xpack-redis
image: redis:7.2.4
hostname: xpack-redis
privileged: true
restart: always
command:
- bash
- -c
- "redis-server --protected-mode yes --logfile redis.log --appendonly no --port 6379 --requirepass redis_6sJZDm"
networks:
- xpack
xpack-rabbitmq:
container_name: xpack-rabbitmq
image: rabbitmq:4.1.2-alpine
privileged: true
restart: always
environment:
- RABBITMQ_DEFAULT_USER=rabbitmq
- RABBITMQ_DEFAULT_PASS=rabbitmq_Gs123dA
networks:
- xpack
networks:
xpack:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.101.0.0/24
+1 -1
View File
@@ -9,7 +9,7 @@
!.yarn/plugins
!.yarn/releases
!.yarn/versions
/pnpm-lock.yaml
# testing
/coverage
+7 -7
View File
@@ -14,7 +14,7 @@ XPack WebUI is the flagship frontend interface for the MCP Store ecosystem, desi
### ✨ Key Features
- **🛍️ Comprehensive Marketplace**: Browse, search, and discover MCP services across multiple categories
- **🛍️ Comprehensive Marketplace**: Browse, search, and discover MCP servers across multiple categories
- **👤 Multi-tier Authentication**: Secure user and admin authentication systems
- **⚙️ Advanced Admin Console**: Complete service management, user administration, and revenue tracking
- **🌐 Full Internationalization**: Native support for English and Chinese with extensible i18n framework
@@ -110,7 +110,7 @@ src/
│ ├── console/ # Admin console components
│ ├── dashboard/ # User dashboard components
│ ├── marketplace/ # Marketplace components
│ ├── mcp-services/ # MCP service management
│ ├── mcp-services/ # MCP server management
│ ├── user-management/ # User administration
│ ├── revenue-management/# Revenue tracking
│ ├── system-setting/ # System configuration
@@ -129,7 +129,7 @@ src/
│ └── utils/ # Utility functions
├── services/ # Backend API integration
│ ├── marketplaceService.ts # Marketplace API
│ ├── mcpService.ts # MCP service API
│ ├── mcpService.ts # MCP server API
│ ├── userService.ts # User management API
│ ├── revenueService.ts # Revenue tracking API
│ ├── paymentChannelService.ts # Payment API
@@ -139,7 +139,7 @@ src/
├── hooks/ # App-specific hooks
│ ├── useAdminLogin.tsx # Admin authentication
│ ├── useLogin.tsx # User authentication
│ ├── useMCPServicesList.ts # MCP services data
│ ├── useMCPServicesList.ts # MCP servers data
│ ├── useMCPServiceDetail.ts # Service details
│ ├── useUserManagement.ts # User management
│ ├── useRevenueManagement.ts # Revenue data
@@ -150,7 +150,7 @@ src/
├── types/ # TypeScript type definitions
│ ├── admin.ts # Admin types
│ ├── dashboard.ts # Dashboard types
│ ├── mcp-service.ts # MCP service types
│ ├── mcp-service.ts # MCP server types
│ ├── payment.ts # Payment types
│ ├── revenue.ts # Revenue types
│ ├── system.ts # System types
@@ -166,7 +166,7 @@ src/
### Marketplace Experience
- **Service Discovery**: Advanced search and filtering capabilities for MCP services
- **Service Discovery**: Advanced search and filtering capabilities for MCP servers
- **Service Catalog**: Browse services by categories with detailed information
- **Service Details**: Comprehensive service documentation and API specifications
- **Installation Guides**: Step-by-step integration instructions for developers
@@ -178,7 +178,7 @@ src/
### Admin Console
- **MCP Services Management**: Complete CRUD operations for MCP services
- **MCP Servers Management**: Complete CRUD operations for MCP servers
- Service creation and editing with OpenAPI generator
- OpenAPI document parsing from files or URLs
- Service status management (enabled/disabled)
+2 -2
View File
@@ -47,7 +47,7 @@ const result = await rpcClient.call("marketplace.getServices", {
Located in `src/services/marketplaceService.ts`:
```typescript
// Fetch all MCP services
// Fetch all MCP servers
export async function fetchServices(): Promise<ServiceData[]>;
// Fetch service by ID
@@ -352,7 +352,7 @@ function ServicesPage() {
### Public Endpoints
- `GET /api/web/mcp_services` - List all MCP services
- `GET /api/web/mcp_services` - List all MCP servers
- `POST /api/web/mcp_service_info` - Get service details by ID
- `GET /api/web/categories` - List service categories
- `POST /api/auth/login` - User login
+4 -4
View File
@@ -58,7 +58,7 @@ src/
│ ├── console/ # Console management
│ ├── dashboard/ # Dashboard components
│ ├── marketplace/ # Marketplace components
│ ├── mcp-services/ # MCP service management
│ ├── mcp-services/ # MCP server management
│ ├── revenue-management/# Revenue tracking
│ ├── system-setting/ # System configuration
│ ├── user-management/ # User administration
@@ -77,7 +77,7 @@ src/
│ └── utils/ # Utility functions
├── services/ # Backend API integration
│ ├── marketplaceService.ts # Marketplace API
│ ├── mcpService.ts # MCP service API
│ ├── mcpService.ts # MCP server API
│ ├── userService.ts # User management API
│ ├── revenueService.ts # Revenue tracking API
│ ├── paymentChannelService.ts # Payment API
@@ -87,7 +87,7 @@ src/
├── hooks/ # App-specific hooks
│ ├── useAdminLogin.tsx # Admin authentication
│ ├── useLogin.tsx # User authentication
│ ├── useMCPServicesList.ts # MCP services data
│ ├── useMCPServicesList.ts # MCP servers data
│ ├── useMCPServiceDetail.ts # Service details
│ ├── useUserManagement.ts # User management
│ ├── useRevenueManagement.ts # Revenue data
@@ -98,7 +98,7 @@ src/
├── types/ # TypeScript type definitions
│ ├── admin.ts # Admin types
│ ├── dashboard.ts # Dashboard types
│ ├── mcp-service.ts # MCP service types
│ ├── mcp-service.ts # MCP server types
│ ├── payment.ts # Payment types
│ ├── revenue.ts # Revenue types
│ ├── system.ts # System types
+159 -152
View File
@@ -16,34 +16,34 @@ XPack WebUI supports multiple languages using react-i18next. This guide covers h
The i18n system is configured in `src/shared/lib/i18n.ts`:
```typescript
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import Backend from 'i18next-http-backend'
import LanguageDetector from 'i18next-browser-languagedetector'
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import Backend from "i18next-http-backend";
import LanguageDetector from "i18next-browser-languagedetector";
i18n
.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: 'en',
debug: process.env.NODE_ENV === 'development',
fallbackLng: "en",
debug: process.env.NODE_ENV === "development",
interpolation: {
escapeValue: false,
},
backend: {
loadPath: '/locales/{{lng}}/{{ns}}.json',
},
detection: {
order: ['localStorage', 'navigator', 'htmlTag'],
caches: ['localStorage'],
},
})
export default i18n
backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
detection: {
order: ["localStorage", "navigator", "htmlTag"],
caches: ["localStorage"],
},
});
export default i18n;
```
### Translation Files Structure
@@ -73,7 +73,7 @@ import { useTranslation } from '@/shared/lib/useTranslation'
function MyComponent() {
const { t } = useTranslation()
return (
<div>
<h1>{t('Welcome')}</h1>
@@ -90,7 +90,7 @@ import { useTranslation } from '@/shared/lib/useTranslation'
function MarketplaceComponent() {
const { t } = useTranslation('marketplace')
return (
<div>
<h1>{t('title')}</h1>
@@ -106,7 +106,7 @@ function MarketplaceComponent() {
function AdminComponent() {
const { t: tCommon } = useTranslation('common')
const { t: tAdmin } = useTranslation('admin')
return (
<div>
<button>{tCommon('save')}</button>
@@ -139,7 +139,7 @@ function AdminComponent() {
```typescript
function Component() {
const { t } = useTranslation()
return (
<div>
<h1>{t('welcome')}</h1>
@@ -172,7 +172,7 @@ function Component() {
```typescript
function UserProfile() {
const { t } = useTranslation()
return (
<div>
<h1>{t('user.profile.title')}</h1>
@@ -198,7 +198,7 @@ function UserProfile() {
function Component() {
const { t } = useTranslation()
const user = { name: 'John', lastLogin: new Date() }
return (
<div>
<h1>{t('greeting', { name: user.name })}</h1>
@@ -227,7 +227,7 @@ function Component() {
function Component() {
const { t } = useTranslation()
const count = 5
return (
<div>
<p>{t('item', { count })}</p>
@@ -255,7 +255,7 @@ function Component() {
function Component() {
const { t } = useTranslation()
const userGender = 'male'
return (
<button>
{t('button.save', { context: userGender })}
@@ -278,11 +278,11 @@ const languages = [
function LanguageSelector() {
const { i18n, t } = useTranslation()
const changeLanguage = (languageCode: string) => {
i18n.changeLanguage(languageCode)
}
return (
<Select
label={t('common.language')}
@@ -305,24 +305,27 @@ function LanguageSelector() {
### Programmatic Language Change
```typescript
import { useTranslation } from '@/shared/lib/useTranslation'
import { useTranslation } from "@/shared/lib/useTranslation";
function useLanguage() {
const { i18n } = useTranslation()
const changeLanguage = useCallback((language: string) => {
i18n.changeLanguage(language)
// Optionally save to user preferences
localStorage.setItem('preferred-language', language)
}, [i18n])
const getCurrentLanguage = () => i18n.language
const { i18n } = useTranslation();
const changeLanguage = useCallback(
(language: string) => {
i18n.changeLanguage(language);
// Optionally save to user preferences
localStorage.setItem("preferred-language", language);
},
[i18n]
);
const getCurrentLanguage = () => i18n.language;
return {
currentLanguage: i18n.language,
changeLanguage,
getCurrentLanguage,
}
};
}
```
@@ -373,20 +376,20 @@ i18n.init({
// ... other config
interpolation: {
format: (value, format, lng) => {
if (format === 'uppercase') return value.toUpperCase()
if (format === 'currency') {
if (format === "uppercase") return value.toUpperCase();
if (format === "currency") {
return new Intl.NumberFormat(lng, {
style: 'currency',
currency: 'USD'
}).format(value)
style: "currency",
currency: "USD",
}).format(value);
}
if (format === 'date') {
return new Intl.DateTimeFormat(lng).format(value)
if (format === "date") {
return new Intl.DateTimeFormat(lng).format(value);
}
return value
}
}
})
return value;
},
},
});
```
```json
@@ -401,27 +404,30 @@ i18n.init({
```typescript
// Custom hook with additional features
export function useAppTranslation(namespace?: string) {
const { t, i18n } = useTranslation(namespace)
const tWithFallback = useCallback((key: string, options?: any) => {
const translation = t(key, options)
// Log missing translations in development
if (process.env.NODE_ENV === 'development' && translation === key) {
console.warn(`Missing translation for key: ${key}`)
}
return translation
}, [t])
const isRTL = i18n.language === 'ar' || i18n.language === 'he'
const { t, i18n } = useTranslation(namespace);
const tWithFallback = useCallback(
(key: string, options?: any) => {
const translation = t(key, options);
// Log missing translations in development
if (process.env.NODE_ENV === "development" && translation === key) {
console.warn(`Missing translation for key: ${key}`);
}
return translation;
},
[t]
);
const isRTL = i18n.language === "ar" || i18n.language === "he";
return {
t: tWithFallback,
i18n,
isRTL,
currentLanguage: i18n.language,
}
};
}
```
@@ -458,7 +464,7 @@ export function useAppTranslation(namespace?: string) {
// en/marketplace.json - Feature-specific translations
{
"title": "MCP Store",
"subtitle": "Discover and install MCP services",
"subtitle": "Discover and install MCP servers",
"search": {
"placeholder": "Search services...",
"noResults": "No services found",
@@ -482,42 +488,45 @@ export function useAppTranslation(namespace?: string) {
```typescript
// Validation script to check for missing translations
import fs from 'fs'
import path from 'path'
import fs from "fs";
import path from "path";
function validateTranslations() {
const localesDir = path.join(process.cwd(), 'public/locales')
const languages = fs.readdirSync(localesDir)
const baseLanguage = 'en'
const baseTranslations = loadTranslations(baseLanguage)
languages.forEach(lang => {
if (lang === baseLanguage) return
const translations = loadTranslations(lang)
const missingKeys = findMissingKeys(baseTranslations, translations)
const localesDir = path.join(process.cwd(), "public/locales");
const languages = fs.readdirSync(localesDir);
const baseLanguage = "en";
const baseTranslations = loadTranslations(baseLanguage);
languages.forEach((lang) => {
if (lang === baseLanguage) return;
const translations = loadTranslations(lang);
const missingKeys = findMissingKeys(baseTranslations, translations);
if (missingKeys.length > 0) {
console.warn(`Missing translations in ${lang}:`, missingKeys)
console.warn(`Missing translations in ${lang}:`, missingKeys);
}
})
});
}
function findMissingKeys(base: any, target: any, prefix = ''): string[] {
const missing: string[] = []
Object.keys(base).forEach(key => {
const fullKey = prefix ? `${prefix}.${key}` : key
function findMissingKeys(base: any, target: any, prefix = ""): string[] {
const missing: string[] = [];
Object.keys(base).forEach((key) => {
const fullKey = prefix ? `${prefix}.${key}` : key;
if (!(key in target)) {
missing.push(fullKey)
} else if (typeof base[key] === 'object' && typeof target[key] === 'object') {
missing.push(...findMissingKeys(base[key], target[key], fullKey))
missing.push(fullKey);
} else if (
typeof base[key] === "object" &&
typeof target[key] === "object"
) {
missing.push(...findMissingKeys(base[key], target[key], fullKey));
}
})
return missing
});
return missing;
}
```
@@ -525,32 +534,32 @@ function findMissingKeys(base: any, target: any, prefix = ''): string[] {
```typescript
// Extract translation keys from components
import { parse } from '@babel/parser'
import traverse from '@babel/traverse'
import fs from 'fs'
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";
import fs from "fs";
function extractTranslationKeys(filePath: string): string[] {
const code = fs.readFileSync(filePath, 'utf-8')
const code = fs.readFileSync(filePath, "utf-8");
const ast = parse(code, {
sourceType: 'module',
plugins: ['typescript', 'jsx']
})
const keys: string[] = []
sourceType: "module",
plugins: ["typescript", "jsx"],
});
const keys: string[] = [];
traverse(ast, {
CallExpression(path) {
if (
path.node.callee.type === 'Identifier' &&
path.node.callee.name === 't' &&
path.node.arguments[0]?.type === 'StringLiteral'
path.node.callee.type === "Identifier" &&
path.node.callee.name === "t" &&
path.node.arguments[0]?.type === "StringLiteral"
) {
keys.push(path.node.arguments[0].value)
keys.push(path.node.arguments[0].value);
}
}
})
return keys
},
});
return keys;
}
```
@@ -560,25 +569,25 @@ function extractTranslationKeys(filePath: string): string[] {
```typescript
// Good: Descriptive, hierarchical keys
t('marketplace.service.install.button')
t('user.profile.form.validation.email.required')
t('admin.dashboard.stats.users.total')
t("marketplace.service.install.button");
t("user.profile.form.validation.email.required");
t("admin.dashboard.stats.users.total");
// Bad: Generic, flat keys
t('button1')
t('error')
t('text')
t("button1");
t("error");
t("text");
```
### 2. Consistent Namespace Usage
```typescript
// Good: Feature-based namespaces
const { t } = useTranslation('marketplace')
const { t: tCommon } = useTranslation('common')
const { t } = useTranslation("marketplace");
const { t: tCommon } = useTranslation("common");
// Bad: Mixed namespace usage
const { t } = useTranslation() // Default namespace for everything
const { t } = useTranslation(); // Default namespace for everything
```
### 3. Translation Context
@@ -601,10 +610,8 @@ const { t } = useTranslation() // Default namespace for everything
```typescript
// Good: Use interpolation
t('welcome.message', { userName: user.name })
// Bad: String concatenation
`Welcome, ${user.name}!`
t("welcome.message", { userName: user.name })// Bad: String concatenation
`Welcome, ${user.name}!`;
```
### 5. Error Message Translations
@@ -649,7 +656,7 @@ describe('MyComponent', () => {
renderWithI18n(<MyComponent />)
expect(screen.getByText('Welcome')).toBeInTheDocument()
})
it('renders in Chinese', async () => {
await i18n.changeLanguage('zh-CN')
renderWithI18n(<MyComponent />)
@@ -662,12 +669,12 @@ describe('MyComponent', () => {
```typescript
// test-utils/i18n-for-tests.ts
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
i18n.use(initReactI18next).init({
lng: 'en',
fallbackLng: 'en',
lng: "en",
fallbackLng: "en",
debug: false,
interpolation: {
escapeValue: false,
@@ -675,20 +682,20 @@ i18n.use(initReactI18next).init({
resources: {
en: {
translation: {
'Welcome': 'Welcome',
'Goodbye': 'Goodbye',
}
Welcome: "Welcome",
Goodbye: "Goodbye",
},
},
'zh-CN': {
"zh-CN": {
translation: {
'Welcome': '欢迎',
'Goodbye': '再见',
}
}
}
})
Welcome: "欢迎",
Goodbye: "再见",
},
},
},
});
export default i18n
export default i18n;
```
## Adding New Languages
@@ -704,10 +711,10 @@ export default i18n
```typescript
// Add to language selector
const languages = [
{ code: 'en', name: 'English', flag: '🇺🇸' },
{ code: 'zh-CN', name: '中文', flag: '🇨🇳' },
{ code: 'es', name: 'Español', flag: '🇪🇸' }, // New language
]
{ code: "en", name: "English", flag: "🇺🇸" },
{ code: "zh-CN", name: "中文", flag: "🇨🇳" },
{ code: "es", name: "Español", flag: "🇪🇸" }, // New language
];
```
### 3. Update i18n Configuration
@@ -716,12 +723,12 @@ const languages = [
// Add fallback languages if needed
i18n.init({
fallbackLng: {
'zh-CN': ['zh', 'en'],
'es': ['en'],
'default': ['en']
"zh-CN": ["zh", "en"],
es: ["en"],
default: ["en"],
},
// ... other config
})
});
```
This comprehensive i18n guide ensures consistent and maintainable internationalization throughout the XPack WebUI application.
This comprehensive i18n guide ensures consistent and maintainable internationalization throughout the XPack WebUI application.
-59
View File
@@ -1,59 +0,0 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
// Enable SSR
output: "standalone",
// Optimize images
images: {
domains: [],
unoptimized: false, // Enable image optimization for SSR
},
// Webpack configuration
webpack: (config) => {
return config;
},
// Redirect configuration
async redirects() {
return [];
},
async rewrites() {
return [
{
source: "/api/:path*",
destination: `${process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8001"}/api/:path*`,
},
{
source: "/uploads/:path*",
destination: `${process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8001"}/uploads/:path*`,
},
];
},
// Headers for better performance
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
],
},
];
},
};
module.exports = nextConfig;
+41
View File
@@ -1,10 +1,15 @@
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
reactStrictMode: false,
output: "standalone",
experimental: {
optimizePackageImports: ["@nextui-org/react"],
},
transpilePackages: ["@nextui-org/react", "@nextui-org/theme"],
images: {
remotePatterns: [
{
@@ -12,6 +17,42 @@ const nextConfig: NextConfig = {
hostname: "**",
},
],
unoptimized: false,
},
// Redirect configuration
async redirects() {
return [];
},
async rewrites() {
return [
{
source: "/uploads/:path*",
destination: `${
process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8001"
}/uploads/:path*`,
},
];
},
// Headers for better performance
async headers() {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
],
},
];
},
};
+9 -7
View File
@@ -16,12 +16,15 @@
"dependencies": {
"@hookform/resolvers": "^3.3.4",
"@iconify/react": "^5.0.2",
"@internationalized/date": "^3.10.1",
"@nextui-org/react": "^2.6.11",
"@nextui-org/theme": "^2.4.5",
"@tailwindcss/typography": "^0.5.16",
"@types/crypto-js": "^4.2.2",
"@uiw/react-markdown-preview": "^5.1.5",
"@uiw/react-md-editor": "^4.0.7",
"animejs": "^4.0.2",
"async_hooks": "^1.0.0",
"crypto-js": "^4.2.0",
"framer-motion": "^11.5.6",
"i18next": "^23.8.0",
@@ -30,15 +33,14 @@
"immer": "^10.0.3",
"lottie-react": "^2.4.1",
"lucide-react": "^0.475.0",
"next": "^15.3.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "^16.1.5",
"react": "^19.1.4",
"react-dom": "^19.1.4",
"react-hook-form": "^7.49.3",
"react-hot-toast": "^2.4.1",
"react-hover-video-player": "^10.0.2",
"react-i18next": "^14.0.1",
"react-icons": "^5.3.0",
"react-markdown": "^10.1.0",
"recharts": "^2.15.1",
"simplex-noise": "^4.0.3",
"swr": "^2.2.4",
@@ -48,12 +50,12 @@
},
"devDependencies": {
"@types/node": "^20.11.0",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@types/three": "^0.177.0",
"autoprefixer": "^10.4.17",
"eslint": "^8.56.0",
"eslint-config-next": "15.0.3",
"eslint-config-next": "16.1.5",
"postcss": "^8.4.33",
"tailwindcss": "^3.4.17",
"typescript": "^5.3.3"
-15851
View File
File diff suppressed because it is too large. Load diff
+242 -12
View File
@@ -1,13 +1,243 @@
{
"**XPack** is a lightweight, open-source marketplace framework for MCP (Model Context Protocol) services.": "**XPack** is a lightweight, open-source marketplace framework for MCP (Model Context Protocol) services.",
"It allows you to transform any OpenAPI into a monetizable MCP service and build your own API store in just minutes.": "It allows you to transform any OpenAPI into a monetizable MCP service and build your own API store in just minutes.",
"✨ With XPack, you can:": "✨ With XPack, you can:",
"- ✅ **One-click OpenAPI → MCP service config**": "- ✅ **One-click OpenAPI → MCP service config**",
"- 🧾 **SEO-friendly homepage + mcp service page**": "- 🧾 **SEO-friendly homepage + mcp service page**",
"- 💳 **Built-in billing (per-call)**": "- 💳 **Built-in billing (per-call)**",
"- 👥 **User account management**": "- 👥 **User account management**",
"- 🛠 **Support Stripe Payment**": "- 🛠 **Support Stripe Payment**",
"- 🔐 **Support Email & Google OAuth Sign in**": "- 🔐 **Support Email & Google OAuth Sign in**",
"Everything is open-source and licensed under **Apache 2.0** — ready for commercial use.": "Everything is open-source and licensed under **Apache 2.0** — ready for commercial use.",
"About Us": "About Us"
}
"Server Configuration": "Server Configuration",
"Subdomain": "Subdomain",
"Enter subdomain (e.g., mysite)": "Enter subdomain (e.g., mysite)",
"Subdomain is required": "Subdomain is required",
"Subdomain must contain only lowercase letters, numbers, and hyphens": "Subdomain must contain only lowercase letters, numbers, and hyphens",
"Subdomain must be between 3 and 63 characters": "Subdomain must be between 3 and 63 characters",
"Log in to your admin account to continue": "Log in to your admin account to continue",
"Your unique subdomain for the platform": "Your unique subdomain for the platform",
"Let's get started!": "Let's get started!",
"Welcome! It's time to set up Lethe Live.": "Welcome! It's time to set up Lethe Live.",
"Start a new Ghost publication": "Start a new Ghost publication",
"Customize your design": "Customize your design",
"Craft a look that reflects your brand and style": "Craft a look that reflects your brand and style",
"Explore the editor": "Explore the editor",
"Build your audience": "Build your audience",
"Share your publication": "Share your publication",
"More questions? Check out our": "More questions? Check out our",
"Help Center": "Help Center",
"Skip onboarding": "Skip onboarding",
"Great! All tasks completed!": "Great! All tasks completed!",
"Continue to Dashboard": "Continue to Dashboard",
"Page Not Found": "Page Not Found",
"The page you're looking for doesn't exist or has been moved.": "The page you're looking for doesn't exist or has been moved.",
"This page could not be found.": "This page could not be found.",
"Back to Home": "Back to Home",
"Subdomain Change Warning": "Subdomain Change Warning",
"The subdomain has been changed. You will be automatically redirected to the new address in {{seconds}} seconds.": "The subdomain has been changed. You will be automatically redirected to the new address in {{seconds}} seconds.",
"New Address": "New Address",
"Redirect Now": "Redirect Now",
"Daily Registered Users": "Daily Registered Users",
"Daily Revenue": "Daily Revenue",
"Daily API Calls": "Daily API Calls",
"Top Servers by Calls": "Top Servers by Calls",
"Date": "Date",
"Users": "Users",
"Revenue": "Revenue",
"Calls": "Calls",
"Server Name": "Server Name",
"Call Volume": "Call Volume",
"Last 30 Days Overview": "Last 30 Days Overview",
"Sort by Call Volume": "Sort by Call Volume",
"Sort by Name": "Sort by Name",
"Total subscribers": "Total subscribers",
"Avg. open rate": "Avg. open rate",
"Avg. click rate": "Avg. click rate",
"Total Users": "Total Users",
"Total Revenue": "Total Revenue",
"Total API Calls": "Total API Calls",
"API server for machine learning tasks": "API server for machine learning tasks",
"Web Scraping Statistics": "Web Scraping Statistics",
"Total Scraped Pages": "Total Scraped Pages",
"Total number of pages scraped from the website": "Total number of pages scraped from the website",
"Scraping Growth Chart": "Scraping Growth Chart",
"New Pages": "New Pages",
"Daily growth of scraped pages over time": "Daily growth of scraped pages over time",
"Real-time data processing service": "Real-time data processing service",
"Natural language processing service": "Natural language processing service",
"Computer vision analysis tool": "Computer vision analysis tool",
"Translation and localization service": "Translation and localization service",
"Web search and indexing engine": "Web search and indexing engine",
"Cloud file storage and management": "Cloud file storage and management",
"Email delivery and management service": "Email delivery and management service",
"Weather data and forecasting API": "Weather data and forecasting API",
"Calendar synchronization service": "Calendar synchronization service",
"Settings": "Settings",
"System Settings": "System Settings",
"General": "General",
"Platform basic configuration": "Platform basic configuration",
"Homepage": "Homepage",
"Homepage content and theme settings": "Homepage content and theme settings",
"Payment Channels": "Payment Channels",
"Configure payment channels": "Configure payment channels",
"Admin Settings": "Admin Settings",
"Configure admin login credentials": "Configure admin login credentials",
"Search settings": "Search settings",
"Clear": "Clear",
"No results": "No results",
"Welcome to Your Platform!": "Welcome to Your Platform!",
"Let's set up {{platformName}} to get you started.": "Let's set up {{platformName}} to get you started.",
"Configure Platform Settings": "Configure Platform Settings",
"Set up your platform name, domain, and branding.": "Set up your platform name, domain, and branding.",
"Add MCP Services": "Add MCP Services",
"Configure and deploy your first MCP server tools.": "Configure and deploy your first MCP server tools.",
"Manage Users": "Manage Users",
"View and configure user accounts and permissions.": "View and configure user accounts and permissions.",
"Configure Payment & Billing": "Configure Payment & Billing",
"Set up payment channels and token pricing.": "Set up payment channels and token pricing.",
"Generate API Keys": "Generate API Keys",
"Create API keys for external integrations.": "Create API keys for external integrations.",
"Share Your Platform": "Share Your Platform",
"Invite users and promote your MCP platform.": "Invite users and promote your MCP platform.",
"Need help getting started? Check out our": "Need help getting started? Check out our",
"Discord Community": "Discord Community",
"Skip setup guide": "Skip setup guide",
"Excellent! Your platform is ready to go!": "Excellent! Your platform is ready to go!",
"Go to Dashboard": "Go to Dashboard",
"Platform": "Platform",
"Billing & Payments": "Billing & Payments",
"Administration": "Administration",
"Meta Data": "Meta Data",
"Extra content for search engines and social accounts": "Extra content for search engines and social accounts",
"Search": "Search",
"X Card": "X Card",
"Facebook Card": "Facebook Card",
"Meta Title": "Meta Title",
"Enter meta title": "Enter meta title",
"Recommended: 70 characters": "Recommended: 70 characters",
"Meta Description": "Meta Description",
"Enter meta description": "Enter meta description",
"Recommended: 156 characters": "Recommended: 156 characters",
"Preview": "Preview",
"Lethe Live": "Lethe Live",
"Thoughts, stories and ideas.": "Thoughts, stories and ideas.",
"Upload X Image": "Upload X Image",
"Upload Facebook Image": "Upload Facebook Image",
"Uploading...": "Uploading...",
"X Title": "X Title",
"Enter X title": "Enter X title",
"X Description": "X Description",
"Enter X description": "Enter X description",
"Facebook Title": "Facebook Title",
"Enter Facebook title": "Enter Facebook title",
"Facebook Description": "Facebook Description",
"Enter Facebook description": "Enter Facebook description",
"Meta data saved successfully": "Meta data saved successfully",
"Please select a valid image file": "Please select a valid image file",
"Image size should be less than 5MB": "Image size should be less than 5MB",
"Failed to upload image": "Failed to upload image",
"General settings": "General settings",
"Title & description": "Title & description",
"Configure your site title and description": "Configure your site title and description",
"Meta data": "Meta data",
"SEO metadata and site configuration": "SEO metadata and site configuration",
"Connect your social media accounts": "Connect your social media accounts",
"Custom domain": "Custom domain",
"Configure your custom domain settings": "Configure your custom domain settings",
"Site": "Site",
"Branding": "Branding",
"Logo, colors, and brand identity": "Logo, colors, and brand identity",
"Theme": "Theme",
"Visual theme and appearance settings": "Visual theme and appearance settings",
"Navigation": "Navigation",
"Configure site navigation and menus": "Configure site navigation and menus",
"Business": "Business",
"Payment": "Payment",
"Payment processing and billing settings": "Payment processing and billing settings",
"XPack Explore": "XPack Explore",
"Explore XPack features and integrations": "Explore XPack features and integrations",
"Advanced": "Advanced",
"Code injection": "Code injection",
"Custom code injection and scripts": "Custom code injection and scripts",
"Enter the domain you want to use": "Enter the domain you want to use",
"Enter your full domain name (e.g., www.example.com)": "Enter your full domain name (e.g., www.example.com)",
"Create your DNS records": "Create your DNS records",
"Add the following DNS records at your DNS provider": "Add the following DNS records at your DNS provider",
"DNS Records Table": "DNS Records Table",
"Type": "Type",
"Host": "Host",
"Value": "Value",
"Activate custom domain": "Activate custom domain",
"Your DNS looks good. You can activate now.": "Your DNS looks good. You can activate now.",
"Make sure your DNS records have propagated before activation.": "Make sure your DNS records have propagated before activation.",
"Activate": "Activate",
"Domain": "Domain",
"Please enter a valid URL with http:// or https://": "Please enter a valid URL with http:// or https://",
"Create MCP Server": "Create MCP Server",
"Choose how you want to create your MCP server": "Choose how you want to create your MCP server",
"Website Content Scraper": "Website Content Scraper",
"Create an MCP server that can scrape and extract content from websites": "Create an MCP server that can scrape and extract content from websites",
"OpenAPI Generator": "OpenAPI Generator",
"Generate MCP server from OpenAPI/Swagger documentation": "Generate MCP server from OpenAPI/Swagger documentation",
"Update Website Scraper": "Update Website Scraper",
"Sync from OpenAPI": "Sync from OpenAPI",
"Update Server": "Update Server",
"Add Server": "Add Server",
"Website URL": "Website URL",
"Enter the website URL (e.g., https://example.com)": "Enter the website URL (e.g., https://example.com)",
"Update website URL for content scraping": "Update website URL for content scraping",
"Enter the website URL you want to scrape content from": "Enter the website URL you want to scrape content from",
"Creating webscraper server...": "Creating webscraper server...",
"Sync server configuration from OpenAPI/Swagger documentation": "Sync server configuration from OpenAPI/Swagger documentation",
"Generate MCP server configuration from OpenAPI/Swagger documentation": "Generate MCP server configuration from OpenAPI/Swagger documentation",
"From URL": "From URL",
"Upload File": "Upload File",
"OpenAPI URL": "OpenAPI URL",
"Enter the URL to your OpenAPI/Swagger specification": "Enter the URL to your OpenAPI/Swagger specification",
"Upload OpenAPI File": "Upload OpenAPI File",
"Choose File": "Choose File",
"Supports JSON and YAML formats": "Supports JSON and YAML formats",
"Parsing OpenAPI document...": "Parsing OpenAPI document...",
"Back": "Back",
"Create Server": "Create Server",
"Generate Server": "Generate Server",
"Sync Server": "Sync Server",
"Select Type": "Select Type",
"Configure": "Configure",
"OR": "OR",
"Use Website Scraper": "Use Website Scraper",
"Use OpenAPI Generator": "Use OpenAPI Generator",
"Data scraping in progress...": "Data scraping in progress...",
"Scraped {{current}} of {{total}} pages": "Scraped {{current}} of {{total}} pages",
"Scraped {{count}} pages": "Scraped {{count}} pages",
"Modifying the URL will trigger re-scraping of the website data.": "Modifying the URL will trigger re-scraping of the website data.",
"You have modified the Website URL. This will trigger re-scraping of the website data. Are you sure you want to continue?": "You have modified the Website URL. This will trigger re-scraping of the website data. Are you sure you want to continue?",
"Scraping...": "Scraping...",
"Server Type": "Server Type",
"Edit Website URL": "Edit Website URL",
"Modifying the website URL will trigger re-scraping of the website data. This process may take some time to complete.": "Modifying the website URL will trigger re-scraping of the website data. This process may take some time to complete.",
"Please enter a valid URL": "Please enter a valid URL",
"Use the refresh button to modify the website URL": "Use the refresh button to modify the website URL",
"Cannot publish while scraping": "Cannot publish while scraping",
"Publish": "Publish",
"Unpublish": "Unpublish",
"Published": "Published",
"Unpublished": "Unpublished",
"Your brand": "Your brand",
"Support JPG, PNG, GIF, SVG. Max size 5MB": "Support JPG, PNG, GIF, SVG. Max size 5MB",
"Site title": "Site title",
"Enter site title": "Enter site title",
"Main title displayed on the home page": "Main title displayed on the home page",
"Site description": "Site description",
"Enter site description": "Enter site description",
"Secondary description displayed below the main title": "Secondary description displayed below the main title",
"Title is required": "Title is required",
"Custom Domain": "Custom Domain",
"Activate your domain": "Activate your domain",
"Set Custom Domain": "Set Custom Domain",
"Configure platform language": "Configure platform language",
"Enter title": "Enter title",
"Enter link URL": "Enter link URL",
"Configure FAQ": "Configure FAQ",
"Enter question": "Enter question",
"Enter answer": "Enter answer",
"Enable Stripe Payment": "Enable Stripe Payment",
"Toggle to enable or disable Stripe payment interface": "Toggle to enable or disable Stripe payment interface",
"Enter Secret Key": "Enter Secret Key",
"Enter Webhook Secret": "Enter Webhook Secret",
"Email Login Settings": "Email Login Settings",
"Open in new tab": "Open in new tab",
"Analyze platform usage and revenue": "Analyze platform usage and revenue",
"Change your password": "Change your password"
}
+254 -79
View File
@@ -40,6 +40,7 @@
"Featured Packages": "Featured Packages",
"Individual Tools": "Individual Tools",
"Details": "Details",
"Copy code": "Copy code",
"excel": "Excel",
"data": "Data",
"analysis": "Analysis",
@@ -80,7 +81,7 @@
"Free": "Free",
"Sign up now to get 100 free calls every month.": "Sign up now to get 100 free calls every month.",
"Generate and manage dynamic PowerPoints and Google Slides with your own custom branding and layouts.": "Generate and manage dynamic PowerPoints and Google Slides with your own custom branding and layouts.",
"Try for free": "Try for free",
"Sign up to get the auth key": "Sign up to get the auth key",
"Lightning Fast Setup": "Lightning Fast Setup",
"Enterprise Security": "Enterprise Security",
"Global Scale": "Global Scale",
@@ -102,7 +103,7 @@
"Build AI Agents": "Build AI Agents",
"With Incredible MCP": "With Incredible MCP",
"Instant Integration": "Instant Integration",
"Connect to global APIs and MCP services with just one config or SDK.": "Connect to global APIs and MCP services with just one config or SDK.",
"Connect to global APIs and MCP servers with just one config or SDK.": "Connect to global APIs and MCP servers with just one config or SDK.",
"Zero Overhead": "Zero Overhead",
"Flexible pay-as-you-go pricing to fuel agent growth at every stage.": "Flexible pay-as-you-go pricing to fuel agent growth at every stage.",
"Secure & Compliant": "Secure & Compliant",
@@ -118,24 +119,24 @@
"Get Started": "Get Started",
"Demo": "Demo",
"Start Deploying": "Start Deploying",
"We help these products connect to global services.": "We help these products connect to global services.",
"We help these products connect to global servers.": "We help these products connect to global servers.",
"Become a partner": "Become a partner",
"AI Design": "AI Design",
"AI Agent": "AI Agent",
"AI Browser": "AI Browser",
"Home": "Home",
"Services": "Services",
"Servers": "Servers",
"Interesting in \n becoming a partner?": "Interesting in \n becoming a partner?",
"Other Partners": "Other Partners",
"Services List": "Services List",
"Submit services": "Submit services",
"Interesting in \n becoming a services supplier?": "Interesting in \n becoming a services supplier?",
"Apply to become a supplier and provide services to global users.": "Apply to become a supplier and provide services to global users.",
"Servers List": "Servers List",
"Submit servers": "Submit servers",
"Interesting in \n becoming a servers supplier?": "Interesting in \n becoming a servers supplier?",
"Apply to become a supplier and provide servers to global users.": "Apply to become a supplier and provide servers to global users.",
"Become a supplier": "Become a supplier",
"We only list some services": "We only list some services",
"Other Services": "Other Services",
"We only list some servers": "We only list some servers",
"Other Servers": "Other Servers",
"Submit a demo": "Submit a demo",
"Number of service categories": "Number of service categories",
"Number of server categories": "Number of server categories",
"Number of MCP Tools": "Number of MCP Tools",
"Time for integration": "Time for integration",
"Daily MCP request count": "Daily MCP request count",
@@ -147,31 +148,31 @@
"It's hard to say goodbyes": "It's hard to say goodbyes",
"We're sorry to see you go. Your subscription has been cancelled.": "We're sorry to see you go. Your subscription has been cancelled.",
"Playground": "Playground",
"MCP Services Management": "MCP Services Management",
"Service List": "Service List",
"Add Service": "Add Service",
"MCP Servers Management": "MCP Servers Management",
"Server List": "Server List",
"Add Server": "Add Server",
"OpenAPI Generator": "OpenAPI Generator",
"Service Name": "Service Name",
"Service Description": "Service Description",
"Service Category": "Service Category",
"Service Status": "Service Status",
"Online": "Online",
"Offline": "Offline",
"Server Name": "Server Name",
"Server Description": "Server Description",
"Server Category": "Server Category",
"Server Status": "Server Status",
"Published": "Published",
"Unpublished": "Unpublished",
"Actions": "Actions",
"Edit": "Edit",
"Delete": "Delete",
"Toggle Status": "Toggle Status",
"Create New Service": "Create New Service",
"Edit Service": "Edit Service",
"Create New Server": "Create New Server",
"Edit Server": "Edit Server",
"Generate from OpenAPI": "Generate from OpenAPI",
"Update from OpenAPI": "Update from OpenAPI",
"Sync from OpenAPI": "Sync from OpenAPI",
"Sync service configuration from OpenAPI/Swagger documentation": "Sync service configuration from OpenAPI/Swagger documentation",
"Sync Service": "Sync Service",
"Sync server configuration from OpenAPI/Swagger documentation": "Sync server configuration from OpenAPI/Swagger documentation",
"Sync Server": "Sync Server",
"OpenAPI URL": "OpenAPI URL",
"Upload OpenAPI File": "Upload OpenAPI File",
"Generate Service": "Generate Service",
"Service Configuration": "Service Configuration",
"Generate Server": "Generate Server",
"Server Configuration": "Server Configuration",
"API Endpoint": "API Endpoint",
"Authentication": "Authentication",
"API Key": "API Key",
@@ -189,56 +190,73 @@
"Edit Tool": "Edit Tool",
"Delete Tool": "Delete Tool",
"Save Changes": "Save Changes",
"No tools configured for this service": "No tools configured for this service",
"Add tools to extend service functionality": "Add tools to extend service functionality",
"Configure and manage tools for this service": "Configure and manage tools for this service",
"No tools configured for this server": "No tools configured for this server",
"Add tools to extend server functionality": "Add tools to extend server functionality",
"Configure and manage tools for this server": "Configure and manage tools for this server",
"Add New Tool": "Add New Tool",
"Enter tool name": "Enter tool name",
"Enter tool description": "Enter tool description",
"Tool name": "Tool name",
"Tool description": "Tool description",
"Take Offline": "Take Offline",
"Bring Online": "Bring Online",
"Platform Domain": "Platform Domain",
"Enter platform domain (e.g., example.com)": "Enter platform domain (e.g., example.com)",
"The domain name of your platform": "The domain name of your platform",
"MCP Server Domain": "MCP Server Domain",
"Enter MCP server domain (e.g., api.example.com)": "Enter MCP server domain (e.g., api.example.com)",
"The domain for MCP server API calls": "The domain for MCP server API calls",
"Featured in the XPack showcase": "Featured in the XPack showcase",
"Enable this option to feature your site in the XPack global showcase and reach users worldwide.": "Enable this option to feature your site in the XPack global showcase and reach users worldwide.",
"Please enter a platform domain before enabling showcase": "Please enter a platform domain before enabling showcase",
"FAQ Management": "FAQ Management",
"Configure frequently asked questions for your users": "Configure frequently asked questions for your users",
"FAQ List": "FAQ List",
"Edit questions and answers directly in the table below": "Edit questions and answers directly in the table below",
"Save All": "Save All",
"Order": "Order",
"Question": "Question",
"Answer": "Answer",
"No FAQ items available.": "No FAQ items available.",
"Insert below": "Insert below",
"Short Description": "Short Description",
"Long Description": "Long Description",
"Brief description of the service": "Brief description of the service",
"Detailed description of the service": "Detailed description of the service",
"Brief description of the server": "Brief description of the server",
"Detailed description of the server": "Detailed description of the server",
"Basic Information": "Basic Information",
"API Configuration": "API Configuration",
"Authentication Type": "Authentication Type",
"Update Service": "Update Service",
"Create Service": "Create Service",
"Update Server": "Update Server",
"Create Server": "Create Server",
"Confirm Delete": "Confirm Delete",
"Are you sure you want to delete this service?": "Are you sure you want to delete this service?",
"Are you sure you want to delete this server?": "Are you sure you want to delete this server?",
"This action cannot be undone.": "This action cannot be undone.",
"Manage your MCP services, configure APIs, and monitor service status": "Manage your MCP services, configure APIs, and monitor service status",
"Search services...": "Search services...",
"Manage your MCP servers, configure APIs, and monitor server status": "Manage your MCP servers, configure APIs, and monitor server status",
"Search MCP servers": "Search MCP servers",
"Filter by category": "Filter by category",
"Filter by status": "Filter by status",
"All Categories": "All Categories",
"All Status": "All Status",
"Created": "Created",
"Last Updated": "Last Updated",
"Total Services": "Total Services",
"Online Services": "Online Services",
"Offline Services": "Offline Services",
"Service created successfully": "Service created successfully",
"Service updated successfully": "Service updated successfully",
"Service deleted successfully": "Service deleted successfully",
"Service status updated successfully": "Service status updated successfully",
"Failed to create service": "Failed to create service",
"Failed to update service": "Failed to update service",
"Failed to delete service": "Failed to delete service",
"Failed to update service status": "Failed to update service status",
"Total Servers": "Total Servers",
"Server created successfully": "Server created successfully",
"Server updated successfully": "Server updated successfully",
"Server deleted successfully": "Server deleted successfully",
"Server status updated successfully": "Server status updated successfully",
"Failed to create server": "Failed to create server",
"Failed to update server": "Failed to update server",
"Failed to delete server": "Failed to delete server",
"Failed to update server status": "Failed to update server status",
"Invalid OpenAPI URL": "Invalid OpenAPI URL",
"Failed to parse OpenAPI document": "Failed to parse OpenAPI document",
"OpenAPI document parsed successfully": "OpenAPI document parsed successfully",
"Please enter a valid URL": "Please enter a valid URL",
"Please enter a valid URL with http:// or https://": "Please enter a valid URL with http:// or https://",
"Please fix validation errors before saving": "Please fix validation errors before saving",
"Please select a file": "Please select a file",
"File uploaded successfully": "File uploaded successfully",
"Failed to upload file": "Failed to upload file",
"Service name is required": "Service name is required",
"Service description is required": "Service description is required",
"Server name is required": "Server name is required",
"Server description is required": "Server description is required",
"API endpoint is required": "API endpoint is required",
"Documentation is required": "Documentation is required",
"Connect Your AI Agent to the Real World": "Connect Your AI Agent to the Real World",
@@ -273,13 +291,13 @@
"Login Success": "Login Success",
"Login Error": "Login Error",
"Back Home": "Back Home",
"MCP Services": "MCP Services",
"MCP Servers": "MCP Servers",
"User Management": "User Management",
"Revenue Management": "Revenue Management",
"Payment Channels": "Payment Channels",
"System Settings": "System Settings",
"Overview and analytics": "Overview and analytics",
"Manage MCP services and API tools": "Manage MCP services and API tools",
"Manage MCP servers and API tools": "Manage MCP servers and API tools",
"Manage registered users": "Manage registered users",
"View user recharge history": "View user recharge history",
"Configure payment channels": "Configure payment channels",
@@ -306,6 +324,14 @@
"All Roles": "All Roles",
"Ban User": "Ban User",
"Unban User": "Unban User",
"Recharge User": "Recharge User",
"Current Balance": "Current Balance",
"User recharged successfully": "User recharged successfully",
"Please enter a valid amount": "Please enter a valid amount",
"Minimum recharge amount is ¥1": "Minimum recharge amount is ¥1",
"User not selected": "User not selected",
"Recharge failed": "Recharge failed",
"Network error, please try again": "Network error, please try again",
"Delete User": "Delete User",
"View Profile": "View Profile",
"Edit User": "Edit User",
@@ -325,7 +351,7 @@
"No": "No",
"User Statistics": "User Statistics",
"API Calls": "API Calls",
"Services Used": "Services Used",
"Servers Used": "Servers Used",
"Total Spent": "Total Spent",
"Wallet Balance": "Wallet Balance",
"Confirm Ban User": "Confirm Ban User",
@@ -354,13 +380,12 @@
"Enter your password": "Enter your password",
"Confirm your password": "Confirm your password",
"Passwords do not match": "Passwords do not match",
"Password must be at least 8 characters": "Password must be at least 8 characters",
"Registration successful": "Registration successful",
"Registration failed": "Registration failed",
"Email already exists": "Email already exists",
"Invalid email format": "Invalid email format",
"Sign up with Google": "Sign up with Google",
"Terms of Service": "Terms of Service",
"Terms of Server": "Terms of Server",
"Privacy Policy": "Privacy Policy",
"By signing up, you agree to our": "By signing up, you agree to our",
"and": "and",
@@ -386,19 +411,27 @@
"Failed to test Google auth": "Failed to test Google auth",
"Failed to fetch Stripe config": "Failed to fetch Stripe config",
"Failed to save Stripe config": "Failed to save Stripe config",
"Failed to save Alipay config": "Failed to save Alipay config",
"Failed to save WeChat config": "Failed to save WeChat config",
"Stripe connection test failed": "Stripe connection test failed",
"Stripe connection test successful": "Stripe connection test successful",
"Alipay connection test successful": "Alipay connection test successful",
"Alipay connection test failed": "Alipay connection test failed",
"WeChat connection test successful": "WeChat connection test successful",
"WeChat connection test failed": "WeChat connection test failed",
"Connection test failed": "Connection test failed",
"Unknown error": "Unknown error",
"Secret Key cannot be empty": "Secret Key cannot be empty",
"Stripe Configuration": "Stripe Configuration",
"Alipay Configuration": "Alipay Configuration",
"WeChat Configuration": "WeChat Configuration",
"Google Login Settings": "Google Login Settings",
"Enable Google Login": "Enable Google Login",
"Administrator Account": "Administrator Account",
"Platform Information": "Platform Information",
"Delete Service": "Delete Service",
"Delete Server": "Delete Server",
"Parsing OpenAPI document...": "Parsing OpenAPI document...",
"Generated Service Configuration": "Generated Service Configuration",
"Generated Server Configuration": "Generated Server Configuration",
"None": "None",
"Tags": "Tags",
"Paid": "Paid",
@@ -436,7 +469,7 @@
"Enter your verification code": "Enter your verification code",
"Resend": "Resend",
"Verify Email Error": "Verify Email Error",
"Generate MCP service configuration from OpenAPI/Swagger documentation": "Generate MCP service configuration from OpenAPI/Swagger documentation",
"Generate MCP server configuration from OpenAPI/Swagger documentation": "Generate MCP server configuration from OpenAPI/Swagger documentation",
"From URL": "From URL",
"Upload File": "Upload File",
"Choose File": "Choose File",
@@ -445,7 +478,11 @@
"Invalid email address": "Invalid email address",
"Back to Home": "Back to Home",
"Enter the URL to your OpenAPI/Swagger specification": "Enter the URL to your OpenAPI/Swagger specification",
"Enter service name": "Enter service name",
"Enter server name": "Enter server name",
"Server ID": "Server ID",
"Enter server ID": "Enter server ID",
"Modifying the ID will affect the MCP access URL. Please modify with caution.": "Modifying the ID will affect the MCP access URL. Please modify with caution.",
"You have modified the Server ID. This will affect the MCP access URL and may break existing integrations. Are you sure you want to continue?": "You have modified the Server ID. This will affect the MCP access URL and may break existing integrations. Are you sure you want to continue?",
"The header name for the API key (e.g., X-API-Key, Authorization)": "The header name for the API key (e.g., X-API-Key, Authorization)",
"Enter API key": "Enter API key",
"Enter bearer token": "Enter bearer token",
@@ -470,7 +507,7 @@
"API Key Header Name": "API Key Header Name",
"Secret Key format is incorrect, should start with sk_": "Secret Key format is incorrect, should start with sk_",
"Webhook Secret format is incorrect, should start with whsec_": "Webhook Secret format is incorrect, should start with whsec_",
"Password must be at least 8 characters long": "Password must be at least 8 characters long",
"Password must be at least 6 characters long": "Password must be at least 6 characters long",
"OAuth 2.0 Client Secret (optional, for server-side verification)": "OAuth 2.0 Client Secret (optional, for server-side verification)",
"Authorized redirect URI configured in Google Cloud Console": "Authorized redirect URI configured in Google Cloud Console",
"Webhook signing secret for verifying Stripe events": "Webhook signing secret for verifying Stripe events",
@@ -511,7 +548,7 @@
"Select currency": "Select currency",
"Default currency for the platform": "Default currency for the platform",
"call": "call",
"No services found": "No services found",
"No servers found": "No servers found",
"free/day": "free/day",
"Account (Email)": "Account (Email)",
"Recharge Amount": "Recharge Amount",
@@ -529,12 +566,23 @@
"No tools added yet. Add your first tool using the input above.": "No tools added yet. Add your first tool using the input above.",
"Insert tool below": "Insert tool below",
"Remove tool": "Remove tool",
"Service Detail": "Service Detail",
"Server Detail": "Server Detail",
"Billing Mode": "Billing Mode",
"Enable free quota": "Enable free quota",
"Configure Stripe payment interface": "Configure Stripe payment interface",
"Configure Alipay payment interface": "Configure Alipay payment interface",
"Configure WeChat payment interface": "Configure WeChat payment interface",
"Secret Key": "Secret Key",
"Stripe secret key for server-side API calls": "Stripe secret key for server-side API calls",
"App ID": "App ID",
"Alipay App ID": "Alipay App ID",
"App Private Key": "App Private Key",
"Alipay App Private Key": "Alipay App Private Key",
"Alipay Public Key": "Alipay Public Key",
"Alipay public key for verification": "Alipay public key for verification",
"WeChat App ID": "WeChat App ID",
"Merchant ID": "Merchant ID",
"WeChat Merchant ID": "WeChat Merchant ID",
"Webhook Secret": "Webhook Secret",
"Test Connection": "Test Connection",
"Monitor platform revenue and view user recharge history": "Monitor platform revenue and view user recharge history",
@@ -547,9 +595,9 @@
"Platform total fund pool": "Platform total fund pool",
"Today's API Calls": "Today's API Calls",
"API call count": "API call count",
"Total MCP Services": "Total MCP Services",
"Deployed services": "Deployed services",
"This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.": "This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.",
"Total MCP Servers": "Total MCP Servers",
"Deployed servers": "Deployed servers",
"This is your AI server management center. You can quickly view platform core data on the left and manage and configure your MCP servers, users, payment channels, etc.": "This is your AI server management center. You can quickly view platform core data on the left and manage and configure your MCP servers, users, payment channels, etc.",
"Log In": "Log In",
"Register Date": "Register Date",
"Dashboard": "Dashboard",
@@ -593,18 +641,18 @@
"Confirm": "Confirm",
"Recharge Account": "Recharge Account",
"Funds will be added to your account balance": "Funds will be added to your account balance",
"Please select a payment method": "Please select a payment method",
"Manage your balance and recharge history": "Manage your balance and recharge history",
"Build incredible AI agents together": "Build incredible AI agents together",
"Balance: {{amount}}": "Balance: {{amount}}",
"Log Out": "Log Out",
"Enter your username": "Enter your username",
"Login": "Login",
"Admin Portal": "Admin Portal",
"Log in to admin console": "Log in to admin console",
"Welcome to XPack.AI Open Source": "Welcome to XPack.AI Open Source",
"Are you sure you want to delete this \"{{name}}\" service?": "Are you sure you want to delete this \"{{name}}\" service?",
"Service status toggled successfully": "Service status toggled successfully",
"Failed to toggle service status": "Failed to toggle service status",
"Log in to your admin account to continue": "Log in to your admin account to continue",
"Welcome to XPack.AI": "Welcome to XPack.AI",
"Are you sure you want to delete this \"{{name}}\" server?": "Are you sure you want to delete this \"{{name}}\" server?",
"Server status toggled successfully": "Server status toggled successfully",
"Failed to toggle server status": "Failed to toggle server status",
"Stripe configuration saved successfully": "Stripe configuration saved successfully",
"Failed to save Stripe configuration": "Failed to save Stripe configuration",
"System config updated successfully": "System config updated successfully",
@@ -633,8 +681,12 @@
"Total Revenue": "Total Revenue",
"Failed to save stripe config": "Failed to save stripe config",
"Stripe config saved successfully": "Stripe config saved successfully",
"Login successful": "Login successful",
"Logged out successfully": "Logged out successfully",
"Alipay config saved successfully": "Alipay config saved successfully",
"WeChat config saved successfully": "WeChat config saved successfully",
"Failed to save {{channelName}} config": "Failed to save {{channelName}} config",
"{{channelName}} config saved successfully": "{{channelName}} config saved successfully",
"{{channelName}} connection test failed": "{{channelName}} connection test failed",
"{{channelName}} connection test successful": "{{channelName}} connection test successful",
"Configure email settings": "Configure email settings",
"Email Configuration": "Email Configuration",
"Configure SMTP settings for email notifications": "Configure SMTP settings for email notifications",
@@ -708,10 +760,10 @@
"Traditional email and password authentication": "Traditional email and password authentication",
"Email/Verification Code": "Email/Verification Code",
"Passwordless login with email verification code": "Passwordless login with email verification code",
"Email service is not configured. Please configure email settings first.": "Email service is not configured. Please configure email settings first.",
"SMTP is not configured. Please configure email settings first.": "SMTP is not configured. Please configure email settings first.",
"Go to Settings": "Go to Settings",
"AI Tools Marketplace": "AI Tools Marketplace",
"A marketplace for AI tools and services. Discover and integrate powerful AI solutions for your projects.": "A marketplace for AI tools and services. Discover and integrate powerful AI solutions for your projects.",
"A marketplace for AI tools and servers. Discover and integrate powerful AI solutions for your projects.": "A marketplace for AI tools and servers. Discover and integrate powerful AI solutions for your projects.",
"Configuration": "Configuration",
"Featured Products": "Featured Products",
"Search": "Search",
@@ -720,12 +772,135 @@
"Re-enter new password": "Re-enter new password",
"Confirm new password": "Confirm new password",
"New password and confirm password do not match": "New password and confirm password do not match",
"New password must be at least 8 characters long": "New password must be at least 8 characters long",
"New password must be at least 6 characters long": "New password must be at least 6 characters long",
"New password and confirm password must be the same": "New password and confirm password must be the same",
"New Password": "New Password",
"Confirm New Password": "Confirm New Password",
"Theme changed successfully": "Theme changed successfully",
"Failed to change theme": "Failed to change theme",
"About page saved successfully": "About page saved successfully",
"Failed to save about page": "Failed to save about page"
}
"Failed to save about page": "Failed to save about page",
"General": "General",
"Homepage": "Homepage",
"Homepage content and theme settings": "Homepage content and theme settings",
"About Page": "About Page",
"About page content configuration": "About page content configuration",
"Email & Admin": "Email & Admin",
"Email and administrator settings": "Email and administrator settings",
"Embedded HTML": "Embedded HTML",
"Configure custom HTML content for global injection": "Configure custom HTML content for global injection",
"Enable Custom HTML": "Enable Custom HTML",
"Toggle to enable or disable custom HTML injection": "Toggle to enable or disable custom HTML injection",
"Show Preview": "Show Preview",
"Hide Preview": "Hide Preview",
"This HTML will be injected globally into the application. You can include script tags, CSS styles, or any valid HTML.": "This HTML will be injected globally into the application. You can include script tags, CSS styles, or any valid HTML.",
"Preview": "Preview",
"Note: This is a text preview. The actual HTML will be rendered when saved and enabled.": "Note: This is a text preview. The actual HTML will be rendered when saved and enabled.",
"Usage Instructions": "Usage Instructions",
"You can include Google Analytics, custom CSS, or any tracking scripts": "You can include Google Analytics, custom CSS, or any tracking scripts",
"The HTML will be injected into the document head section": "The HTML will be injected into the document head section",
"Make sure your code is valid to avoid breaking the application": "Make sure your code is valid to avoid breaking the application",
"Changes take effect immediately after saving and enabling": "Changes take effect immediately after saving and enabling",
"Welcome to Your Platform": "Welcome to Your Platform",
"Let's set up your platform with some basic information": "Let's set up your platform with some basic information",
"Information needed": "Information needed",
"Fields marked with * are required": "Fields marked with * are required",
"Website title is required": "Website title is required",
"Headline is required": "Headline is required",
"Subheadline is required": "Subheadline is required",
"Please fill in all required fields": "Please fill in all required fields",
"Setup failed. Please try again.": "Setup failed. Please try again.",
"Complete Setup": "Complete Setup",
"Platform setup completed successfully!": "Platform setup completed successfully!",
"Welcome to the famous five-minute platform setup process! Just fill in the information below and you'll be on your way to using the most extendable and powerful platform.": "Welcome to the famous five-minute platform setup process! Just fill in the information below and you'll be on your way to using the most extendable and powerful platform.",
"Please provide the following information. Do not worry, you can always change these settings later in the admin panel.": "Please provide the following information. Do not worry, you can always change these settings later in the admin panel.",
"Failed to update homepage config": "Failed to update homepage config",
"Homepage config updated successfully": "Homepage config updated successfully",
"Failed to load homepage config": "Failed to load homepage config",
"FAQ updated successfully": "FAQ updated successfully",
"Navigation updated successfully": "Navigation updated successfully",
"Embedded HTML updated successfully": "Embedded HTML updated successfully",
"Payment channels updated successfully": "Payment channels updated successfully",
"Manage frequently asked questions": "Manage frequently asked questions",
"Add FAQ Item": "Add FAQ Item",
"Remove FAQ Item": "Remove FAQ Item",
"Top Navigation": "Top Navigation",
"Manage top navigation links": "Manage top navigation links",
"Title": "Title",
"Link": "Link",
"Target": "Target",
"Add Navigation Item": "Add Navigation Item",
"Remove Navigation Item": "Remove Navigation Item",
"Same window": "Same window",
"New window": "New window",
"Custom HTML injection": "Custom HTML injection",
"Enable embedded HTML": "Enable embedded HTML",
"HTML Content": "HTML Content",
"Enter custom HTML code": "Enter custom HTML code",
"Manage payment methods": "Manage payment methods",
"Channel ID": "Channel ID",
"Display Name": "Display Name",
"Add Payment Channel": "Add Payment Channel",
"Remove Payment Channel": "Remove Payment Channel",
"Enter channel ID": "Enter channel ID",
"Enter display name": "Enter display name",
"Installation Status": "Installation Status",
"First time installation": "First time installation",
"System installed": "System installed",
"Configure top navigation menu items and links": "Configure top navigation menu items and links",
"Per Million Tokens": "Per Million Tokens",
"Price per million tokens consumed": "Price per million tokens consumed",
"Price per million tokens": "Price per million tokens",
"Price per API call": "Price per API call",
"Payment channel disabled successfully": "Payment channel disabled successfully",
"Failed to disable payment channel": "Failed to disable payment channel",
"Payment channel enabled successfully": "Payment channel enabled successfully",
"Failed to enable payment channel": "Failed to enable payment channel",
"Input Token Price": "Input Token Price",
"Output Token Price": "Output Token Price",
"Price per million input tokens": "Price per million input tokens",
"Price per million output tokens": "Price per million output tokens",
"Input": "Input",
"Output": "Output",
"1M tokens": "1M tokens",
"Total Spending": "Total Spending",
"Remote": "Remote",
"Platform Logo": "Platform Logo",
"Support JPG, PNG, GIF. Max size 5MB": "Support JPG, PNG, GIF. Max size 5MB",
"(30 days)": "(30 days)",
"Sign in": "Sign in",
"or create your account": "or create your account",
"No account? Just continue—we’ll set you up.": "No account? Just continue—we’ll set you up.",
"Password must be at least 6 characters": "Password must be at least 6 characters",
"Email is required": "Email is required",
"No servers available": "No servers available",
"(Deleted)": "(Deleted)",
"Transport Type": "Transport Type",
"Server ID must be less than 255 characters": "Server ID must be less than 255 characters",
"Server Name must be less than 255 characters": "Server Name must be less than 255 characters",
"API Endpoint must be a valid HTTP/HTTPS URL": "API Endpoint must be a valid HTTP/HTTPS URL",
"Server ID is required": "Server ID is required",
"Short description is required": "Short description is required",
"Auth Key Name": "Auth Key Name",
"Search by email": "Search by email",
"Search by service name": "Search by service name",
"Select Date Range": "Select Date Range",
"Resource group name \"{{name}}\" is reserved and cannot be used": "Resource group name \"{{name}}\" is reserved and cannot be used",
"Resource group name \"{{name}}\" already exists": "Resource group name \"{{name}}\" already exists",
"Auth key name \"{{name}}\" already exists": "Auth key name \"{{name}}\" already exists",
"Start date must be before end date": "Start date must be before end date",
"Start date cannot be earlier than 30 days ago": "Start date cannot be earlier than 30 days ago",
"Resource Groups": "Resource Groups",
"Daily call limit per user": "Daily call limit per user",
"Max calls per user per day (Beijing time). Leave blank or 0 for unlimited": "Max calls per user per day (Beijing time). Leave blank or 0 for unlimited",
"e.g. 50": "e.g. 50",
"Free Call Limits": "Free Call Limits",
"Global daily call cap for free services": "Global daily call cap for free services",
"Platform-wide daily call limit per user": "Platform-wide daily call limit per user",
"Applies to every free service, leave blank or 0 for unlimited": "Applies to every free service, leave blank or 0 for unlimited",
"If a service also has its own limit, the smaller number wins": "If a service also has its own limit, the smaller number wins",
"Example 100": "Example 100",
"Enter a non-negative integer": "Enter a non-negative integer",
"Free call limit saved": "Free call limit saved",
"Failed to save free call limit": "Failed to save free call limit"
}
+242 -12
View File
@@ -1,13 +1,243 @@
{
"**XPack** is a lightweight, open-source marketplace framework for MCP (Model Context Protocol) services.": "**XPack** 是一个轻量级的开源 MCP(模型上下文协议)服务市场框架。",
"It allows you to transform any OpenAPI into a monetizable MCP service and build your own API store in just minutes.": "它允许您将任何 OpenAPI 转换为可盈利的 MCP 服务,并在几分钟内构建您自己的 API 商店。",
"✨ With XPack, you can:": "✨ 使用 XPack,您可以:",
"- ✅ **One-click OpenAPI → MCP service config**": "- ✅ **一键 OpenAPI → MCP 服务配置**",
"- 🧾 **SEO-friendly homepage + mcp service page**": "- 🧾 **SEO 友好的主页 + MCP 服务页面**",
"- 💳 **Built-in billing (per-call)**": "- 💳 **内置计费(按调用计费)**",
"- 👥 **User account management**": "- 👥 **用户账户管理**",
"- 🛠 **Support Stripe Payment**": "- 🛠 **支持 Stripe 支付**",
"- 🔐 **Support Email & Google OAuth Sign in**": "- 🔐 **支持邮箱和 Google OAuth 登录**",
"Everything is open-source and licensed under **Apache 2.0** — ready for commercial use.": "一切都是开源的,采用 **Apache 2.0** 许可证 — 可用于商业用途。",
"About Us": "关于我们"
}
"Server Configuration": "服务器配置",
"Subdomain": "子域名",
"Enter subdomain (e.g., mysite)": "输入子域名(例如:mysite)",
"Subdomain is required": "子域名不能为空",
"Subdomain must contain only lowercase letters, numbers, and hyphens": "子域名只能包含小写字母、数字和连字符",
"Subdomain must be between 3 and 63 characters": "子域名长度需在 3 到 63 个字符之间",
"Log in to your admin account to continue": "登录管理员账号以继续",
"Your unique subdomain for the platform": "平台的唯一子域名",
"Let's get started!": "开始设置!",
"Welcome! It's time to set up Lethe Live.": "欢迎!是时候设置 Lethe Live 了。",
"Start a new Ghost publication": "开始新的 Ghost 发布",
"Customize your design": "自定义你的设计",
"Craft a look that reflects your brand and style": "打造反映你品牌与风格的外观",
"Explore the editor": "探索编辑器",
"Build your audience": "构建你的受众",
"Share your publication": "分享你的发布内容",
"More questions? Check out our": "还有问题?请查看我们的",
"Help Center": "帮助中心",
"Skip onboarding": "跳过引导",
"Great! All tasks completed!": "太棒了!所有任务都已完成!",
"Continue to Dashboard": "进入仪表盘",
"Page Not Found": "页面未找到",
"The page you're looking for doesn't exist or has been moved.": "你要访问的页面不存在或已被移动。",
"This page could not be found.": "无法找到此页面。",
"Back to Home": "返回首页",
"Subdomain Change Warning": "子域名更改提醒",
"The subdomain has been changed. You will be automatically redirected to the new address in {{seconds}} seconds.": "子域名已更改。你将在 {{seconds}} 秒后自动跳转至新地址。",
"New Address": "新地址",
"Redirect Now": "立即跳转",
"Daily Registered Users": "每日注册用户",
"Daily Revenue": "每日营收",
"Daily API Calls": "每日 API 调用",
"Top Servers by Calls": "调用量最多的服务器",
"Date": "日期",
"Users": "用户",
"Revenue": "收入",
"Calls": "调用量",
"Server Name": "服务器名称",
"Call Volume": "调用量",
"Last 30 Days Overview": "近 30 天概览",
"Sort by Call Volume": "按调用量排序",
"Sort by Name": "按名称排序",
"Total subscribers": "订阅者总数",
"Avg. open rate": "平均打开率",
"Avg. click rate": "平均点击率",
"Total Users": "用户总数",
"Total Revenue": "总收入",
"Total API Calls": "API 调用总数",
"API server for machine learning tasks": "用于机器学习任务的 API 服务器",
"Web Scraping Statistics": "网页爬取统计",
"Total Scraped Pages": "已爬取页面总数",
"Total number of pages scraped from the website": "从网站爬取的页面总数",
"Scraping Growth Chart": "爬取增长图",
"New Pages": "新增页面",
"Daily growth of scraped pages over time": "每日新增爬取页面数量",
"Real-time data processing service": "实时数据处理服务",
"Natural language processing service": "自然语言处理服务",
"Computer vision analysis tool": "计算机视觉分析工具",
"Translation and localization service": "翻译与本地化服务",
"Web search and indexing engine": "网页搜索与索引引擎",
"Cloud file storage and management": "云端文件存储与管理",
"Email delivery and management service": "邮件投递与管理服务",
"Weather data and forecasting API": "天气数据与预测 API",
"Calendar synchronization service": "日历同步服务",
"Settings": "设置",
"System Settings": "系统设置",
"General": "通用设置",
"Platform basic configuration": "平台基础配置",
"Homepage": "首页",
"Homepage content and theme settings": "首页内容与主题设置",
"Payment Channels": "支付渠道",
"Configure payment channels": "配置支付渠道",
"Admin Settings": "管理员设置",
"Configure admin login credentials": "配置管理员登录信息",
"Search settings": "搜索设置",
"Clear": "清除",
"No results": "无结果",
"Welcome to Your Platform!": "欢迎使用你的平台!",
"Let's set up {{platformName}} to get you started.": "让我们来设置 {{platformName}},开始你的旅程。",
"Configure Platform Settings": "配置平台设置",
"Set up your platform name, domain, and branding.": "设置平台名称、域名和品牌标识。",
"Add MCP Services": "添加 MCP 服务",
"Configure and deploy your first MCP server tools.": "配置并部署你的第一个 MCP 服务器工具。",
"Manage Users": "管理用户",
"View and configure user accounts and permissions.": "查看并配置用户账号与权限。",
"Configure Payment & Billing": "配置支付与结算",
"Set up payment channels and token pricing.": "设置支付渠道与 Token 定价。",
"Generate API Keys": "生成 API Key",
"Create API keys for external integrations.": "为外部集成创建 API Key。",
"Share Your Platform": "分享你的平台",
"Invite users and promote your MCP platform.": "邀请用户并推广你的 MCP 平台。",
"Need help getting started? Check out our": "需要帮助?请查看我们的",
"Discord Community": "Discord 社区",
"Skip setup guide": "跳过设置向导",
"Excellent! Your platform is ready to go!": "太棒了!你的平台已准备就绪!",
"Go to Dashboard": "进入仪表盘",
"Platform": "平台",
"Billing & Payments": "账单与支付",
"Administration": "管理",
"Meta Data": "元数据",
"Extra content for search engines and social accounts": "用于搜索引擎与社交平台的额外信息",
"Search": "搜索",
"X Card": "X 卡片",
"Facebook Card": "Facebook 卡片",
"Meta Title": "Meta 标题",
"Enter meta title": "输入 Meta 标题",
"Recommended: 70 characters": "建议:70 个字符",
"Meta Description": "Meta 描述",
"Enter meta description": "输入 Meta 描述",
"Recommended: 156 characters": "建议:156 个字符",
"Preview": "预览",
"Lethe Live": "Lethe Live",
"Thoughts, stories and ideas.": "思想、故事与想法。",
"Upload X Image": "上传 X 图片",
"Upload Facebook Image": "上传 Facebook 图片",
"Uploading...": "上传中...",
"X Title": "X 标题",
"Enter X title": "输入 X 标题",
"X Description": "X 描述",
"Enter X description": "输入 X 描述",
"Facebook Title": "Facebook 标题",
"Enter Facebook title": "输入 Facebook 标题",
"Facebook Description": "Facebook 描述",
"Enter Facebook description": "输入 Facebook 描述",
"Meta data saved successfully": "元数据保存成功",
"Please select a valid image file": "请选择有效的图片文件",
"Image size should be less than 5MB": "图片大小应小于 5MB",
"Failed to upload image": "图片上传失败",
"General settings": "通用设置",
"Title & description": "标题与描述",
"Configure your site title and description": "配置站点标题与描述",
"Meta data": "元数据",
"SEO metadata and site configuration": "SEO 元数据与站点配置",
"Connect your social media accounts": "连接你的社交媒体账号",
"Custom domain": "自定义域名",
"Configure your custom domain settings": "配置你的自定义域名设置",
"Site": "站点",
"Branding": "品牌",
"Logo, colors, and brand identity": "Logo、颜色与品牌识别",
"Theme": "主题",
"Visual theme and appearance settings": "视觉主题与外观设置",
"Navigation": "导航",
"Configure site navigation and menus": "配置站点导航与菜单",
"Business": "业务",
"Payment": "支付",
"Payment processing and billing settings": "支付处理与结算设置",
"XPack Explore": "XPack 探索",
"Explore XPack features and integrations": "探索 XPack 的功能与集成",
"Advanced": "高级",
"Code injection": "代码注入",
"Custom code injection and scripts": "自定义代码注入与脚本",
"Enter the domain you want to use": "输入你要使用的域名",
"Enter your full domain name (e.g., www.example.com)": "输入完整域名(例如:www.example.com)",
"Create your DNS records": "创建你的 DNS 记录",
"Add the following DNS records at your DNS provider": "在你的 DNS 服务商处添加以下记录",
"DNS Records Table": "DNS 记录表",
"Type": "类型",
"Host": "主机名",
"Value": "值",
"Activate custom domain": "激活自定义域名",
"Your DNS looks good. You can activate now.": "DNS 看起来没问题。现在可以激活了。",
"Make sure your DNS records have propagated before activation.": "激活前请确保 DNS 记录已生效。",
"Activate": "激活",
"Domain": "域名",
"Please enter a valid URL with http:// or https://": "请输入包含 http:// 或 https:// 的有效 URL",
"Create MCP Server": "创建 MCP 服务器",
"Choose how you want to create your MCP server": "选择创建 MCP 服务器的方式",
"Website Content Scraper": "网站内容爬虫",
"Create an MCP server that can scrape and extract content from websites": "创建可以爬取并提取网站内容的 MCP 服务器",
"OpenAPI Generator": "OpenAPI 生成器",
"Generate MCP server from OpenAPI/Swagger documentation": "从 OpenAPI/Swagger 文档生成 MCP 服务器",
"Update Website Scraper": "更新网站爬虫",
"Sync from OpenAPI": "从 OpenAPI 同步",
"Update Server": "更新服务器",
"Add Server": "添加服务器",
"Website URL": "网站 URL",
"Enter the website URL (e.g., https://example.com)": "输入网站 URL(例如:https://example.com)",
"Update website URL for content scraping": "更新用于内容爬取的网站 URL",
"Enter the website URL you want to scrape content from": "输入你想爬取内容的网站 URL",
"Creating webscraper server...": "正在创建爬虫服务器...",
"Sync server configuration from OpenAPI/Swagger documentation": "从 OpenAPI/Swagger 文档同步服务器配置",
"Generate MCP server configuration from OpenAPI/Swagger documentation": "从 OpenAPI/Swagger 文档生成 MCP 服务器配置",
"From URL": "从 URL",
"Upload File": "上传文件",
"OpenAPI URL": "OpenAPI URL",
"Enter the URL to your OpenAPI/Swagger specification": "输入 OpenAPI/Swagger 规范的 URL",
"Upload OpenAPI File": "上传 OpenAPI 文件",
"Choose File": "选择文件",
"Supports JSON and YAML formats": "支持 JSON 与 YAML 格式",
"Parsing OpenAPI document...": "正在解析 OpenAPI 文档...",
"Back": "返回",
"Create Server": "创建服务器",
"Generate Server": "生成服务器",
"Sync Server": "同步服务器",
"Select Type": "选择类型",
"Configure": "配置",
"OR": "或",
"Use Website Scraper": "使用网站爬虫",
"Use OpenAPI Generator": "使用 OpenAPI 生成器",
"Data scraping in progress...": "数据爬取进行中...",
"Scraped {{current}} of {{total}} pages": "已爬取 {{current}} / {{total}} 个页面",
"Scraped {{count}} pages": "已爬取 {{count}} 个页面",
"Modifying the URL will trigger re-scraping of the website data.": "修改 URL 将会触发重新爬取网站数据。",
"You have modified the Website URL. This will trigger re-scraping of the website data. Are you sure you want to continue?": "你已修改网站 URL。这将触发重新爬取网站数据。确定要继续吗?",
"Scraping...": "正在爬取...",
"Server Type": "服务器类型",
"Edit Website URL": "编辑网站 URL",
"Modifying the website URL will trigger re-scraping of the website data. This process may take some time to complete.": "修改网站 URL 将触发重新爬取数据。该过程可能需要一段时间完成。",
"Please enter a valid URL": "请输入有效的 URL",
"Use the refresh button to modify the website URL": "使用刷新按钮来修改网站 URL",
"Cannot publish while scraping": "爬取未完成,无法发布",
"Publish": "发布",
"Unpublish": "取消发布",
"Published": "已发布",
"Unpublished": "未发布",
"Your brand": "你的品牌",
"Support JPG, PNG, GIF, SVG. Max size 5MB": "支持 JPG, PNG, GIF, SVG. 最大支持 5MB",
"Site title": "站点标题",
"Enter site title": "输入站点标题",
"Main title displayed on the home page": "首页显示的主标题",
"Site description": "站点描述",
"Enter site description": "输入站点描述",
"Secondary description displayed below the main title": "主标题下方显示的次标题",
"Title is required": "标题不能为空",
"Custom Domain": "自定义域名",
"Activate your domain": "激活您的域名",
"Set Custom Domain": "设置自定义域名",
"Configure platform language": "配置平台语言",
"Enter title": "输入标题",
"Enter link URL": "输入链接 URL",
"Configure FAQ": "配置常见问题",
"Enter question": "输入问题",
"Enter answer": "输入答案",
"Enable Stripe Payment": "启用 Stripe 支付",
"Toggle to enable or disable Stripe payment interface": "切换以启用或禁用 Stripe 支付接口",
"Enter Secret Key": "输入 Stripe 密钥",
"Enter Webhook Secret": "输入 Stripe Webhook 密钥",
"Email Login Settings": "邮箱登录设置",
"Open in new tab": "在新标签页打开",
"Analyze platform usage and revenue": "分析平台使用情况和收入",
"Change your password": "更改您的密码"
}
+327 -81
View File
@@ -40,6 +40,7 @@
"Featured Packages": "精选工具包",
"Individual Tools": "单个工具",
"Details": "详情",
"Copy code": "复制代码",
"excel": "Excel",
"data": "数据",
"analysis": "分析",
@@ -80,7 +81,7 @@
"Free": "免费",
"Sign up now to get 100 free calls every month.": "注册即可获得每月 100 次免费调用",
"Generate and manage dynamic PowerPoints and Google Slides with your own custom branding and layouts.": "使用您自己的自定义品牌和布局生成和管理动态 PowerPoint 和 Google 幻灯片。",
"Try for free": "免费试用",
"Sign up to get the auth key": "注册以获取认证密钥",
"Lightning Fast Setup": "闪电般快速设置",
"Enterprise Security": "企业级安全",
"Global Scale": "全球规模",
@@ -102,7 +103,7 @@
"Build AI Agents": "使用令人难以置信的 MCP",
"With Incredible MCP": "构建 AI Agent",
"Instant Integration": "即时集成",
"Connect to global APIs and MCP services with just one config or SDK.": "通过一个配置或 SDK 连接到全球 API 和 MCP 服务。",
"Connect to global APIs and MCP servers with just one config or SDK.": "通过一个配置或 SDK 连接到全球 API 和 MCP 服务。",
"Zero Overhead": "零开销",
"Flexible pay-as-you-go pricing to fuel agent growth at every stage.": "灵活的按使用付费定价,为每个阶段的 Agent 增长提供动力。",
"Secure & Compliant": "安全 & 合规",
@@ -118,24 +119,24 @@
"Get Started": "立即开始",
"Demo": "演示",
"Start Deploying": "开始部署",
"We help these products connect to global services.": "我们帮助这些产品连接到全球服务。",
"We help these products connect to global servers.": "我们帮助这些产品连接到全球服务。",
"Become a partner": "成为合作伙伴",
"AI Design": "AI 设计",
"AI Agent": "AI Agent",
"AI Browser": "AI 浏览器",
"Home": "首页",
"Services": "服务",
"Servers": "服务",
"Interesting in \n becoming a partner?": "有兴趣\n 成为合作伙伴吗?",
"Other Partners": "其他合作伙伴",
"Services List": "服务列表",
"Submit services": "提交服务",
"Interesting in \n becoming a services supplier?": "有兴趣\n 成为服务供应商吗?",
"Apply to become a supplier and provide services to global users.": "申请成为供应商,为全球用户提供服务。",
"Servers List": "服务列表",
"Submit servers": "提交服务",
"Interesting in \n becoming a servers supplier?": "有兴趣\n 成为服务供应商吗?",
"Apply to become a supplier and provide servers to global users.": "申请成为供应商,为全球用户提供服务。",
"Become a supplier": "成为供应商",
"We only list some services": "我们只列出部分服务",
"Other Services": "其他服务",
"We only list some servers": "我们只列出部分服务",
"Other Servers": "其他服务",
"Submit a demo": "提交演示",
"Number of service categories": "服务分类数量",
"Number of server categories": "服务分类数量",
"Number of MCP Tools": "MCP 工具数量",
"Time for integration": "集成时间",
"Daily MCP request count": "每日 MCP 请求数量",
@@ -147,31 +148,31 @@
"It's hard to say goodbyes": "说再见总是很难",
"We're sorry to see you go. Your subscription has been cancelled.": "我们很遗憾看到您离开。您的订阅已被取消。",
"Playground": "演示环境",
"MCP Services Management": "MCP 服务管理",
"Service List": "服务列表",
"Add Service": "添加服务",
"MCP Servers Management": "MCP 服务管理",
"Server List": "服务列表",
"Add Server": "添加服务",
"OpenAPI Generator": "OpenAPI 生成器",
"Service Name": "服务名称",
"Service Description": "服务描述",
"Service Category": "服务分类",
"Service Status": "服务状态",
"Online": "上线",
"Offline": "下线",
"Server Name": "服务名称",
"Server Description": "服务描述",
"Server Category": "服务分类",
"Server Status": "服务状态",
"Published": "已发布",
"Unpublished": "未发布",
"Actions": "操作",
"Edit": "编辑",
"Delete": "删除",
"Toggle Status": "切换状态",
"Create New Service": "创建新服务",
"Edit Service": "编辑服务",
"Create New Server": "创建新服务",
"Edit Server": "编辑服务",
"Generate from OpenAPI": "从 OpenAPI 生成",
"Update from OpenAPI": "从 OpenAPI 更新",
"Sync from OpenAPI": "从 OpenAPI 同步",
"Sync service configuration from OpenAPI/Swagger documentation": "从 OpenAPI/Swagger 文档同步服务配置",
"Sync Service": "同步服务",
"Sync server configuration from OpenAPI/Swagger documentation": "从 OpenAPI/Swagger 文档同步服务配置",
"Sync Server": "同步服务",
"OpenAPI URL": "OpenAPI 地址",
"Upload OpenAPI File": "上传 OpenAPI 文件",
"Generate Service": "生成服务",
"Service Configuration": "服务配置",
"Generate Server": "生成服务",
"Server Configuration": "服务配置",
"API Endpoint": "API 端点",
"Authentication": "身份验证",
"API Key": "API 密钥",
@@ -181,7 +182,7 @@
"Markdown Documentation": "Markdown 文档",
"Save": "保存",
"Cancel": "取消",
"Service Documentation": "服务文档",
"Server Documentation": "服务文档",
"Manage Tools": "管理工具",
"Tools Count": "工具数量",
"Tool Name": "工具名称",
@@ -190,56 +191,73 @@
"Edit Tool": "编辑工具",
"Delete Tool": "删除工具",
"Save Changes": "保存更改",
"No tools configured for this service": "此服务未配置任何工具",
"Add tools to extend service functionality": "添加工具以扩展服务功能",
"Configure and manage tools for this service": "配置和管理此服务的工具",
"No tools configured for this server": "此服务未配置任何工具",
"Add tools to extend server functionality": "添加工具以扩展服务功能",
"Configure and manage tools for this server": "配置和管理此服务的工具",
"Add New Tool": "添加新工具",
"Enter tool name": "输入工具名称",
"Enter tool description": "输入工具描述",
"Tool name": "工具名称",
"Tool description": "工具描述",
"Take Offline": "下线",
"Bring Online": "上线",
"Platform Domain": "平台域名",
"Enter platform domain (e.g., example.com)": "输入平台域名(例如:example.com)",
"The domain name of your platform": "您平台的域名",
"MCP Server Domain": "MCP 服务器域名",
"Enter MCP server domain (e.g., api.example.com)": "输入 MCP 服务器域名(例如:api.example.com)",
"The domain for MCP server API calls": "用于 MCP 服务器 API 调用的域名",
"Featured in the XPack showcase": "展示在 XPack 的全球案例榜单",
"Enable this option to feature your site in the XPack global showcase and reach users worldwide.": "当开启选项,你的网站会展示在 XPack 的全球案例榜单来获得全球用户的关注。",
"Please enter a platform domain before enabling showcase": "启用展示功能前请先输入平台域名",
"FAQ Management": "FAQ管理",
"Configure frequently asked questions for your users": "为您的用户配置常见问题",
"FAQ List": "FAQ列表",
"Edit questions and answers directly in the table below": "在下方表格中直接编辑问题和答案",
"Save All": "保存全部",
"Order": "排序",
"Question": "问题",
"Answer": "答案",
"No FAQ items available.": "暂无FAQ项目。",
"Insert below": "在下方插入",
"Short Description": "简短描述",
"Long Description": "详细描述",
"Brief description of the service": "服务的简短描述",
"Detailed description of the service": "服务的详细描述",
"Brief description of the server": "服务的简短描述",
"Detailed description of the server": "服务的详细描述",
"Basic Information": "基本信息",
"API Configuration": "API配置",
"Authentication Type": "认证类型",
"Update Service": "更新服务",
"Create Service": "创建服务",
"Update Server": "更新服务",
"Create Server": "创建服务",
"Confirm Delete": "确认删除",
"Are you sure you want to delete this service?": "您确定要删除此服务吗?",
"Are you sure you want to delete this server?": "您确定要删除此服务吗?",
"This action cannot be undone.": "此操作无法撤销。",
"Manage your MCP services, configure APIs, and monitor service status": "管理您的MCP服务,配置API,并监控服务状态",
"Search services...": "搜索服务...",
"Manage your MCP servers, configure APIs, and monitor server status": "管理您的MCP服务,配置API,并监控服务状态",
"Search MCP servers": "搜索服务...",
"Filter by category": "按分类筛选",
"Filter by status": "按状态筛选",
"All Categories": "所有分类",
"All Status": "所有状态",
"Created": "创建时间",
"Last Updated": "最后更新",
"Total Services": "总服务数",
"Online Services": "在线服务",
"Offline Services": "离线服务",
"Service created successfully": "服务创建成功",
"Service updated successfully": "服务更新成功",
"Service deleted successfully": "服务删除成功",
"Service status updated successfully": "服务状态更新成功",
"Failed to create service": "创建服务失败",
"Failed to update service": "更新服务失败",
"Failed to delete service": "删除服务失败",
"Failed to update service status": "更新服务状态失败",
"Total Servers": "总服务数",
"Server created successfully": "服务创建成功",
"Server updated successfully": "服务更新成功",
"Server deleted successfully": "服务删除成功",
"Server status updated successfully": "服务状态更新成功",
"Failed to create server": "创建服务失败",
"Failed to update server": "更新服务失败",
"Failed to delete server": "删除服务失败",
"Failed to update server status": "更新服务状态失败",
"Invalid OpenAPI URL": "无效的 OpenAPI 地址",
"Failed to parse OpenAPI document": "解析 OpenAPI 文档失败",
"OpenAPI document parsed successfully": "OpenAPI 文档解析成功",
"Please enter a valid URL": "请输入有效的 URL",
"Please enter a valid URL with http:// or https://": "请输入有效的 URL,需要包含 http:// 或 https://",
"Please fix validation errors before saving": "请修复验证错误后再保存",
"Please select a file": "请选择文件",
"File uploaded successfully": "文件上传成功",
"Failed to upload file": "文件上传失败",
"Service name is required": "服务名称为必填项",
"Service description is required": "服务描述为必填项",
"Server name is required": "服务名称为必填项",
"Server description is required": "服务描述为必填项",
"API endpoint is required": "API 端点为必填项",
"Documentation is required": "文档为必填项",
"Connect Your AI Agent to the Real World": "连接您的 AI Agent 到真实世界",
@@ -274,14 +292,15 @@
"Login Success": "登录成功",
"Login Error": "登录错误",
"Back Home": "返回首页",
"MCP Services": "MCP 服务",
"MCP Servers": "MCP 服务",
"User Management": "用户管理",
"Revenue Management": "收入管理",
"Payment Channels": "支付渠道",
"System Settings": "系统设置",
"Overview and analytics": "概览和分析",
"Manage MCP services and API tools": "管理MCP服务及API工具",
"Manage MCP servers and API tools": "管理MCP服务及API工具",
"Manage registered users": "管理注册用户",
"Manage resource groups": "管理资源组",
"View user recharge history": "查看用户充值历史",
"Configure payment channels": "配置支付渠道",
"Platform basic configuration": "平台基础配置",
@@ -307,6 +326,14 @@
"All Roles": "所有角色",
"Ban User": "封禁用户",
"Unban User": "解封用户",
"Recharge User": "为用户充值",
"Current Balance": "当前余额",
"User recharged successfully": "用户充值成功",
"Please enter a valid amount": "请输入有效金额",
"Minimum recharge amount is ¥1": "最低充值金额为 ¥1",
"User not selected": "未选择用户",
"Recharge failed": "充值失败",
"Network error, please try again": "网络错误,请重试",
"Delete User": "删除用户",
"View Profile": "查看资料",
"Edit User": "编辑用户",
@@ -326,7 +353,7 @@
"No": "否",
"User Statistics": "用户统计",
"API Calls": "API调用次数",
"Services Used": "使用的服务",
"Servers Used": "使用的服务",
"Total Spent": "总消费",
"Wallet Balance": "钱包余额",
"Confirm Ban User": "确认封禁用户",
@@ -355,13 +382,12 @@
"Enter your password": "请输入密码",
"Confirm your password": "请确认密码",
"Passwords do not match": "密码不匹配",
"Password must be at least 8 characters": "密码至少需要8个字符",
"Registration successful": "注册成功",
"Registration failed": "注册失败",
"Email already exists": "邮箱已存在",
"Invalid email format": "邮箱格式无效",
"Sign up with Google": "使用Google注册",
"Terms of Service": "服务条款",
"Terms of Server": "服务条款",
"Privacy Policy": "隐私政策",
"By signing up, you agree to our": "注册即表示您同意我们的",
"and": "和",
@@ -387,19 +413,27 @@
"Failed to test Google auth": "测试Google认证失败",
"Failed to fetch Stripe config": "获取Stripe配置失败",
"Failed to save Stripe config": "保存Stripe配置失败",
"Failed to save Alipay config": "保存支付宝配置失败",
"Failed to save WeChat config": "保存微信配置失败",
"Stripe connection test failed": "Stripe连接测试失败",
"Stripe connection test successful": "Stripe连接测试成功",
"Alipay connection test successful": "支付宝连接测试成功",
"Alipay connection test failed": "支付宝连接测试失败",
"WeChat connection test successful": "微信连接测试成功",
"WeChat connection test failed": "微信连接测试失败",
"Connection test failed": "连接测试失败",
"Unknown error": "未知错误",
"Secret Key cannot be empty": "密钥不能为空",
"Stripe Configuration": "Stripe配置",
"Alipay Configuration": "支付宝配置",
"WeChat Configuration": "微信配置",
"Google Login Settings": "Google登录设置",
"Enable Google Login": "启用Google登录",
"Administrator Account": "管理员账户",
"Platform Information": "平台信息",
"Delete Service": "删除服务",
"Delete Server": "删除服务",
"Parsing OpenAPI document...": "正在解析OpenAPI文档...",
"Generated Service Configuration": "生成的服务配置",
"Generated Server Configuration": "生成的服务配置",
"None": "无",
"Tags": "标签",
"Paid": "付费",
@@ -437,7 +471,7 @@
"Enter your verification code": "输入您的验证码",
"Resend": "重新发送",
"Verify Email Error": "邮箱验证错误",
"Generate MCP service configuration from OpenAPI/Swagger documentation": "从OpenAPI/Swagger文档生成MCP服务配置",
"Generate MCP server configuration from OpenAPI/Swagger documentation": "从OpenAPI/Swagger文档生成MCP服务配置",
"From URL": "从URL",
"Upload File": "上传文件",
"Choose File": "选择文件",
@@ -446,7 +480,11 @@
"Invalid email address": "无效的邮箱地址",
"Back to Home": "返回首页",
"Enter the URL to your OpenAPI/Swagger specification": "输入您的OpenAPI/Swagger规范的URL",
"Enter service name": "输入服务名称",
"Enter server name": "输入服务名称",
"Server ID": "服务器ID",
"Enter server ID": "输入服务器ID",
"Modifying the ID will affect the MCP access URL. Please modify with caution.": "修改ID会影响MCP的访问地址,需要谨慎修改。",
"You have modified the Server ID. This will affect the MCP access URL and may break existing integrations. Are you sure you want to continue?": "您已修改了服务器ID。这将影响MCP访问地址,可能会破坏现有的集成。您确定要继续吗?",
"The header name for the API key (e.g., X-API-Key, Authorization)": "API密钥的头部名称(例如:X-API-Key, Authorization)",
"Enter API key": "输入API密钥",
"Enter bearer token": "输入Bearer令牌",
@@ -471,7 +509,7 @@
"API Key Header Name": "API密钥头部名称",
"Secret Key format is incorrect, should start with sk_": "密钥格式不正确,应以sk_开头",
"Webhook Secret format is incorrect, should start with whsec_": "Webhook密钥格式不正确,应以whsec_开头",
"Password must be at least 8 characters long": "密码至少需要8个字符",
"Password must be at least 6 characters long": "密码至少需要6个字符",
"OAuth 2.0 Client Secret (optional, for server-side verification)": "OAuth 2.0 客户端密钥(可选,用于服务端验证)",
"Authorized redirect URI configured in Google Cloud Console": "在Google Cloud Console中配置的授权重定向URI",
"Webhook signing secret for verifying Stripe events": "用于验证Stripe事件的Webhook签名密钥",
@@ -513,7 +551,7 @@
"Select currency": "选择货币",
"Default currency for the platform": "平台默认货币",
"call": "调用",
"No services found": "未找到服务",
"No servers found": "未找到服务",
"free/day": "免费/天",
"Account (Email)": "账户(邮箱)",
"Recharge Amount": "充值金额",
@@ -531,10 +569,21 @@
"No tools added yet. Add your first tool using the input above.": "尚未添加工具。使用上面的输入添加您的第一个工具。",
"Insert tool below": "在下方插入工具",
"Remove tool": "移除工具",
"Service Detail": "服务详情",
"Server Detail": "服务详情",
"Billing Mode": "计费模式",
"Enable free quota": "启用免费配额",
"Configure Stripe payment interface": "配置Stripe支付接口",
"Configure Alipay payment interface": "配置支付宝支付接口",
"Configure WeChat payment interface": "配置微信支付接口",
"App ID": "应用ID",
"Alipay App ID": "支付宝应用ID",
"App Private Key": "应用私钥",
"Alipay App Private Key": "支付宝应用私钥",
"Alipay Public Key": "支付宝公钥",
"Alipay public key for verification": "支付宝公钥用于验证",
"WeChat App ID": "微信应用ID",
"Merchant ID": "商户号",
"WeChat Merchant ID": "微信商户号",
"Secret Key": "密钥",
"Stripe secret key for server-side API calls": "用于服务端API调用的Stripe密钥",
"Webhook Secret": "Webhook密钥",
@@ -549,9 +598,9 @@
"Platform total fund pool": "平台总资金池",
"Today's API Calls": "今日调用量",
"API call count": "API 调用次数",
"Total MCP Services": "MCP服务总数",
"Deployed services": "已部署的服务",
"This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.": "这里是您的AI服务管理中心,您可以在左侧快速查看平台核心数据,在此管理和配置您的 MCP 服务、用户、支付渠道等。",
"Total MCP Servers": "MCP服务总数",
"Deployed servers": "已部署的服务",
"This is your AI server management center. You can quickly view platform core data on the left and manage and configure your MCP servers, users, payment channels, etc.": "这里是您的AI服务管理中心,您可以在左侧快速查看平台核心数据,在此管理和配置您的 MCP 服务、用户、支付渠道等。",
"Log In": "登录",
"Register Date": "注册日期",
"Dashboard": "仪表盘",
@@ -575,6 +624,8 @@
"MCP Config": "MCP配置",
"Copy full config": "复制完整配置",
"Analytics": "分析",
"Resource Group": "资源组",
"Manage Your Resource Groups": "管理您的资源组",
"Times": "次",
"No analytics data available": "无可用分析数据",
"Delete Auth Key": "删除认证密钥",
@@ -594,21 +645,25 @@
"WeChat Pay": "微信支付",
"Confirm": "确认",
"Recharge Account": "充值账户",
"Funds will be added to your account balance": "资金将添加到您的账户余额",
"Funds will be added to your account balance": "资金将添加到您的账户余额中",
"Please select a payment method": "请选择支付方式",
"Manage your balance and recharge history": "管理您的余额和充值历史",
"Build incredible AI agents together": "一起构建强大的 AI 代理",
"Balance: {{amount}}": "余额: {{amount}}",
"Log Out": "退出登录",
"Enter your username": "输入您的用户名",
"Login": "登录",
"Admin Portal": "管理员门户",
"Log in to admin console": "登录管理员控制台",
"Welcome to XPack.AI Open Source": "欢迎来到XPack.AI开源项目",
"Are you sure you want to delete this \"{{name}}\" service?": "您确定要删除这个\"{{name}}\"服务吗?",
"Service status toggled successfully": "服务状态切换成功",
"Failed to toggle service status": "切换服务状态失败",
"Log in to your admin account to continue": "登录管理员控制台",
"Welcome to XPack.AI": "欢迎来到XPack.AI",
"Are you sure you want to delete this \"{{name}}\" server?": "您确定要删除这个\"{{name}}\"服务吗?",
"Server status toggled successfully": "服务状态切换成功",
"Failed to toggle server status": "切换服务状态失败",
"Stripe configuration saved successfully": "Stripe 配置保存成功",
"Failed to save Stripe configuration": "保存 Stripe 配置失败",
"Failed to save {{channelName}} config": "保存{{channelName}}配置失败",
"{{channelName}} config saved successfully": "{{channelName}}配置保存成功",
"{{channelName}} connection test failed": "{{channelName}}连接测试失败",
"{{channelName}} connection test successful": "{{channelName}}连接测试成功",
"System config updated successfully": "系统配置更新成功",
"Failed to update system config": "更新系统配置失败",
"Confirm Purchase": "确认购买",
@@ -635,8 +690,8 @@
"Total Revenue": "总收入",
"Failed to save stripe config": "保存 Stripe 配置失败",
"Stripe config saved successfully": "Stripe 配置保存成功",
"Login successful": "登录成功",
"Logged out successfully": "退出登录成功",
"Alipay config saved successfully": "支付宝配置保存成功",
"WeChat config saved successfully": "微信配置保存成功",
"Configure email settings": "配置邮箱设置",
"Email Configuration": "邮箱配置",
"Configure SMTP settings for email notifications": "配置SMTP设置用于邮件通知",
@@ -710,10 +765,10 @@
"Traditional email and password authentication": "传统邮箱和密码认证",
"Email/Verification Code": "邮箱/验证码",
"Passwordless login with email verification code": "邮箱验证码登录",
"Email service is not configured. Please configure email settings first.": "邮箱服务未配置。请先配置邮箱设置。",
"SMTP is not configured. Please configure email settings first.": "SMTP未配置。请先配置邮箱设置。",
"Go to Settings": "前往设置",
"AI Tools Marketplace": "AI工具市场",
"A marketplace for AI tools and services. Discover and integrate powerful AI solutions for your projects.": "一个AI工具和服务的市场。发现并整合强大的AI解决方案,为您的项目提供支持。",
"A marketplace for AI tools and servers. Discover and integrate powerful AI solutions for your projects.": "一个AI工具和服务的市场。发现并整合强大的AI解决方案,为您的项目提供支持。",
"Configuration": "配置",
"Featured Products": "推荐产品",
"Search": "搜索",
@@ -722,12 +777,203 @@
"Re-enter new password": "重新输入新密码",
"Confirm new password": "确认新密码",
"New password and confirm password do not match": "新密码和确认密码不匹配",
"New password must be at least 8 characters long": "新密码至少需要8个字符",
"New password must be at least 6 characters long": "新密码至少需要6个字符",
"New password and confirm password must be the same": "新密码和确认密码必须相同",
"New Password": "新密码",
"Confirm New Password": "确认新密码",
"Theme changed successfully": "主题切换成功",
"Failed to change theme": "主题切换失败",
"About page saved successfully": "关于页面保存成功",
"Failed to save about page": "关于页面保存失败"
}
"Failed to save about page": "关于页面保存失败",
"General": "常规设置",
"Homepage": "首页设置",
"Homepage content and theme settings": "首页内容和主题设置",
"About Page": "关于页面",
"About page content configuration": "关于页面内容配置",
"Email & Admin": "邮箱与管理员",
"Email and administrator settings": "邮箱和管理员设置",
"Embedded HTML": "嵌入式HTML",
"Configure custom HTML content for global injection": "配置自定义HTML内容进行全局注入",
"Enable Custom HTML": "启用自定义HTML",
"Toggle to enable or disable custom HTML injection": "切换启用或禁用自定义HTML注入",
"Show Preview": "显示预览",
"Hide Preview": "隐藏预览",
"This HTML will be injected globally into the application. You can include script tags, CSS styles, or any valid HTML.": "此HTML将全局注入到应用程序中。您可以包含脚本标签、CSS样式或任何有效的HTML。",
"Preview": "预览",
"Note: This is a text preview. The actual HTML will be rendered when saved and enabled.": "注意:这是文本预览。实际的HTML将在保存并启用后渲染。",
"Usage Instructions": "使用说明",
"You can include Google Analytics, custom CSS, or any tracking scripts": "您可以包含Google Analytics、自定义CSS或任何跟踪脚本",
"The HTML will be injected into the document head section": "HTML将注入到文档头部分",
"Make sure your code is valid to avoid breaking the application": "确保您的代码有效,以避免破坏应用程序",
"Changes take effect immediately after saving and enabling": "更改在保存并启用后立即生效",
"Welcome to Your Platform": "欢迎使用您的平台",
"Let's set up your platform with some basic information": "让我们用一些基本信息来设置您的平台",
"Fields marked with * are required": "标有 * 的字段为必填项",
"Website title is required": "网站标题为必填项",
"Headline is required": "标题为必填项",
"Subheadline is required": "副标题为必填项",
"Please fill in all required fields": "请填写所有必填字段",
"Setup failed. Please try again.": "设置失败,请重试。",
"Complete Setup": "完成设置",
"Platform setup completed successfully!": "平台设置成功完成!",
"Welcome to the famous five-minute platform setup process! Just fill in the information below and you'll be on your way to using the most extendable and powerful platform.": "欢迎使用著名的五分钟平台设置流程!只需填写下面的信息,您就可以开始使用最具扩展性和功能强大的平台了。",
"Information needed": "所需信息",
"Please provide the following information. Do not worry, you can always change these settings later in the admin panel.": "请提供以下信息。不用担心,您随时可以在管理面板中更改这些设置。",
"Failed to update homepage config": "更新主页配置失败",
"Homepage config updated successfully": "主页配置更新成功",
"Failed to load homepage config": "加载主页配置失败",
"FAQ updated successfully": "常见问题更新成功",
"Navigation updated successfully": "导航更新成功",
"Embedded HTML updated successfully": "嵌入HTML更新成功",
"Payment channels updated successfully": "支付渠道更新成功",
"Manage frequently asked questions": "管理常见问题",
"Add FAQ Item": "添加常见问题",
"Remove FAQ Item": "删除常见问题",
"Top Navigation": "顶部导航",
"Manage top navigation links": "管理顶部导航链接",
"Title": "标题",
"Link": "链接",
"Target": "目标",
"Add Navigation Item": "添加导航项",
"Remove Navigation Item": "删除导航项",
"Same window": "当前窗口",
"New window": "新窗口",
"Custom HTML injection": "自定义HTML注入",
"Enable embedded HTML": "启用嵌入HTML",
"HTML Content": "HTML内容",
"Enter custom HTML code": "输入自定义HTML代码",
"Manage payment methods": "管理支付方式",
"Channel ID": "渠道ID",
"Display Name": "显示名称",
"Add Payment Channel": "添加支付渠道",
"Remove Payment Channel": "删除支付渠道",
"Enter channel ID": "输入渠道ID",
"Enter display name": "输入显示名称",
"Installation Status": "安装状态",
"First time installation": "首次安装",
"System installed": "系统已安装",
"Configure top navigation menu items and links": "配置顶部导航菜单项和链接",
"Per Million Tokens": "每百万Token",
"Price per million tokens consumed": "每百万Token消耗的价格",
"Price per million tokens": "每百万Token价格",
"Price per API call": "每次API调用价格",
"Payment channel disabled successfully": "支付渠道禁用成功",
"Failed to disable payment channel": "禁用支付渠道失败",
"Payment channel enabled successfully": "支付渠道启用成功",
"Failed to enable payment channel": "启用支付渠道失败",
"Input Token Price": "输入Token价格",
"Output Token Price": "输出Token价格",
"Price per million input tokens": "每百万输入Token价格",
"Price per million output tokens": "每百万输出Token价格",
"Input": "输入",
"Output": "输出",
"1M tokens": "1M tokens",
"Total Spending": "总支出",
"Remote": "远程",
"Platform Logo": "平台Logo",
"Support JPG, PNG, GIF. Max size 5MB": "支持JPG、PNG、GIF格式,最大大小5MB",
"(30 days)": "(30天)",
"Sign in": "登录",
"or create your account": "或创建您的账户",
"No account? Just continue—we’ll set you up.": "没有账户?继续即可,我们会为您设置。",
"Password must be at least 6 characters": "密码必须至少6个字符",
"Email is required": "邮箱为必填项",
"No servers available": "没有可用服务",
"(Deleted)": "(已删除)",
"Transport Type": "传输方式",
"Server ID must be less than 255 characters": "Server ID 必须少于255个字符",
"Server Name must be less than 255 characters": "Server Name 必须少于255个字符",
"API Endpoint must be a valid HTTP/HTTPS URL": "API Endpoint 必须是一个有效的HTTP/HTTPS URL",
"Server ID is required": "Server ID 为必填项",
"Short description is required": "简短描述为必填项",
"Add": "添加",
"Add to Groups": "添加到资源组",
"Group Name": "资源组名称",
"No resource groups available": "没有可用资源组",
"Failed to load group services": "加载资源组服务失败",
"Resource group deleted successfully": "资源组删除成功",
"Added Time": "添加时间",
"No services in this group": "此资源组没有服务",
"Open Resource Group Page": "打开资源组页面",
"Remove": "删除",
"Confirm Remove": "确认删除",
"Are you sure you want to remove this \"{{name}}\" mcp server from \"{{groupName}}\" resource group?": "您确定要从 \"{{groupName}}\" 资源组中移除 \"{{name}}\" MCP 服务吗?",
"Users associated with this resource group will not be able to call the removed MCP server": "与该资源组关联的用户将无法调用已移除的 MCP 服务",
"You don't have permission to access this MCP server.": "您没有权限访问此 MCP 服务。",
"Failed to load resource groups": "加载资源组失败",
"Failed to delete resource group": "删除资源组失败",
"Failed to add service to group": "添加服务到资源组失败",
"Resource group created successfully": "资源组创建成功",
"Resource group updated successfully": "资源组更新成功",
"Services added successfully": "服务添加成功",
"Service removed successfully": "服务移除成功",
"Select resource group": "选择资源组",
"Manage your resource group. Each user has a resource group and can only access resources within their resource group": "管理您的资源组。每个用户都有一个资源组,并且只能访问其资源组内的资源",
"Please select a group to view services": "请选择一个资源组来查看服务",
"Are you sure you want to remove this \"{{name}}\" Resource Group?": "您确定要删除这个 \"{{name}}\" 资源组吗?",
"The bound users have been transferred to the following resource group": "与该资源组关联的用户已转移至以下资源组",
"Service Name": "服务名称",
"Group List": "资源组列表",
"No groups found": "没有找到资源组",
"No more groups": "没有更多资源组",
"Are you sure you want to delete this item? This action cannot be undone.": "您确定要删除这个项目吗?此操作无法撤销。",
"Create New Resource Group": "创建新资源组",
"Edit Resource Group": "编辑资源组",
"Edit Resource Group Name": "编辑资源组名称",
"Set as default": "设置为默认",
"Automatically bind default resource groups when adding users": "添加用户时自动绑定默认资源组",
"Add MCP Server": "添加 MCP 服务",
"No MCP services available": "没有可用的 MCP 服务",
"Resource Groups": "资源组",
"Resource Group Name": "资源组名称",
"Failed to remove service from group": "从资源组中移除服务失败",
"Failed to update resource group": "更新资源组失败",
"Failed to create resource group": "创建资源组失败",
"Failed to fetch simple mcp services": "获取简易MCP服务失败",
"Failed to fetch group services": "获取资源组服务失败",
"Failed to update user resource group": "更新用户资源组失败",
"Failed to load simple resource groups": "获取简易资源组失败",
"Failed to load resource group detail": "获取资源组详情失败",
"Resource Group Detail": "资源组详情",
"Current display time is UTC time": "当前显示时间为UTC时间",
"View Resource Group Detail": "查看资源组详情",
"Configure tags bar display": "配置标签栏显示",
"Failed to load orders": "加载订单失败",
"Transaction Time": "交易时间",
"All": "全部",
"Purchase": "消费",
"No orders found": "无订单",
"Account Balance": "账户余额",
"View your balance and transaction history": "查看您的余额和交易历史",
"Display tags bar": "显示标签栏",
"Front end displays tags bar and allows users to filter products based on tags.": "前端显示标签栏,允许用户根据标签过滤产品。",
"Tags Bar": "标签栏",
"Auth Key Name": "认证密钥名称",
"Search by email": "按邮箱搜索",
"Search by service name": "按服务名称搜索",
"Select Date Range": "选择日期范围",
"Resource group name \"{{name}}\" is reserved and cannot be used": "资源组名称 \"{{name}}\" 是保留名称,不能使用",
"Resource group name \"{{name}}\" already exists": "资源组名称 \"{{name}}\" 已存在",
"Auth key name \"{{name}}\" already exists": "认证密钥 \"{{name}}\" 已存在",
"Start date must be before end date": "开始日期必须早于结束日期",
"Start date cannot be earlier than 30 days ago": "开始日期不能早于30天前",
"Daily call limit per user": "每用户每日调用上限",
"Max calls per user per day (Beijing time). Leave blank or 0 for unlimited": "每个用户每天最多调用次数(北京时间)。留空或填 0 表示不限",
"e.g. 50": "如 50",
"Free Call Limits": "免费调用限制",
"Global daily call cap for free services": "免费服务的全局每日调用上限",
"Platform-wide daily call limit per user": "全站每用户每日调用上限",
"Applies to every free service, leave blank or 0 for unlimited": "对所有免费服务生效,留空或填 0 表示不限",
"If a service also has its own limit, the smaller number wins": "若单个服务也设置了上限,两者取更小值",
"Example 100": "如 100",
"Enter a non-negative integer": "请输入非负整数",
"Free call limit saved": "免费调用上限已保存",
"Failed to save free call limit": "保存免费调用上限失败",
"Publish MCP Service": "发布 MCP 服务",
"Submit your own MCP service": "提交你的 MCP 服务并上架市场",
"My Submissions": "我的提交记录",
"No submissions yet": "还没有提交记录",
"Pending Review": "待审核",
"Approved": "已通过",
"Rejected": "已拒绝"
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 MiB

+92
View File
@@ -0,0 +1,92 @@
import { ApiResponse } from "@/shared/types";
import { fetchAdminAPI } from "@/rpc/admin-api";
/**
* Admin analytics API data structures based on OpenAPI spec
* GET /api/admin/stats/analytics
*/
export interface DayCountStringItem {
stats_day: string; // yyyy-mm-dd
count: string;
}
export interface DayCountNumberItem {
stats_day: string; // yyyy-mm-dd
count: number;
}
// 用户注册数据
export interface UserRegisterData {
total: number; // user register total count
today?: number; // today user register count
days: DayCountStringItem[]; // daily user register count
}
// user pay data
export interface UserPayData {
total: number; // user pay total amount
today?: number; // today user pay amount
days: DayCountNumberItem[]; // daily user pay amount
}
// MCP 调用数据
export interface MCPCallData {
total: number; // mcp call total count
today?: number; // today mcp call count
days: DayCountNumberItem[]; // daily mcp call count
}
// Top server items
export interface TopServiceItem {
id: string; // server id
name: string; // server name
short_description: string; // short description
call_count: number; // call count
is_deleted: boolean; //It means the server was deleted.
}
// admin analytics data
export interface AdminAnalyticsData {
user_register: UserRegisterData;
user_pay: UserPayData;
mcp_call: MCPCallData;
top_services: TopServiceItem[];
}
// admin analytics response body
export interface AdminAnalyticsResponse
extends ApiResponse<AdminAnalyticsData> {
success: boolean;
code: string;
error_message: string;
data: AdminAnalyticsData;
}
/**
* Get admin analytics data
* Headers: { Authorization: string }
* @param start_time - Start time timestamp (seconds)
* @param end_time - End time timestamp (seconds)
*/
export async function getAdminAnalytics(
start_time?: number,
end_time?: number
): Promise<AdminAnalyticsResponse> {
const params = new URLSearchParams();
if (start_time !== undefined) {
params.append('start', start_time.toString());
}
if (end_time !== undefined) {
params.append('end', end_time.toString());
}
const url = `/api/admin/stats/analytics${params.toString() ? `?${params.toString()}` : ''}`;
return fetchAdminAPI<AdminAnalyticsData>(url, {
method: "GET",
}) as unknown as AdminAnalyticsResponse;
}
+30
View File
@@ -0,0 +1,30 @@
import { fetchAdminAPI } from "@/rpc/admin-api";
import { ApiResponse } from "@/shared/types";
import toast from "react-hot-toast";
export enum OnboardingTaskKey {
PLATFORM_SETUP = "configure-platform-settings",
MCP_SERVICES = "add-mcp-services",
REVENUE_MANAGEMENT = "configure-platment-billings",
SHARE_PLATFORM = "share-your-platform",
}
export enum TaskStatusEnum {
COMPLETED = 1,
NOT_STARTED = 0,
}
export type TaskItem = {
task_id: OnboardingTaskKey;
task_status: TaskStatusEnum;
};
export async function updateAdminOnboardingTasks(
task: TaskItem
): Promise<boolean> {
const res = (await fetchAdminAPI<void>("/api/onboarding/task_update_status", {
method: "PUT",
body: task as unknown as BodyInit,
})) as unknown as ApiResponse<void>;
// if (!res.success) {
// toast.error(res.error_message || "Failed to update onboarding task status");
// }
return res.success;
}
+305
View File
@@ -0,0 +1,305 @@
import { SimpleMcpService } from "@/components/resource-group/AddMcpServerModal";
import { GroupService } from "@/components/resource-group/GroupServiceTable";
import { fetchAdminAPI } from "@/rpc/admin-api";
import { toast } from "react-hot-toast";
import i18n from "@/shared/lib/i18n";
export interface ResourceGroupResponse {
id: string;
name: string;
description: string;
is_default: boolean;
service_count: number;
create_at: string;
}
export interface ResourceGroupDetailResponse {
id: string;
name: string;
description: string;
is_default: boolean;
update_at: number;
create_at: string;
}
export interface ResourceGroupListResponse {
data: ResourceGroupResponse[];
total: number;
page: number;
page_size: number;
}
export interface GroupServiceListResponse {
data: GroupService[];
total: number;
page: number;
page_size: number;
}
export interface SimpleMcpServiceListResponse {
data: SimpleMcpService[];
total: number;
page: number;
page_size: number;
}
export const fetchResourceGroupDetail = async (groupId: string): Promise<ResourceGroupDetailResponse | null> => {
try {
const response = await fetchAdminAPI<ResourceGroupDetailResponse>(`/api/resource_group/info?id=${groupId}`);
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to load resource group detail"));
return null;
}
return response.data || null;
} catch (error) {
console.error("Error fetching resource group detail:", error);
return null;
}
};
/**
* 获取资源组列表
*/
export const fetchResourceGroups = async (page: number, page_size: number, keyword: string): Promise<ResourceGroupListResponse> => {
try {
const response = await fetchAdminAPI<ResourceGroupResponse[]>(`/api/resource_group/list?page=${page}&page_size=${page_size}&keyword=${keyword}`);
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to load resource groups"));
return {
data: [],
total: 0,
page,
page_size,
};
}
return {
data: response.data || [],
total: response.page?.total || 0,
page: response.page?.page || page,
page_size: response.page?.page_size || page_size,
};
} catch (error) {
console.error("Error fetching auth keys:", error);
return {
data: [],
total: 0,
page,
page_size,
};
}
};
/**
* 获取简易资源组列表
*/
export const fetchSimpleResourceGroups = async (): Promise<{ id: string, name: string }[]> => {
try {
const response = await fetchAdminAPI<{ id: string, name: string }[]>(`/api/resource_group/list/simple`);
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to load simple resource groups"));
return []
}
return response.data || []
} catch (error) {
console.error("Error fetching auth keys:", error);
return []
}
};
/**
* 修改用户资源组
*/
export const updateUserResourceGroup = async (userId: string, resourceGroupId: string): Promise<boolean> => {
try {
const response = await fetchAdminAPI<boolean>(`/api/user_manager/resource_group`, {
method: "PUT",
body: { user_id: userId, resource_group: resourceGroupId } as unknown as BodyInit,
});
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to update user resource group"));
return false;
}
return true;
} catch (error) {
console.error("Error updating user resource group:", error);
return false
}
};
/**
* 获取指定资源组下的服务列表
*/
export const fetchGroupServices = async (id: string,page: number, page_size: number, keyword: string): Promise<GroupServiceListResponse> => {
try {
const response = await fetchAdminAPI<GroupService[]>(`/api/resource_group/service/list?id=${id}&page=${page}&page_size=${page_size}&keyword=${keyword}`);
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to fetch group services"));
return {
data: [],
total: 0,
page,
page_size,
};
}
return {
data: response.data || [],
total: response.page?.total || 0,
page: response.page?.page || page,
page_size: response.page?.page_size || page_size,
};
} catch (error) {
console.error("Error fetching auth keys:", error);
return {
data: [],
total: 0,
page,
page_size,
};
}
};
/**
* 获取简易指定资源组下的服务列表
*/
export const fetchSimpleMcpServices = async (id: string): Promise<SimpleMcpService[]> => {
try {
const response = await fetchAdminAPI<SimpleMcpService[]>(`/api/resource_group/service/list/unbind?id=${id}`);
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to fetch simple mcp services"));
return []
}
return response.data || []
} catch (error) {
console.error("Error fetching auth keys:", error);
return []
}
};
/**
* 创建资源组
*/
export const createResourceGroup = async (name: string, isDefault: boolean): Promise<{success: boolean, id: string}> => {
try {
const response = await fetchAdminAPI<{id: string}>(`/api/resource_group`, {
method: "POST",
body: { name: name, is_default: isDefault } as unknown as BodyInit,
});
if (!response.success) {
const errorMsg = response.error_message
if (errorMsg?.endsWith('already exists')) {
toast.error(i18n.t(errorMsg, { name: name }));
} else if(errorMsg?.endsWith('cannot be used')) {
toast.error(i18n.t(errorMsg, { name: name }));
} else {
toast.error(errorMsg || i18n.t("Failed to create resource group"));
}
return {
success: false,
id: "",
};
}
return {
success: true,
id: response.data?.id || "",
};
} catch {
return {
success: false,
id: "",
};
}
};
/**
* 更新资源组
*/
export const updateResourceGroup = async (
groupId: string,
name: string,
isDefault: boolean
): Promise<boolean> => {
try {
const response = await fetchAdminAPI<boolean>(`/api/resource_group?id=${groupId}`, {
method: "PUT",
body: { name: name, is_default: isDefault } as unknown as BodyInit,
});
if (!response.success) {
const errorMsg = response.error_message
if (errorMsg?.endsWith('already exists')) {
toast.error(i18n.t(errorMsg, { name: name }));
} else if(errorMsg?.endsWith('cannot be used')) {
toast.error(i18n.t(errorMsg, { name: name }));
} else {
toast.error(errorMsg || i18n.t("Failed to update resource group"));
}
return false;
}
return true;
} catch {
return false
}
};
/**
* 删除资源组
*/
export const deleteResourceGroup = async (
groupId: string,
transferToGroupId: string
): Promise<boolean> => {
try {
const response = await fetchAdminAPI<boolean>(`/api/resource_group?id=${groupId}&migrate_id=${transferToGroupId}`, {
method: "DELETE"
});
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to delete resource group"));
return false;
}
return true;
} catch {
return false
}
};
/**
* 从资源组中移除服务
*/
export const removeServiceFromGroup = async (
groupId: string,
serviceIds: string[]
): Promise<boolean> => {
try {
const response = await fetchAdminAPI<boolean>(`/api/resource_group/service?id=${groupId}`, {
method: "DELETE",
body: { services: serviceIds } as unknown as BodyInit,
});
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to remove service from group"));
return false;
}
return true;
} catch {
return false
}
};
/**
* 添加服务到资源组
*/
export const addServiceToGroup = async (
groupId: string,
services: string[]
): Promise<boolean> => {
try {
const response = await fetchAdminAPI<boolean>(`/api/resource_group/service?id=${groupId}`, {
method: "PUT",
body: { services: services } as unknown as BodyInit,
});
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to add service to group"));
return false;
}
return true;
} catch {
return false
}
};
+2 -2
View File
@@ -4,8 +4,8 @@ import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
import { AboutThemeSelector } from "@/components/theme/AboutThemeSelector";
export async function generateMetadata(): Promise<Metadata> {
const title = await getDynamicTitle("About");
return createBaseMetadata(title);
const platformConfig = await getDynamicTitle("About");
return createBaseMetadata(platformConfig);
}
export default async function AboutPage() {
+17 -10
View File
@@ -1,13 +1,20 @@
'use server';
"use server";
import { revalidatePath, revalidateTag } from 'next/cache';
import { revalidatePath, revalidateTag } from "next/cache";
import { headers } from "next/headers";
export async function revalidatePlatformConfig() {
// 重新验证根路径和所有子路径
revalidatePath('/', 'layout');
// 如果使用了标签缓存,也可以重新验证特定标签
revalidateTag('platform-config');
console.log('Platform config cache revalidated');
}
// Get current host for host-specific cache invalidation
const headersList = await headers();
const host = headersList.get("host") || "default";
// Revalidate root path and all sub-paths
revalidatePath("/", "layout");
// Revalidate host-specific cache tag
revalidateTag(`platform-config-${host}`, 'max');
console.info(
`Platform config cache revalidated for host: platform-config-${host}`
);
}
@@ -6,7 +6,6 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { useTranslation } from "@/shared/lib/useTranslation";
import { useAdminLogin } from "@/hooks/useAdminLogin";
import toast from "react-hot-toast";
const adminLoginSchema = z.object({
username: z.string().min(1, "Username is required"),
@@ -62,4 +61,4 @@ export const AdminLoginForm = () => {
</Button>
</form>
);
};
};
+13
View File
@@ -0,0 +1,13 @@
import React from "react";
import type { Metadata } from "next";
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
import ConsoleMain from "@/components/console/Main";
export async function generateMetadata(): Promise<Metadata> {
const platformConfig = await getDynamicTitle("Console");
return createBaseMetadata(platformConfig);
}
export default function AdminConsolePage() {
return <ConsoleMain />;
}
+5 -3
View File
@@ -15,8 +15,10 @@ const AdminLoginHeader = () => {
return (
<div className="flex flex-col items-center pb-6">
<DynamicLogo alt="Platform Logo" className="h-[40px]" />
<p className="text-xl font-medium mt-4">{t("Admin Portal")}</p>
<p className="text-sm text-default-500">{t("Log in to admin console")}</p>
<p className="text-xl font-medium mt-4">{t("Welcome")}</p>
<p className="text-sm text-default-500">
{t("Log in to your admin account to continue")}
</p>
</div>
);
};
@@ -28,7 +30,7 @@ const AdminLoginPageContent = () => {
const handleCheckLogin = async () => {
const res = await getAdminUser();
if (res.success) {
router.push("/console");
router.push("/admin/console");
}
};
@@ -0,0 +1,7 @@
"use client";
import React from "react";
import { SubmissionsManagement } from "@/components/console/SubmissionsManagement";
export default function AdminSubmissionsPage() {
return <SubmissionsManagement />;
}
+5 -7
View File
@@ -1,15 +1,13 @@
import React from "react";
import type { Metadata } from "next";
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
import ConsoleMain from "@/components/console/Main";
import DashboardMain from "@/components/dashboard/Main";
export async function generateMetadata(): Promise<Metadata> {
const title = await getDynamicTitle("Console");
return createBaseMetadata(title);
const platformConfig = await getDynamicTitle("Dashboard");
return createBaseMetadata(platformConfig);
}
export default function HomePage() {
return (
<ConsoleMain />
);
export default function ConsolePage() {
return <DashboardMain />;
}
-15
View File
@@ -1,15 +0,0 @@
import React from "react";
import type { Metadata } from "next";
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
import DashboardMain from "@/components/dashboard/Main";
export async function generateMetadata(): Promise<Metadata> {
const title = await getDynamicTitle("Dashboard");
return createBaseMetadata(title);
}
export default function HomePage() {
return (
<DashboardMain />
);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 11 KiB

+14 -2
View File
@@ -1,9 +1,14 @@
/* Import theme styles */
@import "../styles/themes.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Import theme styles */
@import '../styles/themes.css';
input::placeholder,
textarea::placeholder {
--nextui-foreground-500: 240 5.03% 64.9%;
}
html,
body {
@@ -84,3 +89,10 @@ body {
background-size: 16px 16px; /* 每个格子的尺寸 */
background-repeat: repeat;
}
.wmde-markdown ul,
.wmde-markdown ol {
list-style-type: revert;
}
.wmde-markdown {
background-color: inherit !important;
}
+17 -5
View File
@@ -2,7 +2,11 @@ import type { Metadata } from "next";
import { Red_Hat_Display } from "next/font/google";
import ClientRootProviders from "@/shared/components/ClientRootProviders";
import "./globals.css";
import { getCachedPlatformConfig, getDynamicTitle, createBaseMetadata } from "@/shared/utils/metadata";
import {
getCachedPlatformConfig,
getDynamicTitle,
createBaseMetadata,
} from "@/shared/utils/metadata";
const redHatDisplay = Red_Hat_Display({
subsets: ["latin"],
@@ -11,8 +15,8 @@ const redHatDisplay = Red_Hat_Display({
});
export async function generateMetadata(): Promise<Metadata> {
const title = await getDynamicTitle();
return createBaseMetadata(title);
const platformConfig = await getDynamicTitle();
return createBaseMetadata(platformConfig);
}
export default async function RootLayout({
@@ -23,17 +27,25 @@ export default async function RootLayout({
const platformConfig = await getCachedPlatformConfig();
return (
<html lang="en" suppressHydrationWarning>
<html lang="zh-CN" suppressHydrationWarning data-color-mode="light">
<head>
<script
dangerouslySetInnerHTML={{
__html: `
window.localStorage.setItem("i18nextLng", "${platformConfig?.platform?.language || "en"}");
window.localStorage.setItem("i18nextLng", "${platformConfig?.platform?.language || "zh-CN"}");
`,
}}
/>
</head>
<body className={redHatDisplay.className} suppressHydrationWarning>
{platformConfig?.embeded_html?.is_enabled &&
platformConfig?.embeded_html?.html && (
<div
dangerouslySetInnerHTML={{
__html: platformConfig.embeded_html.html,
}}
/>
)}
<ClientRootProviders initConfig={platformConfig}>
{children}
</ClientRootProviders>
+12 -14
View File
@@ -2,7 +2,7 @@
import React, { useEffect, Suspense } from "react";
import { Spinner, Button } from "@nextui-org/react";
import { useLogin } from "@/hooks/useLogin";
import { useLogin } from "@/shared/hooks/useLogin";
import { useRouter, useSearchParams } from "next/navigation";
import { Icon } from "@iconify/react/dist/iconify.js";
import { useTranslation } from "@/shared/lib/useTranslation";
@@ -22,7 +22,7 @@ function LoginSuccessContent() {
const backHome = () => {
const dynamicParams = new URLSearchParams(searchParams?.get("state") || "");
router.push(`/login?${dynamicParams.toString()}`);
router.push(`/?${dynamicParams.toString()}`);
};
return (
@@ -31,22 +31,14 @@ function LoginSuccessContent() {
<Spinner size="lg" color="default" />
) : status === "success" ? (
<>
<Icon
fontSize={70}
className="text-success"
icon="mi:circle-check"
/>
<Icon fontSize={70} className="text-success" icon="mi:circle-check" />
<div className="text-xl font-bold text-success">
{t("Login Success")}
</div>
</>
) : (
<>
<Icon
fontSize={70}
className="text-danger"
icon="mi:circle-error"
/>
<Icon fontSize={70} className="text-danger" icon="mi:circle-error" />
<div className="text-xl font-bold text-danger">
{t("Login Error")}
</div>
@@ -59,8 +51,14 @@ function LoginSuccessContent() {
export default function LoginSuccessPage() {
return (
<Suspense fallback={<div className="flex justify-center mt-40"><Spinner size="lg" color="default" /></div>}>
<Suspense
fallback={
<div className="flex justify-center mt-40">
<Spinner size="lg" color="default" />
</div>
}
>
<LoginSuccessContent />
</Suspense>
);
}
}
+4 -4
View File
@@ -6,8 +6,8 @@ import type { ServiceData } from "@/shared/types/marketplace";
import { ThemeSelector } from "@/components/theme/ThemeSelector";
export async function generateMetadata(): Promise<Metadata> {
const title = await getDynamicTitle();
return createBaseMetadata(title);
const platformConfig = await getDynamicTitle();
return createBaseMetadata(platformConfig);
}
export default async function HomePage({
@@ -36,8 +36,8 @@ export default async function HomePage({
services = response?.data?.services || [];
total = response?.page?.total || 0;
} catch (err) {
console.error("Error fetching services:", err);
error = "Failed to load services";
console.error("Error fetching servers:", err);
error = "Failed to load servers";
}
return (
@@ -5,8 +5,6 @@ import type { Metadata } from "next";
import { createBaseMetadata, getDynamicTitle } from "@/shared/utils/metadata";
import { fetchServiceById } from "@/services/marketplaceService";
import type { ServiceData } from "@/shared/types/marketplace";
import { Footer } from "@/shared/components/Footer";
import { Navigation } from "@/shared/components/Navigation";
interface ProductPageProps {
params: Promise<{ id: string }>;
@@ -32,20 +30,15 @@ export async function generateMetadata({
// use cached function to get data to generate metadata
const product = await getProductById(id);
const productName = product?.name || "Unknown";
if (product) {
const title = await getDynamicTitle(product.name);
return {
...createBaseMetadata(title),
description:
product.short_description ||
`Discover ${product.name} and its powerful tools`,
};
}
// default metadata if product not found
const defaultTitle = await getDynamicTitle("Marketplace");
return createBaseMetadata(defaultTitle);
const platformConfig = await getDynamicTitle(productName);
return {
...createBaseMetadata(platformConfig),
description:
product?.short_description ||
`Discover ${productName} and its powerful tools`,
};
}
export default async function ProductPage({ params }: ProductPageProps) {
@@ -6,8 +6,21 @@ import { Icon } from "@iconify/react/dist/iconify.js";
interface LoginButtonProps {
title: string;
icon?: string;
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger";
variant?: "solid" | "bordered" | "light" | "flat" | "faded" | "shadow" | "ghost";
color?:
| "default"
| "primary"
| "secondary"
| "success"
| "warning"
| "danger";
variant?:
| "solid"
| "bordered"
| "light"
| "flat"
| "faded"
| "shadow"
| "ghost";
onClick?: () => void;
}
@@ -29,4 +42,4 @@ export const LoginButton = ({
{title}
</Button>
);
};
};
@@ -6,12 +6,13 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { StepState } from "../page";
import { useTranslation } from "@/shared/lib/useTranslation";
import i18n from "@/shared/lib/i18n";
const emailSchema = z.object({
email: z
.string()
.email({ message: "Invalid email address" })
.min(1, { message: "Email is required" }),
.email({ message: i18n.t("Invalid email address") })
.min(1, { message: i18n.t("Email is required") }),
});
type EmailFormData = z.infer<typeof emailSchema>;
@@ -30,7 +31,7 @@ export const LoginEmailFrom = ({ setEmail, setStep }: LoginEmailFromProps) => {
formState: { errors, isSubmitting, isValid },
} = useForm<EmailFormData>({
resolver: zodResolver(emailSchema),
mode: "all",
mode: "onBlur",
});
const onSubmit = async (data: EmailFormData) => {
@@ -61,7 +62,9 @@ export const LoginEmailFrom = ({ setEmail, setStep }: LoginEmailFromProps) => {
type="submit"
color="primary"
isLoading={isSubmitting}
className="w-full"
size="lg"
className="w-full font-semibold bg-default-900"
isDisabled={!isValid}
>
{t("Continue")}
</Button>
@@ -7,15 +7,16 @@ import { z } from "zod";
import { useState } from "react";
import { Eye, EyeOff } from "lucide-react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { useLogin } from "@/hooks/useLogin";
import { useLogin } from "@/shared/hooks/useLogin";
import { md5Encrypt } from "@/shared/utils/crypto";
import i18n from "@/shared/lib/i18n";
const emailPasswordSchema = z.object({
email: z
.string()
.email({ message: "Invalid email address" })
.min(1, { message: "Email is required" }),
password: z.string().min(6, "Password must be at least 6 characters"),
.email({ message: i18n.t("Invalid email address") })
.min(1, { message: i18n.t("Email is required") }),
password: z.string().min(6, i18n.t("Password must be at least 6 characters")),
});
type EmailPasswordFormData = z.infer<typeof emailPasswordSchema>;
@@ -37,7 +38,7 @@ export const LoginEmailPasswordForm = ({
formState: { errors, isSubmitting, isValid },
} = useForm<EmailPasswordFormData>({
resolver: zodResolver(emailPasswordSchema),
mode: "all",
mode: "onBlur",
});
const onSubmit = async (data: EmailPasswordFormData) => {
@@ -105,9 +106,11 @@ export const LoginEmailPasswordForm = ({
type="submit"
color="primary"
isLoading={isSubmitting}
className="w-full"
size="lg"
className="w-full font-semibold bg-default-900"
isDisabled={!isValid}
>
{t("Sign In")}
{t("Continue")}
</Button>
</form>
);
+88 -51
View File
@@ -1,86 +1,123 @@
"use client";
import { Divider } from "@nextui-org/react";
import { Suspense, useState } from "react";
import { useRef, useState } from "react";
import { LoginButton } from "./LoginButton";
import { useLogin } from "@/hooks/useLogin";
import { useLogin } from "@/shared/hooks/useLogin";
import { EmailVerificationForm } from "./VerifyEmail";
import { LoginEmailFrom } from "./LoginEmailFrom";
import { LoginEmailPasswordForm } from "./LoginEmailPasswordForm";
import { useTranslation } from "@/shared/lib/useTranslation";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { EmailMode } from "@/shared/types/system";
import BgCollagePattern from "@/shared/components/sign/BgCollagePattern";
import { DynamicLogo } from "@/shared/components/DynamicLogo";
export type StepState = "init" | "emailForm" | "verifyEmail";
const SignInComponent = () => {
export default function SignInComponent() {
const { t } = useTranslation();
const [email, setEmail] = useState("");
const [step, setStep] = useState<StepState>("init");
const { googleLoginOrSignUp } = useLogin();
const { loginConfig } = usePlatformConfig();
const containerRef = useRef<HTMLDivElement>(null);
// 检查是否启用了 Google 登录
const isGoogleLoginEnabled =
loginConfig?.google?.is_enabled && loginConfig?.google?.client_id;
// 检查是否启用了邮箱登录
const isEmailEnabled = loginConfig?.email?.is_enabled ?? true;
// 获取邮箱登录模式
const emailMode = loginConfig?.email?.mode ?? EmailMode.PASSWORD;
return (
<>
<div className="mt-2 flex w-full max-w-sm flex-col gap-8 rounded-large bg-content1 px-8 py-6 shadow-small backdrop-blur-sm">
{step === "verifyEmail" && <EmailVerificationForm email={email} />}
{step === "init" && isGoogleLoginEnabled && (
<LoginButton
title={t("Log in with Google")}
color="primary"
variant="solid"
icon="flat-color-icons:google"
onClick={googleLoginOrSignUp}
/>
)}
{/* OR - 只有在启用 Google 登录且有其他登录方式时才显示分隔符 */}
{isGoogleLoginEnabled && isEmailEnabled && (
<div className="flex items-center gap-4">
<Divider className="flex-1" />
<p className="shrink-0 text-tiny text-default-500">{t("OR")}</p>
<Divider className="flex-1" />
</div>
)}
{/* Login With Email */}
{step === "init" && isEmailEnabled && (
<div className="space-y-4">
{/* 邮箱/密码登录表单 */}
{emailMode === EmailMode.PASSWORD && (
<LoginEmailPasswordForm />
)}
<div
className="relative w-full min-h-screen flex items-center justify-center"
ref={containerRef}
>
{/* Background collage pattern */}
<BgCollagePattern
containerRef={containerRef}
options={{
radius: 30,
background: "#f5f5f5",
particleCount: 20000,
color: "#006fee",
colorPole: "#001aee",
}}
/>
<div className="relative z-10 w-full max-w-md">
<div className="bg-white rounded-2xl shadow-2xl p-8 backdrop-blur-lg bg-opacity-95">
<div className="mb-10">
<div className="flex gap-2 mb-4">
<DynamicLogo className="h-[32px]" hideText />
</div>
<h1 className="text-3xl font-semibold text-default-900">
{t("Sign in")} <br />
<span>{t("or create your account")}</span>
</h1>
</div>
{/* 邮箱/验证码登录表单 */}
{emailMode === EmailMode.CAPTCHA && (
<LoginEmailFrom setEmail={setEmail} setStep={setStep} />
)}
<div className="space-y-6">
{step === "verifyEmail" && (
<EmailVerificationForm email={email} />
)}
{step === "init" && isGoogleLoginEnabled && (
<LoginButton
title={t("Log in with Google")}
color="primary"
variant="solid"
icon="flat-color-icons:google"
onClick={googleLoginOrSignUp}
/>
)}
{/* OR - 只有在启用 Google 登录且有其他登录方式时才显示分隔符 */}
{isGoogleLoginEnabled && isEmailEnabled && (
<div className="flex items-center gap-4">
<Divider className="flex-1" />
<p className="shrink-0 text-tiny text-default-500">
{t("OR")}
</p>
<Divider className="flex-1" />
</div>
)}
{/* Login With Email */}
{step === "init" && isEmailEnabled && (
<div className="space-y-4">
{/* 邮箱/密码登录表单 */}
{emailMode === EmailMode.PASSWORD && (
<LoginEmailPasswordForm />
)}
{/* 邮箱/验证码登录表单 */}
{emailMode === EmailMode.CAPTCHA && (
<LoginEmailFrom setEmail={setEmail} setStep={setStep} />
)}
</div>
)}
{step !== "init" && isGoogleLoginEnabled && (
<LoginButton
title={t("Log in with Google")}
icon="flat-color-icons:google"
onClick={googleLoginOrSignUp}
/>
)}
{/* 底部提示文本 */}
{step === "init" && (
<div className="mt-6 text-center">
<p className="text-sm text-gray-600">
{t("No account? Just continue—we’ll set you up.")}
</p>
</div>
)}
</div>
</div>
)}
{step !== "init" && isGoogleLoginEnabled && (
<LoginButton
title={t("Log in with Google")}
icon="flat-color-icons:google"
onClick={googleLoginOrSignUp}
/>
)}
</div>
</div>
</>
);
};
export default function SignInWrapper() {
return (
<Suspense fallback={<></>}>
<SignInComponent />
</Suspense>
);
}
@@ -5,11 +5,11 @@ import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { useEffect, useRef, useState } from "react";
import { useLogin } from "@/hooks/useLogin";
import { useLogin } from "@/shared/hooks/useLogin";
import { useTranslation } from "@/shared/lib/useTranslation";
import toast from "react-hot-toast";
import { fetchAPI } from "@/shared/rpc/common-function";
import { getEmail } from "@/utils/getEmail";
import { getEmail } from "@/shared/utils/getEmail";
const schema = z.object({
captcha: z
+10 -26
View File
@@ -2,14 +2,11 @@
import React, { useEffect, Suspense } from "react";
import { Spinner } from "@nextui-org/react";
import { Toaster } from "react-hot-toast";
import SignInComponent from "./components/SignIn";
import { useTranslation } from "@/shared/lib/useTranslation";
import { useSearchParams } from "next/navigation";
import { useLogin } from "@/hooks/useLogin";
import { useLogin } from "@/shared/hooks/useLogin";
import { useSharedStore } from "@/shared/store/share";
import { useGlobalStore } from "@/shared/store/global";
import { DynamicLogo } from "@/shared/components/DynamicLogo";
export interface LoginFormData {
user_email: string;
@@ -17,23 +14,6 @@ export interface LoginFormData {
nick_name?: string;
}
const LoginHeader = () => {
const { t } = useTranslation();
return (
<div className="flex flex-col items-center pb-6">
<DynamicLogo
alt="Platform Logo"
className="h-[40px]"
/>
<p className="text-xl font-medium mt-4">{t("Welcome")}</p>
<p className="text-sm text-default-500">
{t("Log in to your account to continue")}
</p>
</div>
);
};
export type StepState = "init" | "emailForm" | "verifyEmail";
const LoginPageContent = () => {
@@ -58,10 +38,8 @@ const LoginPageContent = () => {
return (
<>
<div className="flex flex-col items-center justify-center w-full h-full mt-20">
<LoginHeader />
<div className="flex flex-col items-center justify-center w-full h-full">
<SignInComponent />
<Toaster />
</div>
</>
);
@@ -69,10 +47,16 @@ const LoginPageContent = () => {
const LoginPage = () => {
return (
<Suspense fallback={<div className="flex justify-center mt-40"><Spinner size="lg" color="default" /></div>}>
<Suspense
fallback={
<div className="flex justify-center">
<Spinner size="lg" color="default" />
</div>
}
>
<LoginPageContent />
</Suspense>
);
};
export default LoginPage;
export default LoginPage;
+260
View File
@@ -0,0 +1,260 @@
"use client";
import React, { useEffect, useState } from "react";
import { fetchAPI } from "@/shared/rpc/common-function";
import { useSharedStore } from "@/shared/store/share";
type SubType = "mcp";
type SubRecord = {
id: string;
type: string;
name: string;
status: string;
created_at?: string | null;
review_note?: string | null;
};
const TYPE_LABEL: Record<string, string> = {
mcp: "MCP 服务",
};
const STATUS_LABEL: Record<string, { text: string; cls: string }> = {
pending: { text: "待审核", cls: "bg-yellow-100 text-yellow-800" },
approved: { text: "已通过", cls: "bg-green-100 text-green-800" },
rejected: { text: "已拒绝", cls: "bg-red-100 text-red-700" },
};
export default function SubmitPage() {
// 网页登录态存在 zustand store(XPack_Shared),localStorage["user_token"] 只有扩展侧栏才会写,
// 用 store 判断才不会把已登录用户误判为未登录
const user_token = useSharedStore((s: any) => s.user_token);
const type: SubType = "mcp";
const [name, setName] = useState("");
const [desc, setDesc] = useState("");
const [file, setFile] = useState<File | null>(null);
const [baseUrl, setBaseUrl] = useState("");
const [serviceType, setServiceType] = useState("openapi");
const [tags, setTags] = useState("");
const [chargeType, setChargeType] = useState<"free" | "paid">("free");
const [price, setPrice] = useState("");
const [freeDailyLimit, setFreeDailyLimit] = useState("");
const [msg, setMsg] = useState<{ ok: boolean; text: string } | null>(null);
const [submitting, setSubmitting] = useState(false);
const [subs, setSubs] = useState<SubRecord[]>([]);
const [loggedIn, setLoggedIn] = useState<boolean | null>(null);
const loadSubs = async () => {
if (typeof window === "undefined") return;
try {
const d = await fetchAPI<{ success: boolean; data?: SubRecord[] }>(
"/api/submission/submissions",
{ method: "GET" }
);
if (d?.success && Array.isArray(d.data)) {
setLoggedIn(true);
setSubs(d.data);
return;
}
} catch {
/* 网络异常按未登录处理,不影响提交表单 */
}
setLoggedIn(false);
setSubs([]);
};
useEffect(() => {
loadSubs();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
setMsg(null);
if (typeof window !== "undefined" && !user_token) {
setMsg({ ok: false, text: "请先登录后再提交(右上角登录)" });
return;
}
if (type === "mcp" && !baseUrl.trim()) {
setMsg({ ok: false, text: "MCP 服务必须填写服务地址 base_url" });
return;
}
setSubmitting(true);
try {
const fd = new FormData();
fd.append("type", type);
fd.append("name", name);
if (desc) fd.append("description", desc);
if (file) fd.append("file", file);
if (type === "mcp") {
fd.append("base_url", baseUrl.trim());
fd.append("service_type", serviceType);
if (tags.trim()) fd.append("tags", tags.trim());
fd.append("charge_type", chargeType);
if (chargeType === "paid" && price) fd.append("price", price);
if (chargeType === "free" && freeDailyLimit) fd.append("free_daily_limit", freeDailyLimit);
}
const data = await fetchAPI<{ success: boolean; error_message?: string; data?: { id: string; status: string } }>(
"/api/submission/submission",
{ method: "POST", body: fd }
);
if (data?.success) {
setMsg({ ok: true, text: "提交成功,等待管理员审核。审核通过后将自动上架到市场。" });
setName(""); setDesc(""); setFile(null); setBaseUrl(""); setTags("");
loadSubs();
} else {
setMsg({ ok: false, text: data?.error_message || "提交失败,请稍后重试" });
}
} catch (err) {
setMsg({ ok: false, text: "提交失败:" + (err as Error).message });
} finally {
setSubmitting(false);
}
};
const inputCls = "border p-2 w-full rounded";
return (
<div className="max-w-xl mx-auto p-6">
<div className="flex items-center justify-between mb-4">
<h1 className="text-2xl font-bold">上传 MCP 服务</h1>
</div>
<form onSubmit={handleSubmit} className="space-y-4">
<input value={name} onChange={(e) => setName(e.target.value)} placeholder="名称" className={inputCls} required />
<textarea value={desc} onChange={(e) => setDesc(e.target.value)} placeholder="描述" className={inputCls} rows={3} />
{type === "mcp" && (
<div className="space-y-3 border rounded p-3 bg-gray-50">
<div>
<label className="block text-sm font-medium mb-1">服务地址 base_url *</label>
<input
value={baseUrl}
onChange={(e) => setBaseUrl(e.target.value)}
placeholder="http://192.168.1.10:8020"
className={inputCls}
required
/>
</div>
<div>
<label className="block text-sm font-medium mb-1">服务类型</label>
<select value={serviceType} onChange={(e) => setServiceType(e.target.value)} className={inputCls}>
<option value="openapi">openapi(HTTP 接口)</option>
</select>
</div>
<div>
<label className="block text-sm font-medium mb-1">标签(逗号分隔)</label>
<input value={tags} onChange={(e) => setTags(e.target.value)} placeholder="工具, 搜索, 免费" className={inputCls} />
</div>
<div>
<label className="block text-sm font-medium mb-1">计费方式</label>
<select
value={chargeType}
onChange={(e) => setChargeType(e.target.value as "free" | "paid")}
className={inputCls}
>
<option value="free">免费</option>
<option value="paid">按次付费</option>
</select>
</div>
{chargeType === "paid" ? (
<div>
<label className="block text-sm font-medium mb-1">单价(元/次)</label>
<input
type="number" step="0.01" min="0"
value={price}
onChange={(e) => setPrice(e.target.value)}
placeholder="0.10"
className={inputCls}
/>
</div>
) : (
<div>
<label className="block text-sm font-medium mb-1">每日免费次数(留空 = 不限)</label>
<input
type="number" min="1"
value={freeDailyLimit}
onChange={(e) => setFreeDailyLimit(e.target.value)}
placeholder="100"
className={inputCls}
/>
</div>
)}
<div>
<label className="block text-sm font-medium mb-1">
OpenAPI 规范文件(.json,用于自动生成工具列表)
</label>
<input type="file" onChange={(e) => setFile(e.target.files?.[0] || null)} className={inputCls} />
<p className="text-xs text-gray-500 mt-1">
上传后审核通过会自动生成工具;不上传则上架后需在服务管理里手动添加工具。
</p>
</div>
</div>
)}
<button
type="submit"
disabled={submitting}
className="bg-blue-600 text-white px-4 py-2 rounded disabled:opacity-50"
>
{submitting ? "提交中..." : "提交"}
</button>
</form>
{msg && (
<pre className={`mt-4 text-sm whitespace-pre-wrap ${msg.ok ? "text-green-700" : "text-red-600"}`}>
{msg.text}
</pre>
)}
{loggedIn === false && (
<p className="mt-6 text-sm text-gray-500">
登录后可提交服务并查看审核状态。
</p>
)}
{loggedIn && (
<div className="mt-8 border rounded p-4 bg-white">
<h2 className="text-lg font-semibold mb-3">我的提交记录</h2>
{subs.length === 0 ? (
<p className="text-sm text-gray-500">还没有提交记录</p>
) : (
<ul className="space-y-2">
{subs.map((s) => {
const st = STATUS_LABEL[s.status] || {
text: s.status,
cls: "bg-gray-100 text-gray-600",
};
return (
<li key={s.id} className="border rounded p-3 text-sm">
<div className="flex items-center justify-between gap-2">
<span className="font-medium truncate">{s.name}</span>
<span
className={`px-2 py-0.5 rounded text-xs whitespace-nowrap ${st.cls}`}
>
{st.text}
</span>
</div>
<div className="text-xs text-gray-500 mt-1 flex flex-wrap gap-x-4">
<span>{TYPE_LABEL[s.type] || s.type}</span>
{s.created_at && (
<span>{new Date(s.created_at).toLocaleString("zh-CN")}</span>
)}
</div>
{s.review_note && (
<div className="text-xs text-orange-600 mt-1">
审核备注:{s.review_note}
</div>
)}
</li>
);
})}
</ul>
)}
</div>
)}
</div>
);
}
+10 -10
View File
@@ -1,7 +1,7 @@
"use client";
import React from "react";
import ReactMarkdown from "react-markdown";
import MarkdownPreview from "@uiw/react-markdown-preview";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { Card, CardBody } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
@@ -14,26 +14,26 @@ export const AboutContent: React.FC = () => {
<Card shadow="none" className="bg-transparent">
<CardBody className="space-y-4">
<h1 className="text-3xl font-bold mb-6">{t("About Us")}</h1>
<div className="leading-relaxed prose prose-sm max-w-none">
<div className="leading-relaxed max-w-none">
{platformConfig.about_page ? (
<ReactMarkdown>{platformConfig.about_page}</ReactMarkdown>
<MarkdownPreview source={platformConfig.about_page} />
) : (
<ReactMarkdown>
{`
${t("**XPack** is a lightweight, open-source marketplace framework for MCP (Model Context Protocol) services.")}
${t("It allows you to transform any OpenAPI into a monetizable MCP service and build your own API store in just minutes.")}
<MarkdownPreview
source={`
${t("**XPack** is a lightweight, open-source marketplace framework for MCP (Model Context Protocol) servers.")}
${t("It allows you to transform any OpenAPI into a monetizable MCP server and build your own API store in just minutes.")}
${t("✨ With XPack, you can:")}
${t("- ✅ **One-click OpenAPI → MCP service config**")}
${t("- 🧾 **SEO-friendly homepage + mcp service page**")}
${t("- ✅ **One-click OpenAPI → MCP server config**")}
${t("- 🧾 **SEO-friendly homepage + mcp server page**")}
${t("- 💳 **Built-in billing (per-call)**")}
${t("- 👥 **User account management**")}
${t("- 🛠 **Support Stripe Payment**")}
${t("- 🔐 **Support Email & Google OAuth Sign in**")}
${t("Everything is open-source and licensed under **Apache 2.0** — ready for commercial use.")}`}
</ReactMarkdown>
/>
)}
</div>
</CardBody>
@@ -48,8 +48,8 @@ export const ChangePasswordModal: React.FC<ChangePasswordModalProps> = ({
return;
}
if (newPassword.length < 8) {
toast.error(t("Password must be at least 8 characters long"));
if (newPassword.length < 6) {
toast.error(t("Password must be at least 6 characters long"));
return;
}
@@ -73,7 +73,7 @@ export const ChangePasswordModal: React.FC<ChangePasswordModalProps> = ({
newPassword.trim() !== "" &&
confirmPassword.trim() !== "" &&
newPassword === confirmPassword &&
newPassword.length >= 8;
newPassword.length >= 6;
return (
<Modal isOpen={isOpen} onClose={handleClose} size="md">
@@ -90,7 +90,7 @@ export const ChangePasswordModal: React.FC<ChangePasswordModalProps> = ({
type={showNewPassword ? "text" : "password"}
value={newPassword}
onChange={(e) => setNewPassword(e.target.value)}
description={t("Password must be at least 8 characters long")}
description={t("Password must be at least 6 characters long")}
endContent={
<button
type="button"
@@ -0,0 +1,113 @@
"use client";
import React, { useState, useRef } from "react";
import { Card, Spinner } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import toast from "react-hot-toast";
import { UploadIcon } from "lucide-react";
import { calculateFileSha256 } from "@/shared/utils/crypto";
interface UploadImageProps {
onSave: (file: File, sha256?: string) => Promise<string>;
imageUrl?: string;
setImageUrl: (imageUrl: string) => void;
className?: string;
description?: string;
}
const UploadImage: React.FC<UploadImageProps> = ({
onSave,
imageUrl,
setImageUrl,
className = "h-32 w-32",
description,
}) => {
const { t } = useTranslation();
const [isUploading, setIsUploading] = useState(false);
const fileInputRef = useRef<HTMLInputElement>(null);
const handleImageUpload = async (
event: React.ChangeEvent<HTMLInputElement>
) => {
const file = event.target.files?.[0];
if (!file) return;
// Validate file type
if (!file.type.startsWith("image/")) {
toast.error(t("Please select a valid image file"));
return;
}
// Validate file size (max 5MB)
if (file.size > 5 * 1024 * 1024) {
toast.error(t("Image size should be less than 5MB"));
return;
}
setIsUploading(true);
try {
const sha256 = await calculateFileSha256(file);
const imageUrl = await onSave(file, sha256);
setImageUrl(imageUrl);
} catch (error) {
console.error("Upload failed:", error);
toast.error(t("Failed to upload image"));
} finally {
setIsUploading(false);
}
};
const handleImageClick = () => {
if (!isUploading) {
fileInputRef.current?.click();
}
};
return (
<div className="space-y-2">
<Card
className={`relative group ${isUploading ? "cursor-not-allowed" : "cursor-pointer"} ${className} `}
style={{
backgroundSize: "contain",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
}}
onPress={handleImageClick}
isPressable={!isUploading}
shadow="none"
>
{imageUrl && (
<img
src={imageUrl}
alt="Uploaded"
className="w-full h-full object-contain"
/>
)}
<div
className={`absolute top-0 rounded-large right-0 bg-default-100 w-full h-full flex items-center justify-center transition-opacity duration-300 ${
imageUrl && !isUploading ? "opacity-0" : "opacity-100"
} group-hover:opacity-50 backdrop-blur-sm`}
></div>
<div
className={`absolute w-full h-full flex flex-col gap-2 items-center justify-center ${
imageUrl && !isUploading ? "opacity-0" : "opacity-100"
} group-hover:opacity-100`}
>
<span>
{isUploading ? <Spinner size="lg" /> : <UploadIcon size={48} />}
</span>
<span className="text-sm text-default-500">{description}</span>
</div>
</Card>
<input
ref={fileInputRef}
type="file"
accept="image/*"
onChange={handleImageUpload}
className="hidden"
/>
</div>
);
};
export default UploadImage;
@@ -0,0 +1,138 @@
"use client";
import React, { useState } from "react";
import { Input, Button } from "@nextui-org/react";
import { Eye, EyeOff } from "lucide-react";
import { AdminConfig } from "@/types/system";
import { z } from "zod";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useTranslation } from "@/shared/lib/useTranslation";
const formSchema = z.object({
password: z
.string()
.min(1, "Password is required")
.max(100, "Password is too long")
.min(6, "Password must be at least 6 characters"),
confirmPassword: z
.string()
.min(1, "Confirm password is required")
.max(100, "Confirm password is too long")
.min(6, "Confirm password must be at least 6 characters"),
});
type FormData = z.infer<typeof formSchema>;
interface AdminConfigFormProps {
onSave: (config: AdminConfig) => Promise<boolean>;
}
export const AdminConfigForm: React.FC<AdminConfigFormProps> = ({ onSave }) => {
const { t } = useTranslation();
const {
handleSubmit,
control,
watch,
formState: { errors, isSubmitting, isValid },
} = useForm<FormData>({
resolver: zodResolver(formSchema),
mode: "onBlur",
});
const [showPassword, setShowPassword] = useState(false);
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
const onSubmit = async (data: FormData) => {
await onSave({
password: data.password,
} as AdminConfig);
};
const passwordsMatch = watch("password") === watch("confirmPassword");
return (
<form
onSubmit={handleSubmit(onSubmit)}
className="flex flex-col gap-4 pb-4"
>
<Controller
name="password"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("Administrator Password")}
placeholder={t("Enter administrator password")}
description={t("Password must be at least 6 characters long")}
isInvalid={!!errors.password}
errorMessage={errors.password?.message}
type={showPassword ? "text" : "password"}
endContent={
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
className="focus:outline-none"
>
{showPassword ? (
<EyeOff className="w-4 h-4 text-gray-400" />
) : (
<Eye className="w-4 h-4 text-gray-400" />
)}
</button>
}
isRequired
autoComplete="new-password"
labelPlacement="outside"
/>
)}
/>
<Controller
name="confirmPassword"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("Confirm Password")}
placeholder={t("Confirm administrator password")}
description={t("Re-enter the password to confirm")}
isInvalid={
!!errors.confirmPassword ||
(!passwordsMatch && (field.value?.length || 0) > 0)
}
errorMessage={
errors.confirmPassword?.message || t("Passwords do not match")
}
type={showConfirmPassword ? "text" : "password"}
endContent={
<button
type="button"
onClick={() => setShowConfirmPassword(!showConfirmPassword)}
className="focus:outline-none"
>
{showConfirmPassword ? (
<EyeOff className="w-4 h-4 text-gray-400" />
) : (
<Eye className="w-4 h-4 text-gray-400" />
)}
</button>
}
autoComplete="new-password"
isRequired
labelPlacement="outside"
/>
)}
/>
<div className="flex mt-2">
<Button
type="submit"
color="primary"
isLoading={isSubmitting}
isDisabled={!isValid}
className="w-fit"
size="sm"
>
{t("Save")}
</Button>
</div>
</form>
);
};
@@ -1,5 +0,0 @@
.xpack-console-stats-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
max-width: 100%;
}
+423 -83
View File
@@ -1,105 +1,445 @@
"use client";
import React, { useState, useEffect } from "react";
import { overviewService } from "@/services/overviewService";
import { PlatformOverviewData } from "@/types/dashboard";
import "./ConsoleStats.css"
import { Alert, Card, CardBody, CardFooter } from "@nextui-org/react";
import React, { useMemo, useState, useEffect } from "react";
import {
Card,
CardBody,
CardHeader,
Tabs,
Tab,
Listbox,
ListboxItem,
Skeleton,
DateRangePicker
} from "@nextui-org/react";
import { parseDate } from "@internationalized/date";
import { useTranslation } from "@/shared/lib/useTranslation";
import { ChartBarIcon, DollarSignIcon, ServerIcon, UserIcon } from "lucide-react";
import {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
} from "recharts";
import {
getAdminAnalytics,
AdminAnalyticsData,
TopServiceItem,
} from "@/api/adminAnalytics.api";
import toast from "react-hot-toast";
interface StatCardProps {
title: string;
value: string | number;
icon: React.ReactNode;
description?: string;
// Chart data interface to match existing chart component
interface ChartDataItem {
date: string;
users: number;
revenue: number;
calls: number;
}
const StatCard: React.FC<StatCardProps> = ({ title, value, icon, description }) => {
const { t } = useTranslation();
return (
<Card shadow="none" className="border-1">
<CardBody>
<div className="flex items-center justify-between">
<div className="flex-1">
<p className="text-sm font-medium text-gray-600 mb-1">{t(title)}</p>
<p className="text-2xl font-bold text-gray-900">{value}</p>
</div>
<div className="ml-4 text-blue-500">
{icon}
</div>
</div>
</CardBody>
<CardFooter>
{description && (
<p className="text-xs text-gray-500 mt-1">{t(description)}</p>
)}
</CardFooter>
</Card>
// Transform API data to chart format
const transformToChartData = (
analytics: AdminAnalyticsData
): ChartDataItem[] => {
// Get the maximum length of days arrays to handle potential mismatches
const maxLength = Math.max(
analytics.user_register.days.length,
analytics.user_pay.days.length,
analytics.mcp_call.days.length
);
const chartData: ChartDataItem[] = [];
for (let i = 0; i < maxLength; i++) {
// Format date for display (converting from YYYY-MM-DD to MMM DD)
const userRegDay = analytics.user_register.days[i];
const payDay = analytics.user_pay.days[i];
const callDay = analytics.mcp_call.days[i];
// Use the first available date, format it nicely
const rawDate =
userRegDay?.stats_day || payDay?.stats_day || callDay?.stats_day;
const formattedDate = rawDate
? new Date(rawDate).toLocaleDateString("en-US", {
month: "short",
day: "numeric",
})
: `Day ${i + 1}`;
chartData.push({
date: formattedDate,
users: userRegDay ? parseInt(userRegDay.count as string) || 0 : 0,
revenue: payDay ? payDay.count : 0,
calls: callDay ? callDay.count : 0,
});
}
return chartData;
};
// Render label + total value in tab header
const TabTitle: React.FC<{
label: string;
total: number | string;
}> = ({ label, total }) => (
<div className="flex flex-col items-start gap-2">
<div className="text-sm text-default-500">{label}</div>
<div className="text-2xl font-semibold text-default-900">
{typeof total === "number" ? total.toLocaleString() : total}
</div>
</div>
);
const ConsoleStats: React.FC = () => {
const { t } = useTranslation();
const [overviewData, setOverviewData] = useState<PlatformOverviewData | null>(null);
const fetchOverviewData = async () => {
try {
const data = await overviewService.getPlatformOverview();
setOverviewData(data);
} catch (err) {
console.error('Failed to fetch overview data:', err);
} finally {
}
};
// get platform overview data
useEffect(() => {
fetchOverviewData();
const [activeTab, setActiveTab] = useState<string>("users");
// State for API data
const [analyticsData, setAnalyticsData] = useState<AdminAnalyticsData | null>(
null
);
const [loading, setLoading] = useState(true);
// 日期范围状态 - 默认最近30天
const [dateRange, setDateRange] = useState<any>(() => {
const today = new Date();
const thirtyDaysAgo = new Date();
thirtyDaysAgo.setDate(today.getDate() - 29);
// 格式化为 YYYY-MM-DD
const formatDate = (date: Date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
};
return {
start: parseDate(formatDate(thirtyDaysAgo)),
end: parseDate(formatDate(today)),
};
});
// 计算最早可选日期(30天前)
const minValue = useMemo(() => {
const date = new Date();
date.setDate(date.getDate() - 30);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return parseDate(`${year}-${month}-${day}`);
}, []);
// 计算最大可选日期(今天)
const maxValue = useMemo(() => {
const date = new Date();
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return parseDate(`${year}-${month}-${day}`);
}, []);
// 校验:开始日期必须早于结束日期,且不能早于30天前
const dateValidation = useMemo(() => {
if (!dateRange?.start || !dateRange?.end) {
return { isInvalid: false, error: "" };
}
const start = dateRange.start;
const end = dateRange.end;
const minDate = minValue;
// 检查开始日期是否早于30天前
const isStartTooEarly =
start.year < minDate.year ||
(start.year === minDate.year && start.month < minDate.month) ||
(start.year === minDate.year && start.month === minDate.month && start.day < minDate.day);
if (isStartTooEarly) {
return {
isInvalid: true,
error: t("Start date cannot be earlier than 30 days ago")
};
}
// 检查开始日期是否晚于结束日期
const isEndBeforeStart =
start.year > end.year ||
(start.year === end.year && start.month > end.month) ||
(start.year === end.year && start.month === end.month && start.day >= end.day);
if (isEndBeforeStart) {
return {
isInvalid: true,
error: t("Start date must be before end date")
};
}
return { isInvalid: false, error: "" };
}, [dateRange, minValue, t]);
// 错误消息
const errorMessage = dateValidation.error;
const isInvalidDateRange = dateValidation.isInvalid;
// Fetch analytics data on component mount and when date range changes
useEffect(() => {
const fetchData = async () => {
if (!dateRange?.start || !dateRange?.end) return;
// 如果日期范围无效,不发送请求
if (isInvalidDateRange) {
setLoading(false);
return;
}
try {
setLoading(true);
// parseDate 返回的对象有 year, month, day 属性
const start = dateRange.start;
const end = dateRange.end;
// 转换日期为时间戳(秒)
const startDateTime = new Date(start.year, start.month - 1, start.day, 0, 0, 0);
const startTime = Math.floor(startDateTime.getTime() / 1000);
const endDateTime = new Date(end.year, end.month - 1, end.day, 23, 59, 59);
const endTime = Math.floor(endDateTime.getTime() / 1000);
const response = await getAdminAnalytics(startTime, endTime);
if (response.success) {
setAnalyticsData(response.data);
} else {
toast.error(
response.error_message || "Failed to load analytics data"
);
}
} catch {
toast.error("Failed to load analytics data");
} finally {
setLoading(false);
}
};
fetchData();
}, [dateRange, isInvalidDateRange]);
// Transform API data to chart format
const chartData = useMemo<ChartDataItem[]>(() => {
if (!analyticsData) return [];
return transformToChartData(analyticsData);
}, [analyticsData]);
// Format revenue as currency (CNY by default)
const formatCurrency = (value: number, currency: string = "CNY") =>
new Intl.NumberFormat("zh-CN", { style: "currency", currency }).format(
value
);
if (loading) {
return (
<div className="w-full flex flex-col gap-4 h-full">
<Skeleton className="rounded-lg" isLoaded={!loading}>
<div className="h-24 rounded-lg bg-secondary" />
</Skeleton>
<div className="flex flex-col gap-3">
<Skeleton className="w-3/5 rounded-lg" isLoaded={!loading}>
<div className="h-3 w-full rounded-lg bg-secondary" />
</Skeleton>
<Skeleton className="w-4/5 rounded-lg" isLoaded={!loading}>
<div className="h-3 w-full rounded-lg bg-secondary-300" />
</Skeleton>
<Skeleton className="w-2/5 rounded-lg" isLoaded={!loading}>
<div className="h-3 w-full rounded-lg bg-secondary-200" />
</Skeleton>
</div>
</div>
);
}
return (
<div className="space-y-6">
{/* stat card grid */}
<div className="xpack-console-stats-grid gap-4">
<StatCard
title="Total Users"
value={overviewData?.total_user.toLocaleString() || 0}
icon={
<UserIcon size={32} />
}
description="Platform registered users"
/>
<StatCard
title="Total Revenue"
value={overviewData?.total_balance.toLocaleString() || 0}
icon={
<DollarSignIcon size={32} />
}
description="Platform total fund pool"
/>
<StatCard
title="Today's API Calls"
value={overviewData?.invoke_count.today.toLocaleString() || 0}
icon={
<ChartBarIcon size={32} />
}
description="API call count"
/>
{/* 日期范围选择器 */}
<div className="flex justify-end">
<DateRangePicker
label={t("Select Date Range")}
value={dateRange}
onChange={setDateRange}
minValue={minValue}
maxValue={maxValue}
isInvalid={isInvalidDateRange}
errorMessage={errorMessage}
onKeyDown={(e) => e.preventDefault()}
onKeyUp={(e) => e.preventDefault()}
className="w-[250px]"
visibleMonths={2}
granularity="day"
/>
</div>
<StatCard
title="Total MCP Services"
value={overviewData?.total_service.toLocaleString() || 0}
icon={
<ServerIcon size={32} />
}
description="Deployed services"
/>
</div>
{/* Charts with Tabs */}
<Card shadow="none" className="border-1">
<CardHeader className="p-0 flex items-center justify-between">
<Tabs
selectedKey={activeTab}
onSelectionChange={(key) => setActiveTab(key as string)}
variant="underlined"
color="primary"
classNames={{
base: "w-full",
tab: "h-fit justify-start border-b-1 p-4",
cursor: "w-[90%]",
tabList: "w-full gap-0 p-0",
}}
>
<Tab
key="users"
title={
<TabTitle
label={t("Daily Registered Users")}
total={analyticsData?.user_register.today || 0}
/>
}
/>
<Tab
key="revenue"
title={
<TabTitle
label={t("Daily Revenue")}
total={formatCurrency(analyticsData?.user_pay.today || 0)}
/>
}
/>
<Tab
key="calls"
title={
<TabTitle
label={t("Daily API Calls")}
total={analyticsData?.mcp_call.today || 0}
/>
}
/>
</Tabs>
</CardHeader>
<CardBody>
<div className="w-full h-[300px]">
<ResponsiveContainer width="100%" height="100%">
<LineChart data={chartData}>
<CartesianGrid strokeDasharray="3 3" vertical={false} />
<XAxis dataKey="date" />
<YAxis />
<Tooltip
labelStyle={{ color: "#374151" }}
contentStyle={{
backgroundColor: "#f9fafb",
border: "1px solid #e5e7eb",
borderRadius: "8px",
padding: "12px",
}}
/>
{activeTab === "users" && (
<Line
type="monotone"
dataKey="users"
stroke="#3b82f6"
strokeWidth={2}
dot={false}
activeDot={{ fill: "#3b82f6", strokeWidth: 2, r: 4 }}
/>
)}
{activeTab === "revenue" && (
<Line
type="monotone"
dataKey="revenue"
stroke="#10b981"
strokeWidth={2}
dot={false}
activeDot={{ fill: "#10b981", strokeWidth: 2, r: 4 }}
/>
)}
{activeTab === "calls" && (
<Line
type="monotone"
dataKey="calls"
stroke="#f59e0b"
strokeWidth={2}
dot={false}
activeDot={{ fill: "#f59e0b", strokeWidth: 2, r: 4 }}
/>
)}
</LineChart>
</ResponsiveContainer>
</div>
</CardBody>
</Card>
{/* welcome guide */}
<Alert color="primary" title={t("Welcome to XPack.AI Open Source")} description={t("This is your AI service management center. You can quickly view platform core data on the left and manage and configure your MCP services, users, payment channels, etc.")}></Alert>
{/* Top Servers List */}
<Card shadow="none" className="border-1">
<CardHeader className="pb-0 flex items-center justify-between">
<h4 className="text-lg font-semibold text-gray-900">
{t("Top Servers by Calls")}
</h4>
</CardHeader>
<CardBody>
<div>
{analyticsData?.top_services?.length ? (
<Listbox
aria-label="top servers"
selectionMode="none"
className="overflow-visible p-0"
classNames={{ list: "overflow-visible space-y-3" }}
>
{(analyticsData.top_services || []).map(
(service: TopServiceItem, index: number) => (
<ListboxItem
key={service.id}
className="p-3 bg-gray-50 data-[hover=true]:bg-gray-100 cursor-default"
classNames={{
title: "w-full",
}}
>
<div className="flex items-center justify-between w-full gap-3">
<div className="flex items-center justify-center min-w-8 w-8 h-8 bg-blue-100 text-blue-600 rounded-full text-sm font-semibold">
{index + 1}
</div>
<div className="flex flex-col items-start flex-1 overflow-hidden">
<div className="flex gap-1 w-full">
<span className="text-danger-500">
{service.is_deleted ? t("(Deleted)") : ""}
</span>
<span className="truncate w-full flex-1">
{service.name}
</span>
</div>
<span className="text-xs text-gray-500 truncate w-full">
{service.short_description}
</span>
</div>
<div className="text-right">
<div className="text-lg font-semibold text-gray-900">
{service.call_count.toLocaleString()}
</div>
<div className="text-xs text-gray-500">
{t("Calls")}
</div>
</div>
</div>
</ListboxItem>
)
)}
</Listbox>
) : (
<div className="text-center py-8 text-gray-500">
{t("No servers available")}
</div>
)}
</div>
</CardBody>
</Card>
</div>
);
};
export default ConsoleStats;
export default ConsoleStats;
@@ -1,42 +1,38 @@
"use client";
import React from "react";
import React, { useState } from "react";
import { EmailConfigForm } from "@/components/login-setting/EmailConfigForm";
import { GoogleAuthConfigForm } from "@/components/login-setting/GoogleAuthConfigForm";
import { useSystemConfigManagement } from "@/hooks/useSystemConfigManagement";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { LoginConfig, GoogleAuthConfig } from "@/shared/types/system";
import { TabKey } from "@/shared/types/dashboard";
import { useTranslation } from "@/shared/lib/useTranslation";
import { toast } from "react-hot-toast";
import { EmailConfig } from "@/types/system";
interface LoginSettingsContentProps {
onTabNavigate?: (tab: TabKey) => void;
loginConfig: LoginConfig;
saveLoginConfig: (config: LoginConfig) => Promise<boolean>;
emailConfig: EmailConfig;
type?: "email" | "google";
}
export const LoginSettingsContent: React.FC<LoginSettingsContentProps> = ({
onTabNavigate,
loginConfig,
saveLoginConfig,
emailConfig,
type = "email",
}) => {
const [googleSubmitLoading, setGoogleSubmitLoading] = useState(false);
const [emailSubmitLoading, setEmailSubmitLoading] = useState(false);
const { t } = useTranslation();
const { updateClientConfig } = usePlatformConfig();
const {
// login config
loginConfig,
loginLoading,
saveLoginConfig,
// email config
emailConfig,
// platform config
platformConfig,
} = useSystemConfigManagement();
// 验证至少有一种登录方式启用
// check if at least one login method is enabled
const validateLoginMethods = (config: LoginConfig): boolean => {
const isGoogleEnabled =
config.google?.is_enabled && config.google?.client_id;
const isGoogleEnabled = config.google?.is_enabled;
const isEmailEnabled = config.email?.is_enabled;
const enabledCount = [isGoogleEnabled, isEmailEnabled].filter(
@@ -57,12 +53,13 @@ export const LoginSettingsContent: React.FC<LoginSettingsContentProps> = ({
return;
}
setEmailSubmitLoading(true);
const result = await saveLoginConfig(config);
if (!result) return;
updateClientConfig({
platform: platformConfig,
login: config,
});
setEmailSubmitLoading(false);
};
// save google auth config
@@ -76,31 +73,36 @@ export const LoginSettingsContent: React.FC<LoginSettingsContentProps> = ({
return;
}
setGoogleSubmitLoading(true);
const result = await saveLoginConfig(updatedLoginConfig);
if (!result) return;
updateClientConfig({
platform: platformConfig,
login: updatedLoginConfig,
});
setGoogleSubmitLoading(false);
};
return (
<div className="space-y-6 w-full">
<div className="space-y-4 w-full">
{/* email config */}
<EmailConfigForm
config={loginConfig}
emailConfig={emailConfig}
onSave={handleSaveLoginConfig}
isLoading={loginLoading}
onTabNavigate={onTabNavigate}
/>
{type === "email" && (
<EmailConfigForm
config={loginConfig}
emailConfig={emailConfig}
onSave={handleSaveLoginConfig}
isLoading={emailSubmitLoading}
onTabNavigate={onTabNavigate}
/>
)}
{/* google auth config */}
<GoogleAuthConfigForm
config={loginConfig.google}
onSave={handleSaveGoogleAuthConfig}
isLoading={loginLoading}
/>
{type === "google" && (
<GoogleAuthConfigForm
config={loginConfig.google}
onSave={handleSaveGoogleAuthConfig}
isLoading={googleSubmitLoading}
/>
)}
</div>
);
};
+201 -100
View File
@@ -1,37 +1,38 @@
"use client";
import React, { useEffect, useState, Suspense } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import { useTranslation } from "react-i18next";
import { useSearchParams } from "next/navigation";
import { useTranslation } from "@/shared/lib/useTranslation";
import { useAdminStore } from "@/store/admin";
import DashboardSidebar from "@/shared/components/DashboardSidebar";
import DashboardDemoContent from "@/shared/components/DashboardDemoContent";
import ConsoleStats from "@/components/console/ConsoleStats";
import PaymentChannelsContent from "@/components/console/PaymentChannelsContent";
import SystemSettingsContent from "@/components/console/SystemSettingsContent";
import { SidebarItem, TabKey } from "@/shared/types/dashboard";
import { useAdminLogin } from "@/hooks/useAdminLogin";
import { MCPServicesManagement } from "@/components/mcp-services/MCPServicesManagement";
import UserManagement from "@/components/user-management/UserManagement";
import RevenueManagement from "@/components/revenue-management/RevenueManagement";
import ConsoleSidebar from "./Sidebar";
import { withComponentInjection } from "@/shared/hooks/useComponentInjection";
import { Boxes, DollarSign, Home, Inbox, ServerIcon, Users } from "lucide-react";
import OnboardingWelcome, { REQUIRED_TASK_KEYS } from "./OnboardingWelcome";
import ConsoleStats from "./ConsoleStats";
import SystemSettingsModal from "./SystemSettingsModal";
import SharePlatformModal from "./SharePlatformModal";
import {
Cog,
CreditCard,
DollarSign,
Home,
Settings,
Users,
LogIn,
} from "lucide-react";
import { LoginSettingsContent } from "@/components/console/LoginSettingsContent";
import { Button } from "@nextui-org/react";
import { FaDiscord } from "react-icons/fa";
OnboardingTaskKey,
TaskItem,
TaskStatusEnum,
updateAdminOnboardingTasks,
} from "@/api/onboard.api";
import ResourceGroupManagement from "../resource-group/resourceGroup";
import { SubmissionsManagement } from "./SubmissionsManagement";
const ConsoleContent: React.FC = () => {
const { t } = useTranslation();
const router = useRouter();
const searchParams = useSearchParams();
const [admin_token] = useAdminStore((state) => [state.admin_token]);
const [admin_token, getAdminUser] = useAdminStore((state) => [
state.admin_token,
state.getAdminUser,
]);
const getInitialTab = (): TabKey => {
const tabFromUrl = searchParams.get("tab") as TabKey;
@@ -41,9 +42,8 @@ const ConsoleContent: React.FC = () => {
"mcp-services",
"user-management",
"revenue-management",
"payment-channels",
"login-settings",
"system-settings",
"resource-group",
"submissions",
].includes(tabFromUrl)
) {
return tabFromUrl;
@@ -52,69 +52,75 @@ const ConsoleContent: React.FC = () => {
};
const [activeTab, setActiveTab] = useState<TabKey>(getInitialTab);
const isSkipOnboarding =
typeof window !== "undefined" &&
localStorage.getItem("admin_onboarding_skip") === "1";
const [showOnboarding, setShowOnboarding] = useState<boolean>(false);
const [completedTasks, setCompletedTasks] = useState<string[]>([]);
const [isSettingsModalOpen, setIsSettingsModalOpen] =
useState<boolean>(false);
const [isShareModalOpen, setIsShareModalOpen] = useState<boolean>(false);
const [settingModalKeyword, setSettingModalKeyword] = useState<string>("");
const sidebarItems: SidebarItem[] = [
{
key: TabKey.CONSOLE,
icon: <Home className="w-5 h-5" />,
label: t("Dashboard"),
description: t("Overview and analytics"),
icon: <Home size={18} />,
label: t("Analytics"),
description: t("Analyze platform usage and revenue"),
},
{
key: TabKey.MCP_SERVICES,
icon: <Settings className="w-5 h-5" />,
label: t("MCP Services"),
description: t("Manage MCP services and API tools"),
icon: <ServerIcon size={18} />,
label: t("MCP"),
description: t("Manage MCP servers and API tools"),
},
{
key: TabKey.SUBMISSIONS,
icon: <Inbox size={18} />,
label: t("Submissions"),
description: t("Review user submissions and publish to marketplace"),
},
{
key: TabKey.USER_MANAGEMENT,
icon: <Users className="w-5 h-5" />,
label: t("User Management"),
icon: <Users size={18} />,
label: t("User"),
description: t("Manage registered users"),
},
{
key: TabKey.RESOURCE_GROUP,
icon: <Boxes size={18} />,
label: t("Resource Group"),
description: t("Manage resource groups"),
},
{
key: TabKey.REVENUE_MANAGEMENT,
icon: <DollarSign className="w-5 h-5" />,
label: t("Revenue Management"),
icon: <DollarSign size={18} />,
label: t("Revenue"),
description: t("View user recharge history"),
},
{
key: TabKey.PAYMENT_CHANNELS,
icon: <CreditCard className="w-5 h-5" />,
label: t("Payment Channels"),
description: t("Configure payment channels"),
},
{
key: TabKey.LOGIN_SETTINGS,
icon: <LogIn className="w-5 h-5" />,
label: t("Login Settings"),
description: t("Configure authentication methods"),
},
{
key: TabKey.SYSTEM_SETTINGS,
icon: <Cog className="w-5 h-5" />,
label: t("System Settings"),
description: t("Platform basic configuration"),
},
];
// If admin is not logged in, redirect to admin login page
useEffect(() => {
if (!admin_token) {
router.push("/admin");
window.location.href =
process.env.NEXT_PUBLIC_ADMIN_LOGIN_URL || "/admin";
}
}, [admin_token, router]);
}, [admin_token]);
const handleTabNavigate = (tab: TabKey | string, _subTab?: string) => {
setActiveTab(tab as TabKey);
const handleTabNavigate = (tab: TabKey) => {
setActiveTab(tab);
// update url params
if (tab === TabKey.CONSOLE) {
// when switch to dashboard, clear all query params, only keep base path
router.push("/console", { scroll: false });
window.history.pushState({}, "", "/admin/console");
} else {
// other tabs set corresponding tab params
const params = new URLSearchParams();
params.set("tab", tab);
router.push(`/console?${params.toString()}`, { scroll: false });
window.history.pushState({}, "", `/admin/console?${params.toString()}`);
}
};
@@ -125,11 +131,105 @@ const ConsoleContent: React.FC = () => {
adminLogout();
};
const handleSettingsClick = () => {
setIsSettingsModalOpen(true);
};
const handleSettingsModalClose = () => {
setIsSettingsModalOpen(false);
setSettingModalKeyword("");
};
const initOnboarding = async () => {
const res = await getAdminUser();
if (!res.success) {
adminLogout();
return;
}
try {
const completedTasks: string[] = (res.data.onboarding_tasks || [])
.filter(
(task: TaskItem) => task.task_status === TaskStatusEnum.COMPLETED
)
.map((task: TaskItem) => task.task_id);
setCompletedTasks(completedTasks);
setShowOnboarding(completedTasks.length !== REQUIRED_TASK_KEYS.length);
} catch (e) {
// Fallback to show onboarding if localStorage not available
setShowOnboarding(false);
}
};
//todo: onboarding
// Initialize onboarding state from localStorage
useEffect(() => {
if (isSkipOnboarding) {
setShowOnboarding(false);
return;
}
initOnboarding();
}, []);
const handleSkipOnboarding = () => {
localStorage.setItem("admin_onboarding_skip", "1");
setShowOnboarding(false);
};
const markTaskAsCompleted = async (taskKey: OnboardingTaskKey) => {
// Mark task as completed
const next = Array.from(new Set([...completedTasks, taskKey]));
setCompletedTasks(next);
const result = await updateAdminOnboardingTasks({
task_id: taskKey,
task_status: TaskStatusEnum.COMPLETED,
});
if (!result) return;
if (next.length === REQUIRED_TASK_KEYS.length) {
localStorage.setItem("admin_onboarding_skip", "1");
setShowOnboarding(false);
}
};
const handleTaskClick = async (taskKey: OnboardingTaskKey) => {
switch (taskKey) {
case OnboardingTaskKey.PLATFORM_SETUP:
setIsSettingsModalOpen(true);
await markTaskAsCompleted(taskKey);
break;
case OnboardingTaskKey.MCP_SERVICES:
handleTabNavigate(TabKey.MCP_SERVICES);
await markTaskAsCompleted(taskKey);
break;
case OnboardingTaskKey.REVENUE_MANAGEMENT:
setSettingModalKeyword("Payment");
setIsSettingsModalOpen(true);
await markTaskAsCompleted(taskKey);
break;
case OnboardingTaskKey.SHARE_PLATFORM:
setIsShareModalOpen(true);
// 不在这里标记完成,等待实际分享后再标记
break;
}
};
const handleShareComplete = async () => {
await markTaskAsCompleted(OnboardingTaskKey.SHARE_PLATFORM);
};
const handleShareModalClose = () => {
setIsShareModalOpen(false);
};
// render different content based on activeTab
const renderContent = () => {
switch (activeTab) {
case TabKey.MCP_SERVICES:
return <MCPServicesManagement />;
case TabKey.SUBMISSIONS:
return (
<div className="h-full overflow-auto">
<SubmissionsManagement />
</div>
);
case TabKey.USER_MANAGEMENT:
return (
<div className="h-full overflow-auto">
@@ -142,38 +242,30 @@ const ConsoleContent: React.FC = () => {
<RevenueManagement />
</div>
);
case TabKey.PAYMENT_CHANNELS:
case TabKey.RESOURCE_GROUP:
return (
<DashboardDemoContent
title={t("Payment Channels")}
description={t("Configure payment channels")}
>
<PaymentChannelsContent />
</DashboardDemoContent>
);
case "login-settings":
return (
<DashboardDemoContent
title={t("Login Settings")}
description={t("Configure authentication methods")}
>
<LoginSettingsContent onTabNavigate={handleTabNavigate} />
</DashboardDemoContent>
);
case "system-settings":
return (
<DashboardDemoContent
title={t("System Settings")}
description={t("Platform basic configuration")}
>
<SystemSettingsContent />
</DashboardDemoContent>
<div className="h-full overflow-auto">
<ResourceGroupManagement />
</div>
);
default:
return (
return showOnboarding ? (
<OnboardingWelcome
onSkipOnboarding={handleSkipOnboarding}
onTaskClick={handleTaskClick}
completedTasks={completedTasks}
/>
) : (
<DashboardDemoContent
title={t("Admin Dashboard")}
description={t("Platform management and analytics")}
title={
<div className="flex items-center gap-2">
<span>{t("Analytics")}</span>
<span className="text-primary text-lg font-medium">
{t("(30 days)")}
</span>
</div>
}
description={t("Analyze platform usage and revenue")}
>
<ConsoleStats />
</DashboardDemoContent>
@@ -185,30 +277,35 @@ const ConsoleContent: React.FC = () => {
<div className="min-h-screen bg-background">
<div className="flex">
{/* Sidebar */}
<DashboardSidebar
<ConsoleSidebar
activeTab={activeTab}
onTabNavigate={handleTabNavigate}
onLogout={handleLogout}
sidebarItems={sidebarItems}
bottomPanel={
<Button
variant="light"
startContent={<FaDiscord className="w-5 h-5" />}
className="w-full justify-start h-auto p-3"
onPress={() => {
window.open("https://discord.gg/cyZfcdCXkW", "_blank");
}}
>
<div className="flex justify-between items-center w-full">
<span className="font-medium">{t("Discord")}</span>
</div>
</Button>
}
onSettingsClick={handleSettingsClick}
/>
{/* Main Content */}
<div className="flex-1 h-screen overflow-y-auto">{renderContent()}</div>
</div>
{/* Settings Modal */}
{isSettingsModalOpen && (
<SystemSettingsModal
isOpen={true}
onClose={handleSettingsModalClose}
keyword={settingModalKeyword}
/>
)}
{/* Share Platform Modal */}
{isShareModalOpen && (
<SharePlatformModal
isOpen={true}
onClose={handleShareModalClose}
onShareComplete={handleShareComplete}
/>
)}
</div>
);
};
@@ -229,4 +326,8 @@ const ConsoleMain: React.FC = () => {
);
};
export default ConsoleMain;
// Export the base component for direct use
export { ConsoleMain as ConsoleMainBase };
// Export with component injection support
export default withComponentInjection("console/Main", ConsoleMain);
@@ -0,0 +1,180 @@
"use client";
import React, { useEffect, useState } from "react";
import {
CheckCircle2,
Share2,
ArrowRight,
Settings,
ServerIcon,
DollarSign,
} from "lucide-react";
import {
Button,
Card,
CardBody,
Listbox,
ListboxItem,
Link,
} from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { OnboardingTaskKey } from "@/api/onboard.api";
export const REQUIRED_TASK_KEYS = [
OnboardingTaskKey.PLATFORM_SETUP,
OnboardingTaskKey.MCP_SERVICES,
OnboardingTaskKey.REVENUE_MANAGEMENT,
OnboardingTaskKey.SHARE_PLATFORM,
];
interface OnboardingWelcomeProps {
onSkipOnboarding: () => void;
completedTasks: string[];
onTaskClick: (taskKey: OnboardingTaskKey) => void;
}
const OnboardingWelcome: React.FC<OnboardingWelcomeProps> = ({
onSkipOnboarding,
completedTasks,
onTaskClick,
}) => {
const { t } = useTranslation();
const { platformConfig } = usePlatformConfig();
const [activeTab, setActiveTab] = useState<OnboardingTaskKey | undefined>(
REQUIRED_TASK_KEYS.find((task) => !completedTasks.includes(task))
);
useEffect(() => {
setActiveTab(
REQUIRED_TASK_KEYS.find((task) => !completedTasks.includes(task))
);
}, [completedTasks]);
const tasks = [
{
key: OnboardingTaskKey.PLATFORM_SETUP,
title: t("Configure Platform Settings"),
subtitle: t("Set up your platform name, domain, and branding."),
icon: <Settings size={18} />,
},
{
key: OnboardingTaskKey.MCP_SERVICES,
title: t("Add MCP Services"),
subtitle: t("Configure and deploy your first MCP server tools."),
icon: <ServerIcon size={18} />,
},
{
key: OnboardingTaskKey.REVENUE_MANAGEMENT,
title: t("Configure Payment & Billing"),
subtitle: t("Set up payment channels and token pricing."),
icon: <DollarSign size={18} />,
},
{
key: OnboardingTaskKey.SHARE_PLATFORM,
title: t("Share Your Platform"),
subtitle: t("Invite users and promote your MCP platform."),
icon: <Share2 size={18} />,
},
];
const isTaskCompleted = (taskKey: string) => completedTasks.includes(taskKey);
return (
<div className="min-h-screen flex flex-col items-center justify-center p-6">
{/* Header */}
<div className="text-center mb-8">
<h1 className="text-2xl font-bold text-gray-900 mb-2">
{t("Welcome to {{name}}!", {
name: platformConfig.name || "your platform",
})}
</h1>
<p className="text-gray-600 text-sm">
{t("Let's set up {{name}} to get you started.", {
name: platformConfig.name || "your platform",
})}
</p>
</div>
<Card className="w-full max-w-lg border-1 overflow-visible" shadow="none">
<CardBody className="py-0 overflow-y-visible">
<Listbox
aria-label="Onboarding tasks"
className="overflow-visible"
classNames={{
list: "overflow-visible",
}}
>
{tasks.map((task, index) => (
<ListboxItem
key={task.key}
startContent={
<div
className={`flex-shrink-0 ${
!isTaskCompleted(task.key)
? "text-primary"
: "text-default-400"
}`}
>
{task.icon}
</div>
}
endContent={
isTaskCompleted(task.key) ? (
<CheckCircle2
size={18}
className="text-green-500 flex-shrink-0"
/>
) : (
<ArrowRight
size={18}
className="text-primary flex-shrink-0 group-data-[hover=true]:translate-x-1 duration-300 ease-in-out"
/>
)
}
description={activeTab === task.key ? task.subtitle : undefined}
onPress={() => {
onTaskClick(task.key);
}}
className={`py-6 gap-3 ${
!isTaskCompleted(task.key)
? "data-[hover=true]:opacity-50"
: "text-default-500 data-[hover=true]:text-default-500"
} ${activeTab === task.key ? "scale-[1.15] border-2 border-primary bg-white px-6 data-[hover=true]:opacity-100 data-[hover=true]:bg-white" : "data-[hover=true]:bg-transparent"}`}
classNames={{
title: "font-bold text-md",
}}
showDivider={
index !== tasks.length - 1 && activeTab !== task.key
}
>
{task.title}
</ListboxItem>
))}
</Listbox>
</CardBody>
</Card>
{/* Help Section */}
<div className="text-center my-6">
<p className="text-xs text-gray-500">
{t("Need help getting started? Check out our")}{" "}
<Link
href="https://discord.gg/cyZfcdCXkW"
size="sm"
className="font-medium"
target="_blank"
>
{t("Discord Community")}
</Link>
.
</p>
</div>
{/* Skip Button */}
<div className="text-center">
<Button onPress={onSkipOnboarding} size="sm" variant="bordered">
{t("Skip setup guide")}
</Button>
</div>
</div>
);
};
export default OnboardingWelcome;
@@ -1,46 +1,76 @@
'use client';
"use client";
import React from 'react';
import { StripeConfigForm } from './StripeConfigForm';
import { useTranslation } from "@/shared/lib/useTranslation";
import React from "react";
import { StripeConfigForm } from "../payment/StripeConfigForm";
import { AlipayConfigForm } from "../payment/AlipayConfigForm";
import { WechatConfigForm } from "../payment/WechatConfigForm";
import { EpayConfigForm } from "../payment/EpayConfigForm";
import { usePaymentChannelManagement } from "@/hooks/usePaymentChannelManagement";
import { StripeConfig } from "@/types/payment";
import { toast } from "react-hot-toast";
export const PaymentChannelsContent: React.FC = () => {
const { t } = useTranslation();
interface PaymentChannelsContentProps {
labelPlacement?: "outside" | "inside";
}
export const PaymentChannelsContent: React.FC<PaymentChannelsContentProps> = ({
labelPlacement = "inside",
}) => {
const {
stripeConfig,
isSaving,
alipayConfig,
wechatConfig,
epayConfig,
isWechatSaving,
isStripeSaving,
isAlipaySaving,
isEpaySaving,
saveStripeConfig,
testStripeConnection,
saveAlipayConfig,
saveWechatConfig,
saveEpayConfig,
enableChannel,
disableChannel,
} = usePaymentChannelManagement();
// test stripe connection
const handleTestStripeConnection = async (config: StripeConfig) => {
const result = await testStripeConnection(config);
if (result.success) {
toast.success(t("Stripe connection test successful"));
} else {
toast.error(result.message || t("Stripe connection test failed"));
}
};
return (
<div className="space-y-6 w-full">
{/* stripe configuration */}
<StripeConfigForm
config={stripeConfig}
onSave={saveStripeConfig}
onTest={handleTestStripeConnection}
isLoading={isSaving}
isTestLoading={false}
onEnable={enableChannel}
onDisable={disableChannel}
isLoading={isStripeSaving}
labelPlacement={labelPlacement}
/>
{/* epay (易支付) configuration */}
<EpayConfigForm
config={epayConfig}
onSave={saveEpayConfig}
onEnable={enableChannel}
onDisable={disableChannel}
isLoading={isEpaySaving}
labelPlacement={labelPlacement}
/>
{/* coming soon */}
{/* alipay configuration */}
{/* <AlipayConfigForm
config={alipayConfig}
onSave={saveAlipayConfig}
onEnable={enableChannel}
onDisable={disableChannel}
isLoading={isAlipaySaving}
/> */}
{/* coming soon */}
{/* wechat configuration */}
{/* <WechatConfigForm
config={wechatConfig}
onSave={saveWechatConfig}
onEnable={enableChannel}
onDisable={disableChannel}
isLoading={isWechatSaving}
/> */}
</div>
);
};
export default PaymentChannelsContent;
export default PaymentChannelsContent;
@@ -0,0 +1,165 @@
"use client";
import React from "react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { Link as LinkIcon } from "lucide-react";
import {
Modal,
ModalContent,
ModalBody,
Button,
Image,
} from "@nextui-org/react";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { FaFacebook } from "react-icons/fa";
import { FaLinkedin } from "react-icons/fa6";
import { FaXTwitter } from "react-icons/fa6";
import { copyToClipboard } from "@/shared/utils/clipboard";
import toast from "react-hot-toast";
interface SharePlatformModalProps {
isOpen: boolean;
onClose: () => void;
onShareComplete: () => void;
}
const SharePlatformModal: React.FC<SharePlatformModalProps> = ({
isOpen,
onClose,
onShareComplete,
}) => {
const { t } = useTranslation();
const { platformConfig } = usePlatformConfig();
const handleCopyLink = async () => {
try {
const res = await copyToClipboard(window.location.origin);
onShareComplete();
if (res.success) {
toast.success(t("Copied to clipboard"));
}
} catch (err) {
console.error("Failed to copy link:", err);
}
};
const handleSocialShare = (platform: "x" | "facebook" | "linkedin") => {
const text = t(
`Just launched my first MCP Platform:{{name}} with xpack.ai 🚀
Built in minutes, no coding, ready for AI Agents 🤖
👉Go and try my MCP: {{link}}
#MCP #AI #APIs #XPack #AIagents #DevTools`,
{
name: platformConfig.name,
link: window.location.origin,
}
);
let url = "";
const shareUrl = encodeURIComponent(window.location.origin);
switch (platform) {
case "x":
url = `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${shareUrl}`;
break;
case "facebook":
url = `https://www.facebook.com/sharer/sharer.php?u=${shareUrl}`;
break;
case "linkedin":
url = `https://www.linkedin.com/sharing/share-offsite/?url=${shareUrl}`;
break;
}
if (url) {
window.open(url, "_blank", "width=600,height=400");
onShareComplete();
}
};
return (
<Modal isOpen={isOpen} onClose={onClose} size="xl">
<ModalContent>
<ModalBody>
{/* Header */}
<div className="my-6 flex flex-col gap-2 ">
<h2 className="text-2xl font-extrabold text-primary md:text-4xl">
{t("Your MCP Market is ready.")}
</h2>
<p className="text-2xl font-bold text-gray-900">
{t("Share your MCP to the world")}
</p>
</div>
{/* Preview Card */}
<div className="mb-6 rounded-xl border border-gray-200 bg-white p-6">
<div className="space-y-2">
<h3 className="text-xl font-semibold text-gray-900">
{platformConfig.website_title || platformConfig.name}
</h3>
<p className="text-gray-700">{platformConfig.meta_description}</p>
</div>
<div className="mt-4 flex items-center gap-2 text-sm text-gray-800">
{platformConfig.logo && (
<Image
src={platformConfig.logo}
alt={platformConfig.name}
width={20}
height={20}
/>
)}
<span className="font-semibold">{platformConfig.name}</span>
<span>•</span>
<span className="text-gray-600">{window.location.hostname}</span>
</div>
</div>
{/* Actions */}
<div className="flex flex-col items-stretch gap-4 sm:flex-row sm:items-center sm:justify-between mb-4">
{/* Social buttons */}
<div className="flex items-center gap-2">
<Button
onPress={() => handleSocialShare("x")}
title={t("Share on X")}
isIconOnly
size="lg"
variant="flat"
>
<FaXTwitter size={20} />
</Button>
<Button
onPress={() => handleSocialShare("facebook")}
title={t("Share on Facebook")}
isIconOnly
size="lg"
variant="flat"
>
<FaFacebook size={20} className="text-primary" />
</Button>
<Button
onPress={() => handleSocialShare("linkedin")}
title={t("Share on LinkedIn")}
isIconOnly
size="lg"
variant="flat"
>
<FaLinkedin size={20} className="text-blue-500" />
</Button>
</div>
{/* Copy link button */}
<Button
onPress={handleCopyLink}
size="lg"
color="primary"
className="gap-1 w-full bg-default-900"
>
<LinkIcon size={20} />
<span className="text-base font-semibold">{t("Copy link")}</span>
</Button>
</div>
</ModalBody>
</ModalContent>
</Modal>
);
};
export default SharePlatformModal;
+114
View File
@@ -0,0 +1,114 @@
"use client";
import React from "react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { Button, Divider, Tooltip } from "@nextui-org/react";
import { ExternalLinkIcon, LogOut, Settings } from "lucide-react";
import { DashboardSidebarProps } from "@/shared/types/dashboard";
import { DynamicLogo } from "@/shared/components/DynamicLogo";
import { FaDiscord } from "react-icons/fa";
import Link from "next/link";
interface ConsoleSidebarProps extends DashboardSidebarProps {
onSettingsClick?: () => void;
}
const ConsoleSidebar: React.FC<ConsoleSidebarProps> = ({
activeTab,
onTabNavigate,
onLogout,
sidebarItems,
onSettingsClick,
}) => {
const { t } = useTranslation();
// Filter out system settings from sidebar items
const filteredSidebarItems = sidebarItems.filter(
(item) => item.key !== "system-settings"
);
return (
<>
<div className="flex h-screen">
{/* Main Sidebar */}
<div className="py-2 px-4 w-[300px] overflow-hidden border-r border-divider flex flex-col justify-between bg-default-50">
{/* Header */}
<div className="mb-6 mt-4 flex gap-2 justify-between items-center">
<Link href="/" prefetch target="_blank">
<DynamicLogo
alt="Platform Logo"
className="max-w-full h-[32px] object-contain"
/>
</Link>
<Tooltip content={t("Open in new tab")} closeDelay={0} disableAnimation>
<Link
href="/"
prefetch
target="_blank"
className="hover:text-primary"
>
<ExternalLinkIcon size={18} />
</Link>
</Tooltip>
</div>
{/* Navigation */}
<div className="flex flex-col gap-2 flex-1">
{filteredSidebarItems.map((item) => (
<Button
key={item.key}
variant={activeTab === item.key ? "flat" : "light"}
color={activeTab === item.key ? "primary" : "default"}
startContent={item.icon}
className="w-full h-auto p-4 justify-start"
onPress={() => onTabNavigate?.(item.key)}
>
{t(item.label)}
</Button>
))}
</div>
<div>
<Divider className="my-2" />
<div className="space-y-2">
<Button
variant="light"
startContent={<FaDiscord size={18} />}
className="w-full h-auto p-4 justify-start"
onPress={() => {
window.open("https://discord.gg/cyZfcdCXkW", "_blank");
}}
>
{t("Discord")}
</Button>
{/* Settings */}
<Button
variant="light"
startContent={<Settings size={18} />}
className="w-full h-auto p-4 justify-start"
onPress={onSettingsClick}
>
{t("Settings")}
</Button>
{/* Logout */}
<Button
variant="light"
color="danger"
startContent={<LogOut size={18} />}
className="w-full h-auto p-4 justify-start"
onPress={onLogout}
>
{t("Log Out")}
</Button>
</div>
</div>
</div>
</div>
</>
);
};
export default ConsoleSidebar;
@@ -1,121 +0,0 @@
'use client';
import React, { useEffect, useState } from 'react';
import { Input, Button, AccordionItem, Accordion } from '@nextui-org/react';
import { Eye, EyeOff } from 'lucide-react';
import { StripeConfig } from '@/types/payment';
import { useTranslation } from "@/shared/lib/useTranslation";
interface StripeConfigFormProps {
config: StripeConfig;
onSave: (config: StripeConfig) => void;
onTest: (config: StripeConfig) => void;
isLoading?: boolean;
isTestLoading?: boolean;
}
export const StripeConfigForm: React.FC<StripeConfigFormProps> = ({
config,
onSave,
isLoading = false,
}) => {
const { t } = useTranslation();
const [formData, setFormData] = useState<StripeConfig>(config);
const [showSecretKey, setShowSecretKey] = useState(false);
const [showWebhookSecret, setShowWebhookSecret] = useState(false);
useEffect(() => {
console.log("config", config);
setFormData(config);
}, [config]);
const handleInputChange = (field: keyof StripeConfig, value: string) => {
setFormData(prev => ({
...prev,
[field]: value
}));
};
const handleSave = () => {
onSave(formData);
};
const isFormValid = formData.secret.trim() !== '' && formData.webhook_secret.trim() !== '';
return (
<Accordion variant='splitted' itemClasses={{
base: 'shadow-none border-1',
}} defaultExpandedKeys={['stripe-config']} className='px-0'>
<AccordionItem key="stripe-config" title={
<div className="flex flex-col justify-between">
<h3 className="text-lg font-semibold">{t('Stripe Configuration')}</h3>
<p className="text-sm text-gray-500">{t('Configure Stripe payment interface')}</p>
</div>
} >
<div className="space-y-4">
{/* Secret Key */}
<Input
label={t('Secret Key')}
placeholder="sk_test_... or sk_live_..."
description={t('Stripe secret key for server-side API calls')}
value={formData.secret}
onChange={(e) => handleInputChange('secret', e.target.value)}
type={showSecretKey ? "text" : "password"}
endContent={
<button
type="button"
onClick={() => setShowSecretKey(!showSecretKey)}
className="focus:outline-none"
>
{showSecretKey ? (
<EyeOff className="w-4 h-4 text-gray-400" />
) : (
<Eye className="w-4 h-4 text-gray-400" />
)}
</button>
}
isRequired
/>
{/* Webhook Secret (Optional) */}
<Input
label={t('Webhook Secret')}
placeholder="whsec_..."
description={t('Webhook signing secret for verifying Stripe events')}
value={formData.webhook_secret || ''}
onChange={(e) => handleInputChange('webhook_secret', e.target.value)}
type={showWebhookSecret ? "text" : "password"}
isRequired
endContent={
<button
type="button"
onClick={() => setShowWebhookSecret(!showWebhookSecret)}
className="focus:outline-none"
>
{showWebhookSecret ? (
<EyeOff className="w-4 h-4 text-gray-400" />
) : (
<Eye className="w-4 h-4 text-gray-400" />
)}
</button>
}
/>
</div>
{/* Action Buttons */}
<div className="flex gap-3 py-4">
<Button
color="primary"
variant="solid"
onPress={handleSave}
isLoading={isLoading}
isDisabled={!isFormValid}
size='sm'
>
{t('Save')}
</Button>
</div>
</AccordionItem>
</Accordion>
);
};
@@ -0,0 +1,173 @@
"use client";
import React, { useEffect, useState } from "react";
import { fetchAdminAPI } from "@/rpc/admin-api";
interface Metadata {
base_url?: string;
service_type?: string;
tags?: string;
charge_type?: string;
price?: number;
free_daily_limit?: number | null;
published_service_id?: string;
}
interface Submission {
id: string;
user_id: string;
type: string;
name: string;
description?: string;
file_path?: string;
metadata_json?: Metadata | null;
status: string;
created_at?: string;
review_note?: string;
}
const statusColor: Record<string, string> = {
pending: "bg-yellow-100 text-yellow-800",
approved: "bg-green-100 text-green-800",
rejected: "bg-red-100 text-red-800",
};
export function SubmissionsManagement() {
const [subs, setSubs] = useState<Submission[]>([]);
const [filter, setFilter] = useState<string>("");
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");
const [rejectNote, setRejectNote] = useState<Record<string, string>>({});
const load = async () => {
setLoading(true);
setError("");
try {
const qs = filter ? `?status=${filter}` : "";
// fetchAdminAPI<T> already returns the { success, error_message, data } envelope
const response = await fetchAdminAPI<Submission[]>(
`/api/submission/admin/submissions${qs}`
);
if (response?.success === false) {
setError(response.error_message || "加载失败");
setSubs([]);
} else if (response?.data) {
setSubs(response.data);
} else {
setSubs([]);
}
} catch (err) {
setError("加载失败:" + (err as Error).message);
setSubs([]);
} finally {
setLoading(false);
}
};
useEffect(() => { load(); }, [filter]);
const act = async (id: string, action: "approve" | "reject") => {
const body: RequestInit =
action === "approve"
? { method: "PUT" }
: {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ note: rejectNote[id] || "" }),
};
await fetchAdminAPI(`/api/submission/admin/submission/${id}/${action}`, body);
load();
};
return (
<div className="max-w-6xl mx-auto p-6">
<div className="flex items-center justify-between mb-4">
<h1 className="text-2xl font-bold">投稿审核</h1>
<select value={filter} onChange={(e) => setFilter(e.target.value)} className="border p-2">
<option value="">全部</option>
<option value="pending">待审核</option>
<option value="approved">已通过</option>
<option value="rejected">已拒绝</option>
</select>
</div>
{error && <div className="mb-4 p-3 bg-red-50 text-red-700 rounded">{error}</div>}
{loading && <div className="mb-4 text-gray-500">加载中...</div>}
{!loading && !error && subs.length === 0 && (
<div className="mb-4 text-gray-500">暂无提交记录</div>
)}
<div className="space-y-4">
{subs.map((s) => {
const meta = s.metadata_json || {};
return (
<div key={s.id} className="border rounded p-4 space-y-2">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<span className="font-semibold">{s.name}</span>
<span className="px-2 py-0.5 rounded text-xs">{s.type}</span>
<span className={`px-2 py-0.5 rounded text-xs ${statusColor[s.status] || "bg-gray-100"}`}>{s.status}</span>
</div>
<span className="text-sm text-gray-500">{s.created_at?.slice(0, 19).replace("T", " ")}</span>
</div>
{s.description && <p className="text-sm text-gray-700">{s.description}</p>}
{s.type === "mcp" && (meta.base_url || meta.tags || meta.charge_type) && (
<div className="text-sm text-gray-600 bg-gray-50 rounded p-2 space-y-1">
{meta.base_url && <div>服务地址:<code className="text-xs">{meta.base_url}</code></div>}
{meta.tags && <div>标签:{meta.tags}</div>}
<div>
计费:
{meta.charge_type === "paid"
? `按次付费 ¥${meta.price ?? 0}/次`
: `免费${meta.free_daily_limit ? `(每日 ${meta.free_daily_limit} 次)` : "(不限次)"}`}
</div>
{meta.published_service_id && (
<div className="text-green-700">
已上架市场,服务 ID:<code className="text-xs">{meta.published_service_id}</code>
</div>
)}
</div>
)}
{s.file_path && (
<div className="text-sm text-gray-500">
附件:<code className="text-xs">{s.file_path}</code>
</div>
)}
{s.review_note && (
<div className="text-sm text-gray-600">审核备注:{s.review_note}</div>
)}
{s.status === "pending" ? (
<div className="space-y-2">
<input
value={rejectNote[s.id] || ""}
onChange={(e) => setRejectNote({ ...rejectNote, [s.id]: e.target.value })}
placeholder="拒绝原因(可选)"
className="border p-2 w-full text-sm"
/>
<div className="flex gap-2">
<button
onClick={() => act(s.id, "approve")}
className="bg-green-600 text-white px-3 py-1 rounded text-sm"
>
通过(自动上架)
</button>
<button
onClick={() => act(s.id, "reject")}
className="bg-red-600 text-white px-3 py-1 rounded text-sm"
>
拒绝
</button>
</div>
</div>
) : null}
</div>
);
})}
</div>
</div>
);
}
@@ -1,110 +0,0 @@
"use client";
import React, { useState } from "react";
import { PlatformConfigForm } from "@/components/system-setting/PlatformConfigForm";
import { AdminConfigForm } from "@/components/system-setting/AdminConfigForm";
import { EmailConfigForm } from "@/components/system-setting/EmailConfigForm";
import { useSystemConfigManagement } from "@/hooks/useSystemConfigManagement";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { Theme } from "@/shared/types/system";
import i18n from "@/shared/lib/i18n";
export const SystemSettingsContent: React.FC = () => {
const { updateClientConfig } = usePlatformConfig();
const [isAboutLoading, setIsAboutLoading] = useState(false);
const {
// platform config
platformConfig,
platformLoading,
savePlatformConfig,
// admin config
adminConfig,
adminLoading,
saveAdminConfig,
// email config
emailConfig,
emailLoading,
saveEmailConfig,
// image upload
uploadImage,
} = useSystemConfigManagement();
// save admin config
const handleSaveAdminConfig = async (config: typeof adminConfig) => {
await saveAdminConfig(config);
};
// save email config
const handleSaveEmailConfig = async (config: typeof emailConfig) => {
await saveEmailConfig(config);
};
// save platform config
const handleSavePlatformConfig = async (config: typeof platformConfig) => {
const result = await savePlatformConfig(config);
if (!result) return;
updateClientConfig({
platform: config,
});
if (config.language !== i18n.language) {
i18n.changeLanguage(config.language);
}
};
// handle theme change
const handleThemeChange = async (theme: Theme) => {
const updatedConfig = { ...platformConfig, theme };
const result = await savePlatformConfig(updatedConfig, "theme");
if (!result) return;
updateClientConfig({
platform: updatedConfig,
});
};
// handle about save
const handleAboutSave = async (aboutContent: string) => {
setIsAboutLoading(true);
const updatedConfig = { ...platformConfig, about_page: aboutContent };
const result = await savePlatformConfig(updatedConfig, "about");
setIsAboutLoading(false);
if (!result) return;
updateClientConfig({
platform: updatedConfig,
});
};
return (
<div className="space-y-6 w-full">
{/* platform config */}
<PlatformConfigForm
config={platformConfig}
onSave={handleSavePlatformConfig}
onThemeChange={handleThemeChange}
onAboutSave={handleAboutSave}
isLoading={platformLoading}
isAboutLoading={isAboutLoading}
onImageUpload={uploadImage}
/>
{/* admin config */}
<AdminConfigForm
config={adminConfig}
onSave={handleSaveAdminConfig}
isLoading={adminLoading}
/>
{/* email config */}
<EmailConfigForm
config={emailConfig}
onSave={handleSaveEmailConfig}
isLoading={emailLoading}
/>
</div>
);
};
export default SystemSettingsContent;
@@ -0,0 +1,481 @@
"use client";
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import {
Modal,
ModalContent,
ModalBody,
ModalHeader,
Button,
} from "@nextui-org/react";
import { useSystemConfigManagement } from "@/hooks/useSystemConfigManagement";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
import { Theme } from "@/shared/types/system";
import SystemSettingsSidebar, {
SettingsGroup,
SettingsMenuItem,
} from "./SystemSettingsSidebar";
import {
AppWindow,
Captions,
Code,
CreditCard,
Gauge,
GhostIcon,
GlobeIcon,
LockIcon,
Mail,
Package,
Palette,
SquareMenu,
TableOfContents,
Tags,
Trello,
XIcon,
} from "lucide-react";
import SystemSettingsRightContent from "./SystemSettingsRightContent";
import { SettingModalTab } from "./console.type";
import { useHomepageConfigManagement } from "@/hooks/useHomepageConfigManagement";
import { FcGoogle } from "react-icons/fc";
import { useTranslation } from "@/shared/lib/useTranslation";
interface SystemSettingsModalProps {
isOpen: boolean;
onClose: () => void;
keyword?: string;
}
const SystemSettingsModal: React.FC<SystemSettingsModalProps> = ({
isOpen,
onClose,
keyword,
}) => {
// Left menu active state
const [activeSubTab, setActiveSubTab] = useState<SettingModalTab>(
SettingModalTab.BRANDING
);
const { t } = useTranslation();
// Search state (pure frontend)
const [searchQuery, setSearchQuery] = useState<string>(keyword || "");
// Scroll container and section refs
const rightContentRef = useRef<HTMLDivElement | null>(null);
const sectionRefs = useRef<Record<string, HTMLElement | null>>({});
const titleRefs = useRef<Record<string, HTMLElement | null>>({});
const scrollingByClickRef = useRef(false);
const activeKeyRef = useRef<SettingModalTab>(SettingModalTab.BRANDING);
useEffect(() => {
activeKeyRef.current = activeSubTab;
}, [activeSubTab]);
// Load and manage config once here to avoid duplicate network calls
const { updateClientConfig } = usePlatformConfig();
const {
// platform config
platformConfig,
savePlatformConfig,
// image upload
uploadImage,
// login config
loginConfig,
saveLoginConfig,
// email config
emailConfig,
saveEmailConfig,
emailLoading,
} = useSystemConfigManagement();
const {
homepageConfig,
saveNavigationConfig,
saveEmbeddedHtmlConfig,
saveFaqConfig,
} = useHomepageConfigManagement();
const handleSavePlatformConfig = async (config: { [key: string]: any }) => {
const newConfig = { ...platformConfig, ...config };
const result = await savePlatformConfig(newConfig);
if (!result) return false;
updateClientConfig({ platform: newConfig });
return result;
};
const handleThemeChange = async (theme: Theme) => {
const updatedConfig = { ...platformConfig, theme };
const result = await savePlatformConfig(updatedConfig, "theme");
if (!result) return;
updateClientConfig({ platform: updatedConfig });
};
const settingsMenuItems: SettingsMenuItem[] = [
// General settings
{
key: SettingModalTab.BRANDING,
label: "Branding",
icon: <Trello size={16} />,
description: "Logo, colors, and brand identity",
},
{
key: SettingModalTab.TITLE_DESCRIPTION,
label: "Title & description",
icon: <Captions size={16} />,
description: "Configure your site title and description",
},
{
key: SettingModalTab.META_DATA,
label: "Meta data",
icon: <AppWindow size={16} />,
description: "Extra content for search engines and social accounts",
},
{
key: SettingModalTab.CUSTOM_DOMAIN,
label: "Domain",
icon: <GhostIcon size={16} />,
description: "Configure your custom domain settings",
},
{
key: SettingModalTab.PLATFORM_LANGUAGE,
label: "Platform Language",
icon: <GlobeIcon size={16} />,
description: "Configure platform language",
},
// Site
{
key: SettingModalTab.THEME,
label: "Theme",
icon: <Palette size={16} />,
description: "Visual theme and appearance settings",
},
{
key: SettingModalTab.NAVIGATION,
label: "Navigation",
icon: <SquareMenu size={16} />,
description: "Configure site navigation and menus",
},
{
key: SettingModalTab.TAGS_BAR,
label: "Tags Bar",
icon: <Tags size={16} />,
description: "Configure tags bar display",
},
{
key: SettingModalTab.FAQ,
label: "FAQ",
icon: <TableOfContents size={16} />,
description: "Configure FAQ",
},
// Business
{
key: SettingModalTab.PAYMENT,
label: "Payment",
icon: <CreditCard size={16} />,
description: "Configure payment channels",
},
{
key: SettingModalTab.FREE_QUOTA,
label: "Free Call Limits",
icon: <Gauge size={16} />,
description: "Global daily call cap for free services",
},
{
key: SettingModalTab.XPACK_EXPLORE,
label: "XPack Explore",
icon: <Package size={16} />,
description: "Explore XPack features and integrations",
},
// Advanced
{
key: SettingModalTab.SMTP_SETTINGS,
label: "Email Configuration",
icon: <Mail size={16} />,
description: "Configure SMTP settings for email notifications",
},
{
key: SettingModalTab.EMAIL_LOGIN_SETTINGS,
label: "Email Login Settings",
icon: <LockIcon size={16} />,
description: "Configure email-based authentication",
},
{
key: SettingModalTab.GOOGLE_LOGIN_SETTINGS,
label: "Google Login Settings",
icon: <FcGoogle size={16} />,
description: "Configure Google OAuth integration",
},
{
key: SettingModalTab.CODE_INJECTION,
label: "Code injection",
icon: <Code size={16} />,
description: "Custom code injection and scripts",
},
// Account
{
key: SettingModalTab.CHANGE_PASSWORD,
label: "Password",
icon: <LockIcon size={16} />,
description: "Change your password",
},
];
// Hierarchical groups for the sidebar
const settingsGroups: SettingsGroup[] = useMemo(() => {
const mapByKey = Object.fromEntries(
settingsMenuItems.map((it) => [it.key, it])
);
const groupItems = (keys: SettingModalTab[]) =>
keys.map((k) => mapByKey[k]).filter(Boolean) as SettingsMenuItem[];
return [
{
key: "general-settings",
title: "General settings",
items: groupItems([
SettingModalTab.BRANDING,
SettingModalTab.TITLE_DESCRIPTION,
SettingModalTab.META_DATA,
SettingModalTab.CUSTOM_DOMAIN,
SettingModalTab.PLATFORM_LANGUAGE,
]),
},
{
key: "site",
title: "Site",
items: groupItems([
SettingModalTab.THEME,
SettingModalTab.NAVIGATION,
SettingModalTab.TAGS_BAR,
SettingModalTab.FAQ,
]),
},
{
key: "business",
title: "Business",
items: groupItems([
SettingModalTab.PAYMENT,
SettingModalTab.FREE_QUOTA,
SettingModalTab.XPACK_EXPLORE,
]),
},
{
key: "advanced",
title: "Advanced",
items: groupItems([
SettingModalTab.SMTP_SETTINGS,
SettingModalTab.EMAIL_LOGIN_SETTINGS,
SettingModalTab.GOOGLE_LOGIN_SETTINGS,
SettingModalTab.CODE_INJECTION,
]),
},
{
key: "account",
title: "Account",
items: groupItems([SettingModalTab.CHANGE_PASSWORD]),
},
];
}, []);
// Filter keys by search (pure frontend)
const filteredKeys = useMemo(() => {
const q = searchQuery.trim().toLowerCase();
if (!q) return settingsMenuItems.map((it) => it.key);
return settingsMenuItems
.filter(
(it) =>
t(it.label).toLowerCase().includes(q) ||
t(it.description || "")
?.toLowerCase()
.includes(q)
)
.map((it) => it.key);
}, [searchQuery]);
// Optimized scroll to section function
const scrollToSection = useCallback((key: SettingModalTab) => {
const container = rightContentRef.current;
const el = titleRefs.current[key];
if (!container || !el) return;
// Prevent multiple rapid calls
if (scrollingByClickRef.current) return;
const containerRect = container.getBoundingClientRect();
const elRect = el.getBoundingClientRect();
// scroll so that the title is aligned near the top of the container viewport
const TOP_OFFSET = 16; // small padding
const offset =
elRect.top - containerRect.top + container.scrollTop - TOP_OFFSET;
scrollingByClickRef.current = true;
setActiveSubTab(key);
// Use CSS-based scroll with better performance
const prevBehavior = container.style.scrollBehavior;
container.style.scrollBehavior = "smooth";
container.scrollTo({ top: Math.max(0, offset) });
// Reset scroll behavior and stop suppressing after animation completes
window.setTimeout(() => {
if (container) {
container.style.scrollBehavior = prevBehavior || "auto";
}
scrollingByClickRef.current = false;
}, 400);
}, []);
// Scroll-based scrollspy using rAF to avoid IO jitter
useEffect(() => {
const container = rightContentRef.current;
if (!container || !isOpen) return;
let ticking = false;
const computeActive = () => {
if (!container) return;
const keys = filteredKeys;
const rect = container.getBoundingClientRect();
const containerTop = rect.top;
const TOP_OFFSET = 16;
const scrollTop = container.scrollTop;
const scrollHeight = container.scrollHeight;
const containerHeight = container.clientHeight;
// Bottom stickiness
if (scrollTop + containerHeight >= scrollHeight - 2) {
const lastKey = keys[keys.length - 1];
if (lastKey && activeKeyRef.current !== lastKey) {
setActiveSubTab(lastKey);
}
return;
}
// Determine the last section whose title top is above the top + offset
let currentKey: SettingModalTab | null = null;
for (const k of keys) {
const el = titleRefs.current[k];
if (!el) continue;
const r = el.getBoundingClientRect();
if (r.top - containerTop <= TOP_OFFSET + 1) {
currentKey = k;
} else {
break;
}
}
if (!currentKey) {
const firstKey = keys[0];
if (firstKey && activeKeyRef.current !== firstKey) {
setActiveSubTab(firstKey);
}
return;
}
if (currentKey && activeKeyRef.current !== currentKey) {
setActiveSubTab(currentKey);
}
};
const onScroll = () => {
if (scrollingByClickRef.current) return;
if (!ticking) {
ticking = true;
requestAnimationFrame(() => {
computeActive();
ticking = false;
});
}
};
// Initial compute and bind listeners
computeActive();
container.addEventListener("scroll", onScroll, { passive: true });
return () => {
container.removeEventListener("scroll", onScroll);
};
}, [isOpen, filteredKeys]);
// When searching, auto-jump to first matched section
useEffect(() => {
if (!searchQuery.trim()) return;
if (filteredKeys.length > 0) {
const firstKey = filteredKeys[0];
if (firstKey !== activeSubTab) {
scrollToSection(firstKey);
}
}
}, [searchQuery]); // Only depend on searchQuery, not filteredKeys
return (
<Modal
isOpen={isOpen}
onClose={onClose}
size="full"
classNames={{
base: "h-screen !max-w-none !w-screen p-0",
body: "flex-1 overflow-hidden",
}}
isDismissable={false}
hideCloseButton={true}
>
<ModalContent>
<ModalHeader className="flex justify-between border-b border-default">
<h2 className="text-2xl font-bold">{t("System Settings")}</h2>
<Button onPress={onClose} isIconOnly size="sm" variant="light">
<XIcon size={24} className="text-gray-500" />
</Button>
</ModalHeader>
<ModalBody className="p-0">
<div className="flex h-full">
{/* Left Navigation */}
<SystemSettingsSidebar
activeKey={activeSubTab}
onSelect={scrollToSection}
searchQuery={searchQuery}
onSearchChange={setSearchQuery}
groups={settingsGroups}
filteredKeys={filteredKeys}
/>
{/* Right Content: stacked sections with anchors */}
<div className="flex-1">
<SystemSettingsRightContent
filteredKeys={filteredKeys}
settingsMenuItems={settingsMenuItems}
platformConfig={platformConfig}
homepageConfig={homepageConfig}
onSaveEmbeddedHtml={saveEmbeddedHtmlConfig}
sectionRefs={sectionRefs}
titleRefs={titleRefs}
onSavePlatformConfig={handleSavePlatformConfig}
handleThemeChange={handleThemeChange}
uploadImage={uploadImage}
scrollContainerRef={rightContentRef}
saveNavigationConfig={saveNavigationConfig}
saveFaqConfig={saveFaqConfig}
saveLoginConfig={saveLoginConfig}
emailConfig={emailConfig}
loginConfig={loginConfig}
onSaveEmailConfig={saveEmailConfig}
emailSubmitLoading={emailLoading}
/>
</div>
</div>
</ModalBody>
</ModalContent>
</Modal>
);
};
export default SystemSettingsModal;
@@ -0,0 +1,254 @@
"use client";
import React, { useMemo } from "react";
import { useTranslation } from "@/shared/lib/useTranslation";
import {
EmbeddedHtmlConfig,
FaqItem,
LoginConfig,
PlatformConfig,
Theme,
TopNavigationItem,
} from "@/shared/types/system";
import { SettingsMenuItem } from "./SystemSettingsSidebar";
import TitleAndDescPanel, {
TitleAndDescPanelConfig,
} from "./system-setting/TitleAndDescPanel";
import MetaDataPanel from "./system-setting/MetaDataPanel";
import BrandPanel, { BrandPanelConfig } from "./system-setting/BrandPanel";
import { ThemeSelector } from "@/components/system-setting/ThemeSelector";
import { TopNavigationSettings } from "@/components/system-setting/TopNavigationSettings";
import { EmbeddedHtmlSettings } from "@/components/system-setting/EmbeddedHtmlSettings";
import { ExplorePanel } from "./system-setting/ExplorePanel";
import DomainPanel from "./system-setting/DomainPanel";
import PaymentChannelsContent from "@/components/console/PaymentChannelsContent";
import { HomepageConfig } from "@/services/homepageConfigService";
import { FaqSettings } from "@/components/system-setting/FaqSettings";
import { AdminConfigForm } from "./AdminConfigForm";
import { systemConfigService } from "@/services/systemConfigService";
import { md5Encrypt } from "@/shared/utils/crypto";
import { AdminConfig, EmailConfig } from "@/types/system";
import { LoginSettingsContent } from "./LoginSettingsContent";
import { EmailConfigForm } from "@/components/system-setting/EmailConfigForm";
import { LanguageSetting } from "@/components/system-setting/LanguageSetting";
import { FreeQuotaSettings } from "@/components/system-setting/FreeQuotaSettings";
import { TagsBarSetting } from "../system-setting/TagsBarSetting";
interface SystemSettingsRightContentProps {
filteredKeys: string[];
settingsMenuItems: SettingsMenuItem[];
platformConfig: PlatformConfig;
homepageConfig: HomepageConfig;
sectionRefs: React.MutableRefObject<Record<string, HTMLElement | null>>;
titleRefs: React.MutableRefObject<Record<string, HTMLElement | null>>; // New: refs for section titles
onSavePlatformConfig: (config: { [key: string]: any }) => Promise<boolean>;
onSaveEmbeddedHtml: (config: EmbeddedHtmlConfig) => Promise<boolean>;
handleThemeChange: (theme: Theme) => Promise<void>;
uploadImage: any;
scrollContainerRef?: React.RefObject<HTMLDivElement>;
saveNavigationConfig: (config: TopNavigationItem[]) => Promise<boolean>;
saveFaqConfig: (config: FaqItem[]) => Promise<boolean>;
saveLoginConfig: (config: LoginConfig) => Promise<boolean>;
emailConfig: EmailConfig;
loginConfig: LoginConfig;
onSaveEmailConfig: (config: EmailConfig) => Promise<boolean>;
emailSubmitLoading: boolean;
}
const SystemSettingsRightContent: React.FC<SystemSettingsRightContentProps> = ({
filteredKeys,
settingsMenuItems,
platformConfig,
homepageConfig,
onSaveEmbeddedHtml,
sectionRefs,
titleRefs, // New prop
onSavePlatformConfig,
handleThemeChange,
uploadImage,
scrollContainerRef,
saveNavigationConfig,
saveFaqConfig,
saveLoginConfig,
emailConfig,
loginConfig,
onSaveEmailConfig,
emailSubmitLoading,
}) => {
const { t } = useTranslation();
const menuItems = useMemo(() => {
return settingsMenuItems.filter((it) => filteredKeys.includes(it.key));
}, [settingsMenuItems, filteredKeys]);
const handleChangePassword = async (config: AdminConfig) => {
const result = await systemConfigService.updateSystemConfig(
{
account: {
...config,
password: md5Encrypt(config.password),
},
},
"password"
);
return result;
};
return (
<div
ref={scrollContainerRef}
className="flex-1 overflow-y-auto h-full pb-40 space-y-6"
style={{ scrollBehavior: "auto" }}
>
<div className="h-0" aria-hidden="true"></div>
{menuItems.map((section) => (
<>
<section
key={section.key}
ref={(el) => {
if (el) sectionRefs.current[section.key] = el;
}}
id={`section-${section.key}`}
className="px-6 py-6 scroll-mt-16 border-1 rounded-lg shadow-md max-w-2xl mx-auto"
>
<div className="mb-4">
<h2
className="text-xl font-semibold"
ref={(el) => {
if (el) titleRefs.current[section.key] = el;
}}
id={`title-${section.key}`}
>
{t(section.label)}
</h2>
<p className="text-sm text-default-500">
{t(section.description || "")}
</p>
</div>
{/* Content sections */}
{section.key === "title-description" && (
<TitleAndDescPanel
config={platformConfig as TitleAndDescPanelConfig}
onSave={onSavePlatformConfig}
/>
)}
{section.key === "meta-data" && (
<MetaDataPanel
metaData={platformConfig}
onSave={onSavePlatformConfig}
uploadImage={uploadImage}
platformConfig={platformConfig}
/>
)}
{section.key === "custom-domain" && (
<div className="space-y-4">
<DomainPanel
config={platformConfig}
onSave={onSavePlatformConfig}
/>
</div>
)}
{section.key === "platform-language" && (
<LanguageSetting
config={platformConfig}
onSave={onSavePlatformConfig}
/>
)}
{section.key === "branding" && (
<BrandPanel
config={platformConfig as BrandPanelConfig}
onSave={onSavePlatformConfig}
onUploadImage={uploadImage}
/>
)}
{section.key === "theme" && (
<ThemeSelector
value={platformConfig.theme || Theme.DEFAULT}
onChange={handleThemeChange}
/>
)}
{section.key === "smtp-settings" && (
<EmailConfigForm
config={emailConfig}
onSave={onSaveEmailConfig}
isLoading={emailSubmitLoading}
/>
)}
{section.key === "email-login-settings" && (
<LoginSettingsContent
loginConfig={loginConfig}
saveLoginConfig={saveLoginConfig}
emailConfig={emailConfig}
type="email"
/>
)}
{section.key === "google-login-settings" && (
<LoginSettingsContent
loginConfig={loginConfig}
saveLoginConfig={saveLoginConfig}
emailConfig={emailConfig}
type="google"
/>
)}
{section.key === "navigation" && (
<TopNavigationSettings
onSave={saveNavigationConfig}
config={homepageConfig.top_navigation}
labelPlacement="outside"
/>
)}
{section.key === "tagsBar" && (
<TagsBarSetting
isEnabled={!!platformConfig.tag_bar_display}
onSave={onSavePlatformConfig}
/>
)}
{section.key === "faq" && (
<FaqSettings
onSave={saveFaqConfig}
config={homepageConfig.faq}
labelPlacement="outside"
/>
)}
{section.key === "payment" && (
<PaymentChannelsContent labelPlacement="outside" />
)}
{section.key === "free-quota" && <FreeQuotaSettings />}
{section.key === "xpack-explore" && (
<ExplorePanel
isEnabled={!!platformConfig.is_showcased}
onSave={onSavePlatformConfig}
/>
)}
{section.key === "code-injection" && (
<EmbeddedHtmlSettings
onSave={onSaveEmbeddedHtml}
config={homepageConfig.embeded_html}
labelPlacement="outside"
/>
)}
{section.key === "change-password" && (
<AdminConfigForm onSave={handleChangePassword} />
)}
</section>
</>
))}
{/* Bottom spacer to allow last sections to scroll higher into view for better selection */}
<div className="h-40" aria-hidden="true" />
</div>
);
};
export default SystemSettingsRightContent;
@@ -0,0 +1,157 @@
"use client";
import React, { useMemo, useRef, useEffect } from "react";
import { Input, Button, ScrollShadow } from "@nextui-org/react";
import { Search } from "lucide-react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { SettingModalTab } from "./console.type";
export interface SettingsMenuItem {
key: SettingModalTab;
label: string;
description?: string;
icon?: React.ReactNode;
}
export interface SettingsGroup {
key: string;
title: string;
items: SettingsMenuItem[];
}
interface Props {
activeKey: SettingModalTab;
onSelect: (key: SettingModalTab) => void;
searchQuery: string;
onSearchChange: (val: string) => void;
groups: SettingsGroup[];
filteredKeys: SettingModalTab[]; // which item keys match the current search
}
const SystemSettingsSidebar: React.FC<Props> = ({
activeKey,
onSelect,
searchQuery,
onSearchChange,
groups,
filteredKeys,
}) => {
const { t } = useTranslation();
const sidebarScrollRef = useRef<HTMLDivElement | null>(null);
const activeItemRefs = useRef<Record<string, HTMLButtonElement | null>>({});
// filter groups based on filteredKeys
const visibleGroups = useMemo(() => {
const keySet = new Set(filteredKeys);
return groups
.map((g) => ({
...g,
items: g.items.filter((it) => keySet.has(it.key)),
}))
.filter((g) => g.items.length > 0);
}, [groups, filteredKeys]);
const hasResults = visibleGroups.length > 0;
// Auto-scroll to active item when activeKey changes
useEffect(() => {
const activeElement = activeItemRefs.current[activeKey];
const scrollContainer = sidebarScrollRef.current;
if (activeElement && scrollContainer) {
// Get the scroll container element (ScrollShadow wraps content)
const scrollElement =
(scrollContainer.querySelector(
'[data-scrollable="true"]'
) as HTMLElement) || scrollContainer;
const containerRect = scrollElement.getBoundingClientRect();
const elementRect = activeElement.getBoundingClientRect();
// Check if element is visible in container
const isElementVisible =
elementRect.top >= containerRect.top &&
elementRect.bottom <= containerRect.bottom;
if (!isElementVisible) {
// Calculate scroll position to center the active item
const containerHeight = containerRect.height;
const elementTop = activeElement.offsetTop;
const elementHeight = activeElement.offsetHeight;
const scrollTop = elementTop - containerHeight / 2 + elementHeight / 2;
scrollElement.scrollTo({
top: Math.max(0, scrollTop),
behavior: "smooth",
});
}
}
}, [activeKey]);
return (
<ScrollShadow
ref={sidebarScrollRef}
className="w-[300px] border-r border-divider bg-content1/50 scrollbar-thin"
>
<div className="p-4 space-y-4">
<Input
size="sm"
aria-label={t("Search settings")}
placeholder={t("Search settings")}
value={searchQuery}
onValueChange={onSearchChange}
startContent={<Search size={16} className="text-default-400" />}
isClearable
onClear={() => onSearchChange("")}
/>
{!hasResults ? (
<div className="text-xs text-default-400 px-1 py-2">
{t("No results")}
</div>
) : (
<nav className="space-y-6">
{visibleGroups.map((group) => (
<div key={group.key} className="space-y-1">
<div className="px-2 text-[11px] tracking-wide text-default-400">
{t(group.title)}
</div>
<div className="flex flex-col gap-2">
{group.items.map((item) => {
const isActive = activeKey === item.key;
return (
<Button
key={item.key}
ref={(el) => {
if (el) activeItemRefs.current[item.key] = el;
}}
variant={isActive ? "flat" : "light"}
color={isActive ? "primary" : "default"}
size="sm"
className={`w-full border-1 justify-start h-auto py-3 px-3 text-left rounded-md ${
isActive
? "bg-primary/10 border-primary/20"
: "hover:bg-default-100 border-transparent"
}`}
onPress={() => onSelect(item.key)}
startContent={item.icon}
>
<div className="flex flex-col items-start w-full">
<div className="font-medium text-sm">
{t(item.label)}
</div>
</div>
</Button>
);
})}
</div>
</div>
))}
</nav>
)}
</div>
</ScrollShadow>
);
};
export default SystemSettingsSidebar;
@@ -0,0 +1,19 @@
export enum SettingModalTab {
TITLE_DESCRIPTION = "title-description",
META_DATA = "meta-data",
CUSTOM_DOMAIN = "custom-domain",
BRANDING = "branding",
THEME = "theme",
PAYMENT = "payment",
FREE_QUOTA = "free-quota",
CODE_INJECTION = "code-injection",
XPACK_EXPLORE = "xpack-explore",
NAVIGATION = "navigation",
TAGS_BAR = "tagsBar",
FAQ = "faq",
CHANGE_PASSWORD = "change-password",
EMAIL_LOGIN_SETTINGS = "email-login-settings",
GOOGLE_LOGIN_SETTINGS = "google-login-settings",
SMTP_SETTINGS = "smtp-settings",
PLATFORM_LANGUAGE = "platform-language",
}
@@ -0,0 +1,74 @@
"use client";
import React, { useState } from "react";
import { Input, Card, CardBody } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
interface CustomDomainPanelProps {
domain: string;
setDomain: (domain: string) => void;
onValidationChange?: (isValid: boolean) => void;
}
const CustomDomainPanel: React.FC<CustomDomainPanelProps> = ({
domain,
setDomain,
onValidationChange,
}) => {
const { t } = useTranslation();
const [validationError, setValidationError] = useState<string | undefined>();
// Validate domain URL
const validateDomain = (value: string): string | undefined => {
if (!value.trim()) {
return undefined; // Domain is optional
}
// Basic domain format validation ,like www.example.com
const domainRegex =
/^(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,})$/;
if (!domainRegex.test(value)) {
return t("Please enter a valid domain");
}
return undefined;
};
const handleBlur = () => {
const error = validateDomain(domain);
setValidationError(error);
// 通知父组件校验状态
onValidationChange?.(!error);
};
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
setDomain(value);
// 实时校验
const error = validateDomain(value);
setValidationError(error);
onValidationChange?.(!error);
};
return (
<Card shadow="none">
<CardBody className="flex flex-col p-0">
<h3 className="font-semibold mb-2">
{"1. "}
{t("Enter the domain you want to use")}
</h3>
<Input
label={t("Domain")}
placeholder={t("Enter your full domain name (e.g., www.example.com)")}
value={domain}
onChange={handleChange}
onBlur={handleBlur}
isInvalid={!!validationError}
errorMessage={validationError}
/>
</CardBody>
</Card>
);
};
export default CustomDomainPanel;
@@ -0,0 +1,66 @@
"use client";
import React from "react";
import {
Card,
CardBody,
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
} from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
interface DNSRecordsPanelProps {
cnameTarget: string; // e.g., subdomain.domainhost.com
apexATarget?: string; // optional A record IP for apex
}
type DnsRow = { key: string; type: string; host: string; value: string };
const DNSRecordsPanel: React.FC<DNSRecordsPanelProps> = ({
cnameTarget,
apexATarget,
}) => {
const { t } = useTranslation();
const rows: DnsRow[] = [
...(cnameTarget
? [{ key: "cname", type: "CNAME", host: "www", value: cnameTarget }]
: []),
...(apexATarget
? [{ key: "a-record", type: "A", host: "@", value: apexATarget }]
: []),
];
return (
<Card shadow="none">
<CardBody className="p-0 flex flex-col gap-2">
<h3 className="font-semibold mb-2">
{"2. "}
{t("Create your DNS records")}
</h3>
<Table aria-label={t("DNS Records Table")} shadow="none" removeWrapper>
<TableHeader>
<TableColumn>{t("Type")}</TableColumn>
<TableColumn>{t("Host")}</TableColumn>
<TableColumn>{t("Value")}</TableColumn>
</TableHeader>
<TableBody items={rows}>
{(item) => (
<TableRow key={item.key}>
<TableCell>{item.type}</TableCell>
<TableCell>{item.host}</TableCell>
<TableCell>{item.value}</TableCell>
</TableRow>
)}
</TableBody>
</Table>
</CardBody>
</Card>
);
};
export default DNSRecordsPanel;
@@ -0,0 +1,92 @@
"use client";
import React, { useState } from "react";
import {
Button,
Modal,
ModalContent,
ModalBody,
ModalHeader,
Card,
CardBody,
} from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import CustomDomainPanel from "./CustomDomainPanel";
import DNSRecordsPanel from "./DNSRecordsPanel";
export type DomainActivationPanelConfig = {
domain?: string;
subdomain?: string;
cname_a_ip?: string;
};
interface DomainActivationPanelProps {
config: DomainActivationPanelConfig;
onSave: (config: DomainActivationPanelConfig) => void;
isOpen: boolean;
onClose: () => void;
}
const DomainActivationPanel: React.FC<DomainActivationPanelProps> = ({
config,
onSave,
isOpen,
onClose,
}) => {
const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(false);
const [domain, setDomain] = useState(config.domain || "");
const [isValidDomain, setIsValidDomain] = useState(false);
const handleActivate = async () => {
setIsLoading(true);
try {
await onSave({
domain,
});
onClose();
} finally {
setIsLoading(false);
}
};
return (
<>
<Modal isOpen={isOpen} onClose={onClose} size="xl">
<ModalContent>
<ModalHeader>{t("Set Custom Domain")}</ModalHeader>
<ModalBody className="flex flex-col gap-4">
<CustomDomainPanel
domain={domain}
setDomain={setDomain}
onValidationChange={setIsValidDomain}
/>
<DNSRecordsPanel
cnameTarget={`${config.subdomain || ""}${process.env.NEXT_PUBLIC_DOMAIN_HOST || ""}`}
apexATarget={config.cname_a_ip}
/>
<Card shadow="none">
<CardBody className="p-0 flex flex-col gap-2 pb-4">
<h3 className="font-semibold mb-2">
{"3. "}
{t("Activate your domain")}
</h3>
<Button
color="primary"
isDisabled={!domain || !isValidDomain}
isLoading={isLoading}
onPress={handleActivate}
size="sm"
>
{t("Activate")}
</Button>
</CardBody>
</Card>
</ModalBody>
</ModalContent>
</Modal>
</>
);
};
export default DomainActivationPanel;
@@ -0,0 +1,108 @@
"use client";
import React, { useEffect } from "react";
import { Input, Button } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { z } from "zod";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import UploadImage from "@/components/common/UploadImage";
export type BrandPanelConfig = {
logo: string;
name: string;
};
const brandPanelSchema = z.object({
logo: z.string(),
name: z.string().min(1, "Name is required"),
});
interface BrandPanelProps {
config: BrandPanelConfig;
onSave: (config: BrandPanelConfig) => Promise<boolean>;
onUploadImage: (file: File, sha256?: string) => Promise<string>;
}
const BrandPanel: React.FC<BrandPanelProps> = ({
config,
onSave,
onUploadImage,
}) => {
const { t } = useTranslation();
const {
handleSubmit,
control,
setValue,
formState: { errors, isSubmitting, isValid },
} = useForm<BrandPanelConfig>({
resolver: zodResolver(brandPanelSchema),
mode: "onBlur",
defaultValues: config,
});
useEffect(() => {
setValue("name", config.name);
setValue("logo", config.logo);
}, [config]);
return (
<div className="space-y-4">
<div className="flex flex-col gap-4">
<form onSubmit={handleSubmit(onSave)} className="flex flex-col gap-4">
<Controller
name="name"
control={control}
render={({ field }) => (
<>
<Input
{...field}
label={t("Your brand")}
placeholder={t("Enter your brand name")}
isInvalid={!!errors.name}
errorMessage={errors.name?.message}
labelPlacement="outside"
isRequired
/>
</>
)}
/>
<Controller
name="logo"
control={control}
render={({ field }) => (
<div className="flex flex-col gap-2">
<div>
<label className="text-sm font-medium text-foreground">
{t("Logo")}
</label>
<p className="text-xs text-gray-500">
{t("Support JPG, PNG, GIF, SVG. Max size 5MB")}
</p>
</div>
<UploadImage
onSave={onUploadImage}
setImageUrl={(imageUrl) => field.onChange(imageUrl)}
imageUrl={field.value}
/>
</div>
)}
/>
<Button
color="primary"
variant="solid"
type="submit"
isLoading={isSubmitting}
size="sm"
isDisabled={!isValid}
className="mt-2 w-fit"
>
{t("Save")}
</Button>
</form>
</div>
</div>
);
};
export default BrandPanel;
@@ -0,0 +1,70 @@
"use client";
import React, { useState, useEffect } from "react";
import { Button } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { EditIcon } from "lucide-react";
import DomainActivationPanel from "../custom-domain/DomainActivationPanel";
export type DomainPanelConfig = {
subdomain?: string;
domain?: string;
cname_a_ip?: string;
};
interface DomainPanelProps {
config: DomainPanelConfig;
onSave: (config: DomainPanelConfig) => Promise<boolean>;
}
const DomainPanel: React.FC<DomainPanelProps> = ({ config, onSave }) => {
const { t } = useTranslation();
const [formData, setFormData] = useState<DomainPanelConfig>(config);
const [showCustomDomainModal, setShowCustomDomainModal] = useState(false);
// when context config updated, sync to form
useEffect(() => {
setFormData(config);
}, [config]);
const handleCustomDomainSave = async (config: DomainPanelConfig) => {
const result = await onSave(config);
if (!result) return;
};
return (
<>
<div className="flex flex-col gap-4">
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">{t("Custom Domain")}</span>
<span className="text-xs text-gray-500">
{formData.domain || t("Set your custom domain for the platform")}
</span>
</div>
<Button
size="sm"
onPress={() => setShowCustomDomainModal(true)}
isIconOnly
startContent={<EditIcon size={16} />}
variant="flat"
></Button>
</div>
</div>
{showCustomDomainModal && (
<DomainActivationPanel
config={{
subdomain: formData.subdomain,
domain: formData.domain,
cname_a_ip: config.cname_a_ip,
}}
onSave={handleCustomDomainSave}
isOpen={showCustomDomainModal}
onClose={() => setShowCustomDomainModal(false)}
/>
)}
</>
);
};
export default DomainPanel;
@@ -0,0 +1,51 @@
"use client";
import React from "react";
import { Switch } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
export type ExplorePanelConfig = {
is_showcased: boolean;
};
interface ExplorePanelProps {
isEnabled: boolean;
onSave: (config: ExplorePanelConfig) => void;
}
export const ExplorePanel: React.FC<ExplorePanelProps> = ({
isEnabled,
onSave,
}) => {
const { t } = useTranslation();
return (
<div className="space-y-4">
<div className="flex flex-col gap-4">
{/* showcase in xpack */}
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">
{t("Featured in the XPack showcase")}
</span>
<span className="text-xs text-gray-500">
{t(
"Enable this option to feature your site in the XPack global showcase and reach users worldwide."
)}
</span>
</div>
<Switch
isSelected={isEnabled}
onValueChange={(value) => {
onSave({
is_showcased: value,
});
}}
color="primary"
size="sm"
/>
</div>
</div>
</div>
);
};
@@ -0,0 +1,159 @@
"use client";
import React, { useEffect } from "react";
import { Button, Card, CardBody, Input } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import UploadImage from "@/components/common/UploadImage";
import { z } from "zod";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { PlatformConfig } from "@/shared/types/system";
import { FaFacebook } from "react-icons/fa6";
export interface FacebookMetaData {
facebook_title: string;
facebook_description: string;
facebook_image_url?: string;
}
const formSchema = z.object({
facebook_title: z
.string()
.max(200, "Title is too long")
.optional()
.default(""),
facebook_description: z
.string()
.max(1000, "Description is too long")
.optional()
.default(""),
facebook_image_url: z.string().optional().or(z.literal("")).default(""),
});
type FormData = z.infer<typeof formSchema>;
interface MetaDataFacebookFormProps {
metaData: FacebookMetaData;
onSave: (metaData: FacebookMetaData) => Promise<boolean>;
onUploadImage: (file: File, sha256?: string) => Promise<string>;
platformConfig: PlatformConfig;
}
const MetaDataFacebookForm: React.FC<MetaDataFacebookFormProps> = ({
metaData,
onSave,
onUploadImage,
platformConfig,
}) => {
const { t } = useTranslation();
const {
control,
handleSubmit,
setValue,
formState: { errors, isSubmitting, isValid },
} = useForm<FormData>({
resolver: zodResolver(formSchema),
mode: "onBlur",
defaultValues: metaData,
});
useEffect(() => {
if (!metaData) return;
setValue("facebook_title", metaData.facebook_title || "");
setValue("facebook_description", metaData.facebook_description || "");
setValue("facebook_image_url", metaData.facebook_image_url || "");
}, [metaData, setValue]);
const onSubmit = async (data: FormData) => {
await onSave(data);
};
return (
<>
<div className="max-w-2xl">
<div className="mb-2">
<div className="flex items-center gap-2">
<FaFacebook className="text-primary" size={40} />
<div className="flex flex-col">
<span className="font-semibold text-default-900">
{platformConfig.name}
</span>
<span className="text-default-400 text-xs">2h</span>
</div>
</div>
</div>
<div className="mb-2 h-3 w-full rounded-large bg-default-100"></div>
<div className="mb-4 h-3 w-3/5 rounded-large bg-default-100"></div>
</div>
<Card shadow="none" className="border-1 max-w-2xl">
<CardBody className="px-0 py-4">
<form
onSubmit={handleSubmit(onSubmit)}
className="flex flex-col gap-4 px-4"
>
<Controller
name="facebook_image_url"
control={control}
render={({ field }) => (
<UploadImage
onSave={onUploadImage}
imageUrl={field.value}
setImageUrl={(imageUrl) => {
field.onChange(imageUrl);
}}
className="h-[280px] w-full bg-default-100"
description={t("Upload Facebook Image")}
/>
)}
/>
<Controller
name="facebook_title"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("Facebook Title")}
placeholder={platformConfig.headline || " "}
isInvalid={!!errors.facebook_title}
errorMessage={errors.facebook_title?.message}
labelPlacement="outside"
/>
)}
/>
<Controller
name="facebook_description"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("Facebook Description")}
placeholder={platformConfig.subheadline || " "}
isInvalid={!!errors.facebook_description}
errorMessage={errors.facebook_description?.message}
labelPlacement="outside"
/>
)}
/>
<div className="flex justify-start mt-2">
<Button
type="submit"
color="primary"
size="sm"
className="w-fit"
isLoading={isSubmitting}
isDisabled={!isValid}
>
{t("Save")}
</Button>
</div>
</form>
</CardBody>
</Card>
</>
);
};
export default MetaDataFacebookForm;
@@ -0,0 +1,82 @@
"use client";
import React, { useEffect } from "react";
import { Tabs, Tab } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import MetaDataFacebookForm from "./MetaDataFacebookForm";
import MetaDataXForm from "./MetaDataXForm";
import MetaDataSearchForm from "./MetaDataSearchForm";
import { FacebookMetaData } from "./MetaDataFacebookForm";
import { SearchMetaData } from "./MetaDataSearchForm";
import { XMetaData } from "./MetaDataXForm";
import { PlatformConfig } from "@/shared/types/system";
interface MetaData {
website_title?: string;
meta_description?: string;
x_title?: string;
x_description?: string;
x_image_url?: string;
facebook_title?: string;
facebook_description?: string;
facebook_image_url?: string;
}
interface MetaDataPanelProps {
metaData: MetaData;
onSave: (metaData: MetaData) => Promise<boolean>;
uploadImage: (file: File, sha256?: string) => Promise<string>;
platformConfig: PlatformConfig;
}
const MetaDataPanel: React.FC<MetaDataPanelProps> = ({
metaData,
onSave,
uploadImage,
platformConfig,
}) => {
const { t } = useTranslation();
const handleSave = async (data: MetaData) => {
return await onSave({
...metaData,
...data,
});
};
return (
<Tabs
aria-label="Meta data options"
variant="solid"
className="w-full"
destroyInactiveTabPanel={false}
>
<Tab key="search" title={t("Search")} className="pb-0">
<MetaDataSearchForm
metaData={metaData as SearchMetaData}
onSave={handleSave}
platformConfig={platformConfig}
/>
</Tab>
<Tab key="x" title={t("X Card")} className="pb-0">
<MetaDataXForm
metaData={metaData as XMetaData}
onSave={handleSave}
onUploadImage={uploadImage}
platformConfig={platformConfig}
/>
</Tab>
<Tab key="facebook" title={t("Facebook Card")} className="pb-0">
<MetaDataFacebookForm
metaData={metaData as FacebookMetaData}
onSave={handleSave}
onUploadImage={uploadImage}
platformConfig={platformConfig}
/>
</Tab>
</Tabs>
);
};
export default MetaDataPanel;
@@ -0,0 +1,215 @@
"use client";
import React, { useEffect } from "react";
import { Button, Card, CardBody, CardFooter, Input } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { z } from "zod";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { PlatformConfig } from "@/shared/types/system";
export interface SearchMetaData {
website_title: string;
meta_description: string;
}
const formSchema = z.object({
website_title: z.string().max(75, "Title is too long").optional().default(""),
meta_description: z
.string()
.max(156, "Description is too long")
.optional()
.or(z.literal(""))
.default(""),
});
type FormData = z.infer<typeof formSchema>;
interface MetaDataSearchFormProps {
metaData: SearchMetaData;
platformConfig: PlatformConfig;
onSave: (metaData: SearchMetaData) => Promise<boolean>;
}
const MetaDataSearchForm: React.FC<MetaDataSearchFormProps> = ({
metaData,
platformConfig,
onSave,
}) => {
const { t } = useTranslation();
const {
control,
handleSubmit,
setValue,
watch,
formState: { errors, isSubmitting, isValid },
} = useForm<FormData>({
resolver: zodResolver(formSchema),
mode: "onBlur",
defaultValues: metaData,
});
useEffect(() => {
if (!metaData) return;
setValue("meta_description", metaData.meta_description || "");
setValue("website_title", metaData.website_title || "");
}, [metaData, setValue]);
const onSubmit = async (data: FormData) => {
await onSave(data);
};
const metaDescription = watch("meta_description");
const websiteTitle = watch("website_title");
return (
<Card shadow="none" className="border-1 max-w-2xl">
<CardBody className="px-0 py-4">
<form
onSubmit={handleSubmit(onSubmit)}
className="flex flex-col gap-4 px-4"
>
<Controller
name="website_title"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("Meta Title")}
placeholder={platformConfig.headline || " "}
isInvalid={!!errors.website_title}
errorMessage={errors.website_title?.message}
labelPlacement="outside"
defaultValue={t("Recommended: 70 characters")}
/>
)}
/>
<Controller
name="meta_description"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("Meta Description")}
placeholder={platformConfig.subheadline || " "}
isInvalid={!!errors.meta_description}
errorMessage={errors.meta_description?.message}
labelPlacement="outside"
defaultValue={t("Recommended: 156 characters")}
/>
)}
/>
<div className="flex justify-start mt-2">
<Button
type="submit"
color="primary"
size="sm"
className="w-fit"
isLoading={isSubmitting}
isDisabled={!isValid}
>
{t("Save")}
</Button>
</div>
</form>
</CardBody>
<CardFooter className="p-0">
<div className="w-full bg-default-100">
<div className="mt-4 mb-2 text-grey-500 px-5 uppercase text-xs">
{t("Preview")}
</div>
<div className="mx-5 -mb-5 overflow-hidden rounded-b-xl bg-grey-50 pt-2 ">
<div className="rounded-t-lg bg-white px-5 py-3 shadow-lg mb-5">
<div className="mt-3 flex items-center">
<div>
<svg fill="none" viewBox="0 0 92 31" className="mr-7 h-7">
<title>google</title>
<path
d="M39.15 15.898c0 4.303-3.378 7.473-7.525 7.473s-7.526-3.17-7.526-7.473c0-4.334 3.38-7.474 7.526-7.474 4.147 0 7.526 3.14 7.526 7.474zm-3.294 0c0-2.69-1.958-4.529-4.231-4.529-2.273 0-4.231 1.84-4.231 4.529 0 2.662 1.958 4.528 4.231 4.528 2.273 0 4.231-1.87 4.231-4.528z"
fill="#EA4335"
></path>
<path
d="M55.386 15.898c0 4.303-3.379 7.473-7.526 7.473-4.146 0-7.526-3.17-7.526-7.473 0-4.33 3.38-7.474 7.526-7.474 4.147 0 7.526 3.14 7.526 7.474zm-3.294 0c0-2.69-1.959-4.529-4.232-4.529s-4.231 1.84-4.231 4.529c0 2.662 1.958 4.528 4.231 4.528 2.273 0 4.232-1.87 4.232-4.528z"
fill="#FBBC05"
></path>
<path
d="M70.945 8.875v13.418c0 5.52-3.267 7.774-7.13 7.774-3.636 0-5.825-2.423-6.65-4.404l2.868-1.19c.511 1.217 1.763 2.652 3.779 2.652 2.472 0 4.004-1.52 4.004-4.38V21.67h-.115c-.737.906-2.158 1.698-3.95 1.698-3.751 0-7.188-3.255-7.188-7.443 0-4.22 3.437-7.501 7.188-7.501 1.789 0 3.21.792 3.95 1.671h.115V8.88h3.129v-.004zm-2.895 7.05c0-2.632-1.763-4.556-4.005-4.556-2.273 0-4.177 1.924-4.177 4.556 0 2.604 1.904 4.501 4.177 4.501 2.242 0 4.005-1.897 4.005-4.501z"
fill="#4285F4"
></path>
<path
d="M76.103 1.01v21.903H72.89V1.011h3.213z"
fill="#34A853"
></path>
<path
d="M88.624 18.357l2.558 1.699c-.826 1.216-2.815 3.312-6.251 3.312-4.262 0-7.445-3.282-7.445-7.474 0-4.444 3.21-7.473 7.076-7.473 3.893 0 5.798 3.086 6.42 4.754l.341.85-10.028 4.137c.768 1.5 1.962 2.264 3.636 2.264 1.678 0 2.841-.822 3.693-2.069zm-7.87-2.688l6.703-2.774c-.368-.933-1.478-1.583-2.783-1.583-1.674 0-4.005 1.472-3.92 4.357z"
fill="#EA4335"
></path>
<path
d="M11.936 13.953v-3.17h10.726c.105.552.159 1.206.159 1.914 0 2.378-.653 5.32-2.757 7.416-2.046 2.123-4.66 3.255-8.124 3.255-6.42 0-11.818-5.21-11.818-11.605C.122 5.368 5.52.158 11.94.158c3.551 0 6.081 1.389 7.982 3.198l-2.246 2.237c-1.363-1.273-3.21-2.264-5.74-2.264-4.688 0-8.354 3.764-8.354 8.434s3.666 8.434 8.354 8.434c3.041 0 4.773-1.216 5.882-2.322.9-.896 1.492-2.176 1.725-3.925l-7.607.003z"
fill="#4285F4"
></path>
</svg>
</div>
<div className="grow">
<div className="flex w-full items-center justify-end rounded-full bg-white p-3 px-4 shadow dark:bg-grey-900">
<svg
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
stroke-width="1.5"
className="pointer-events-none size-4 stroke-[2px] text-blue-600"
>
<path
d="M0.750 9.812 A9.063 9.063 0 1 0 18.876 9.812 A9.063 9.063 0 1 0 0.750 9.812 Z"
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
transform="translate(-3.056 4.62) rotate(-23.025)"
></path>
<path
d="M16.221 16.22L23.25 23.25"
fill="none"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
</div>
</div>
</div>
<div className="mt-4 flex items-center gap-2 border-t border-grey-200 pt-4 dark:border-grey-900">
<div
className="flex size-7 items-center justify-center rounded-full bg-grey-200 dark:bg-grey-700"
style={{
backgroundImage: `url("${platformConfig.logo}")`,
backgroundSize: "contain",
}}
></div>
<div className="flex flex-col text-sm">
<span>{platformConfig.domain || window.location.host}</span>
<span className="-mt-0.5 inline-block text-xs text-grey-600">
https://
{platformConfig.domain || window.location.host}
</span>
</div>
</div>
<div className="mt-1 flex flex-col">
<span className="text-lg text-[#1a0dab] dark:text-blue">
{websiteTitle || platformConfig.headline}
</span>
<span className="text-sm text-grey-900 dark:text-grey-700">
{metaDescription || platformConfig.subheadline}
</span>
</div>
</div>
</div>
</div>
</CardFooter>
</Card>
);
};
export default MetaDataSearchForm;
@@ -0,0 +1,160 @@
"use client";
import React, { useEffect } from "react";
import { Button, Card, CardBody, Input } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import UploadImage from "@/components/common/UploadImage";
import { z } from "zod";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { PlatformConfig } from "@/shared/types/system";
import { FaXTwitter } from "react-icons/fa6";
export interface XMetaData {
x_title: string;
x_description: string;
x_image_url?: string;
}
const formSchema = z.object({
x_title: z.string().max(200, "Title is too long").optional().default(""),
x_description: z
.string()
.max(1000, "Description is too long")
.optional()
.or(z.literal(""))
.default(""),
x_image_url: z.string().optional().or(z.literal("")).default(""),
});
type FormData = z.infer<typeof formSchema>;
interface MetaDataXFormProps {
metaData: XMetaData;
onSave: (metaData: XMetaData) => Promise<boolean>;
onUploadImage: (file: File, sha256?: string) => Promise<string>;
platformConfig: PlatformConfig;
}
const MetaDataXForm: React.FC<MetaDataXFormProps> = ({
metaData,
onSave,
onUploadImage,
platformConfig,
}) => {
const { t } = useTranslation();
const {
control,
handleSubmit,
setValue,
formState: { errors, isSubmitting, isValid },
} = useForm<FormData>({
resolver: zodResolver(formSchema),
mode: "onBlur",
defaultValues: metaData,
});
useEffect(() => {
if (!metaData) return;
setValue("x_title", metaData.x_title || "");
setValue("x_description", metaData.x_description || "");
setValue("x_image_url", metaData.x_image_url || "");
}, [metaData, setValue]);
const onSubmit = async (data: FormData) => {
await onSave(data);
};
return (
<>
<div className="flex items-start gap-2 w-full">
<FaXTwitter size={40} />
<div className="w-full">
<div className="max-w-2xl">
<div className="mb-2">
<div className="flex">
<span className="mr-1 font-semibold text-default-900">
{platformConfig.name}
</span>
<span className="text-default-400">· 2h</span>
</div>
</div>
<div className="mb-2 h-3 w-full rounded-large bg-default-100"></div>
<div className="mb-4 h-3 w-3/5 rounded-large bg-default-100"></div>
</div>
<Card shadow="none" className="border-1 max-w-2xl">
<CardBody className="px-0 py-4">
<form
onSubmit={handleSubmit(onSubmit)}
className="flex flex-col gap-4 px-4"
>
<Controller
name="x_image_url"
control={control}
render={({ field }) => (
<UploadImage
onSave={onUploadImage}
imageUrl={field.value}
setImageUrl={(imageUrl) => {
field.onChange(imageUrl);
}}
className="h-[280px] w-full bg-default-100"
description={t("Upload X Image")}
/>
)}
/>
<Controller
name="x_title"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("X Title")}
placeholder={platformConfig.headline || " "}
isInvalid={!!errors.x_title}
errorMessage={errors.x_title?.message}
labelPlacement="outside"
/>
)}
/>
<Controller
name="x_description"
control={control}
render={({ field }) => (
<Input
{...field}
label={t("X Description")}
placeholder={platformConfig.subheadline || " "}
isInvalid={!!errors.x_description}
errorMessage={errors.x_description?.message}
labelPlacement="outside"
/>
)}
/>
<div className="flex justify-start mt-2">
<Button
type="submit"
color="primary"
size="sm"
className="w-fit"
isLoading={isSubmitting}
isDisabled={!isValid}
>
{t("Save")}
</Button>
</div>
</form>
</CardBody>
</Card>
</div>
</div>
</>
);
};
export default MetaDataXForm;
@@ -0,0 +1,106 @@
"use client";
import React, { useEffect } from "react";
import { Input, Button } from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { z } from "zod";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
export type TitleAndDescPanelConfig = {
headline: string;
subheadline: string;
};
const titleAndDescPanelSchema = z.object({
headline: z.string().min(1, "Title is required"),
subheadline: z.string(),
});
interface TitleAndDescPanelProps {
config: TitleAndDescPanelConfig;
onSave: (config: TitleAndDescPanelConfig) => Promise<boolean>;
}
const TitleAndDescPanel: React.FC<TitleAndDescPanelProps> = ({
config,
onSave,
}) => {
const { t } = useTranslation();
const {
handleSubmit,
control,
setValue,
formState: { errors, isSubmitting, isValid },
} = useForm<TitleAndDescPanelConfig>({
resolver: zodResolver(titleAndDescPanelSchema),
mode: "onBlur",
defaultValues: config,
});
useEffect(() => {
setValue("headline", config.headline);
setValue("subheadline", config.subheadline);
}, [config]);
return (
<div className="space-y-4">
<div className="flex flex-col gap-4">
<form onSubmit={handleSubmit(onSave)} className="flex flex-col gap-4">
<Controller
name="headline"
control={control}
render={({ field }) => (
<>
{/* homepage headline */}
<Input
{...field}
label={t("Site title")}
placeholder={t("Enter site title")}
description={t("Main title displayed on the home page")}
isInvalid={!!errors.headline}
errorMessage={errors.headline?.message}
labelPlacement="outside"
isRequired
/>
</>
)}
/>
<Controller
name="subheadline"
control={control}
render={({ field }) => (
<>
{/* homepage subheadline */}
<Input
{...field}
label={t("Site description")}
placeholder={t("Enter site description")}
description={t(
"Secondary description displayed below the main title"
)}
isInvalid={!!errors.subheadline}
errorMessage={errors.subheadline?.message}
labelPlacement="outside"
/>
</>
)}
/>
<Button
color="primary"
variant="solid"
type="submit"
isLoading={isSubmitting}
size="sm"
isDisabled={!isValid}
className="mt-2 w-fit"
>
{t("Save")}
</Button>
</form>
</div>
</div>
);
};
export default TitleAndDescPanel;
@@ -64,7 +64,12 @@ export const APIKeyModal = ({
if (!response.success) {
console.error("Error creating auth key:", response.error_message);
toast.error(t("Failed to create auth key"));
const errorMsg = response.error_message
if (errorMsg?.endsWith('already exists')) {
toast.error(t(errorMsg, { name: keyName }));
} else {
toast.error(t("Failed to create auth key"));
}
return;
}
@@ -79,7 +84,12 @@ export const APIKeyModal = ({
if (!response.success) {
console.error("Error updating auth key:", response.error_message);
toast.error(t("Failed to update auth key"));
const errorMsg = response.error_message
if (errorMsg?.endsWith('already exists')) {
toast.error(t(errorMsg, { name: keyName }));
} else {
toast.error(t("Failed to update auth key"));
}
return;
}
@@ -90,6 +100,7 @@ export const APIKeyModal = ({
toast.success(t("Auth key updated successfully"));
onClose();
}
setName('')
} catch (error) {
console.error("Error creating/updating auth key:", error);
toast.error(t("Failed to create/update auth key"));
@@ -0,0 +1,388 @@
"use client";
import React, { useState, useCallback, useRef, useEffect } from "react";
import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
Button,
Pagination,
Tooltip,
Spinner,
Chip,
Dropdown,
DropdownTrigger,
DropdownMenu,
DropdownItem,
} from "@nextui-org/react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { Calendar, HelpCircle, Filter } from "lucide-react";
import { fetchAPI } from "@/shared/rpc/common-function";
import i18n from "@/shared/lib/i18n";
import { toast } from "react-hot-toast";
import { fetchAdminAPI } from "@/rpc/admin-api";
export interface OrderItem {
id: string;
amount: string;
balance: string;
order_id: string;
// 支付类型,stripe默认值
payment_type: string;
// 支付状态,0=未支付,1=已支付,2=支付失败
payment_state: number;
description: string;
// 充值时间
create_at: string;
// 交易时间,确认订单时间,只有充值完成后才有
confirm_at: string;
// 订单类型,充值(recharge),消费(purchase),退款(refund),冲正(reversal)
order_type: string;
}
interface AccountBalanceTableProps {
userId?: string;
source?: "client" | "admin";
}
const AccountBalanceTable: React.FC<AccountBalanceTableProps> = ({ userId, source }) => {
const { t } = useTranslation();
const [items, setItems] = useState<OrderItem[]>([]);
const [loading, setLoading] = useState(false);
const [pagination, setPagination] = useState({
page: 1,
pageSize: 10,
total: 0,
});
const [selectedType, setSelectedType] = useState<string>("all");
const [selectedStatus, setSelectedStatus] = useState<string>("all");
const resourceGroupsParams = useRef({
page: 1,
pageSize: 10,
keyword: "",
orderType: "",
status: "",
});
const pages = Math.ceil(pagination.total / pagination.pageSize);
const currentPage = Number(pagination.page);
const fetchOrders = useCallback(
async (
page: number,
page_size: number,
order_type?: string,
status?: string
): Promise<{ data: OrderItem[]; total: number; page: number; page_size: number }> => {
try {
const params = new URLSearchParams({
page: page.toString(),
page_size: page_size.toString(),
});
if (order_type) params.append("order_type", order_type);
if (status) params.append("status", status);
if (userId) params.append("user_id", userId);
// 根据是否有 userId 来决定使用哪个 API
const apiUrl = userId
? `/api/order/list/by_user?${params.toString()}`
: `/api/user/order/list?${params.toString()}`;
const response = source === "client" ? await fetchAPI<OrderItem[]>(apiUrl) : await fetchAdminAPI<OrderItem[]>(apiUrl);
if (!response.success) {
toast.error(response.error_message || i18n.t("Failed to load orders"));
return {
data: [],
total: 0,
page,
page_size,
};
}
return {
data: response.data || [],
total: response.page?.total || 0,
page: response.page?.page || page,
page_size: response.page?.page_size || page_size,
};
} catch (error) {
console.error("Error fetching orders:", error);
return {
data: [],
total: 0,
page,
page_size,
};
}
},
[userId]
);
const loadOrders = useCallback(
async (
page: number = 1,
pageSize: number = 10,
keyword: string = "",
orderType: string = "",
status: string = ""
) => {
setLoading(true);
try {
const response = await fetchOrders(
page,
pageSize,
orderType || undefined,
status || undefined
);
setItems(response.data);
setPagination({
page: response.page,
pageSize: response.page_size,
total: response.total,
});
resourceGroupsParams.current = {
page: response.page,
pageSize: response.page_size,
keyword,
orderType,
status,
};
} catch (error) {
console.error(t("Failed to load orders"), error);
} finally {
setLoading(false);
}
},
[fetchOrders]
);
const formatDate = (dateString: string) => {
return (
<div className="flex items-center gap-1">
<Calendar className="w-3 h-3 text-gray-500" />
<span className="text-sm text-gray-600">
{new Date(dateString).toLocaleString()}
</span>
</div>
);
};
// 格式化金额,带正负号和人民币符号
const formatAmount = (amount: string | number): string => {
const numAmount = typeof amount === 'string' ? parseFloat(amount) : amount;
if (isNaN(numAmount)) return '¥0.00';
const absAmount = Math.abs(numAmount).toFixed(2);
if (numAmount > 0) {
return `+¥${absAmount}`;
} else if (numAmount < 0) {
return `-¥${absAmount}`;
}
return `¥${absAmount}`;
};
// 格式化余额,只显示人民币符号,不带正负号
const formatBalance = (balance: string | number): string => {
const numBalance = typeof balance === 'string' ? parseFloat(balance) : balance;
if (isNaN(numBalance)) return '¥0.00';
return `¥${Math.abs(numBalance).toFixed(2)}`;
};
const getStatusColor = (status: number) => {
switch (status) {
case 1:
return "success";
case 2:
return "danger";
default:
return "warning";
}
};
const onPageChange = (page: number) => {
const { pageSize, orderType, status } = resourceGroupsParams.current;
loadOrders(page, pageSize, "", orderType, status);
};
const handleTypeChange = (value: string) => {
setSelectedType(value);
const orderType = value === "all" ? "" : value;
const { status } = resourceGroupsParams.current;
loadOrders(1, pagination.pageSize, "", orderType, status);
};
const handleStatusChange = (value: string) => {
setSelectedStatus(value);
const status = value === "all" ? "" : value;
const { orderType } = resourceGroupsParams.current;
loadOrders(1, pagination.pageSize, "", orderType, status);
};
useEffect(() => {
loadOrders(1, 10, "");
}, [loadOrders]);
return (
<div className="space-y-4">
<Table
aria-label="Orders table"
classNames={{
wrapper: "min-h-[400px]",
}}
removeWrapper
>
<TableHeader>
<TableColumn>
<div className="flex items-center gap-1">
<span>{t("Transaction Time")}</span>
</div>
</TableColumn>
<TableColumn>
<div className="flex items-center gap-2">
<span>{t("Type")}</span>
<Dropdown>
<DropdownTrigger>
<Button
isIconOnly
size="sm"
variant="light"
aria-label="Filter by type"
>
<Filter
className={`w-4 h-4 ${
selectedType !== "all" ? "text-primary" : ""
}`}
/>
</Button>
</DropdownTrigger>
<DropdownMenu
aria-label="Type filter"
selectionMode="single"
selectedKeys={[selectedType]}
onSelectionChange={(keys) => {
const selected = Array.from(keys)[0] as string;
handleTypeChange(selected);
}}
>
<DropdownItem key="all">{t("All")}</DropdownItem>
<DropdownItem key="recharge">{t("Recharge")}</DropdownItem>
<DropdownItem key="purchase">{t("Purchase")}</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
</TableColumn>
<TableColumn>{t("Description")}</TableColumn>
<TableColumn>{t("Amount")}</TableColumn>
<TableColumn>{t("Balance")}</TableColumn>
<TableColumn>
<div className="flex items-center gap-2">
<span>{t("Status")}</span>
<Dropdown>
<DropdownTrigger>
<Button
isIconOnly
size="sm"
variant="light"
aria-label="Filter by status"
>
<Filter
className={`w-4 h-4 ${
selectedStatus !== "all" ? "text-primary" : ""
}`}
/>
</Button>
</DropdownTrigger>
<DropdownMenu
aria-label="Status filter"
selectionMode="single"
selectedKeys={[selectedStatus]}
onSelectionChange={(keys) => {
const selected = Array.from(keys)[0] as string;
handleStatusChange(selected);
}}
>
<DropdownItem key="all">{t("All")}</DropdownItem>
<DropdownItem key="0">{t("Pending")}</DropdownItem>
<DropdownItem key="1">{t("Completed")}</DropdownItem>
<DropdownItem key="2">{t("Failed")}</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
</TableColumn>
</TableHeader>
<TableBody
items={items}
isLoading={loading}
loadingContent={<Spinner />}
emptyContent={t("No orders found")}
>
{(order) => (
<TableRow key={order.id}>
<TableCell>{formatDate(order.payment_state === 0 ? order.create_at : order.confirm_at)}</TableCell>
<TableCell>
<span
className={
order.order_type === "recharge"
? "text-green-500"
: "text-red-500"
}
>
{
order.order_type === "recharge" ? t("Recharge") : t("Purchase")
}
</span>
</TableCell>
<TableCell>{order.description}</TableCell>
<TableCell>
<span
className={
order.order_type === "recharge"
? "text-green-500"
: "text-red-500"
}
>
{formatAmount(order.amount)}
</span>
</TableCell>
<TableCell>{formatBalance(order.balance)}</TableCell>
<TableCell>
<Chip
className="capitalize"
color={getStatusColor(order.payment_state)}
size="sm"
variant="flat"
>
{t(
order.payment_state === 1
? "Completed"
: order.payment_state === 2
? "Failed"
: "Pending"
)}
</Chip>
</TableCell>
</TableRow>
)}
</TableBody>
</Table>
{pages > 1 && (
<div className="flex w-full justify-center">
<Pagination
showControls
color="primary"
variant="light"
page={currentPage}
total={pages}
onChange={onPageChange}
/>
</div>
)}
</div>
);
};
export default AccountBalanceTable;
@@ -32,6 +32,7 @@ interface AuthKeyDetailsProps {
interface ApiAnalyticsData {
stats_day: string;
call_tool_count: number;
amount: number;
}
// Custom cursor to highlight the hovered bar with a lighter and narrower overlay
@@ -76,7 +77,7 @@ const AuthKeyDetails: React.FC<AuthKeyDetailsProps> = ({
try {
setIsLoading(true);
const response = await fetchAPI(
`/api/stats/key_call_tool_count?apikey_id=${selectedApiKey.apikey_id}`,
`/api/stats/key_call_tool?apikey_id=${selectedApiKey.apikey_id}`,
{
method: "GET",
}
@@ -86,7 +87,8 @@ const AuthKeyDetails: React.FC<AuthKeyDetailsProps> = ({
const formattedData = response.data.days.map(
(day: ApiAnalyticsData) => ({
name: new Date(day.stats_day).toISOString().split("T")[0],
value: day.call_tool_count,
value: day.amount,
count: day.call_tool_count,
})
);
setAnalyticsData(formattedData);
@@ -101,7 +103,7 @@ const AuthKeyDetails: React.FC<AuthKeyDetailsProps> = ({
}, [selectedApiKey, t]);
useEffect(() => {
if (!selectedApiKey?.apikey_id) return
if (!selectedApiKey?.apikey_id) return;
fetchAnalyticsData();
}, [selectedApiKey?.apikey_id]);
@@ -163,7 +165,9 @@ const AuthKeyDetails: React.FC<AuthKeyDetailsProps> = ({
</div>
<div className="flex items-center gap-2 bg-gray-100 p-2 rounded relative justify-between">
<span className="overflow-hidden text-ellipsis whitespace-nowrap">{getEncryptedKey(selectedApiKey.apikey)}</span>
<span className="overflow-hidden text-ellipsis whitespace-nowrap">
{getEncryptedKey(selectedApiKey.apikey)}
</span>
<Button
isIconOnly
size="sm"
@@ -213,11 +217,14 @@ const AuthKeyDetails: React.FC<AuthKeyDetailsProps> = ({
axisLine={false}
tickLine={false}
tick={{ fontSize: 12, fill: "#666" }}
allowDecimals={false}
allowDecimals={true}
/>
<RechartsTooltip
cursor={<CustomCursor />}
formatter={(value: number) => [value, t("Times")]}
formatter={(value: number) => [
value,
t("Total Spending"),
]}
contentStyle={{
backgroundColor: "#fff",
border: "1px solid #e5e7eb",
@@ -53,6 +53,10 @@ const OverviewPage: React.FC = () => {
useEffect(() => {
fetchApiKeys();
if (sessionStorage.getItem('create_new_authorization')) {
handleNewKey();
sessionStorage.removeItem('create_new_authorization');
}
}, []);
// create new auth key
+40 -18
View File
@@ -11,8 +11,9 @@ import { formatCurrency } from "@/shared/utils/currency";
// Import dashboard content components
import DashboardOverview from "@/components/dashboard/DashboardOverview";
import WalletManagement from "@/components/wallet/WalletManagement";
import { Home, Key, Wallet } from "lucide-react";
import { Avatar, Card, CardBody, Button, Divider } from "@nextui-org/react";
import UserAccountBalance from "@/components/dashboard/UserAccountBalance";
import { Home, Key, Wallet, Rocket } from "lucide-react";
import { Avatar, Card, CardBody, Button, Divider, Link } from "@nextui-org/react";
import { RechargeModal } from "@/shared/components/modal/RechargeModal";
import { useTranslation } from "@/shared/lib/useTranslation";
import { ChangePasswordModal } from "@/components/common/ChangePasswordModal";
@@ -29,7 +30,7 @@ const DashboardContent: React.FC = () => {
state.user_token,
state.user,
]);
const { loginConfig } = usePlatformConfig();
const { loginConfig, paymentChannels } = usePlatformConfig();
const [logOut, useGetUser] = useGlobalStore((state) => [
state.logOut,
@@ -41,7 +42,7 @@ const DashboardContent: React.FC = () => {
const [isRechargeModalOpen, setIsRechargeModalOpen] = useState(false);
const getInitialTab = (): TabKey => {
const tabFromUrl = searchParams.get("tab") as TabKey;
if (tabFromUrl && [TabKey.OVERVIEW, TabKey.WALLET].includes(tabFromUrl)) {
if (tabFromUrl && [TabKey.OVERVIEW, TabKey.WALLET, TabKey.USER_ACCOUNT].includes(tabFromUrl)) {
return tabFromUrl;
}
return TabKey.OVERVIEW;
@@ -91,19 +92,30 @@ const DashboardContent: React.FC = () => {
label: "Dashboard",
description: "Manage your integration and auth key",
},
{
key: "publish-service",
icon: <Rocket className="w-5 h-5" />,
label: "Publish MCP Service",
description: "Submit your own MCP service",
},
];
const handleTabNavigate = (tab: TabKey) => {
setActiveTab(tab);
const handleTabNavigate = (tab: TabKey | string) => {
// 发布 MCP 服务:跳转到独立提交页
if (tab === "publish-service") {
router.push("/submit");
return;
}
setActiveTab(tab as TabKey);
// update url params
if (tab === TabKey.OVERVIEW) {
// when switch to dashboard, clear all query params, only keep base path
router.push("/dashboard", { scroll: false });
router.push("/console", { scroll: false });
} else {
// other tabs set corresponding tab params
const params = new URLSearchParams();
params.set("tab", tab);
router.push(`/dashboard?${params.toString()}`, { scroll: false });
router.push(`/console?${params.toString()}`, { scroll: false });
}
};
@@ -158,19 +170,28 @@ const DashboardContent: React.FC = () => {
<Wallet size={16} />
<span>
{t("Balance: {{amount}}", {
amount: formatCurrency(user?.wallet?.balance || 0),
})}
amount: "",
}).replace("{{amount}}", "")}
<Link
href="#"
className="text-xs cursor-pointer"
onPress={() => handleTabNavigate(TabKey.USER_ACCOUNT)}
>
{formatCurrency(user?.wallet?.balance || 0)}
</Link>
</span>
</div>
<Button
variant="bordered"
onPress={handleRecharge}
aria-label="Recharge wallet"
size="sm"
>
{t("Recharge")}
</Button>
{paymentChannels.length > 0 && (
<Button
variant="bordered"
onPress={handleRecharge}
aria-label="Recharge wallet"
size="sm"
>
{t("Recharge")}
</Button>
)}
</div>
</CardBody>
</Card>
@@ -185,6 +206,7 @@ const DashboardContent: React.FC = () => {
{activeTab === TabKey.WALLET && (
<WalletManagement onRecharge={() => setIsRechargeModalOpen(true)} />
)}
{activeTab === TabKey.USER_ACCOUNT && <UserAccountBalance />}
</div>
</div>
@@ -0,0 +1,23 @@
"use client";
import React from "react";
import { useTranslation } from "@/shared/lib/useTranslation";
import DashboardDemoContent from "@/shared/components/DashboardDemoContent";
import AccountBalanceTable from "./AccountBalanceTable";
const UserAccountBalance: React.FC = () => {
const { t } = useTranslation();
return (
<DashboardDemoContent
title={t("Account Balance")}
description={t("View your balance and transaction history")}
>
<div className="space-y-6 w-full">
<AccountBalanceTable source="client" />
</div>
</DashboardDemoContent>
);
};
export default UserAccountBalance;
@@ -3,8 +3,6 @@
import React, { useEffect, useState } from "react";
import {
Switch,
AccordionItem,
Accordion,
Select,
SelectItem,
Button,
@@ -21,7 +19,7 @@ interface EmailConfigFormProps {
emailConfig: EmailConfig;
onSave: (config: LoginConfig) => Promise<void>;
isLoading?: boolean;
onTabNavigate?: (tab: TabKey) => void;
onTabNavigate?: (tab: TabKey, subTab?: string) => void;
}
export const EmailConfigForm: React.FC<EmailConfigFormProps> = ({
@@ -72,139 +70,115 @@ export const EmailConfigForm: React.FC<EmailConfigFormProps> = ({
const isEmailEnabled = formData.email?.is_enabled || false;
return (
<Accordion
variant="splitted"
itemClasses={{
base: "shadow-none border-1",
}}
defaultExpandedKeys={["email-login"]}
className="px-0"
>
<AccordionItem
key="email-login"
title={
<div className="flex items-center gap-3">
<div className="flex flex-col">
<h3 className="text-lg font-semibold">{t("Email Login")}</h3>
<p className="text-sm text-gray-500">
{t("Configure email-based authentication")}
</p>
</div>
</div>
}
>
<div className="space-y-4">
{/* enable email login */}
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">
{t("Enable Email Login")}
</span>
<span className="text-xs text-gray-500">
{t("Allow users to sign in with email")}
</span>
</div>
<Switch
isSelected={isEmailEnabled}
onValueChange={handleToggleEnabled}
color="primary"
size="sm"
isDisabled={isLoading || (isCaptchaMode && !isEmailConfigured)}
/>
</div>
<div className="space-y-4">
{/* enable email login */}
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">{t("Enable Email Login")}</span>
<span className="text-xs text-gray-500">
{t("Allow users to sign in with email")}
</span>
</div>
<Switch
isSelected={isEmailEnabled}
onValueChange={handleToggleEnabled}
color="primary"
size="sm"
isDisabled={isLoading || (isCaptchaMode && !isEmailConfigured)}
/>
</div>
{/* authentication mode selection */}
<div className="p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
{/* authentication mode selection */}
<div className="p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">
{t("Authentication Mode")}
</span>
<span className="text-xs text-gray-500">
{t("Choose how users authenticate with email")}
</span>
</div>
<Select
selectedKeys={[formData.email?.mode || EmailMode.PASSWORD]}
onSelectionChange={(keys) => {
const mode = Array.from(keys)[0] as EmailMode;
handleModeChange(mode);
}}
size="sm"
isDisabled={isLoading || !isEmailEnabled}
renderValue={() => {
const selectedKey = formData.email?.mode || EmailMode.PASSWORD;
if (selectedKey === EmailMode.PASSWORD)
return t("Email/Password");
return t(
selectedKey === EmailMode.CAPTCHA
? "Email/Verification Code"
: "Email/Password"
);
}}
>
<SelectItem key={EmailMode.PASSWORD} value={EmailMode.PASSWORD}>
<div className="flex flex-col">
<span className="text-sm font-medium">
{t("Authentication Mode")}
{t("Email/Password")}
</span>
<span className="text-xs text-gray-500">
{t("Choose how users authenticate with email")}
{t("Traditional email and password authentication")}
</span>
</div>
<Select
selectedKeys={[formData.email?.mode || EmailMode.PASSWORD]}
onSelectionChange={(keys) => {
const mode = Array.from(keys)[0] as EmailMode;
handleModeChange(mode);
}}
size="sm"
isDisabled={isLoading || !isEmailEnabled}
renderValue={() => {
const selectedKey =
formData.email?.mode || EmailMode.PASSWORD;
if (selectedKey === EmailMode.PASSWORD)
return t("Email/Password");
return t(
selectedKey === EmailMode.CAPTCHA
? "Email/Verification Code"
: "Email/Password"
);
}}
>
<SelectItem key={EmailMode.PASSWORD} value={EmailMode.PASSWORD}>
<div className="flex flex-col">
<span className="text-sm font-medium">
{t("Email/Password")}
</span>
<span className="text-xs text-gray-500">
{t("Traditional email and password authentication")}
</span>
</div>
</SelectItem>
<SelectItem key={EmailMode.CAPTCHA} value={EmailMode.CAPTCHA}>
<div className="flex flex-col">
<span className="text-sm font-medium">
{t("Email/Verification Code")}
</span>
<span className="text-xs text-gray-500">
{t("Passwordless login with email verification code")}
</span>
</div>
</SelectItem>
</Select>
</div>
</div>
{/* email configuration hint - only show in captcha mode */}
{isEmailEnabled && isCaptchaMode && !isEmailConfigured && (
<Alert color="warning" variant="flat" className="mb-4">
<div className="flex gap-2">
<span>
{t(
"Email service is not configured. Please configure email settings first."
)}
</SelectItem>
<SelectItem key={EmailMode.CAPTCHA} value={EmailMode.CAPTCHA}>
<div className="flex flex-col">
<span className="text-sm font-medium">
{t("Email/Verification Code")}
</span>
<span className="text-xs text-gray-500">
{t("Passwordless login with email verification code")}
</span>
<Link
className="text-sm underline cursor-pointer"
onPress={() => {
onTabNavigate?.(TabKey.SYSTEM_SETTINGS);
}}
>
{t("Go to Settings")}
</Link>
</div>
</Alert>
)}
{/* save button - only show in enabled state */}
{isEmailEnabled && (
<div className="flex gap-3 py-4">
<Button
color="primary"
variant="solid"
onPress={handleSave}
isLoading={isLoading}
size="sm"
>
{t("Save")}
</Button>
</div>
)}
</SelectItem>
</Select>
</div>
</AccordionItem>
</Accordion>
</div>
{/* email configuration hint - only show in captcha mode */}
{isEmailEnabled && isCaptchaMode && !isEmailConfigured && (
<Alert color="warning" variant="flat" className="mb-4">
<div className="flex gap-2">
<span>
{t(
"SMTP is not configured. Please configure email settings first."
)}
</span>
{onTabNavigate ? (
<Link
className="text-sm underline cursor-pointer"
onPress={() => {
onTabNavigate?.(TabKey.SYSTEM_SETTINGS, "email-admin");
}}
>
{t("Go to Settings")}
</Link>
) : null}
</div>
</Alert>
)}
{/* save button - only show in enabled state */}
{isEmailEnabled && (
<div className="flex gap-3 py-4">
<Button
color="primary"
variant="solid"
onPress={handleSave}
isLoading={isLoading}
size="sm"
>
{t("Save")}
</Button>
</div>
)}
</div>
);
};
@@ -1,16 +1,10 @@
"use client";
import React, { useEffect, useState } from "react";
import {
Input,
Button,
Switch,
AccordionItem,
Accordion,
} from "@nextui-org/react";
import { Input, Button, Switch } from "@nextui-org/react";
import { Eye, EyeOff } from "lucide-react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { getGoogleRedirectUri } from "@/hooks/useLogin";
import { getGoogleRedirectUri } from "@/shared/hooks/useLogin";
import { GoogleAuthConfig } from "@/shared/types/system";
interface GoogleAuthConfigFormProps {
@@ -47,115 +41,94 @@ export const GoogleAuthConfigForm: React.FC<GoogleAuthConfigFormProps> = ({
const isFormValid = formData.client_id.trim() !== "";
return (
<Accordion
variant="splitted"
itemClasses={{
base: "shadow-none border-1",
}}
defaultExpandedKeys={["google-auth-config"]}
className="px-0"
>
<AccordionItem
key="google-auth-config"
title={
<div className="flex flex-col justify-between">
<h3 className="text-lg font-semibold">
{t("Google Login Settings")}
</h3>
<p className="text-sm text-gray-500">
{t("Configure Google OAuth integration")}
</p>
<>
<div className="space-y-4">
{/* enable google login */}
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">
{t("Enable Google Login")}
</span>
<span className="text-xs text-gray-500">
{t("Allow users to sign in with Google")}
</span>
</div>
}
>
<div className="space-y-4">
{/* enable google login */}
<div className="flex items-center justify-between p-4 bg-gray-50 rounded-lg">
<div className="flex flex-col gap-1">
<span className="text-sm font-medium">
{t("Enable Google Login")}
</span>
<span className="text-xs text-gray-500">
{t("Allow users to sign in with Google")}
</span>
</div>
<Switch
isSelected={formData.is_enabled}
onValueChange={(value) => {
onSave({
...formData,
is_enabled: value,
});
}}
color="primary"
size="sm"
/>
</div>
{/* Google Client ID */}
<Input
label={t("Google Client ID")}
placeholder={t("OAuth 2.0 Client ID from Google Cloud Console")}
value={formData.client_id}
onChange={(e) => handleInputChange("client_id", e.target.value)}
isRequired
isDisabled={!formData.is_enabled}
/>
{/* Google Client Secret */}
<Input
label={t("Google Client Secret")}
placeholder={t(
"OAuth 2.0 Client Secret (optional, for server-side verification)"
)}
value={formData.client_secret || ""}
onChange={(e) => handleInputChange("client_secret", e.target.value)}
type={showClientSecret ? "text" : "password"}
endContent={
<button
type="button"
onClick={() => setShowClientSecret(!showClientSecret)}
className="focus:outline-none"
disabled={!formData.is_enabled}
>
{showClientSecret ? (
<EyeOff className="w-4 h-4 text-gray-400" />
) : (
<Eye className="w-4 h-4 text-gray-400" />
)}
</button>
}
isDisabled={!formData.is_enabled}
/>
{/* Redirect URI */}
<Input
label={t("Redirect URI")}
placeholder="https://yourdomain.com/auth/google/callback"
description={t(
"Authorized redirect URI configured in Google Cloud Console"
)}
value={getGoogleRedirectUri()}
isDisabled={true}
<Switch
isSelected={formData.is_enabled}
onValueChange={(value) => {
onSave({
...formData,
is_enabled: value,
});
}}
color="primary"
size="sm"
/>
</div>
{/* Action Buttons */}
{formData.is_enabled && (
<div className="flex gap-3 py-4">
<Button
color="primary"
variant="solid"
onPress={handleSave}
isLoading={isLoading}
isDisabled={!isFormValid}
size="sm"
{/* Google Client ID */}
<Input
label={t("Google Client ID")}
placeholder={t("OAuth 2.0 Client ID from Google Cloud Console")}
value={formData.client_id}
onChange={(e) => handleInputChange("client_id", e.target.value)}
isRequired
isDisabled={!formData.is_enabled}
/>
{/* Google Client Secret */}
<Input
label={t("Google Client Secret")}
placeholder={t(
"OAuth 2.0 Client Secret (optional, for server-side verification)"
)}
value={formData.client_secret || ""}
onChange={(e) => handleInputChange("client_secret", e.target.value)}
type={showClientSecret ? "text" : "password"}
endContent={
<button
type="button"
onClick={() => setShowClientSecret(!showClientSecret)}
className="focus:outline-none"
disabled={!formData.is_enabled}
>
{t("Save")}
</Button>
</div>
)}
</AccordionItem>
</Accordion>
{showClientSecret ? (
<EyeOff className="w-4 h-4 text-gray-400" />
) : (
<Eye className="w-4 h-4 text-gray-400" />
)}
</button>
}
isDisabled={!formData.is_enabled}
/>
{/* Redirect URI */}
<Input
label={t("Redirect URI")}
placeholder="https://yourdomain.com/auth/google/callback"
description={t(
"Authorized redirect URI configured in Google Cloud Console"
)}
value={getGoogleRedirectUri()}
isDisabled={true}
/>
</div>
{/* Action Buttons */}
{formData.is_enabled && (
<div className="flex gap-3 py-4">
<Button
color="primary"
variant="solid"
onPress={handleSave}
isLoading={isLoading}
isDisabled={!isFormValid}
size="sm"
>
{t("Save")}
</Button>
</div>
)}
</>
);
};
@@ -0,0 +1,58 @@
"use client";
import React from "react";
import { Accordion, AccordionItem } from "@nextui-org/react";
import { Plus } from "lucide-react";
import { useTranslation } from "@/shared/lib/useTranslation";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
function FaqClient() {
const { faqItems } = usePlatformConfig();
const { t } = useTranslation();
// Custom indicator component with plus sign that fades out when expanded
const CustomIndicator = ({ isOpen }: { isOpen?: boolean }) => (
<Plus
className={`text-black transition-all duration-300 ${
isOpen ? "rotate-0 opacity-0" : "rotate-0 opacity-100"
}`}
size={16}
/>
);
if (faqItems.length === 0) return null;
return (
<section className="py-12 sm:py-20 px-4 sm:px-6" id="faqs">
<div className="max-w-7xl mx-auto">
<h2 className="text-2xl sm:text-3xl font-bold mb-8 sm:mb-12 text-center">
{t("FAQs")}
</h2>
{/**content */}
<div className="relative bg-white rounded-lg">
<Accordion variant="light">
{faqItems.map((faq, index) => (
<AccordionItem
key={index}
aria-label={faq.question}
title={
<span className="text-base sm:text-lg font-medium">
{faq.question}
</span>
}
className="pt-2 px-2"
indicator={({ isOpen }) => <CustomIndicator isOpen={isOpen} />}
>
<div className="text-sm sm:text-base text-foreground-600 leading-relaxed space-y-2">
{faq.answer}
</div>
</AccordionItem>
))}
</Accordion>
</div>
</div>
</section>
);
}
export function Faq() {
return <FaqClient />;
}
+47 -10
View File
@@ -4,12 +4,19 @@ import React, { useState, useEffect } from "react";
import { useRouter } from "next/navigation";
import { HeroSection } from "../../shared/components/marketplace/HeroSection";
import { ServiceListSection } from "@/shared/components/marketplace/ServiceListSection";
import { TagFilter } from "@/shared/components/marketplace/TagFilter";
import { ServiceData } from "@/shared/types/marketplace";
import { fetchServices } from "@/services/marketplaceService";
import { Spinner } from "@nextui-org/react";
import { ThemeType } from "@/shared/types/system";
interface MarketplaceMainProps {
initialServices: ServiceData[];
availableTags: string[];
isTagBarDisplay: boolean;
selectedTag: string;
setSelectedTag: (tag: string) => void;
currentTheme: ThemeType;
initialTotal: number;
initialPage: number;
initialSearch: string;
@@ -19,6 +26,11 @@ interface MarketplaceMainProps {
export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
initialServices,
availableTags,
isTagBarDisplay,
selectedTag,
setSelectedTag,
currentTheme,
initialTotal,
initialPage,
initialSearch,
@@ -33,21 +45,23 @@ export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
const [total, setTotal] = useState(initialTotal);
const [loading, setLoading] = useState(false);
// load services data
const loadServices = async (page: number, search: string) => {
const loadServices = async (page: number, search: string, tag: string = "ALL") => {
try {
setLoading(true);
const result = await fetchServices({
page,
page_size: pageSize,
keyword: search,
// 如果需要,可以在这里添加tag参数传递给API
tag: tag !== "ALL" ? tag : undefined,
});
setServices(result.data.services);
setTotal(result.page.total);
setCurrentPage(page);
} catch (error) {
console.error('Failed to load services:', error);
console.error("Failed to load servers:", error);
} finally {
setLoading(false);
}
@@ -55,7 +69,7 @@ export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
// when search query changes, scroll to the top of the page
useEffect(() => {
window.scrollTo({ top: 0, behavior: 'smooth' });
window.scrollTo({ top: 0, behavior: "smooth" });
}, [currentPage, searchQuery]);
// update URL parameters
@@ -63,11 +77,11 @@ export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
const params = new URLSearchParams();
if (page > 1) {
params.set('page', page.toString());
params.set("page", page.toString());
}
if (search.trim()) {
params.set('search', search.trim());
params.set("search", search.trim());
}
const queryString = params.toString();
@@ -79,13 +93,20 @@ export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
// when page number changes, reload
const handlePageChange = (page: number) => {
updateURL(page, searchQuery);
loadServices(page, searchQuery);
loadServices(page, searchQuery, selectedTag);
};
// handle search submit
const handleSearch = () => {
updateURL(1, searchQuery);
loadServices(1, searchQuery);
loadServices(1, searchQuery, selectedTag);
};
// handle tag change
const handleTagChange = (tag: string) => {
setSelectedTag(tag);
setCurrentPage(1);
loadServices(1, searchQuery, tag);
};
// if there is an error, show error message
@@ -102,11 +123,27 @@ export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
{/* Hero Section */}
<HeroSection
searchQuery={searchQuery}
isTagBarDisplay={isTagBarDisplay}
onSearchChange={setSearchQuery}
onSearch={handleSearch}
/>
{/* filter section */}
{
isTagBarDisplay && (
<>
<TagFilter
theme={currentTheme}
tags={availableTags}
selectedTag={selectedTag}
onTagChange={handleTagChange}
maxWidthPercent={80}
/>
</>
)
}
{/* Service List Section */}
{/* Server List Section */}
{loading ? (
<div className="mx-auto h-[200px] flex items-center justify-center">
<Spinner />
@@ -122,4 +159,4 @@ export const MarketplaceMain: React.FC<MarketplaceMainProps> = ({
)}
</>
);
};
};
@@ -1,133 +0,0 @@
"use client";
import React from 'react';
import {
Input,
Select,
SelectItem,
Chip,
} from '@nextui-org/react';
import { useTranslation } from '@/shared/lib/useTranslation';
import { AuthMethod, MCPServiceFormData } from '@/types/mcp-service';
interface BasicInfoTabProps {
formData: MCPServiceFormData;
newTag: string;
setNewTag: (value: string) => void;
onInputChange: (field: keyof MCPServiceFormData, value: any) => void;
onAddTag: () => void;
onRemoveTag: (tag: string) => void;
}
export const BasicInfoTab: React.FC<BasicInfoTabProps> = ({
formData,
newTag,
setNewTag,
onInputChange,
onAddTag,
onRemoveTag
}) => {
const { t } = useTranslation();
return (
<div className="space-y-4">
<Input
label={t('Service Name')}
placeholder={t('Enter service name')}
value={formData.name}
onChange={(e) => onInputChange('name', e.target.value)}
isRequired
/>
<Input
label={t('Short Description')}
placeholder={t('Brief description of the service')}
value={formData.short_description || ''}
onChange={(e) => onInputChange('short_description', e.target.value)}
isRequired
/>
<Input
label={t('API Endpoint')}
placeholder="https://api.example.com/v1"
value={formData.base_url || ''}
onChange={(e) => onInputChange('base_url', e.target.value)}
isRequired
/>
<Select
label={t('Authentication Type')}
selectedKeys={formData.auth_method ? [formData.auth_method] : []}
onSelectionChange={(keys) => {
const selectedKey = Array.from(keys)[0] as string;
onInputChange('auth_method', selectedKey);
// clear auth config when switch auth type
onInputChange('auth_header', '');
onInputChange('auth_token', '');
}}
>
<SelectItem key="none" value={AuthMethod.None}>{t('None')}</SelectItem>
<SelectItem key="apikey" value={AuthMethod.APIKey}>{t('API Key')}</SelectItem>
<SelectItem key="token" value={AuthMethod.BearerToken}>{t('Bearer Token')}</SelectItem>
</Select>
{/* auth config input fields */}
{formData.auth_method === AuthMethod.APIKey && (
<div className="space-y-4">
<Input
label={t('API Key Header Name')}
placeholder="X-API-Key"
value={formData.auth_header || ''}
onChange={(e) => onInputChange('auth_header', e.target.value)}
description={t('The header name for the API key (e.g., X-API-Key, Authorization)')}
/>
<Input
label={t('API Key Value')}
placeholder={t('Enter API key')}
type="password"
value={formData.auth_token || ''}
onChange={(e) => onInputChange('auth_token', e.target.value)}
autoComplete='new-password'
/>
</div>
)}
{formData.auth_method === AuthMethod.BearerToken && (
<Input
label={t('Bearer Token')}
placeholder={t('Enter bearer token')}
type="password"
value={formData.auth_token || ''}
onChange={(e) => onInputChange('auth_token', e.target.value)}
description={t('The bearer token for authentication')}
autoComplete='new-password'
/>
)}
{/* tag management */}
<div className="space-y-2">
<label className="text-sm font-medium">{t('Tags')}</label>
<div className="flex gap-2">
<Input
placeholder={t('Add tag')}
value={newTag}
onChange={(e) => setNewTag(e.target.value)}
onKeyUp={(e) => e.key === 'Enter' && onAddTag()}
/>
</div>
<div className="flex flex-wrap gap-2">
{(formData.tags || []).map((tag, index) => (
<Chip
key={index}
onClose={() => onRemoveTag(tag)}
variant="flat"
>
{tag}
</Chip>
))}
</div>
</div>
</div>
);
};
@@ -1,41 +1,54 @@
"use client";
import React, { useState, useCallback, useEffect } from "react";
import { useRouter, useSearchParams } from "next/navigation";
import React, { useState, useCallback, useEffect, useRef } from "react";
import { useSearchParams } from "next/navigation";
import { useMCPServicesList } from "@/hooks/useMCPServicesList";
import { MCPService, MCPServiceFormData, EnabledEnum } from "@/types/mcp-service";
import { MCPService, MCPServiceFormData } from "@/shared/types/mcp-service";
import { useTranslation } from "@/shared/lib/useTranslation";
import { ServiceFiltersBar } from "./ServiceFiltersBar";
import { ServiceTable } from "./ServiceTable";
import { ServiceEditPage } from "./ServiceEditPage";
import { OpenAPIGeneratorModal } from "./OpenAPIGeneratorModal";
import { ServiceFiltersBar } from "@/shared/components/mcp-services/ServiceFiltersBar";
import { ServiceEditPage } from "@/components/mcp-services/ServiceEditPage";
import { DeleteConfirmModal } from "@/shared/components/modal/DeleteConfirmModal";
import DashboardDemoContent from "@/shared/components/DashboardDemoContent";
import { ServiceTable } from "@/shared/components/mcp-services/ServiceTable";
import { OpenAPIGeneratorModal } from "@/shared/components/mcp-services/OpenAPIGeneratorModal";
import { Input } from "@nextui-org/react";
import { Search } from "lucide-react";
type ViewMode = "list" | "edit" | "create";
export const MCPServicesManagement: React.FC = () => {
const { t } = useTranslation();
const router = useRouter();
const searchParams = useSearchParams();
const {
services,
loading,
pagination,
searchTerm,
setSearchTerm,
statusFilter,
setStatusFilter,
onPageChange,
createService,
updateService,
deleteService,
toggleServiceStatus,
parseOpenAPIDocument,
loadServices
loadServices,
setSearchTerm,
setStatusFilter,
} = useMCPServicesList();
const [addServiceType, setAddServiceType] = useState<string | null>(null);
// 搜索相关状态
const [searchValue, setSearchValue] = useState('');
const searchTimerRef = useRef<NodeJS.Timeout | null>(null);
// 清理定时器
useEffect(() => {
return () => {
if (searchTimerRef.current) {
clearTimeout(searchTimerRef.current);
}
};
}, []);
// Get initial state from URL
const getInitialViewMode = (): ViewMode => {
@@ -57,26 +70,29 @@ export const MCPServicesManagement: React.FC = () => {
);
// Update URL when view mode or service ID changes
const updateURL = useCallback((mode: ViewMode, serviceId?: string | null) => {
const params = new URLSearchParams(searchParams);
const updateURL = useCallback(
(mode: ViewMode, serviceId?: string | null) => {
const params = new URLSearchParams(searchParams);
// Always keep the tab parameter
params.set("tab", "mcp-services");
// Always keep the tab parameter
params.set("tab", "mcp-services");
if (mode === "list") {
params.delete("mode");
params.delete("serviceId");
} else {
params.set("mode", mode);
if (serviceId) {
params.set("serviceId", serviceId);
} else {
if (mode === "list") {
params.delete("mode");
params.delete("serviceId");
} else {
params.set("mode", mode);
if (serviceId) {
params.set("serviceId", serviceId);
} else {
params.delete("serviceId");
}
}
}
router.push(`/console?${params.toString()}`, { scroll: false });
}, [router, searchParams]);
window.history.pushState({}, "", `/admin/console?${params.toString()}`);
},
[searchParams]
);
// Sync state with URL on mount and URL changes
useEffect(() => {
@@ -94,29 +110,38 @@ export const MCPServicesManagement: React.FC = () => {
null
);
// Service CRUD operations
const handleCreateService = useCallback(() => {
setSelectedServiceId(null);
setViewMode("create");
updateURL("create");
}, [updateURL]);
// Server CRUD operations
const handleCreateService = (type: string) => {
setAddServiceType(type);
setIsOpenAPIModalOpen(true);
};
const handleEditService = useCallback((service: MCPService) => {
setSelectedServiceId(service.id);
setViewMode("edit");
updateURL("edit", service.id);
}, [updateURL]);
const handleEditService = useCallback(
(service: MCPService) => {
setSelectedServiceId(service.id);
setViewMode("edit");
updateURL("edit", service.id);
},
[updateURL]
);
const handleSaveService = useCallback(
async (formData: MCPServiceFormData) => {
async (formData: MCPServiceFormData, isDraft?: boolean) => {
try {
const result = selectedServiceId ? await updateService(selectedServiceId, formData) : await createService(formData);
if (!result) return
const result = selectedServiceId
? await updateService(selectedServiceId, formData)
: await createService(formData);
if (!result) return false;
if (isDraft) {
return true;
}
setViewMode("list");
setSelectedServiceId(null);
updateURL("list");
return true;
} catch (error) {
console.error("Failed to save service:", error);
console.error("Failed to save server:", error);
return false;
}
},
[selectedServiceId, updateService, createService, updateURL]
@@ -140,28 +165,22 @@ export const MCPServicesManagement: React.FC = () => {
setIsDeleteModalOpen(false);
setServiceToDelete(null);
} catch (error) {
console.error("Failed to delete service:", error);
console.error("Failed to delete server:", error);
}
}
}, [serviceToDelete, deleteService]);
const handleToggleStatus = useCallback(
async (service: MCPService) => {
async (serviceId: string) => {
try {
await toggleServiceStatus(service.id);
await toggleServiceStatus(serviceId);
} catch (error) {
console.error("Failed to toggle service status:", error);
console.error("Failed to toggle server status:", error);
}
},
[toggleServiceStatus]
);
// OpenAPI operations
const handleOpenAPIGenerate = useCallback(() => {
setIsOpenAPIModalOpen(true);
}, []);
const handleEditGeneratedService = useCallback(
async (serviceId: string) => {
try {
@@ -172,7 +191,7 @@ export const MCPServicesManagement: React.FC = () => {
setIsOpenAPIModalOpen(false);
loadServices(1);
} catch (error) {
console.error("Failed to navigate to generated service:", error);
console.error("Failed to navigate to generated server:", error);
}
},
[updateURL]
@@ -188,6 +207,26 @@ export const MCPServicesManagement: React.FC = () => {
setServiceToDelete(null);
}, []);
// 处理搜索 - 使用防抖
const handleSearchChange = useCallback((value: string) => {
setSearchValue(value);
// 清除之前的定时器
if (searchTimerRef.current) {
clearTimeout(searchTimerRef.current);
}
// 设置新的定时器,500ms 后触发搜索
searchTimerRef.current = setTimeout(() => {
setSearchTerm(value);
}, 500);
}, [setSearchTerm]);
// 处理状态筛选
const handleStatusFilterChange = useCallback((status: string) => {
setStatusFilter(status);
}, [setStatusFilter]);
// Render edit page if in edit/create mode
if (viewMode === "edit" || viewMode === "create") {
return (
@@ -196,31 +235,45 @@ export const MCPServicesManagement: React.FC = () => {
onSave={handleSaveService}
onCancel={handleCancelEdit}
loading={loading}
onUnpublish={handleToggleStatus}
onRefreshList={() => {
loadServices(1);
}}
/>
);
}
return (
<DashboardDemoContent
title="MCP Services"
description="Manage your MCP services, configure APIs, and monitor service status"
title={t("MCP")}
description={t(
"Manage your MCP servers, configure APIs, and monitor server status"
)}
>
<div className="space-y-6 w-full">
{/* comming soon:Filters and Actions */}
<ServiceFiltersBar
filters={{
search: searchTerm,
status: statusFilter,
}}
onFiltersChange={(filters) => {
setSearchTerm(filters.search);
setStatusFilter(filters.status);
}}
onAddService={handleCreateService}
onImportOpenAPI={handleOpenAPIGenerate}
/>
{/* Filters and Actions */}
<div className="flex justify-between items-center gap-4">
<ServiceFiltersBar onAddService={handleCreateService} />
{/* 搜索框 - 右侧 */}
<Input
isClearable
className="w-full sm:max-w-[400px]"
placeholder={t('Search by service name')}
startContent={<Search className="w-4 h-4" />}
value={searchValue}
onClear={() => {
setSearchValue('');
if (searchTimerRef.current) {
clearTimeout(searchTimerRef.current);
}
setSearchTerm('');
}}
onValueChange={handleSearchChange}
/>
</div>
{/* Services Table */}
{/* Servers Table */}
<ServiceTable
services={services}
loading={loading}
@@ -229,28 +282,31 @@ export const MCPServicesManagement: React.FC = () => {
onDelete={handleDeleteService}
onToggleStatus={handleToggleStatus}
onPageChange={onPageChange}
onStatusFilterChange={handleStatusFilterChange}
/>
{/* Modals */}
{
isOpenAPIModalOpen && (
<OpenAPIGeneratorModal
isOpen={true}
onClose={handleCloseOpenAPIModal}
onGenerate={parseOpenAPIDocument}
onEditGenerated={handleEditGeneratedService}
/>
)
}
{isOpenAPIModalOpen && (
<OpenAPIGeneratorModal
isOpen={true}
onClose={handleCloseOpenAPIModal}
onGenerate={parseOpenAPIDocument}
onEditGenerated={handleEditGeneratedService}
serverType={addServiceType || "openapi"}
/>
)}
<DeleteConfirmModal
isOpen={isDeleteModalOpen}
onClose={handleCloseDeleteModal}
onConfirm={handleConfirmDelete}
title={t('Confirm Delete')}
description={t('Are you sure you want to delete this "{{name}}" service?', {
name: serviceToDelete?.name || "",
})}
title={t("Confirm Delete")}
description={t(
'Are you sure you want to delete this "{{name}}" server?',
{
name: serviceToDelete?.name || "",
}
)}
/>
</div>
</DashboardDemoContent>
@@ -1,69 +0,0 @@
"use client";
import React from 'react';
import {
Input,
Select,
SelectItem,
} from '@nextui-org/react';
import { useTranslation } from '@/shared/lib/useTranslation';
import { MCPServiceFormData } from '@/types/mcp-service';
import { getCurrencySymbol } from '@/shared/utils/currency';
import { ChargeType } from '@/shared/types/marketplace';
interface PricingTabProps {
formData: MCPServiceFormData;
onInputChange: (field: keyof MCPServiceFormData, value: any) => void;
}
export const PricingTab: React.FC<PricingTabProps> = ({
formData,
onInputChange
}) => {
const { t } = useTranslation();
return (
<div className="space-y-4">
<Select
label={t('Charge Type')}
selectedKeys={formData.charge_type ? [formData.charge_type] : []}
onSelectionChange={(keys) => {
const selectedKey = Array.from(keys)[0] as string;
onInputChange('charge_type', selectedKey);
}}
renderValue={() => {
const selectedKey = formData.charge_type || ChargeType.PerCall;
if (selectedKey === ChargeType.Free) return t('Free');
return t(selectedKey === ChargeType.PerCall ? 'Per Call' : 'Per Token');
}}
>
<SelectItem key="free" value={ChargeType.Free}>
<div className="flex flex-col">
<span>{t('Free')}</span>
<span className="text-xs text-gray-500">{t('No charge for API calls')}</span>
</div>
</SelectItem>
<SelectItem key="per_call" value={ChargeType.PerCall}>
<div className="flex flex-col">
<span>{t('Per Call')}</span>
<span className="text-xs text-gray-500">{t('Fixed price per API call')}</span>
</div>
</SelectItem>
</Select>
{formData.charge_type !== ChargeType.Free && (
<Input
label={t('Price')}
type="number"
min="0"
step="0.01"
value={formData.price || ''}
onChange={(e) => onInputChange('price', e.target.value)}
description={t('Price per unit (call or token)')}
startContent={<span className="text-gray-500 leading-[20px]">{getCurrencySymbol()}</span>}
/>
)}
</div>
);
};
@@ -1,50 +1,115 @@
"use client";
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect } from "react";
import { Button, Tabs, Tab, Spinner } from "@nextui-org/react";
import { ChevronLeftIcon } from "lucide-react";
import { useTranslation } from "@/shared/lib/useTranslation";
import {
Button,
Tabs,
Tab,
Spinner,
} from '@nextui-org/react';
import { ChevronLeftIcon } from 'lucide-react';
import { useTranslation } from '@/shared/lib/useTranslation';
import { AuthMethod, MCPServiceFormData } from '@/types/mcp-service';
AuthMethod,
EnabledEnum,
MCPServiceFormData,
} from "@/shared/types/mcp-service";
import { useMCPServiceDetail } from "@/hooks/useMCPServiceDetail";
import { BasicInfoTab } from './BasicInfoTab';
import { PricingTab } from './PricingTab';
import { DescriptionTab } from './DescriptionTab';
import { ToolsTab } from './ToolsTab';
import { OpenAPIGeneratorModal } from './OpenAPIGeneratorModal';
import { ChargeType } from '@/shared/types/marketplace';
import { BasicInfoTab } from "@/shared/components/mcp-services/BasicInfoTab";
import { PricingTab } from "@/shared/components/mcp-services/PricingTab";
import { DescriptionTab } from "@/shared/components/mcp-services/DescriptionTab";
import { ToolsTab } from "@/shared/components/mcp-services/ToolsTab";
import { OpenAPIGeneratorModal } from "@/shared/components/mcp-services/OpenAPIGeneratorModal";
import { ChargeType } from "@/shared/types/marketplace";
import { withComponentInjection } from "@/shared/hooks/useComponentInjection";
import ResourceGroup from "@/shared/components/mcp-services/ResourceGroup";
const _DefaultFormData: MCPServiceFormData = {
id: '',
name: '',
short_description: '',
long_description: '',
base_url: '',
id: "",
name: "",
short_description: "",
long_description: "",
base_url: "",
auth_method: AuthMethod.None,
auth_header: '',
auth_token: '',
auth_header: "",
auth_token: "",
charge_type: ChargeType.Free,
price: '',
price: "",
free_daily_limit: "",
enabled: 0,
tags: [],
apis: []
}
apis: [],
};
// Helper function to validate URL
const isValidUrl = (url: string) => {
if (!url) return false;
try {
const parsed = new URL(url);
return parsed.protocol === "http:" || parsed.protocol === "https:";
} catch {
return false;
}
};
// Helper function to validate domain format (allow domain or IP address including LAN IPs)
const isValidDomain = (url: string) => {
if (!url) return false;
try {
const parsed = new URL(url);
const hostname = parsed.hostname;
// Allow IPv4 addresses (including private/lan IPs like 192.168.x.x, 10.x.x.x, 172.x.x.x)
const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
if (ipv4Regex.test(hostname)) return true;
// Allow IPv6 (simplified)
if (hostname.includes(":")) return true;
// Domain format
const domainRegex = /^(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,})$/;
return domainRegex.test(hostname);
} catch {
return false;
}
};
const validateServiceForm = (data: MCPServiceFormData, t: any) => {
const errors: Record<string, string> = {};
if (!data.slug_name?.trim()) {
errors.slug_name = t("Server ID is required");
} else if (data.slug_name.length > 255) {
errors.slug_name = t("Server ID must be less than 255 characters");
}
if (!data.name?.trim()) {
errors.name = t("Server name is required");
} else if (data.name.length > 255) {
errors.name = t("Server Name must be less than 255 characters");
}
if (!data.base_url?.trim()) {
errors.base_url = t("API Endpoint is required");
} else if (!isValidUrl(data.base_url)) {
errors.base_url = t("API Endpoint must be a valid HTTP/HTTPS URL");
} else if (!isValidDomain(data.base_url)) {
errors.base_url = t("API Endpoint must contain a valid domain name");
}
if (!data.short_description?.trim()) {
errors.short_description = t("Short description is required");
}
return errors;
};
interface ServiceEditPageProps {
serviceId?: string;
onSave: (data: MCPServiceFormData) => void;
onSave: (data: MCPServiceFormData, isDraft?: boolean) => void;
onCancel: () => void;
loading?: boolean;
onUnpublish?: (serviceId: string) => void;
onRefreshList?: () => void;
}
export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
const BaseServiceEditPage: React.FC<ServiceEditPageProps> = ({
serviceId,
onSave,
onCancel,
loading = false
loading = false,
}) => {
const { t } = useTranslation();
const isEditing = !!serviceId;
@@ -54,19 +119,24 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
serviceDetail: service,
detailLoading: dataLoading,
getServiceDetail,
clearServiceDetail
clearServiceDetail,
parseOpenAPIDocumentForUpdate,
fetchMCPResourceGroups,
deleteResourceGroup,
addServiceToGroup,
updateLoading,
} = useMCPServiceDetail();
const [isSaving, setIsSaving] = useState(false);
const [isDraft, setIsDraft] = useState(false);
// use services list hook for OpenAPI update
const { parseOpenAPIDocumentForUpdate, updateLoading } = useMCPServiceDetail();
const [formData, setFormData] = useState<MCPServiceFormData>(_DefaultFormData);
const [newTag, setNewTag] = useState('');
const [formData, setFormData] =
useState<MCPServiceFormData>(_DefaultFormData);
const [newTag, setNewTag] = useState("");
// OpenAPI modal state
const [isOpenAPIModalOpen, setIsOpenAPIModalOpen] = useState(false);
// get service detail
// get server detail
useEffect(() => {
if (serviceId) {
getServiceDetail(serviceId);
@@ -80,42 +150,70 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
// when service data loaded, fill form
useEffect(() => {
if (!serviceId || !service) return
if (!serviceId || !service) return;
setFormData({
...formData,
...service
...service,
});
}, [service, serviceId]);
const handleInputChange = (field: keyof MCPServiceFormData, value: any) => {
setFormData(prev => ({
setFormData((prev) => ({
...prev,
[field]: value
[field]: value,
}));
};
const handleAddTag = () => {
if (newTag.trim() && !(formData.tags || []).includes(newTag.trim())) {
setFormData(prev => ({
setFormData((prev) => ({
...prev,
tags: [...(prev.tags || []), newTag.trim()]
tags: [...(prev.tags || []), newTag.trim()],
}));
setNewTag('');
setNewTag("");
}
};
const handleRemoveTag = (tagToRemove: string) => {
setFormData(prev => ({
setFormData((prev) => ({
...prev,
tags: (prev.tags || []).filter(tag => tag !== tagToRemove)
tags: (prev.tags || []).filter((tag) => tag !== tagToRemove),
}));
};
const handleSubmit = () => {
onSave(formData);
const handleSubmit = async (enabled?: EnabledEnum) => {
// Check if slug_name has been modified
const isSlugNameChanged =
isEditing &&
service?.slug_name &&
formData.slug_name !== service.slug_name;
if (isSlugNameChanged) {
const confirmed = window.confirm(
t(
"You have modified the Server ID. This will affect the MCP access URL and may break existing integrations. Are you sure you want to continue?"
)
);
if (!confirmed) {
return;
}
}
// Proceed with save
setIsSaving(true);
const isDraft =
service?.enabled === EnabledEnum.Offline && enabled === undefined;
setIsDraft(isDraft);
await onSave(
{
...formData,
headers: formData.headers?.filter((header) => header.name !== ""),
...(enabled !== undefined ? { enabled } : {}),
},
isDraft
);
setIsSaving(false);
setIsDraft(false);
};
// OpenAPI update handlers
@@ -127,19 +225,26 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
setIsOpenAPIModalOpen(false);
};
const handleOpenAPIGenerate = async (url?: string, file?: File): Promise<{ service_id: string }> => {
const handleOpenAPIGenerate = async (
url?: string,
file?: File
): Promise<{ service_id: string }> => {
if (!serviceId) {
throw new Error('Service ID is required for update');
throw new Error("Server ID is required for update");
}
try {
const updatedService = await parseOpenAPIDocumentForUpdate(serviceId, url, file);
const updatedService = await parseOpenAPIDocumentForUpdate(
serviceId,
url,
file
);
// update form data
setFormData({
...formData,
...updatedService,
update_type: 'openapi'
update_type: "openapi",
});
// close modal
@@ -148,24 +253,46 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
// return service_id format to compatible with OpenAPIGeneratorModal
return { service_id: updatedService.id };
} catch (error) {
console.error('OpenAPI update failed:', error);
console.error("OpenAPI update failed:", error);
throw error;
}
};
// Helper function to validate price string
const isValidPrice = (priceStr: string | undefined): boolean => {
if (!priceStr || priceStr.trim() === "") {
return false;
}
const numValue = parseFloat(priceStr);
return !isNaN(numValue) && numValue >= 0;
};
const validationErrors = validateServiceForm(formData, t);
const isFormValid = () => {
const hasBasicInfo = formData.name.trim() && formData.short_description?.trim();
if (Object.keys(validationErrors).length > 0) {
return false;
}
// if free, no need to validate price
if (formData.charge_type === ChargeType.Free) {
return hasBasicInfo;
return true;
}
// if PerCall, validate price
if (formData.charge_type === ChargeType.PerCall) {
return isValidPrice(formData.price);
}
// if PerToken, validate both input and output token prices
if (formData.charge_type === ChargeType.PerToken) {
return (
isValidPrice(formData.input_token_price) &&
isValidPrice(formData.output_token_price)
);
}
// if paid, need to validate price
return hasBasicInfo &&
formData.price !== undefined &&
formData.price.trim() !== '';
return formData.price !== undefined && formData.price.trim() !== "";
};
return (
@@ -173,16 +300,11 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
{/* page title */}
<div className="flex items-center justify-between mb-6 px-8">
<div className="flex items-center gap-3">
<Button
isIconOnly
onPress={onCancel}
variant='flat'
size='sm'
>
<Button isIconOnly onPress={onCancel} variant="flat" size="sm">
<ChevronLeftIcon className="w-5 h-5" />
</Button>
<h1 className="text-2xl font-bold">
{isEditing ? t('Service Detail') : t('Create New Service')}
{isEditing ? t("Server Detail") : t("Create New Server")}
</h1>
</div>
<div className="flex items-center gap-2">
@@ -192,20 +314,39 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
onPress={handleOpenAPIUpdate}
isDisabled={loading || dataLoading || updateLoading}
isLoading={updateLoading}
size='sm'
size="sm"
>
{t('Update from OpenAPI')}
{t("Update from OpenAPI")}
</Button>
)}
<Button
color="primary"
onPress={handleSubmit}
isDisabled={!isFormValid() || loading || dataLoading || updateLoading}
isLoading={updateLoading}
size='sm'
onPress={() => handleSubmit()}
isDisabled={
!isFormValid() || loading || dataLoading || updateLoading
}
isLoading={
isSaving && (isDraft || service?.enabled !== EnabledEnum.Offline)
}
size="sm"
>
{t('Save')}
{service?.enabled === EnabledEnum.Offline
? t("Save Draft")
: t("Save")}
</Button>
{service?.enabled === EnabledEnum.Offline && (
<Button
color="success"
onPress={() => handleSubmit(EnabledEnum.Online)}
isDisabled={
!isFormValid() || loading || dataLoading || updateLoading
}
isLoading={isSaving && !isDraft}
size="sm"
>
{t("Publish")}
</Button>
)}
</div>
</div>
@@ -214,7 +355,7 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
<div className="flex-1 flex items-center justify-center">
<div className="flex flex-col items-center gap-4">
<Spinner size="lg" />
<p className="text-gray-600">{t('Loading service data...')}</p>
<p className="text-gray-600">{t("Loading server data...")}</p>
</div>
</div>
)}
@@ -222,17 +363,17 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
{/* form content */}
{!dataLoading && (
<Tabs
aria-label="Service edit tabs"
variant='bordered'
color='primary'
aria-label="Server edit tabs"
variant="bordered"
color="primary"
classNames={{
panel: "flex-1 overflow-y-auto px-8"
panel: "flex-1 overflow-y-auto px-8",
}}
className=' px-8'
className=" px-8"
>
<Tab key="basic" title={t('Basic Information')}>
<Tab key="basic" title={t("Basic Information")}>
<div className="pt-2 flex gap-4">
<div className='flex-1'>
<div className="flex-1">
<BasicInfoTab
formData={formData}
newTag={newTag}
@@ -240,9 +381,10 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
onInputChange={handleInputChange}
onAddTag={handleAddTag}
onRemoveTag={handleRemoveTag}
errors={validationErrors}
/>
</div>
<div className='w-[400px] max-w-[1/2]'>
<div className="w-[400px] max-w-[1/2]">
<PricingTab
formData={formData}
onInputChange={handleInputChange}
@@ -251,16 +393,13 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
</div>
</Tab>
<Tab key="tools" title={t('Tools Management')}>
<Tab key="tools" title={t("Tools Management")}>
<div className="pt-2">
<ToolsTab
formData={formData}
onInputChange={handleInputChange}
/>
<ToolsTab formData={formData} onInputChange={handleInputChange} />
</div>
</Tab>
<Tab key="description" title={t('Detailed Description')} >
<Tab key="description" title={t("Detailed Description")}>
<div className="pt-2 h-full">
<DescriptionTab
formData={formData}
@@ -268,20 +407,32 @@ export const ServiceEditPage: React.FC<ServiceEditPageProps> = ({
/>
</div>
</Tab>
<Tab key="ResourceGroups" title={t("Resource Groups")}>
<div className="pt-2 h-full">
<ResourceGroup
formData={formData}
deleteResourceGroup={deleteResourceGroup}
fetchMCPResourceGroups={fetchMCPResourceGroups}
addServiceToGroup={addServiceToGroup}
/>
</div>
</Tab>
</Tabs>
)}
{/* OpenAPI Generator Modal */}
{
isOpenAPIModalOpen && (
<OpenAPIGeneratorModal
isOpen={true}
onClose={handleCloseOpenAPIModal}
onGenerate={handleOpenAPIGenerate}
mode="update"
/>
)
}
{isOpenAPIModalOpen && (
<OpenAPIGeneratorModal
isOpen={true}
onClose={handleCloseOpenAPIModal}
onGenerate={handleOpenAPIGenerate}
mode="update"
/>
)}
</div>
);
};
};
export const ServiceEditPage = withComponentInjection(
"components/mcp-services/ServiceEditPage",
BaseServiceEditPage
);
@@ -1,83 +0,0 @@
"use client";
import React from 'react';
import { Input, Select, SelectItem, Button } from '@nextui-org/react';
import { useTranslation } from '@/shared/lib/useTranslation';
import { ServiceFilters } from '@/types/mcp-service';
import { Search, Plus } from 'lucide-react';
interface ServiceFiltersBarProps {
filters: ServiceFilters;
onFiltersChange: (filters: ServiceFilters) => void;
onAddService: () => void;
onImportOpenAPI?: () => void;
}
export const ServiceFiltersBar: React.FC<ServiceFiltersBarProps> = ({
filters,
onFiltersChange,
onImportOpenAPI
}) => {
const { t } = useTranslation();
const handleSearchChange = (value: string) => {
onFiltersChange({ ...filters, search: value });
};
const handleStatusChange = (value: string) => {
onFiltersChange({ ...filters, status: value });
};
return (
<div className="flex flex-col sm:flex-row gap-4 mb-6">
<div className="flex-1">
<Button
color="primary"
onPress={onImportOpenAPI}
startContent={<Plus size={16} />}
>
{t('Add Service')}
</Button>
{/* <Input
placeholder={t('Search services...')}
value={filters.search}
onValueChange={handleSearchChange}
startContent={<Search className="w-4 h-4 text-gray-400" />}
classNames={{
input: "text-sm",
inputWrapper: "h-10"
}}
/> */}
</div>
<div className="flex gap-2">
{/* <Select
placeholder={t('Filter by status')}
selectedKeys={filters.status ? [filters.status] : []}
onSelectionChange={(keys) => {
const value = Array.from(keys)[0] as string;
handleStatusChange(value || '');
}}
className="w-40"
classNames={{
trigger: "h-10"
}}
>
{[
{ key: "all", label: t('All Status') },
{ key: "enabled", label: t('Online') },
{ key: "disabled", label: t('Offline') }
].map((item) => (
<SelectItem key={item.key} value={item.key}>
{item.label}
</SelectItem>
))}
</Select> */}
</div>
</div>
);
};
Loaded 100 of 357 files, more files were not shown because too many files have changed in this diff. Show more