diff options
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | companion-lite/index.html | 2 | ||||
-rw-r--r-- | companion-lite/src/indieauth.ts | 2 | ||||
-rw-r--r-- | companion-lite/src/micropub_api.ts | 2 | ||||
-rw-r--r-- | examples/password-hasher.rs | 2 | ||||
-rw-r--r-- | indieauth/src/lib.rs | 2 | ||||
-rw-r--r-- | indieauth/src/scopes.rs | 6 | ||||
-rw-r--r-- | nixos-tests/webmention-test.nix | 4 | ||||
-rw-r--r-- | src/bin/kittybox-check-webmention.rs | 6 | ||||
-rw-r--r-- | src/bin/kittybox-indieauth-helper.rs | 14 | ||||
-rw-r--r-- | src/bin/kittybox-mf2.rs | 2 | ||||
-rw-r--r-- | src/database/postgres/mod.rs | 6 | ||||
-rw-r--r-- | src/indieauth/backend/fs.rs | 6 | ||||
-rw-r--r-- | src/indieauth/mod.rs | 2 | ||||
-rw-r--r-- | src/media/storage/file.rs | 6 | ||||
-rw-r--r-- | src/micropub/util.rs | 2 | ||||
-rw-r--r-- | src/webmentions/check.rs | 4 | ||||
-rw-r--r-- | templates-neo/src/mf2.rs | 4 | ||||
-rw-r--r-- | templates/javascript/src/indieauth.ts | 2 | ||||
-rw-r--r-- | templates/src/indieauth.rs | 2 |
20 files changed, 40 insertions, 40 deletions
diff --git a/README.md b/README.md index 85f0e70..2299f20 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ $ cargo check ## Deployment ### Using NixOS ```nix -{ config, pkgs, lib, ...}: let +{ config, pkgs, lib, ...}: let # Included as an example. You should probably use `flake.nix` instead. # You will get version pinning and you will probably be happier. kittybox = (builtins.getFlake "git+https://git.sr.ht/~vikanezrimaya/kittybox?ref=main"); @@ -71,7 +71,7 @@ in { imports = [ kittybox.nixosModules.default ]; - + services.kittybox.enable = true; } ``` diff --git a/companion-lite/index.html b/companion-lite/index.html index fc99c60..f5e0bdb 100644 --- a/companion-lite/index.html +++ b/companion-lite/index.html @@ -58,7 +58,7 @@ <input type="radio" id="select_channels" name="channel_select" value="on"> <label for="select_channels">Select channels manually</label> </section> - + <fieldset id="channels" style="display: none"> <legend>Available channels:</legend> <template id="channel_selector"> diff --git a/companion-lite/src/indieauth.ts b/companion-lite/src/indieauth.ts index 40facab..31854ee 100644 --- a/companion-lite/src/indieauth.ts +++ b/companion-lite/src/indieauth.ts @@ -45,7 +45,7 @@ export interface IndiewebEndpoints { userinfo_endpoint: URL | null, revocation_endpoint: URL | null, micropub: URL, - + } export function create_verifier() { diff --git a/companion-lite/src/micropub_api.ts b/companion-lite/src/micropub_api.ts index fa1c431..c863256 100644 --- a/companion-lite/src/micropub_api.ts +++ b/companion-lite/src/micropub_api.ts @@ -44,7 +44,7 @@ export class Micropub { readonly token: string readonly micropub_endpoint: URL private config_response: MicropubConfig | null - + constructor({ endpoint, token }: { endpoint: URL, token: string }) { this.micropub_endpoint = endpoint; this.token = token; diff --git a/examples/password-hasher.rs b/examples/password-hasher.rs index f11c591..92de7f7 100644 --- a/examples/password-hasher.rs +++ b/examples/password-hasher.rs @@ -11,7 +11,7 @@ fn main() -> std::io::Result<()> { s }; - + let salt = SaltString::generate(&mut OsRng); let argon2 = Argon2::default(); //eprintln!("{}", password.trim()); diff --git a/indieauth/src/lib.rs b/indieauth/src/lib.rs index a60cc42..9841b53 100644 --- a/indieauth/src/lib.rs +++ b/indieauth/src/lib.rs @@ -517,7 +517,7 @@ impl TokenData { /// Check if the token in question expired. pub fn expired(&self) -> bool { use std::time::{Duration, SystemTime, UNIX_EPOCH}; - + self.exp .map(|exp| SystemTime::now() .duration_since(UNIX_EPOCH) diff --git a/indieauth/src/scopes.rs b/indieauth/src/scopes.rs index d74878e..c664c55 100644 --- a/indieauth/src/scopes.rs +++ b/indieauth/src/scopes.rs @@ -164,7 +164,7 @@ impl<'de> Visitor<'de> for ScopeVisitor { } } impl<'de> Deserialize<'de> for Scopes { - + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'de> @@ -191,7 +191,7 @@ mod tests { let scope_str = scope_serialized.as_str().unwrap(); assert_eq!(scope_str, "create update delete media kittybox_internal_access"); - assert!(serde_json::from_value::<Scopes>(scope_serialized).unwrap().has_all(&scopes)) + assert!(serde_json::from_value::<Scopes>(scope_serialized).unwrap().has_all(&scopes)) } #[test] @@ -201,7 +201,7 @@ mod tests { ]); assert!(scopes.has_all(&[Scope::Create, Scope::custom("draft")])); - + assert!(!scopes.has_all(&[Scope::Read, Scope::custom("kittybox_internal_access")])); } diff --git a/nixos-tests/webmention-test.nix b/nixos-tests/webmention-test.nix index 2161e88..45e3ff7 100644 --- a/nixos-tests/webmention-test.nix +++ b/nixos-tests/webmention-test.nix @@ -33,7 +33,7 @@ in { firewall.allowedUDPPorts = [ 443 ]; }; - + services.kittybox = { enable = true; logLevel = "info,kittybox=debug,retainer::cache=warn,h2=warn,rustls=warn"; @@ -156,6 +156,6 @@ in { # Ensure the webmention has propagated # Kittybox doesn't fully render them yet, but the counters are there kittybox.succeed("xh --verify ${./tls/rootCA.pem} https://kittybox.test/posts/test-post | grep " + shlex.quote('<span class="icon" aria-label="replies">💬</span><span class="counter">1</span>')) - + ''; } diff --git a/src/bin/kittybox-check-webmention.rs b/src/bin/kittybox-check-webmention.rs index f02032c..820e7c4 100644 --- a/src/bin/kittybox-check-webmention.rs +++ b/src/bin/kittybox-check-webmention.rs @@ -104,7 +104,7 @@ fn check_mention(document: impl AsRef<str>, base_url: &url::Url, link: &url::Url } } } - + } } @@ -128,7 +128,7 @@ struct Args { #[tokio::main] async fn main() -> Result<(), self::Error> { let args = Args::parse(); - + let http: reqwest::Client = { #[allow(unused_mut)] let mut builder = reqwest::Client::builder() @@ -141,7 +141,7 @@ async fn main() -> Result<(), self::Error> { let response = http.get(args.url.clone()).send().await?; let text = response.text().await?; - + if let Some(mention_type) = check_mention(text, &args.url, &args.link)? { println!("{:?}", mention_type); diff --git a/src/bin/kittybox-indieauth-helper.rs b/src/bin/kittybox-indieauth-helper.rs index 3377ec3..4e82f8b 100644 --- a/src/bin/kittybox-indieauth-helper.rs +++ b/src/bin/kittybox-indieauth-helper.rs @@ -80,7 +80,7 @@ async fn main() -> Result<(), Error> { let redirect_uri: url::Url = args.redirect_uri .clone() .unwrap_or_else(|| DEFAULT_REDIRECT_URI.parse().unwrap()); - + eprintln!("Checking .well-known for metadata..."); let metadata = http.get(args.me.join("/.well-known/oauth-authorization-server")?) .header("Accept", "application/json") @@ -90,7 +90,7 @@ async fn main() -> Result<(), Error> { .await?; let verifier = PKCEVerifier::new(); - + let authorization_request = AuthorizationRequest { response_type: kittybox_indieauth::ResponseType::Code, client_id: args.client_id.clone(), @@ -112,21 +112,21 @@ async fn main() -> Result<(), Error> { eprintln!("Custom redirect URI specified, won't be able to catch authorization response."); std::process::exit(0); } - + // Prepare a callback let (tx, rx) = tokio::sync::oneshot::channel::<AuthorizationResponse>(); let server = { use axum::{routing::get, extract::Query, response::IntoResponse}; let tx = std::sync::Arc::new(tokio::sync::Mutex::new(Some(tx))); - + let router = axum::Router::new() .route("/callback", axum::routing::get( move |query: Option<Query<AuthorizationResponse>>| async move { if let Some(Query(response)) = query { if let Some(tx) = tx.lock_owned().await.take() { tx.send(response).unwrap(); - + (axum::http::StatusCode::OK, [("Content-Type", "text/plain")], "Thank you! This window can now be closed.") @@ -152,7 +152,7 @@ async fn main() -> Result<(), Error> { tokio::task::spawn(server) }; - + let authorization_response = rx.await.unwrap(); // Clean up after the server @@ -166,7 +166,7 @@ async fn main() -> Result<(), Error> { eprintln!("Got authorization response: {:#?}", authorization_response); eprint!("Checking issuer field..."); std::io::stderr().lock().flush()?; - + if dbg!(authorization_response.iss.as_str()) == dbg!(metadata.issuer.as_str()) { eprintln!(" Done"); } else { diff --git a/src/bin/kittybox-mf2.rs b/src/bin/kittybox-mf2.rs index 4366cb8..85ebc6f 100644 --- a/src/bin/kittybox-mf2.rs +++ b/src/bin/kittybox-mf2.rs @@ -27,7 +27,7 @@ enum Error { #[tokio::main] async fn main() -> Result<(), Error> { let args = Args::parse(); - + let http: reqwest::Client = { #[allow(unused_mut)] let mut builder = reqwest::Client::builder() diff --git a/src/database/postgres/mod.rs b/src/database/postgres/mod.rs index 9176d12..ee7dd1c 100644 --- a/src/database/postgres/mod.rs +++ b/src/database/postgres/mod.rs @@ -60,7 +60,7 @@ impl PostgresStorage { .connect_with(options) .await? ).await - + } /// Construct a [`PostgresStorage`] from a [`sqlx::PgPool`], @@ -227,7 +227,7 @@ impl Storage for PostgresStorage { .bind(post) .execute(&mut *txn) .await?; - + txn.commit().await.map_err(Into::into) } @@ -307,7 +307,7 @@ ORDER BY mf2 #>> '{properties,published,0}' DESC ); Ok(Some(feed)) - + } #[tracing::instrument(skip(self))] diff --git a/src/indieauth/backend/fs.rs b/src/indieauth/backend/fs.rs index 600e901..80c3703 100644 --- a/src/indieauth/backend/fs.rs +++ b/src/indieauth/backend/fs.rs @@ -25,7 +25,7 @@ impl FileBackend { path: path.into() } } - + /// Sanitize a filename, leaving only alphanumeric characters. /// /// Doesn't allocate a new string unless non-alphanumeric @@ -71,7 +71,7 @@ impl FileBackend { (if has_ext { filename .extension() - + } else { filename .file_name() @@ -337,7 +337,7 @@ impl AuthBackend for FileBackend { let password_filename = self.path .join(FileBackend::url_to_dir(website)) .join("password"); - + let salt = SaltString::generate(&mut OsRng); let argon2 = Argon2::default(); let password_hash = argon2.hash_password(password.as_bytes(), &salt) diff --git a/src/indieauth/mod.rs b/src/indieauth/mod.rs index 0ad2702..def9dfc 100644 --- a/src/indieauth/mod.rs +++ b/src/indieauth/mod.rs @@ -89,7 +89,7 @@ impl <S: Send + Sync, A: AuthBackend> axum::extract::FromRequestParts<S> for Use let Host(host) = Host::from_request_parts(req, state) .await .map_err(|_| IndieAuthResourceError::InvalidRequest)?; - + auth.get_token( &format!("https://{host}/").parse().unwrap(), token.token() diff --git a/src/media/storage/file.rs b/src/media/storage/file.rs index 0aaaa3b..a910eca 100644 --- a/src/media/storage/file.rs +++ b/src/media/storage/file.rs @@ -122,7 +122,7 @@ impl MediaStore for FileStore { debug!("File path: {}, metadata: {}", filepath.display(), metapath.display()); { let parent = filepath.parent().unwrap(); - tokio::fs::create_dir_all(parent).await?; + tokio::fs::create_dir_all(parent).await?; } let mut meta = OpenOptions::new() .create_new(true) @@ -178,7 +178,7 @@ impl MediaStore for FileStore { Ok(meta) } - + #[tracing::instrument(skip(self))] async fn stream_range( &self, @@ -367,7 +367,7 @@ mod tests { assert_eq!(range.as_slice(), file); } - + #[tokio::test] #[tracing_test::traced_test] async fn test_streaming_read_write() { diff --git a/src/micropub/util.rs b/src/micropub/util.rs index 940d7c3..b6a045d 100644 --- a/src/micropub/util.rs +++ b/src/micropub/util.rs @@ -26,7 +26,7 @@ fn get_folder_from_type(post_type: &str) -> String { /// Reset the datetime to a proper datetime. /// Do not attempt to recover the information. -/// Do not pass GO. Do not collect $200. +/// Do not pass GO. Do not collect $200. fn reset_dt(post: &mut serde_json::Value) -> DateTime<FixedOffset> { let curtime: DateTime<Local> = Local::now(); post["properties"]["published"] = json!([curtime.to_rfc3339()]); diff --git a/src/webmentions/check.rs b/src/webmentions/check.rs index f7322f7..6dc6a25 100644 --- a/src/webmentions/check.rs +++ b/src/webmentions/check.rs @@ -90,7 +90,7 @@ pub fn check_mention(document: impl AsRef<str> + std::fmt::Debug, base_url: &url continue 'nodes_loop; } } - // if it's not `<a href="...">`, skip it + // if it's not `<a href="...">`, skip it if attr.name.local != *"href" { continue; } // Be forgiving in parsing URLs, and resolve them against the base URL if let Ok(url) = base_url.join(attr.value.as_ref()) { @@ -105,7 +105,7 @@ pub fn check_mention(document: impl AsRef<str> + std::fmt::Debug, base_url: &url } } } - + } } diff --git a/templates-neo/src/mf2.rs b/templates-neo/src/mf2.rs index e59b51c..194e02b 100644 --- a/templates-neo/src/mf2.rs +++ b/templates-neo/src/mf2.rs @@ -223,7 +223,7 @@ impl TryFrom<Item> for Cite { todo!() } - + } pub enum Citation { @@ -343,7 +343,7 @@ impl TryFrom<Item> for Entry { PropertyValue::Temporal(Temporal::Timestamp(dt)) => { // This is incredibly sketchy. let (date, time, offset) = (dt.date.clone().unwrap().data, dt.as_time().unwrap().data.clone(), dt.as_time().unwrap().offset.unwrap().data); - + date.and_time(time).and_local_timezone(offset).single().ok_or_else(|| Error::WrongValueType { expected: "datetime with timezone", got: PropertyValue::Temporal(Temporal::Timestamp(dt)) diff --git a/templates/javascript/src/indieauth.ts b/templates/javascript/src/indieauth.ts index 01732b7..57f075e 100644 --- a/templates/javascript/src/indieauth.ts +++ b/templates/javascript/src/indieauth.ts @@ -126,7 +126,7 @@ export async function submit_handler(e: SubmitEvent) { authorization_method: credential }); console.log(body); - + const response = await fetch(form.action, { method: form.method, body: body, diff --git a/templates/src/indieauth.rs b/templates/src/indieauth.rs index 6a46773..155b580 100644 --- a/templates/src/indieauth.rs +++ b/templates/src/indieauth.rs @@ -143,7 +143,7 @@ document.getElementById("indieauth_page").addEventListener("submit", submit_hand input[type="password", name="user_password", id="user_password"]; } } - + input[type="submit", value="Authenticate"]; br; |