diff --git a/src/main.rs b/src/main.rs index 1b2d101..251778b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,22 +1,15 @@ -use anyhow::Error; -use reqwest::redirect::Policy; -use reqwest::{multipart, Client, RequestBuilder, Response, StatusCode, Url}; +use reqwest::{multipart, Client, StatusCode, Url}; use serde::{Deserialize, Serialize}; use std::cmp::min; use std::fs; -use std::os::unix::fs::MetadataExt; use std::path::PathBuf; use std::process::Command; use std::sync::{Arc, Mutex}; use clap::Parser; use futures_util::StreamExt; -use keyring::Entry; -use log::{debug, error, info}; use notify_rust::{Hint, Notification, NotificationHandle}; use reqwest::header::{HeaderValue, AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE}; -use rusqlite::{Connection, OpenFlags}; -use serde::de::DeserializeOwned; use wl_clipboard_rs::copy::{ClipboardType, MimeType, Options, Source}; type GodriveToken = String; @@ -38,16 +31,6 @@ struct GodriveSharePermissions { can_upload: bool, } -impl GodriveSharePermissions { - fn download_only() -> Self { - GodriveSharePermissions { - can_edit: false, - can_download: true, - can_upload: false, - } - } -} - #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { @@ -190,34 +173,6 @@ async fn main() { } } -async fn fire(req_builder: RequestBuilder) -> Result { - let resp = req_builder.send().await; - match resp { - Ok(resp) => { - let resp_dbg = format!("{:?}", resp); - let result_text = resp - .text() - .await - .expect("apparently they didnt send us text"); - let result = serde_json::from_str((&result_text).as_str()); - match result { - Ok(good) => Ok(good), - Err(bad) => { - eprintln!( - "{:?}, serialization error or something, idk\nResp: {:?}\nBody: {:?}", - bad, resp_dbg, result_text - ); - Err(Error::msg(bad)) - } - } - } - Err(error) => { - eprintln!("{:?}, networking error or something, idk", error); - return Err(Error::from(error)); - } - } -} - async fn godrive_get_share_link( ctx: &CommunicationContext, auth_token: &GodriveToken, @@ -284,7 +239,7 @@ async fn post_upload( } form = form.text("json", serde_json::to_string(&file_infos).unwrap()); for (i, file) in files.iter().enumerate() { - form = match form.file(format!("file-{i}"), file.clone()).await { + form = match form.file(format!("file-{i}"), file).await { Ok(f) => f, Err(e) => { eprintln!("Failed to add multipart file-{i} {file:?}: {e}");