chore (backend-rs): remove unused things
This commit is contained in:
parent
eb11b32c5c
commit
e35ce24369
5 changed files with 4 additions and 37 deletions
3
packages/backend-rs/index.d.ts
vendored
3
packages/backend-rs/index.d.ts
vendored
|
@ -531,9 +531,6 @@ export interface Instance {
|
|||
faviconUrl: string | null
|
||||
}
|
||||
|
||||
export type InternalActor = 'instance'|
|
||||
'relay';
|
||||
|
||||
/**
|
||||
* Checks if a server is allowlisted.
|
||||
* Returns `Ok(true)` if private mode is disabled.
|
||||
|
|
|
@ -392,7 +392,6 @@ module.exports.greet = nativeBinding.greet
|
|||
module.exports.hashPassword = nativeBinding.hashPassword
|
||||
module.exports.Inbound = nativeBinding.Inbound
|
||||
module.exports.initializeRustLogger = nativeBinding.initializeRustLogger
|
||||
module.exports.InternalActor = nativeBinding.InternalActor
|
||||
module.exports.isAllowedServer = nativeBinding.isAllowedServer
|
||||
module.exports.isBlockedServer = nativeBinding.isBlockedServer
|
||||
module.exports.isOldPasswordAlgorithm = nativeBinding.isOldPasswordAlgorithm
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//! In-memory instance actor cache
|
||||
|
||||
use super::INSTANCE_ACTOR_USERNAME;
|
||||
use crate::{database::db_conn, model::entity::user};
|
||||
use sea_orm::prelude::*;
|
||||
use tokio::sync::OnceCell;
|
||||
|
@ -9,6 +8,7 @@ use tokio::sync::OnceCell;
|
|||
// https://github.com/napi-rs/napi-rs/issues/2060
|
||||
type User = user::Model;
|
||||
|
||||
pub const USERNAME: &str = "instance.actor";
|
||||
static INSTANCE_ACTOR: OnceCell<User> = OnceCell::const_new();
|
||||
|
||||
#[macros::errors]
|
||||
|
@ -25,7 +25,7 @@ async fn set_cache() -> Result<&'static User, Error> {
|
|||
.get_or_try_init(|| async {
|
||||
tracing::debug!("caching @instance.actor");
|
||||
let found_model = user::Entity::find()
|
||||
.filter(user::Column::Username.eq(INSTANCE_ACTOR_USERNAME))
|
||||
.filter(user::Column::Username.eq(USERNAME))
|
||||
.filter(user::Column::Host.is_null())
|
||||
.one(db_conn().await?)
|
||||
.await?;
|
||||
|
|
|
@ -1,33 +1,4 @@
|
|||
pub mod instance;
|
||||
pub mod relay;
|
||||
|
||||
use super::acct::Acct;
|
||||
|
||||
#[derive(Debug)]
|
||||
#[macros::derive_clone_and_export(string_enum = "lowercase")]
|
||||
pub enum InternalActor {
|
||||
Instance,
|
||||
Relay,
|
||||
}
|
||||
|
||||
const INSTANCE_ACTOR_USERNAME: &str = "instance.actor";
|
||||
const RELAY_ACTOR_USERNAME: &str = "relay.actor";
|
||||
|
||||
// TODO: When `std::mem::variant_count` is stabilized, use
|
||||
// it to count system actors instead of hard coding the magic number
|
||||
pub const INTERNAL_ACTORS: u64 = 2;
|
||||
|
||||
impl From<InternalActor> for Acct {
|
||||
fn from(actor: InternalActor) -> Self {
|
||||
match actor {
|
||||
InternalActor::Instance => Acct {
|
||||
username: INSTANCE_ACTOR_USERNAME.to_owned(),
|
||||
host: None,
|
||||
},
|
||||
InternalActor::Relay => Acct {
|
||||
username: RELAY_ACTOR_USERNAME.to_owned(),
|
||||
host: None,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
//! In-memory relay actor id cache
|
||||
|
||||
use super::RELAY_ACTOR_USERNAME;
|
||||
use crate::{database::db_conn, model::entity::user};
|
||||
use sea_orm::{prelude::*, QuerySelect, SelectColumns};
|
||||
use tokio::sync::OnceCell;
|
||||
|
||||
pub const USERNAME: &str = "relay.actor";
|
||||
static RELAY_ACTOR_ID: OnceCell<String> = OnceCell::const_new();
|
||||
|
||||
#[macros::errors]
|
||||
|
@ -23,7 +23,7 @@ async fn set_id_cache() -> Result<&'static str, Error> {
|
|||
let found_id = user::Entity::find()
|
||||
.select_only()
|
||||
.select_column(user::Column::Id)
|
||||
.filter(user::Column::Username.eq(RELAY_ACTOR_USERNAME))
|
||||
.filter(user::Column::Username.eq(USERNAME))
|
||||
.filter(user::Column::Host.is_null())
|
||||
.into_tuple::<String>()
|
||||
.one(db_conn().await?)
|
||||
|
|
Loading…
Reference in a new issue