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; const res = await promise;
if (res.type === "User") { 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") { } else if (res.type === "Note") {
mainRouter.push(`/notes/${res.object.id}`); mainRouter.push(`/notes/${res.object.id}`);
} }

View File

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