Compare commits

...

2 Commits

2 changed files with 12 additions and 8 deletions

View File

@ -53,7 +53,11 @@ export async function search() {
const res = await promise;
if (res.type === "User") {
mainRouter.push(`/@${res.object.username}@${res.object.host}`);
mainRouter.push(
`/@${res.object.username}` + res.object.host
? `@${res.object.host}`
: ""
);
} else if (res.type === "Note") {
mainRouter.push(`/notes/${res.object.id}`);
}

View File

@ -8,7 +8,7 @@ use miette::{miette, IntoDiagnostic};
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use std::any::Any;
use std::collections::HashMap;
use std::collections::{BTreeMap, HashMap};
use std::fmt::Debug;
use std::future;
use std::future::Future;
@ -135,15 +135,15 @@ type MagRpcDecoderMapped =
dyn (Fn(&'_ [u8]) -> Result<MessageRaw, rmp_serde::decode::Error>) + Send + Sync + 'static;
pub struct MagRpc {
listeners: HashMap<String, Arc<MagRpcHandlerMapped>>,
payload_decoders: HashMap<String, Box<MagRpcDecoderMapped>>,
listeners: BTreeMap<String, Arc<MagRpcHandlerMapped>>,
payload_decoders: BTreeMap<String, Box<MagRpcDecoderMapped>>,
}
impl MagRpc {
pub fn new() -> Self {
MagRpc {
listeners: HashMap::new(),
payload_decoders: HashMap::new(),
listeners: BTreeMap::new(),
payload_decoders: BTreeMap::new(),
}
}
@ -410,8 +410,8 @@ fn process(
#[derive(Clone)]
struct RpcCallDecoder {
listeners: Arc<HashMap<String, Arc<MagRpcHandlerMapped>>>,
payload_decoders: Arc<HashMap<String, Box<MagRpcDecoderMapped>>>,
listeners: Arc<BTreeMap<String, Arc<MagRpcHandlerMapped>>>,
payload_decoders: Arc<BTreeMap<String, Box<MagRpcDecoderMapped>>>,
}
impl RpcCallDecoder {