Skip to content

Commit

Permalink
🐛 Fix bx unusual activity
Browse files Browse the repository at this point in the history
  • Loading branch information
luoshuijs committed Mar 28, 2024
1 parent 0c5ae5f commit e5184ca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
13 changes: 12 additions & 1 deletion crates/openai/src/arkose/funcaptcha/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ use std::path::Path;
use std::sync::Arc;

type FunResult<T, E = super::error::ArkoseError> = Result<T, E>;
const REFERER: &'static str =
"https://tcr9i.chat.openai.com/v2/2.3.4/enforcement.c70df15cb97792b18c2f4978b68954a0.html";
const ORIGIN: &'static str = "https://tcr9i.chat.openai.com";

pub async fn start_challenge(ctx: &ArkoseSolverContext) -> FunResult<Session> {
let value = ctx.arkose_token.value();
Expand All @@ -34,7 +37,7 @@ pub async fn start_challenge(ctx: &ArkoseSolverContext) -> FunResult<Session> {
.to_owned();

let referer = format!(
"{}/fc/assets/ec-game-core/game-core/1.18.0/standard/index.html?session={}",
"{}/fc/assets/ec-game-core/game-core/1.20.0/standard/index.html?session={}",
ctx.typed.origin_url(),
value.replace("|", "&")
);
Expand Down Expand Up @@ -121,6 +124,8 @@ impl Session {
"{}/fc/gc/?token={}",
self.origin, self.session_token
))
.header(header::REFERER, REFERER)
.header(header::ORIGIN, ORIGIN)
.send()
.await?
.error_for_status()?;
Expand Down Expand Up @@ -168,6 +173,8 @@ impl Session {
header::CONTENT_TYPE,
"application/x-www-form-urlencoded; charset=UTF-8",
)
.header(header::REFERER, REFERER)
.header(header::ORIGIN, ORIGIN)
.body(form)
.send()
.await?;
Expand Down Expand Up @@ -207,6 +214,8 @@ impl Session {
header::CONTENT_TYPE,
"application/x-www-form-urlencoded; charset=UTF-8".parse()?,
);
headers.insert(header::REFERER, header::HeaderValue::from_static(REFERER));
headers.insert(header::ORIGIN, header::HeaderValue::from_static(ORIGIN));

let challenge = self
.client
Expand Down Expand Up @@ -359,6 +368,8 @@ impl Session {
header::CONTENT_TYPE,
"application/x-www-form-urlencoded; charset=UTF-8".parse()?,
);
headers.insert(header::REFERER, header::HeaderValue::from_static(REFERER));
headers.insert(header::ORIGIN, header::HeaderValue::from_static(ORIGIN));

let resp = self
.client
Expand Down
Loading

0 comments on commit e5184ca

Please sign in to comment.