diff options
| author | Xe Iaso <me@christine.website> | 2023-09-30 10:36:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-30 10:36:37 -0400 |
| commit | ac6a3df0d18cc73524c0096d954a57d24cad5669 (patch) | |
| tree | 81474177d730440657f490ae29892d62392251ea /src/bin | |
| parent | cbdea8ba3fca9a663778af71f8df5965aeb6c090 (diff) | |
| download | xesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.tar.xz xesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.zip | |
Xesite V4 (#723)
* scripts/ditherify: fix quoting
Signed-off-by: Xe Iaso <me@xeiaso.net>
* clean up some old files
Signed-off-by: Xe Iaso <me@xeiaso.net>
* import site into lume
Signed-off-by: Xe Iaso <me@xeiaso.net>
* initial go code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* move vods index to top level
Signed-off-by: Xe Iaso <me@xeiaso.net>
* remove the ads
Signed-off-by: Xe Iaso <me@xeiaso.net>
* internal/lume: metrics
Signed-off-by: Xe Iaso <me@xeiaso.net>
* delete old code
Signed-off-by: Xe Iaso <me@xeiaso.net>
* load config into memory
Signed-off-by: Xe Iaso <me@xeiaso.net>
* autogenerate data from dhall config
Signed-off-by: Xe Iaso <me@xeiaso.net>
* various cleanups, import clackset logic
Signed-off-by: Xe Iaso <me@xeiaso.net>
* Update signalboost.dhall (#722)
Added myself, and also fixed someone’s typo
* Add Connor Edwards to signal boost (#721)
* add cache headers
Signed-off-by: Xe Iaso <me@xeiaso.net>
* move command to xesite folder
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: listen for GitHub webhook push events
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: 5 minute timeout for rebuilding the site
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: add rebuild metrics
Signed-off-by: Xe Iaso <me@xeiaso.net>
* xesite: update default variables
Signed-off-by: Xe Iaso <me@xeiaso.net>
* don't commit binaries oops lol
Signed-off-by: Xe Iaso <me@xeiaso.net>
* lume: make search have a light background
Signed-off-by: Xe Iaso <me@xeiaso.net>
* add a notfound page
Signed-off-by: Xe Iaso <me@xeiaso.net>
* fetch info from patreon API
Signed-off-by: Xe Iaso <me@xeiaso.net>
* create contact page
Signed-off-by: Xe Iaso <me@xeiaso.net>
* Toot embedding
Signed-off-by: Xe Iaso <me@xeiaso.net>
* attempt a docker image
Signed-off-by: Xe Iaso <me@xeiaso.net>
* lume: fix deno lock
Signed-off-by: Xe Iaso <me@xeiaso.net>
* add gokrazy post
Signed-off-by: Xe Iaso <me@xeiaso.net>
* cmd/xesite: go up before trying to connect to the saas proxy
Signed-off-by: Xe Iaso <me@xeiaso.net>
* blog: add Sine post/demo
Signed-off-by: Xe Iaso <me@xeiaso.net>
---------
Signed-off-by: Xe Iaso <me@xeiaso.net>
Co-authored-by: bri <284789+b-@users.noreply.github.com>
Co-authored-by: Connor Edwards <38229097+cedws@users.noreply.github.com>
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/fetch_mastodon_post.rs | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/src/bin/fetch_mastodon_post.rs b/src/bin/fetch_mastodon_post.rs deleted file mode 100644 index c4d981c..0000000 --- a/src/bin/fetch_mastodon_post.rs +++ /dev/null @@ -1,68 +0,0 @@ -use color_eyre::Result; -use std::{env, fs}; -use tracing::debug; -use xesite_types::mastodon::{Toot, User}; - -#[tokio::main] -async fn main() -> Result<()> { - color_eyre::install()?; - tracing_subscriber::fmt::init(); - - let args: Vec<String> = env::args().collect(); - debug!("{args:?}"); - if args.len() != 2 { - eprintln!("Usage: {} <mastodon post URL>", args[0]); - } - - let mut post_url = args[1].clone(); - - let cli = reqwest::Client::builder() - .user_agent("github.com/Xe/site fetch_mastodon_post") - .build()?; - - let toot: Toot = cli - .get(&post_url) - .header("Accept", "application/json") - .send() - .await? - .error_for_status()? - .json() - .await?; - - debug!("got post by {}", toot.attributed_to); - - fs::create_dir_all("./data/toots")?; - - if !post_url.ends_with(".json") { - post_url = format!("{post_url}.json"); - } - let post_hash = xesite::hash_string(post_url); - - debug!("wrote post to ./data/toots/{post_hash}.json"); - - let mut fout = fs::File::create(format!("./data/toots/{post_hash}.json"))?; - serde_json::to_writer_pretty(&mut fout, &toot)?; - - debug!("fetching {} ...", toot.attributed_to); - let user: User = cli - .get(&toot.attributed_to) - .header("Accept", "application/json") - .send() - .await? - .error_for_status()? - .json() - .await?; - - fs::create_dir_all("./data/users")?; - - debug!("got user {} ({})", user.preferred_username, user.name); - - let user_url = format!("{}.json", toot.attributed_to); - let user_hash = xesite::hash_string(user_url); - - debug!("wrote post to ./data/users/{user_hash}.json"); - let mut fout = fs::File::create(format!("./data/users/{user_hash}.json"))?; - serde_json::to_writer_pretty(&mut fout, &user)?; - - Ok(()) -} |
