single browser agent constant

This commit is contained in:
Brandon Thomas committed 2025-10-01 22:42:04 -04:00
1 parent 2d3ec8b4e5
commit 2fbd2c8f8b
8 files changed
+31 -12

No files matched your search

@@ -0,0 +1 @@
pub (crate) mod user_agent;
@@ -0,0 +1,22 @@
// TODO: enum UserAgent { Mac, Linux, Windows } which maps to these.
/// This user agent is tied to the sentinel generation.
/// If we need to change it, we may need to change sentinel generation too.
pub (crate) const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
// NB: from sentinel token request -
// /// This user agent is tied to the sentinel generation. If we need to change it, we may need to change sentinel generation too.
// const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
// NB: from image gen request -
// /// This user agent is tied to the sentinel generation. If we need to change it, we may need to change sentinel generation too.
// //const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
// Previous job status user agent
// const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
// NB: image gen status -
// /// This user agent is tied to the sentinel generation. If we need to change it, we may need to change sentinel generation too.
// pub (crate) const USER_AGENT: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
@@ -1,5 +1,7 @@
pub (crate) mod constants;
pub mod creds;
pub mod error;
pub mod recipes;
pub mod requests;
pub mod utils;
pub mod utils;
@@ -1,3 +1,4 @@
use crate::constants::user_agent::USER_AGENT;
use crate::creds::sora_credential_set::SoraCredentialSet;
use crate::requests::image_gen::image_gen_status::TaskId;
use log::warn;
@@ -8,9 +9,6 @@ use wreq::{Client, StatusCode};
const SORA_IMAGE_GEN_URL: &str = "https://sora.com/backend/video_gen";
/// This user agent is tied to the sentinel generation. If we need to change it, we may need to change sentinel generation too.
const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
#[derive(Error, Debug)]
pub enum SoraImageGenError {
#[error("Sora token expired: {0}")]
@@ -1,3 +1,4 @@
use crate::constants::user_agent::USER_AGENT;
use crate::creds::sora_credential_set::SoraCredentialSet;
use crate::creds::sora_jwt_bearer_token::SoraJwtBearerToken;
use crate::error::sora_client_error::SoraClientError;
@@ -15,9 +16,6 @@ use wreq::Client;
const SORA_STATUS_URL: &str = "https://sora.com/backend/video_gen";
/// This user agent is tied to the sentinel generation. If we need to change it, we may need to change sentinel generation too.
pub (crate) const USER_AGENT: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
/// A strongly typed task ID for Sora tasks.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Serialize, Deserialize)]
pub struct TaskId(pub String);
@@ -1,3 +1,4 @@
use crate::constants::user_agent::USER_AGENT;
use crate::creds::sora_credential_set::SoraCredentialSet;
use crate::error::sora_client_error::SoraClientError;
use crate::error::sora_error::SoraError;
@@ -5,8 +6,6 @@ use crate::error::sora_generic_api_error::SoraGenericApiError;
use log::error;
use wreq::Client;
const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
// https://sora.com/backend/notif?limit=100&before=task_01jqwwrkvgeqp8jsf5mqk1jceh
pub async fn sora_job_status(
@@ -9,11 +9,10 @@ use log::error;
use serde_derive::{Deserialize, Serialize};
use thiserror::Error;
use wreq::Client;
use crate::constants::user_agent::USER_AGENT;
const SORA_IMAGE_GEN_URL: &str = "https://chatgpt.com/backend-api/sentinel/req";
/// This user agent is tied to the sentinel generation. If we need to change it, we may need to change sentinel generation too.
const USER_AGENT : &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36";
const SENTINEL_FLOW: &str = "sora_create_task";
@@ -1,9 +1,9 @@
use crate::constants::user_agent::USER_AGENT;
use crate::creds::sora_credential_set::SoraCredentialSet;
use crate::error::sora_client_error::SoraClientError;
use crate::error::sora_error::SoraError;
use crate::error::sora_generic_api_error::SoraGenericApiError;
use crate::requests::bearer::generate_bearer_with_cookie::SoraAuthResponse;
use crate::requests::image_gen::image_gen_status::USER_AGENT;
use crate::utils::classify_general_http_error::classify_general_http_error;
use log::{error, info};
use serde::Deserialize;