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

Configure Feed

Select the types of activity you want to include in your feed.

ft: replace `forge` source with `http` source

+15 -20
+10 -13
cli/src/sources/mod.rs
··· 17 17 pub enum Source { 18 18 Raw(Raw), 19 19 Hosts(Hosts), 20 - Forge(Forge), 20 + Http(Http), 21 21 Github(String), 22 22 Sourcehut(String), 23 23 Gitlab(String), ··· 30 30 match *self { 31 31 Source::Raw(ref raw) => raw.fetch().await, 32 32 Source::Hosts(ref raw) => raw.fetch().await, 33 - Source::Forge(ref raw) => raw.fetch().await, 34 - Source::Github(ref user) => Forge { user: user.clone(), host: "github.com".into() }.fetch().await, 35 - Source::Sourcehut(ref user) => Forge { user: user.clone(), host: "meta.sr.ht".into() }.fetch().await, 36 - Source::Gitlab(ref user) => Forge { user: user.clone(), host: "gitlab.com".into() }.fetch().await, 37 - Source::Codeberg(ref user) => Forge { user: user.clone(), host: "codeberg.org".into() }.fetch().await, 33 + Source::Http(ref raw) => raw.fetch().await, 34 + Source::Github(ref user) => Http { url: format!("https://github.com/{user}.keys") }.fetch().await, 35 + Source::Sourcehut(ref user) => Http { url: format!("https://meta.sr.ht/{user}.keys") }.fetch().await, 36 + Source::Gitlab(ref user) => Http { url: format!("https://gitlab.com/{user}.keys") }.fetch().await, 37 + Source::Codeberg(ref user) => Http { url: format!("https://codeberg.org/{user}.keys") }.fetch().await, 38 38 } 39 39 } 40 40 } ··· 81 81 } 82 82 83 83 #[derive(Debug, Deserialize)] 84 - pub struct Forge { 85 - pub user: String, 86 - pub host: String, 84 + pub struct Http { 85 + pub url: String 87 86 } 88 87 89 88 #[async_trait] 90 - impl Fetch for Forge { 89 + impl Fetch for Http { 91 90 async fn fetch(&self) -> Vec<PublicKey> { 92 - let url = format!("https://{}/{}.keys", self.host, self.user); 93 - 94 - reqwest::get(url) 91 + reqwest::get(&self.url) 95 92 .await 96 93 .unwrap() 97 94 .text()
+5 -7
docs/fuk.1.scd
··· 34 34 *host* 35 35 Hostnames that will be passed to _ssh-keyscan_(1). 36 36 37 - *forge* 38 - Takes map as an argument, that map must have 2 keys, _user_ which will 39 - be the name of the user used for querying and _host_ which will be the 40 - host that will be queried. The resulting URL will be constructed as 41 - _https://{host}/{user}.keys_. 37 + *http* 38 + Takes `url` as and argument, with URL pointing to the HTTP resource that 39 + will contain SSH keys. 42 40 43 41 *github*, *gitlab*, *sourcehut*, *codeberg* 44 - Each of these are shortcuts for *forge* entries to provide default 45 - _host_ for equivalent entries. In order these would be _github.com_, 42 + Each of these are shortcuts for *http* entries to provide default 43 + _url_ for equivalent entries. In order these would be _github.com_, 46 44 _gitlab.com_, _meta.sr.ht_, and _codeberg.org_. 47 45 48 46 Example configuration: