cookie: prepend in library

This commit is contained in:
Quaternions 2024-12-13 19:01:37 -08:00
parent a99b5a2666
commit c49f9e4dd3
2 changed files with 3 additions and 2 deletions

View File

@ -199,8 +199,9 @@ fn read_readable(mut readable:impl std::io::Read)->std::io::Result<Vec<u8>>{
#[derive(Clone)]
pub struct Cookie(String);
impl Cookie{
/// cookie is prepended with ".ROBLOSECURITY=" by this function
pub fn new(cookie:String)->Self{
Self(cookie)
Self(format!(".ROBLOSECURITY={cookie}"))
}
pub fn get(self)->String{
self.0

View File

@ -621,7 +621,7 @@ async fn cookie_from_args(literal:Option<String>,environment:Option<String>,file
(None,None,Some(cookie_file))=>tokio::fs::read_to_string(cookie_file).await?,
_=>Err(anyhow::Error::msg("Illegal cookie argument triple"))?,
};
Ok(Cookie::new(format!(".ROBLOSECURITY={cookie}")))
Ok(Cookie::new(cookie))
}
async fn api_key_from_args(literal:Option<String>,environment:Option<String>,file:Option<PathBuf>)->AResult<ApiKey>{
let api_key=match (literal,environment,file){