Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ configs/auth/
# Temporary files
tmp/
ui/dist/
*.css
test/
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ sudo docker compose down

本项目基于 [**ais2api**](https://github.com/Ellinav/ais2api)(作者:[**Ellinav**](https://github.com/Ellinav))分支开发,并完全沿用上游项目所采用的 CC BY-NC 4.0 许可证,其使用、分发与修改行为均需遵守原有许可证的全部条款,完整许可的内容请参见 [LICENSE](LICENSE) 文件。

### ©️ 版权 / 署名
## 🤝 贡献者

- 原始作品 Copyright © [Ellinav](https://github.com/Ellinav)
- 修改与新增部分 Copyright © 2024 [iBenzene](https://github.com/iBenzene)、[bbbugg](https://github.com/bbbugg)、[挈挈](https://github.com/ljh156705)及其他贡献者
[![Contributors](https://contrib.rocks/image?repo=iBUHub/AIStudioToAPI)](https://github.com/iBUHub/AIStudioToAPI/graphs/contributors)

感谢所有为本项目付出汗水与智慧的开发者。
7 changes: 4 additions & 3 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ Edit `configs/models.json` to customize available models and their settings.

This project is a fork of [**ais2api**](https://github.com/Ellinav/ais2api) by [**Ellinav**](https://github.com/Ellinav), and fully adopts the CC BY-NC 4.0 license used by the upstream project. All usage, distribution, and modification activities must comply with all terms of the original license. See the full license text in [LICENSE](LICENSE).

### ©️ Copyright / Attribution
## 🤝 Contributors

- Original work Copyright © [Ellinav](https://github.com/Ellinav)
- Modifications and additions Copyright © 2024 [iBenzene](https://github.com/iBenzene)、[bbbugg](https://github.com/bbbugg)、[挈挈](https://github.com/ljh156705) and contributors
[![Contributors](https://contrib.rocks/image?repo=iBUHub/AIStudioToAPI)](https://github.com/iBUHub/AIStudioToAPI/graphs/contributors)

We would like to thank all developers who have contributed their time, effort, and wisdom to this project.
3 changes: 1 addition & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: main.js
* Description: Main entry file that initializes and starts the AIStudio To API proxy server system
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

// Load environment variables based on NODE_ENV
Expand Down
3 changes: 1 addition & 2 deletions scripts/auth/saveAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: scripts/auth/saveAuth.js
* Description: Automated script to launch browser, extract authentication state from Google AI Studio, and save to config files
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const { firefox } = require("playwright");
Expand Down
3 changes: 1 addition & 2 deletions scripts/auth/setupAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: scripts/auth/setupAuth.js
* Description: Cross-platform auth setup helper. Installs dependencies, downloads Camoufox, and runs saveAuth.js.
*
* Maintainers: iBenzene, bbbugg, MasakiMu319
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg, MasakiMu319
*/

const { spawnSync } = require("child_process");
Expand Down
4 changes: 2 additions & 2 deletions scripts/client/build.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* File: scripts/client/build.js
* Description: Client-side browser script (圈内人称「build 反代」) that runs in the headless browser to proxy API requests through WebSocket
* Description: Client-side browser script that runs in the headless browser to proxy API requests through WebSocket
*
* Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

/* eslint-env browser */
Expand Down
3 changes: 1 addition & 2 deletions src/auth/AuthSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/auth/AuthSource.js
* Description: Authentication source manager that loads and validates authentication data from config files
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const fs = require("fs");
Expand Down
3 changes: 1 addition & 2 deletions src/auth/AuthSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/auth/AuthSwitcher.js
* Description: Authentication switcher that handles account rotation logic, failure tracking, and usage-based switching
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

/**
Expand Down
3 changes: 1 addition & 2 deletions src/auth/CreateAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/auth/CreateAuth.js
* Description: Authentication creation handler for VNC-based auth generation
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const fs = require("fs");
Expand Down
3 changes: 1 addition & 2 deletions src/core/BrowserManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/core/BrowserManager.js
* Description: Browser manager for launching and controlling headless Firefox instances with authentication contexts
*
* Maintainers: iBenzene, bbbugg, 挈挈
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg, 挈挈
*/

const fs = require("fs");
Expand Down
3 changes: 1 addition & 2 deletions src/core/ConnectionRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/core/ConnectionRegistry.js
* Description: Connection registry that manages WebSocket connections and routes messages to appropriate message queues
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const { EventEmitter } = require("events");
Expand Down
3 changes: 1 addition & 2 deletions src/core/FormatConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/core/FormatConverter.js
* Description: Format converter that translates between OpenAI and Google Gemini API request/response formats
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const axios = require("axios");
Expand Down
3 changes: 1 addition & 2 deletions src/core/ProxyServerSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/core/ProxyServerSystem.js
* Description: Main proxy server system that orchestrates all components including HTTP/WebSocket servers, authentication, and request handling
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const { EventEmitter } = require("events");
Expand Down
3 changes: 1 addition & 2 deletions src/core/RequestHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/core/RequestHandler.js
* Description: Main request handler that processes API requests, manages retries, and coordinates between authentication and format conversion
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

/**
Expand Down
3 changes: 1 addition & 2 deletions src/routes/AuthRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/routes/AuthRoutes.js
* Description: Authentication routes for login and logout functionality
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const CreateAuth = require("../auth/CreateAuth");
Expand Down
5 changes: 2 additions & 3 deletions src/routes/StatusRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/routes/StatusRoutes.js
* Description: Status and system management routes
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const fs = require("fs");
Expand Down Expand Up @@ -255,7 +254,7 @@ class StatusRoutes {

const { authSource } = this.serverSystem;

if (!authSource.availableIndices.includes(targetIndex)) {
if (!authSource.initialIndices.includes(targetIndex)) {
return res.status(404).json({ index: targetIndex, message: "errorAccountNotFound" });
}

Expand Down
3 changes: 1 addition & 2 deletions src/routes/WebRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/routes/WebRoutes.js
* Description: Web routes coordinator - delegates to specialized route handlers
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const session = require("express-session");
Expand Down
3 changes: 1 addition & 2 deletions src/utils/ConfigLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/utils/ConfigLoader.js
* Description: Configuration loader that reads and validates system settings from environment variables
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const fs = require("fs");
Expand Down
3 changes: 1 addition & 2 deletions src/utils/LoggingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/utils/LoggingService.js
* Description: Logging service that formats, buffers, and outputs system logs with different severity levels
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

/**
Expand Down
3 changes: 1 addition & 2 deletions src/utils/MessageQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: src/utils/MessageQueue.js
* Description: Asynchronous message queue for managing request/response communication between server and browser client
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

const { EventEmitter } = require("events");
Expand Down
2 changes: 1 addition & 1 deletion src/utils/VersionChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* File: src/utils/VersionChecker.js
* Description: Checks for new versions by querying GitHub Tags API
*
* Maintainers: iBenzene, bbbugg
* Author: Ellinav, iBenzene, bbbugg
*/

const axios = require("axios");
Expand Down
3 changes: 1 addition & 2 deletions ui/app/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: ui/app/App.vue
* Description: Root Vue component that serves as the main entry point for the application router
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
-->

<template>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: ui/index.js
* Description: Main entry point for the Vue application, initializing Vue, Element Plus, router and i18n
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
*/

import { createApp } from 'vue';
Expand All @@ -12,6 +11,7 @@ import 'element-plus/dist/index.css';
import App from './/App.vue';
import router from './router';
import I18n from './utils/i18n';
import 'element-plus/theme-chalk/dark/css-vars.css';
import './/styles/global.less';

const app = createApp(App);
Expand Down
7 changes: 5 additions & 2 deletions ui/app/pages/AuthPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: ui/app/pages/AuthPage.vue
* Description: VNC-based authentication page for adding new Google AI Studio accounts
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
-->

<template>
Expand Down Expand Up @@ -247,6 +246,7 @@
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import I18n from "../utils/i18n";
import { useTheme } from "../utils/useTheme";

const hasInitialized = ref(false);
const isConnected = ref(false);
Expand All @@ -263,6 +263,9 @@ const statusTone = ref("info");
const textInput = ref("");
const textInputRef = ref(null);

// Initialize theme
useTheme();

const t = key => {
langVersion.value; // Access to track language changes
return I18n.t(key, key);
Expand Down
7 changes: 5 additions & 2 deletions ui/app/pages/LoginPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: ui/app/pages/LoginPage.vue
* Description: Login page component for user authentication with internationalization support
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
-->

<template>
Expand Down Expand Up @@ -53,6 +52,7 @@
import { computed, onMounted, ref, watchEffect } from "vue";
import { useRoute } from "vue-router";
import I18n from "../utils/i18n";
import { useTheme } from "../utils/useTheme";

const route = useRoute();

Expand All @@ -64,6 +64,9 @@ const onLangChange = () => {
langVersion.value++;
};

// Initialize theme
useTheme();

onMounted(() => {
I18n.onChange(onLangChange);
});
Expand Down
3 changes: 1 addition & 2 deletions ui/app/pages/NotFound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* File: ui/app/pages/NotFound.vue
* Description: 404 Not Found page component for handling invalid routes
*
* Maintainers: iBenzene, bbbugg
* Original Author: Ellinav
* Author: Ellinav, iBenzene, bbbugg
-->

<template>
Expand Down
Loading