|
|
|
@ -20,6 +20,7 @@ use data::Did as Did;
|
|
|
|
|
use data::Cid as Cid;
|
|
|
|
|
use data::Handle as Handle;
|
|
|
|
|
use crate::data::Timeline;
|
|
|
|
|
use crate::data::url;
|
|
|
|
|
|
|
|
|
|
use std::io;
|
|
|
|
|
use std::io::Write;
|
|
|
|
@ -246,7 +247,8 @@ fn ss(c :&Context) -> reqwest::Result<()> {
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.repo.describe";
|
|
|
|
|
let s = "describe".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
if let Ok(user) = c.string_flag("user") {
|
|
|
|
|
at_user(url, user);
|
|
|
|
|
} else {
|
|
|
|
@ -281,7 +283,8 @@ fn ff(c :&Context) -> reqwest::Result<()> {
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.repo.listRecords";
|
|
|
|
|
let s = "record_list".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let col = "app.bsky.feed.post".to_string();
|
|
|
|
|
if let Ok(user) = c.string_flag("user") {
|
|
|
|
|
at_feed(url, user, col);
|
|
|
|
@ -312,7 +315,8 @@ async fn aa() -> reqwest::Result<()> {
|
|
|
|
|
let handle = data.user;
|
|
|
|
|
let mut map = HashMap::new();
|
|
|
|
|
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.session.create";
|
|
|
|
|
let s = "session_create".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
map.insert("handle", &handle);
|
|
|
|
|
map.insert("password", &data.pass);
|
|
|
|
|
let client = reqwest::Client::new();
|
|
|
|
@ -350,14 +354,8 @@ async fn pp(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
let token = json.accessJwt;
|
|
|
|
|
let did = json.did;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let data = Datas::new().unwrap();
|
|
|
|
|
let data = Datas {
|
|
|
|
|
host: data.host,
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.repo.createRecord";
|
|
|
|
|
let s = "record_create".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let col = "app.bsky.feed.post".to_string();
|
|
|
|
|
let d = Timestamp::now_utc();
|
|
|
|
|
let d = d.to_string();
|
|
|
|
@ -449,7 +447,8 @@ async fn tt(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
let json: Token = serde_json::from_str(&data).unwrap();
|
|
|
|
|
let token = json.accessJwt;
|
|
|
|
|
|
|
|
|
|
let url = "https://bsky.social/xrpc/app.bsky.feed.getTimeline";
|
|
|
|
|
let s = "timeline_get".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
|
|
|
|
|
let client = reqwest::Client::new();
|
|
|
|
|
let j = client.get(url)
|
|
|
|
@ -506,16 +505,11 @@ async fn pro(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
let json: Token = serde_json::from_str(&data).unwrap();
|
|
|
|
|
let token = json.accessJwt;
|
|
|
|
|
|
|
|
|
|
let data = Datas::new().unwrap();
|
|
|
|
|
let data = Datas {
|
|
|
|
|
host: data.host,
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let user = c.args[0].to_string();
|
|
|
|
|
if user.is_empty() == false {
|
|
|
|
|
let url = "https://bsky.social/xrpc/app.bsky.actor.getProfile?actor=".to_owned() + &user;
|
|
|
|
|
let s = "profile_get".to_string();
|
|
|
|
|
if c.args[0].is_empty() == false {
|
|
|
|
|
let user = c.args[0].to_string();
|
|
|
|
|
let url = url(&s) + &"?actor=" + &user;
|
|
|
|
|
println!("{}", url);
|
|
|
|
|
let client = reqwest::Client::new();
|
|
|
|
|
let j = client.get(url)
|
|
|
|
|
.header("Authorization", "Bearer ".to_owned() + &token)
|
|
|
|
@ -531,16 +525,6 @@ async fn pro(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
f.write_all(&j.as_bytes()).unwrap();
|
|
|
|
|
}
|
|
|
|
|
println!("{}", j);
|
|
|
|
|
} else {
|
|
|
|
|
let url = "https://bsky.social/xrpc/app.bsky.actor.getProfile?actor=".to_owned() + &data.user;
|
|
|
|
|
let client = reqwest::Client::new();
|
|
|
|
|
let j = client.get(url)
|
|
|
|
|
.header("Authorization", "Bearer ".to_owned() + &token)
|
|
|
|
|
.send()
|
|
|
|
|
.await?
|
|
|
|
|
.text()
|
|
|
|
|
.await?;
|
|
|
|
|
println!("{}", j);
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
@ -570,7 +554,9 @@ async fn mm(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.blob.upload";
|
|
|
|
|
|
|
|
|
|
let s = "upload_blob".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
|
|
|
|
|
let f = "@".to_owned() + &c.args[0].to_string();
|
|
|
|
|
use std::process::Command;
|
|
|
|
@ -619,13 +605,8 @@ async fn hh(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
|
|
|
|
|
let m = c.args[0].to_string();
|
|
|
|
|
|
|
|
|
|
let data = Datas::new().unwrap();
|
|
|
|
|
let data = Datas {
|
|
|
|
|
host: data.host,
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.handle.update";
|
|
|
|
|
let s = "update_handle".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
println!("DNS txt : _atproto.{}, did={}.", m, did);
|
|
|
|
|
|
|
|
|
|
let handle = Handle {
|
|
|
|
@ -659,7 +640,9 @@ async fn cc(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.account.create";
|
|
|
|
|
|
|
|
|
|
let s = "account_create".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let handle = data.user;
|
|
|
|
|
|
|
|
|
|
let mut map = HashMap::new();
|
|
|
|
@ -716,13 +699,8 @@ async fn mention(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
let handle: Handle = serde_json::from_str(&data).unwrap();
|
|
|
|
|
let handle = handle.handle;
|
|
|
|
|
|
|
|
|
|
let data = Datas::new().unwrap();
|
|
|
|
|
let data = Datas {
|
|
|
|
|
host: data.host,
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.repo.createRecord";
|
|
|
|
|
let s = "record_create".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let col = "app.bsky.feed.post".to_string();
|
|
|
|
|
|
|
|
|
|
let d = Timestamp::now_utc();
|
|
|
|
@ -811,15 +789,11 @@ async fn nn(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
|
|
|
|
|
let json: Token = serde_json::from_str(&data).unwrap();
|
|
|
|
|
let token = json.accessJwt;
|
|
|
|
|
|
|
|
|
|
let data = Datas::new().unwrap();
|
|
|
|
|
let data = Datas {
|
|
|
|
|
host: data.host,
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if let Ok(_get) = c.string_flag("get") {
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/app.bsky.notification.getCount";
|
|
|
|
|
|
|
|
|
|
let s = "notify_count".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let client = reqwest::Client::new();
|
|
|
|
|
let res = client
|
|
|
|
|
.get(url)
|
|
|
|
@ -831,7 +805,8 @@ async fn nn(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
println!("{}", res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/app.bsky.notification.list";
|
|
|
|
|
let s = "notify_list".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let client = reqwest::Client::new();
|
|
|
|
|
let res = client
|
|
|
|
|
.get(url)
|
|
|
|
@ -1001,14 +976,8 @@ async fn rr(c: &Context) -> reqwest::Result<()> {
|
|
|
|
|
let token = json.accessJwt;
|
|
|
|
|
let did = json.did;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let data = Datas::new().unwrap();
|
|
|
|
|
let data = Datas {
|
|
|
|
|
host: data.host,
|
|
|
|
|
user: data.user,
|
|
|
|
|
pass: data.pass,
|
|
|
|
|
};
|
|
|
|
|
let url = "https://".to_owned() + &data.host + &"/xrpc/com.atproto.repo.createRecord";
|
|
|
|
|
let s = "record_create".to_string();
|
|
|
|
|
let url = url(&s);
|
|
|
|
|
let col = "app.bsky.feed.post".to_string();
|
|
|
|
|
let d = Timestamp::now_utc();
|
|
|
|
|
let d = d.to_string();
|
|
|
|
|