mirror of
https://framagit.org/veretcle/tootube.git
synced 2025-07-20 20:41:17 +02:00
fix: send file, not just name
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use crate::{config::YoutubeConfig, error::TootubeError, peertube::PeerTubeVideo};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{error::Error, sync::Mutex};
|
||||
use std::{error::Error, fs::File, sync::Mutex};
|
||||
|
||||
static ACCESS_TOKEN: Mutex<String> = Mutex::new(String::new());
|
||||
|
||||
@@ -150,14 +150,18 @@ pub fn upload_video(
|
||||
r_url: &str,
|
||||
config: &YoutubeConfig,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
// Get access token
|
||||
let access_token = refresh_token(config)?;
|
||||
|
||||
// Create client
|
||||
let client = reqwest::blocking::Client::new();
|
||||
|
||||
let file = File::open(f_path)?;
|
||||
|
||||
let res = client
|
||||
.post(r_url)
|
||||
.put(r_url)
|
||||
.header("Authorization", format!("Bearer {}", access_token))
|
||||
.body(f_path.to_string())
|
||||
.body(file)
|
||||
.send()?;
|
||||
|
||||
if res.status().is_success() {
|
||||
|
Reference in New Issue
Block a user