Skip to content

Commit

Permalink
Merge branch 'main' into aumetra/basic-ui-functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Oct 15, 2023
2 parents 9e149c8 + 874582e commit 7ddc054
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Rust target directories
target
target-analyzer

# Redis dump
/dump.rdb
Expand Down
18 changes: 13 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"nixEnvSelector.nixFile": "${workspaceRoot}/flake.nix",
"rust-analyzer.cargo.buildScripts.enable": true,
"editor.formatOnSave": true,
"rust-analyzer.showUnlinkedFileNotification": false,
"rust-analyzer.cargo.features": ["oidc"]
"nixEnvSelector.nixFile": "${workspaceRoot}/flake.nix",
"rust-analyzer.cargo.buildScripts.enable": true,
"editor.formatOnSave": true,
"rust-analyzer.showUnlinkedFileNotification": false,
"rust-analyzer.cargo.features": [
"oidc"
],
"rust-analyzer.check.extraArgs": [
"--target-dir=target-analyzer"
],
"rust-analyzer.server.extraEnv": {
"CARGO_TARGET_DIR": "target-analyzer"
}
}
5 changes: 2 additions & 3 deletions crates/kitsune-core/src/mapping/mastodon/sealed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use scoped_futures::ScopedFutureExt;
use serde::{de::DeserializeOwned, Serialize};
use smol_str::SmolStr;
use speedy_uuid::Uuid;
use std::str::FromStr;
use std::{fmt::Write, str::FromStr};

#[derive(Clone, Copy)]
pub struct MapperState<'a> {
Expand Down Expand Up @@ -103,8 +103,7 @@ impl IntoMastodon for DbAccount {

let mut acct = self.username.clone();
if !self.local {
acct.push('@');
acct.push_str(&self.domain);
let _ = write!(acct, "@{}", self.domain);
}

let avatar = if let Some(avatar_id) = self.avatar_id {
Expand Down
19 changes: 12 additions & 7 deletions crates/kitsune-http-signatures/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use derive_builder::Builder;
use http::{header::DATE, request::Parts};
use std::{
cmp::min,
fmt::Write,
time::{Duration, SystemTime, SystemTimeError},
};
use time::{format_description::well_known::Rfc2822, OffsetDateTime};
Expand Down Expand Up @@ -130,19 +131,23 @@ impl TryFrom<SignatureHeader<'_>> for String {
);

if let Some(algorithm) = value.algorithm {
signature_header.push_str(",algorithm=\"");
signature_header.push_str(algorithm);
signature_header.push('"');
let _ = write!(signature_header, ",algorithm=\"{algorithm}\"");
}

if let Some(created) = value.created {
signature_header.push_str(",created=");
signature_header.push_str(&created.to_unix_timestamp()?.to_string());
let _ = write!(
signature_header,
",created={}",
created.to_unix_timestamp()?
);
}

if let Some(expires) = value.expires {
signature_header.push_str(",expires=");
signature_header.push_str(&expires.to_unix_timestamp()?.to_string());
let _ = write!(
signature_header,
",expires={}",
expires.to_unix_timestamp()?
);
}

Ok(signature_header)
Expand Down

0 comments on commit 7ddc054

Please sign in to comment.