|
|
@ -73,7 +73,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
use std::{borrow::Cow, io::BufRead, ops}; |
|
|
|
use std::{borrow::Cow, io::BufRead, ops}; |
|
|
|
|
|
|
|
|
|
|
|
use reqwest::{Client, RequestBuilder, Response}; |
|
|
|
use reqwest::blocking::{Client, RequestBuilder, Response}; |
|
|
|
use tap_reader::Tap; |
|
|
|
use tap_reader::Tap; |
|
|
|
use tungstenite::client::AutoStream; |
|
|
|
use tungstenite::client::AutoStream; |
|
|
|
|
|
|
|
|
|
|
@ -461,7 +461,10 @@ impl MastodonClient for Mastodon { |
|
|
|
url.query_pairs_mut() |
|
|
|
url.query_pairs_mut() |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "user"); |
|
|
|
.append_pair("stream", "user"); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -481,7 +484,10 @@ impl MastodonClient for Mastodon { |
|
|
|
url.query_pairs_mut() |
|
|
|
url.query_pairs_mut() |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "public"); |
|
|
|
.append_pair("stream", "public"); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -501,7 +507,10 @@ impl MastodonClient for Mastodon { |
|
|
|
url.query_pairs_mut() |
|
|
|
url.query_pairs_mut() |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "public:local"); |
|
|
|
.append_pair("stream", "public:local"); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -522,7 +531,10 @@ impl MastodonClient for Mastodon { |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "hashtag") |
|
|
|
.append_pair("stream", "hashtag") |
|
|
|
.append_pair("tag", hashtag); |
|
|
|
.append_pair("tag", hashtag); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -543,7 +555,10 @@ impl MastodonClient for Mastodon { |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "hashtag:local") |
|
|
|
.append_pair("stream", "hashtag:local") |
|
|
|
.append_pair("tag", hashtag); |
|
|
|
.append_pair("tag", hashtag); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -564,7 +579,10 @@ impl MastodonClient for Mastodon { |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "list") |
|
|
|
.append_pair("stream", "list") |
|
|
|
.append_pair("list", list_id); |
|
|
|
.append_pair("list", list_id); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -584,7 +602,10 @@ impl MastodonClient for Mastodon { |
|
|
|
url.query_pairs_mut() |
|
|
|
url.query_pairs_mut() |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("access_token", &self.token) |
|
|
|
.append_pair("stream", "direct"); |
|
|
|
.append_pair("stream", "direct"); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
@ -600,7 +621,7 @@ impl MastodonClient for Mastodon { |
|
|
|
|
|
|
|
|
|
|
|
/// Equivalent to /api/v1/media
|
|
|
|
/// Equivalent to /api/v1/media
|
|
|
|
fn media(&self, media_builder: MediaBuilder) -> Result<Attachment> { |
|
|
|
fn media(&self, media_builder: MediaBuilder) -> Result<Attachment> { |
|
|
|
use reqwest::multipart::Form; |
|
|
|
use reqwest::blocking::multipart::Form; |
|
|
|
|
|
|
|
|
|
|
|
let mut form_data = Form::new().file("file", media_builder.file.as_ref())?; |
|
|
|
let mut form_data = Form::new().file("file", media_builder.file.as_ref())?; |
|
|
|
|
|
|
|
|
|
|
@ -808,7 +829,10 @@ impl MastodonUnauth { |
|
|
|
pub fn streaming_public(&self) -> Result<EventReader<WebSocket>> { |
|
|
|
pub fn streaming_public(&self) -> Result<EventReader<WebSocket>> { |
|
|
|
let mut url: url::Url = self.route("/api/v1/streaming/public/local")?; |
|
|
|
let mut url: url::Url = self.route("/api/v1/streaming/public/local")?; |
|
|
|
url.query_pairs_mut().append_pair("stream", "public"); |
|
|
|
url.query_pairs_mut().append_pair("stream", "public"); |
|
|
|
let mut url: url::Url = reqwest::get(url.as_str())?.url().as_str().parse()?; |
|
|
|
let mut url: url::Url = reqwest::blocking::get(url.as_str())? |
|
|
|
|
|
|
|
.url() |
|
|
|
|
|
|
|
.as_str() |
|
|
|
|
|
|
|
.parse()?; |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
let new_scheme = match url.scheme() { |
|
|
|
"http" => "ws", |
|
|
|
"http" => "ws", |
|
|
|
"https" => "wss", |
|
|
|
"https" => "wss", |
|
|
|