保存当前工作内容,准备拉取远程更新
This commit is contained in:
41
API连接说明.md
Normal file
41
API连接说明.md
Normal file
@@ -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` 文件中的相关代码。
|
||||
@@ -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",
|
||||
|
||||
@@ -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'`}</pre>
|
||||
apiRoot: 'https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil'`}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -72,7 +72,7 @@ export default function YggdrasilTutorialPage() {
|
||||
|
||||
{/* 拖放配置卡片 */}
|
||||
<DragConfigCard
|
||||
authUrl="https://skin.littlelan.cn/api/yggdrasil"
|
||||
authUrl="https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil"
|
||||
serviceName="HITWH.GAMES 皮肤系统"
|
||||
/>
|
||||
|
||||
@@ -91,7 +91,7 @@ export default function YggdrasilTutorialPage() {
|
||||
<li>点击"添加认证服务器"</li>
|
||||
<li>
|
||||
在"服务器地址"中输入:<br/>
|
||||
<code className="bg-gray-100 dark:bg-gray-800 px-3 py-2 rounded block mt-2">https://skin.littlelan.cn/api/yggdrasil</code>
|
||||
<code className="bg-gray-100 dark:bg-gray-800 px-3 py-2 rounded block mt-2">https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil</code>
|
||||
</li>
|
||||
<li>点击"下一步",然后输入您在HITWH.GAMES的用户名和密码</li>
|
||||
<li>完成后点击"登录"即可使用您的HITWH.GAMES账号</li>
|
||||
@@ -105,7 +105,7 @@ export default function YggdrasilTutorialPage() {
|
||||
<li>选择"外置登录"</li>
|
||||
<li>
|
||||
在"认证服务器"中输入:<br/>
|
||||
<code className="bg-gray-100 dark:bg-gray-800 px-3 py-2 rounded block mt-2">https://skin.littlelan.cn/api/yggdrasil</code>
|
||||
<code className="bg-gray-100 dark:bg-gray-800 px-3 py-2 rounded block mt-2">https://code.littlelan.cn/CarrotSkin/APIgateway/yggdrasil</code>
|
||||
</li>
|
||||
<li>点击"保存"</li>
|
||||
<li>返回主界面,输入您在HITWH.GAMES的用户名和密码进行登录</li>
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user