diff --git a/README.md b/README.md
index 334f00897..19ca1f58f 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ Reverse engineered `ChatGPT` proxy (bypass Cloudflare 403 Access Denied)
### Installation
-If you need more detailed installation and usage information, please check [Installation Document](https://github.com/gngpp/ninja/blob/main/doc/readme.md))
+If you need more detailed installation and usage information, please check [Installation Document](https://github.com/gngpp/ninja/blob/main/doc/readme.md)
- Platform
diff --git a/README_zh.md b/README_zh.md
index 4bcb12cdc..7fd860360 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -32,7 +32,7 @@
### 安装
-如果您需要更详细的安装与使用信息,请查看[安装文档](https://github.com/gngpp/ninja/blob/main/doc/readme_zh.md))
+如果您需要更详细的安装与使用信息,请查看[安装文档](https://github.com/gngpp/ninja/blob/main/doc/readme_zh.md)
### 贡献
diff --git a/openai/src/auth/error.rs b/openai/src/auth/error.rs
index 70889e493..3e6369c68 100644
--- a/openai/src/auth/error.rs
+++ b/openai/src/auth/error.rs
@@ -1,57 +1,57 @@
#[derive(thiserror::Error, Debug)]
pub enum AuthError {
- #[error("bad request (error {0:?})")]
+ #[error("Bad request (error {0:?})")]
BadRequest(String),
- #[error("too many requests (error {0:?})")]
+ #[error("Too many requests (error {0:?})")]
TooManyRequests(String),
#[error("Unauthorized request (error {0:?})")]
Unauthorized(String),
#[error("Server error ({0:?})")]
ServerError(String),
- #[error("failed login")]
+ #[error("Failed login")]
FailedLogin,
#[error(transparent)]
FailedRequest(#[from] reqwest::Error),
- #[error("invalid client request (error {0:?})")]
- InvalidClientRequest(String),
- #[error("failed to get access token (error {0:?})")]
+ #[error("Failed to get access token (error {0:?})")]
FailedAccessToken(String),
- #[error("invalid arkose token ({0:?})")]
- InvalidArkoseToken(anyhow::Error),
- #[error("failed get code from callback url")]
+ #[error("Failed get code from callback url")]
FailedCallbackCode,
- #[error("failed callback url")]
+ #[error("Failed callback url")]
FailedCallbackURL,
- #[error("failed to get authorized url")]
+ #[error("Failed to get authorized url")]
FailedAuthorizedUrl,
#[error("Failed to get state")]
FailedState,
- #[error("failed get csrf token")]
+ #[error("Failed get csrf token")]
FailedCsrfToken,
- #[error("failed to get auth session cookie")]
+ #[error("Failed to get auth session cookie")]
FailedAuthSessionCookie,
- #[error("invalid request login url (error {0:?})")]
+ #[error("Invalid client request (error {0:?})")]
+ InvalidClientRequest(String),
+ #[error("Invalid arkose token ({0:?})")]
+ InvalidArkoseToken(anyhow::Error),
+ #[error("Invalid request login url (error {0:?})")]
InvalidLoginUrl(String),
- #[error("invalid email or password")]
+ #[error("Invalid email or password")]
InvalidEmailOrPassword,
- #[error("invalid request (error {0:?})")]
+ #[error("Invalid request (error {0:?})")]
InvalidRequest(String),
- #[error("invalid email")]
+ #[error("Invalid email")]
InvalidEmail,
- #[error("invalid Location")]
+ #[error("Invalid Location")]
InvalidLocation,
- #[error("invalid refresh token")]
+ #[error("Invalid refresh token")]
InvalidRefreshToken,
- #[error("invalid location path")]
+ #[error("Accidentally jumped back to the login homepage, please try again.")]
InvalidLocationPath,
#[error("MFA failed")]
MFAFailed,
#[error("MFA required")]
MFARequired,
- #[error("json deserialize error (error {0:?})")]
+ #[error("Json deserialize error (error {0:?})")]
DeserializeError(String),
- #[error("implementation is not supported")]
+ #[error("Implementation is not supported")]
NotSupportedImplementation,
- #[error("failed to get preauth cookie")]
+ #[error("Failed to get preauth cookie")]
PreauthCookieNotFound,
}
diff --git a/openai/src/auth/mod.rs b/openai/src/auth/mod.rs
index 87b7c06a3..e58851e63 100644
--- a/openai/src/auth/mod.rs
+++ b/openai/src/auth/mod.rs
@@ -453,7 +453,15 @@ impl AuthClientBuilder {
AuthClientBuilder {
inner: Client::builder()
.danger_accept_invalid_certs(true)
- .connect_timeout(Duration::from_secs(30))
+ .connect_timeout(Duration::from_secs(10))
+ .timeout(Duration::from_secs(30))
+ .default_headers({
+ let mut headers = HeaderMap::new();
+ headers.insert(header::DNT, HeaderValue::from_static("1"));
+ headers.insert(header::ORIGIN, HeaderValue::from_static(OPENAI_OAUTH_URL));
+ headers.insert(header::REFERER, HeaderValue::from_static(OPENAI_OAUTH_URL));
+ headers
+ })
.redirect(Policy::none()),
}
}
diff --git a/openai/src/auth/provide/mod.rs b/openai/src/auth/provide/mod.rs
index e9865fa69..766a83249 100644
--- a/openai/src/auth/provide/mod.rs
+++ b/openai/src/auth/provide/mod.rs
@@ -112,6 +112,8 @@ impl<'a> RequestContext<'a> {
self.cookie
.insert(format!("arkoseToken={}", arkose_token.value()));
+ self.cookie
+ .insert(format!("arkose_token={}", arkose_token.value()));
Ok(())
}
}
diff --git a/openai/src/token/mod.rs b/openai/src/token/mod.rs
index cbd591a59..b5ab52183 100644
--- a/openai/src/token/mod.rs
+++ b/openai/src/token/mod.rs
@@ -87,7 +87,7 @@ pub async fn await_check_for_u8(token: &[u8]) -> TokenResult