feat: 更新OAuth回调服务器主机和图片资源

fix: 修复curl命令中baseURL拼接问题
refactor: 将授权成功后的刷新逻辑移至provider-manager
docs: 更新README中的赞助者列表和图片引用
This commit is contained in:
hex2077 2025-12-22 13:44:35 +08:00
parent 0816de2ba2
commit 231505afd9
9 changed files with 39 additions and 14 deletions

View file

@ -134,7 +134,7 @@ AIClient-2-APIを使い始める最も推奨される方法は、自動起動ス
#### Web UI管理コントロールコンソール
![Web UI](src/img/web.png)
![Web UI](src/img/zh.png)
以下の機能モジュールを備えたWeb管理インターフェース
@ -272,6 +272,15 @@ AIClient-2-APIプロジェクトに貢献してくれたすべての開発者に
[![Contributors](https://contrib.rocks/image?repo=justlovemaki/AIClient-2-API)](https://github.com/justlovemaki/AIClient-2-API/graphs/contributors)
### スポンサーリスト
プロジェクトをサポートしてくださっているスポンサーの皆様に深く感謝いたします:
- [**Cigarliu**](https://github.com/Cigarliu "9.9")
- [**xianengqi**](https://github.com/xianengqi "9.9")
- [**3831143avl**](https://github.com/3831143avl "10")
- [**醉春风**](https://github.com/handsometong "28.8")
- [**crazy**](https://github.com/404 "88")
### 🌟 Star History

View file

@ -133,7 +133,7 @@
#### Web UI 管理控制台
![Web UI](src/img/web.png)
![Web UI](src/img/zh.png)
功能完善的 Web 管理界面,包含:
@ -269,6 +269,15 @@ curl http://localhost:3000/ollama/api/chat \
[![Contributors](https://contrib.rocks/image?repo=justlovemaki/AIClient-2-API)](https://github.com/justlovemaki/AIClient-2-API/graphs/contributors)
### 赞助者列表
非常感谢以下赞助者对本项目的支持:
- [**Cigarliu**](https://github.com/Cigarliu "9.9")
- [**xianengqi**](https://github.com/xianengqi "9.9")
- [**3831143avl**](https://github.com/3831143avl "10")
- [**醉春风**](https://github.com/handsometong "28.8")
- [**crazy**](https://github.com/404 "88")
### 🌟 Star History

View file

@ -134,7 +134,7 @@ Go to the **"Configuration"** page, you can:
#### Web UI Management Console
![Web UI](src/img/web.png)
![Web UI](src/img/en.png)
A functional Web management interface, including:
@ -272,6 +272,15 @@ Thanks to all the developers who contributed to the AIClient-2-API project:
[![Contributors](https://contrib.rocks/image?repo=justlovemaki/AIClient-2-API)](https://github.com/justlovemaki/AIClient-2-API/graphs/contributors)
### Sponsor List
We are grateful for the support from our sponsors:
- [**Cigarliu**](https://github.com/Cigarliu "9.9")
- [**xianengqi**](https://github.com/xianengqi "9.9")
- [**3831143avl**](https://github.com/3831143avl "10")
- [**醉春风**](https://github.com/handsometong "28.8")
- [**crazy**](https://github.com/404 "88")
### 🌟 Star History

BIN
src/img/en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

BIN
src/img/zh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

View file

@ -250,7 +250,7 @@ async function createOAuthCallbackServer(config, redirectUri, authClient, credPa
}
});
const host = 'localhost';
const host = '0.0.0.0';
server.listen(config.port, host, () => {
console.log(`${config.logPrefix} OAuth 回调服务器已启动于 ${host}:${config.port}`);
activeServers.set(config.port, server);

View file

@ -39,15 +39,6 @@ function initEventStream() {
showToast(t('common.success'), `${t('common.success')} (${data.provider})`, 'success');
// 发送自定义事件,以便其他模块(如生成凭据逻辑)可以接收到详细信息
window.dispatchEvent(new CustomEvent('oauth_success_event', { detail: data }));
// 关闭授权窗口和模态框
// 查找并关闭所有授权相关的模态框
const modals = document.querySelectorAll('.modal-overlay');
modals.forEach(modal => modal.remove());
// 授权成功后刷新配置和提供商列表
if (loadProviders) loadProviders();
if (loadConfigList) loadConfigList();
});
newEventSource.addEventListener('provider_update', (event) => {

View file

@ -4,6 +4,7 @@ import { providerStats, updateProviderStats } from './constants.js';
import { showToast, formatUptime } from './utils.js';
import { fileUploadHandler } from './file-upload.js';
import { t, getCurrentLanguage } from './i18n.js';
import { loadConfigList } from './upload-config-manager.js';
// 保存初始服务器时间和运行时间
let initialServerTime = null;
@ -602,6 +603,10 @@ function showAuthModal(authUrl, authInfo) {
}
modal.remove();
window.removeEventListener('oauth_success_event', handleOAuthSuccess);
// 授权成功后刷新配置和提供商列表
loadProviders();
loadConfigList();
};
window.addEventListener('oauth_success_event', handleOAuthSuccess);

View file

@ -1010,7 +1010,9 @@
curlCodes.forEach(element => {
const curlCommand = element.textContent;
// 替换curl命令中的http://localhost:3000部分
const updatedCommand = curlCommand.replace(/curl http:\/\/localhost:3000/g, `curl ${baseURL}`);
// 确保baseURL不以斜杠结尾然后正确拼接路径
const cleanBaseURL = baseURL.replace(/\/$/, '');
const updatedCommand = curlCommand.replace(/curl http:\/\/localhost:3000/g, `curl ${cleanBaseURL}`);
element.textContent = updatedCommand;
});
}