diff --git a/API连接说明.md b/API连接说明.md new file mode 100644 index 0000000..5cc4ce6 --- /dev/null +++ b/API连接说明.md @@ -0,0 +1,41 @@ +# API后端连接说明 + +## 配置已完成 + +✅ 已将前端项目配置为连接到您提供的API后端服务: +- **API后端地址**: `https://code.littlelan.cn/CarrotSkin/APIgateway` + +## 配置详情 + +环境变量已在 `.env.local` 文件中更新: +``` +NEXT_PUBLIC_API_URL=https://code.littlelan.cn/CarrotSkin/APIgateway +``` + +## 如何测试连接 + +1. 确保开发服务器正在运行: + ```bash + npm run dev + ``` + +2. 访问应用并尝试登录或上传皮肤等功能,系统将自动连接到配置的API后端。 + +3. 前端项目中的主要API调用位于: + - `src/lib/api/actions.ts` - 包含登录、注册等用户操作 + - `src/lib/api/auth.ts` - 包含认证相关配置 + +## 注意事项 + +- **CORS配置**: 请确保您的API后端已正确配置CORS,允许来自前端域名的请求 +- **API路径映射**: 前端默认会在API URL后添加相应端点,例如登录API路径为 `/auth/login` +- **环境变量**: `.env.local` 文件不会被Git跟踪,如需在其他环境部署,请确保复制此配置 +- **开发调试**: 您可以在浏览器控制台查看API调用情况,以便调试连接问题 + +## 测试账号 + +前端项目内置了测试账号功能(用于开发环境): +- 用户名: `test` +- 密码: `test` + +如果您希望禁用测试账号功能,请修改 `src/lib/api/actions.ts` 和 `src/lib/api/auth.ts` 文件中的相关代码。 \ No newline at end of file diff --git a/src/app/help/customskinloader/page.tsx b/src/app/help/customskinloader/page.tsx index c0ad7de..fca43c7 100644 --- a/src/app/help/customskinloader/page.tsx +++ b/src/app/help/customskinloader/page.tsx @@ -110,7 +110,7 @@ export default function CustomSkinLoaderTutorialPage() { { "name": "OurSkin", "type": "CustomSkinAPI", - "root": "https://example.com/api/csl/" + "root": "https://code.littlelan.cn/CarrotSkin/APIgateway/csl/" }, { "name": "Mojang", diff --git a/src/app/help/multilogin/page.tsx b/src/app/help/multilogin/page.tsx index 9b0c89d..8d97903 100644 --- a/src/app/help/multilogin/page.tsx +++ b/src/app/help/multilogin/page.tsx @@ -169,7 +169,7 @@ name: 'LittleSkin' # Don't change it unless you really want to. serviceType: BLESSING_SKIN # Fill in the API root like \`https://skin.example.com/api/yggdrasil\` -apiRoot: 'https://skin.littlelan.cn/api/yggdrasil'`} +apiRoot: 'https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil'`} diff --git a/src/app/help/yggdrasil/page.tsx b/src/app/help/yggdrasil/page.tsx index 09d85e4..c68510f 100644 --- a/src/app/help/yggdrasil/page.tsx +++ b/src/app/help/yggdrasil/page.tsx @@ -72,7 +72,7 @@ export default function YggdrasilTutorialPage() { {/* 拖放配置卡片 */} @@ -91,7 +91,7 @@ export default function YggdrasilTutorialPage() {
  • 点击"添加认证服务器"
  • 在"服务器地址"中输入:
    - https://skin.littlelan.cn/api/yggdrasil + https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil
  • 点击"下一步",然后输入您在HITWH.GAMES的用户名和密码
  • 完成后点击"登录"即可使用您的HITWH.GAMES账号
  • @@ -105,7 +105,7 @@ export default function YggdrasilTutorialPage() {
  • 选择"外置登录"
  • 在"认证服务器"中输入:
    - https://skin.littlelan.cn/api/yggdrasil + https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil
  • 点击"保存"
  • 返回主界面,输入您在HITWH.GAMES的用户名和密码进行登录
  • diff --git a/src/app/user-home/page.tsx b/src/app/user-home/page.tsx index 24ca9da..3f2ab44 100644 --- a/src/app/user-home/page.tsx +++ b/src/app/user-home/page.tsx @@ -104,11 +104,11 @@ export default function UserHome() { name: "外置登录", uuid: session?.user?.id || "user_uuid", accessToken: "demo_token", - validateUrl: "http://localhost:3000/api/auth/validate", - refreshUrl: "http://localhost:3000/api/auth/refresh", - invalidateUrl: "http://localhost:3000/api/auth/invalidate", - userInfoUrl: "http://localhost:3000/api/auth/user", - authUrl: "http://localhost:3000/api/auth/authenticate" + validateUrl: "https://code.littlelan.cn/CarrotSkin/APIgateway/auth/validate", + refreshUrl: "https://code.littlelan.cn/CarrotSkin/APIgateway/auth/refresh", + invalidateUrl: "https://code.littlelan.cn/CarrotSkin/APIgateway/auth/invalidate", + userInfoUrl: "https://code.littlelan.cn/CarrotSkin/APIgateway/auth/user", + authUrl: "https://code.littlelan.cn/CarrotSkin/APIgateway/auth/authenticate" }); e.dataTransfer.setData('text/plain', yggdrasilData); e.dataTransfer.effectAllowed = 'copy';