Fetch User Keys - simple tool for fetching SSH keys from various sources

ft: normalise SourceHut username

hauleth.dev bdd4cf14 d35e5c70

verified
Changed files
+9 -1
cli
src
sources
+9 -1
cli/src/sources/mod.rs
···
}
.fetch(),
Source::Sourcehut(ref user) => Http {
-
url: format!("https://meta.sr.ht/{user}.keys"),
}
.fetch(),
Source::Gitlab(ref user) => Http {
···
.fetch(),
Source::Tangled(ref atproto) => atproto.fetch(),
}
}
}
···
}
.fetch(),
Source::Sourcehut(ref user) => Http {
+
url: format!("https://meta.sr.ht/{}.keys", normalize_sourcehut(user)),
}
.fetch(),
Source::Gitlab(ref user) => Http {
···
.fetch(),
Source::Tangled(ref atproto) => atproto.fetch(),
}
+
}
+
}
+
+
fn normalize_sourcehut<'a>(s: &'a str) -> std::borrow::Cow<'a, str> {
+
if s.starts_with("~") {
+
s.into()
+
} else {
+
format!("~{s}").into()
}
}