xeiaso.net

Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-05-28 09:17:01 -04:00
parent ff64215d07
commit bdc64f78f2
7 changed files with 50 additions and 45 deletions

View File

@ -29,7 +29,7 @@ impl Client {
.build()?; .build()?;
Ok(Self { Ok(Self {
cli: cli, cli,
base_url: "https://mi.within.website".to_string(), base_url: "https://mi.within.website".to_string(),
}) })
} }
@ -63,11 +63,3 @@ pub struct WebMention {
pub source: String, pub source: String,
pub title: Option<String>, pub title: Option<String>,
} }
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

View File

@ -37,7 +37,7 @@ pub fn render(inp: &str) -> Result<String> {
let mut data = node.data.borrow_mut(); let mut data = node.data.borrow_mut();
match &mut data.value { match &mut data.value {
&mut NodeValue::Link(ref mut link) => { &mut NodeValue::Link(ref mut link) => {
let base = Url::parse("https://christine.website/")?; let base = Url::parse("https://xeiaso.net/")?;
let u = base.join(std::str::from_utf8(&link.url.clone())?)?; let u = base.join(std::str::from_utf8(&link.url.clone())?)?;
if u.scheme() != "conversation" { if u.scheme() != "conversation" {
return Ok(()); return Ok(());
@ -85,9 +85,9 @@ pub fn render(inp: &str) -> Result<String> {
<div class="conversation"> <div class="conversation">
<div class="conversation-picture conversation-smol"> <div class="conversation-picture conversation-smol">
<picture> <picture>
<source srcset="https://cdn.christine.website/file/christine-static/stickers/{name_lower}/{mood}.avif" type="image/avif"> <source srcset="https://cdn.xeiaso.net/file/christine-static/stickers/{name_lower}/{mood}.avif" type="image/avif">
<source srcset="https://cdn.christine.website/file/christine-static/stickers/{name_lower}/{mood}.webp" type="image/webp"> <source srcset="https://cdn.xeiaso.net/file/christine-static/stickers/{name_lower}/{mood}.webp" type="image/webp">
<img src="https://cdn.christine.website/file/christine-static/stickers/{name_lower}/{mood}.png" alt="{name} is {mood}"> <img src="https://cdn.xeiaso.net/file/christine-static/stickers/{name_lower}/{mood}.png" alt="{name} is {mood}">
</picture> </picture>
</div> </div>
<div class="conversation-chat">&lt;<b>{name}</b>&gt; "#), ContentType::Html); <div class="conversation-chat">&lt;<b>{name}</b>&gt; "#), ContentType::Html);

View File

@ -54,7 +54,7 @@ async fn patrons() -> Result<Option<patreon::Users>> {
} }
} }
pub const ICON: &'static str = "https://christine.website/static/img/avatar.png"; pub const ICON: &'static str = "https://xeiaso.net/static/img/avatar.png";
pub struct State { pub struct State {
pub cfg: Config, pub cfg: Config,
@ -106,12 +106,12 @@ pub async fn init(cfg: PathBuf) -> Result<State> {
.author( .author(
jsonfeed::Author::new() jsonfeed::Author::new()
.name("Xe") .name("Xe")
.url("https://christine.website") .url("https://xeiaso.net")
.avatar(ICON), .avatar(ICON),
) )
.feed_url("https://christine.website/blog.json") .feed_url("https://xeiaso.net/blog.json")
.user_comment("This is a JSON feed of my blogposts. For more information read: https://jsonfeed.org/version/1") .user_comment("This is a JSON feed of my blogposts. For more information read: https://jsonfeed.org/version/1")
.home_page_url("https://christine.website") .home_page_url("https://xeiaso.net")
.icon(ICON) .icon(ICON)
.favicon(ICON); .favicon(ICON);
@ -124,17 +124,17 @@ pub async fn init(cfg: PathBuf) -> Result<State> {
let smw = sitemap::writer::SiteMapWriter::new(&mut sm); let smw = sitemap::writer::SiteMapWriter::new(&mut sm);
let mut urlwriter = smw.start_urlset()?; let mut urlwriter = smw.start_urlset()?;
for url in &[ for url in &[
"https://christine.website/resume", "https://xeiaso.net/resume",
"https://christine.website/contact", "https://xeiaso.net/contact",
"https://christine.website/", "https://xeiaso.net/",
"https://christine.website/blog", "https://xeiaso.net/blog",
"https://christine.website/signalboost", "https://xeiaso.net/signalboost",
] { ] {
urlwriter.url(*url)?; urlwriter.url(*url)?;
} }
for post in &everything { for post in &everything {
urlwriter.url(format!("https://christine.website/{}", post.link))?; urlwriter.url(format!("https://xeiaso.net/{}", post.link))?;
} }
urlwriter.end()?; urlwriter.end()?;

View File

@ -29,7 +29,7 @@ pub async fn the_cloud() -> Result<()> {
async fn bing() -> Result<()> { async fn bing() -> Result<()> {
let cli = reqwest::Client::new(); let cli = reqwest::Client::new();
cli.get("https://www.bing.com/ping") cli.get("https://www.bing.com/ping")
.query(&[("sitemap", "https://christine.website/sitemap.xml")]) .query(&[("sitemap", "https://xeiaso.net/sitemap.xml")])
.header("User-Agent", crate::APPLICATION_NAME) .header("User-Agent", crate::APPLICATION_NAME)
.send() .send()
.await? .await?
@ -42,7 +42,7 @@ async fn bing() -> Result<()> {
async fn google() -> Result<()> { async fn google() -> Result<()> {
let cli = reqwest::Client::new(); let cli = reqwest::Client::new();
cli.get("https://www.google.com/ping") cli.get("https://www.google.com/ping")
.query(&[("sitemap", "https://christine.website/sitemap.xml")]) .query(&[("sitemap", "https://xeiaso.net/sitemap.xml")])
.header("User-Agent", crate::APPLICATION_NAME) .header("User-Agent", crate::APPLICATION_NAME)
.send() .send()
.await? .await?
@ -56,17 +56,17 @@ async fn cloudflare() -> Result<()> {
let cli = cfcache::Client::new(env::var("CF_TOKEN")?, env::var("CF_ZONE_ID")?)?; let cli = cfcache::Client::new(env::var("CF_TOKEN")?, env::var("CF_ZONE_ID")?)?;
cli.purge( cli.purge(
vec![ vec![
"https://christine.website/sitemap.xml", "https://xeiaso.net/sitemap.xml",
"https://christine.website", "https://xeiaso.net",
"https://christine.website/blog", "https://xeiaso.net/blog",
"https://christine.website/blog.atom", "https://xeiaso.net/blog.atom",
"https://christine.website/blog.json", "https://xeiaso.net/blog.json",
"https://christine.website/blog.rss", "https://xeiaso.net/blog.rss",
"https://christine.website/gallery", "https://xeiaso.net/gallery",
"https://christine.website/talks", "https://xeiaso.net/talks",
"https://christine.website/resume", "https://xeiaso.net/resume",
"https://christine.website/signalboost", "https://xeiaso.net/signalboost",
"https://christine.website/feeds", "https://xeiaso.net/feeds",
] ]
.into_iter() .into_iter()
.map(|i| i.to_string()) .map(|i| i.to_string())

View File

@ -5,7 +5,7 @@ use axum::{
http::StatusCode, http::StatusCode,
response::{Html, IntoResponse, Response}, response::{Html, IntoResponse, Response},
}; };
use chrono::{Datelike, Timelike, Utc}; use chrono::{Datelike, Timelike, Utc, Weekday};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use prometheus::{opts, register_int_counter_vec, IntCounterVec}; use prometheus::{opts, register_int_counter_vec, IntCounterVec};
use std::sync::Arc; use std::sync::Arc;
@ -16,6 +16,19 @@ pub mod feeds;
pub mod gallery; pub mod gallery;
pub mod talks; pub mod talks;
fn weekday_to_name(w: Weekday) -> &'static str {
use Weekday::*;
match w {
Sun => "Sun",
Mon => "Mon",
Tue => "Tue",
Wed => "Wed",
Thu => "Thu",
Fri => "Fri",
Sat => "Sat",
}
}
lazy_static! { lazy_static! {
static ref HIT_COUNTER: IntCounterVec = static ref HIT_COUNTER: IntCounterVec =
register_int_counter_vec!(opts!("hits", "Number of hits to various pages"), &["page"]) register_int_counter_vec!(opts!("hits", "Number of hits to various pages"), &["page"])
@ -24,7 +37,7 @@ lazy_static! {
let now = Utc::now(); let now = Utc::now();
format!( format!(
"{dayname}, {day} {month} {year} {hour}:{minute}:{second} GMT", "{dayname}, {day} {month} {year} {hour}:{minute}:{second} GMT",
dayname = now.weekday(), dayname = weekday_to_name(now.weekday()),
day = now.day(), day = now.day(),
month = now.month(), month = now.month(),
year = now.year(), year = now.year(),

View File

@ -268,7 +268,7 @@ async fn go_vanity() -> Html<Vec<u8>> {
templates::gitea_html( templates::gitea_html(
&mut buffer, &mut buffer,
"christine.website/jsonfeed", "christine.website/jsonfeed",
"https://christine.website/metrics", "https://tulpa.dev/Xe/jsonfeed",
"master", "master",
) )
.unwrap(); .unwrap();

View File

@ -31,14 +31,14 @@ impl Into<jsonfeed::Item> for Post {
let mut result = jsonfeed::Item::builder() let mut result = jsonfeed::Item::builder()
.title(self.front_matter.title) .title(self.front_matter.title)
.content_html(self.body_html) .content_html(self.body_html)
.id(format!("https://christine.website/{}", self.link)) .id(format!("https://xeiaso.net/{}", self.link))
.url(format!("https://christine.website/{}", self.link)) .url(format!("https://xeiaso.net/{}", self.link))
.date_published(self.date.to_rfc3339()) .date_published(self.date.to_rfc3339())
.author( .author(
jsonfeed::Author::new() jsonfeed::Author::new()
.name("Xe Iaso") .name("Xe Iaso")
.url("https://christine.website") .url("https://xeiaso.net")
.avatar("https://christine.website/static/img/avatar.png"), .avatar("https://xeiaso.net/static/img/avatar.png"),
); );
let mut tags: Vec<String> = vec![]; let mut tags: Vec<String> = vec![];
@ -105,7 +105,7 @@ async fn read_post(dir: &str, fname: PathBuf, cli: &Option<mi::Client>) -> Resul
let mentions: Vec<mi::WebMention> = match cli { let mentions: Vec<mi::WebMention> = match cli {
Some(cli) => cli Some(cli) => cli
.mentioners(format!("https://christine.website/{}", link)) .mentioners(format!("https://xeiaso.net/{}", link))
.await .await
.map_err(|why| tracing::error!("error: can't load mentions for {}: {}", link, why)) .map_err(|why| tracing::error!("error: can't load mentions for {}: {}", link, why))
.unwrap_or(vec![]) .unwrap_or(vec![])
@ -130,7 +130,7 @@ async fn read_post(dir: &str, fname: PathBuf, cli: &Option<mi::Client>) -> Resul
let new_post = NewPost { let new_post = NewPost {
title: front_matter.title.clone(), title: front_matter.title.clone(),
summary: format!("{} minute read", read_time_estimate_minutes), summary: format!("{} minute read", read_time_estimate_minutes),
link: format!("https://christine.website/{}", link), link: format!("https://xeiaso.net/{}", link),
}; };
Ok(Post { Ok(Post {