bump: textsender_models
Rust Build / Rustfmt (pull_request) Successful in 1m32s
Rust Build / Clippy (pull_request) Failing after 1m37s
Rust Build / Check (pull_request) Successful in 1m40s

This commit is contained in:
2026-07-04 19:48:12 -04:00
parent 9dba08f179
commit d3f040bde6
7 changed files with 52 additions and 650 deletions
+5 -9
View File
@@ -192,9 +192,8 @@ pub async fn user_login(
Ok(matches) => {
if matches {
// Create token
let key = textsender_models::envy::environment::get_secret_key()
.await
.value;
let key =
textsender_models::envy::environment::get_secret_key().value;
let cst = token_stuff::create_token(&key, &user.id).unwrap();
if token_stuff::verify_token(&key, &cst.access_token) {
@@ -332,9 +331,8 @@ pub async fn service_user_login(
if matches {
// Create token
println!("Creating token");
let key = textsender_models::envy::environment::get_secret_key()
.await
.value;
let key =
textsender_models::envy::environment::get_secret_key().value;
let cst =
token_stuff::create_token(&key, &service_user.id).unwrap();
@@ -439,9 +437,7 @@ pub async fn refresh_token(
}),
)
} else {
let key = textsender_models::envy::environment::get_secret_key()
.await
.value;
let key = textsender_models::envy::environment::get_secret_key().value;
if token_stuff::verify_token(&key, &payload.access_token) {
match token_stuff::extract_id_from_token(&key, &payload.access_token) {
Ok(id) => {
+1 -1
View File
@@ -183,7 +183,7 @@ pub async fn register_user(
/// Checks to see if registration is enabled
async fn is_registration_enabled() -> Result<bool, std::io::Error> {
let key = String::from("ENABLE_REGISTRATION");
let var = textsender_models::envy::environment::get_env(&key).await;
let var = textsender_models::envy::environment::get_env(&key);
let parsed_value = var.value.to_uppercase();
if parsed_value == "TRUE" {
+1 -3
View File
@@ -1,9 +1,7 @@
use sqlx::postgres::PgPoolOptions;
pub async fn create_pool() -> Result<sqlx::PgPool, sqlx::Error> {
let database_url = textsender_models::envy::environment::get_db_url()
.await
.value;
let database_url = textsender_models::envy::environment::get_db_url().value;
println!("Database url: {database_url}");
PgPoolOptions::new()
+1 -1
View File
@@ -58,7 +58,7 @@ pub mod init {
match std::env::var(textsender_models::envy::keys::APP_ENV).as_deref() {
Ok("production") => {
let allowed_origins_env =
textsender_models::envy::environment::get_allowed_origins().await;
textsender_models::envy::environment::get_allowed_origins();
match textsender_models::envy::utility::delimitize(&allowed_origins_env) {
Ok(alwd) => {
let allowed_origins: Vec<axum::http::HeaderValue> = alwd
+3 -3
View File
@@ -26,7 +26,7 @@ pub fn create_token(
audiences: vec![String::from(AUDIENCE)],
user_id: *id,
};
textsender_models::token::create_token(provided_key, &resource, time::Duration::hours(4))
textsender_models::token::create_token(provided_key, resource, time::Duration::hours(4))
}
pub fn create_service_token(
@@ -39,7 +39,7 @@ pub fn create_service_token(
audiences: vec![String::from(AUDIENCE)],
user_id: *id,
};
textsender_models::token::create_token(provided, &resource, time::Duration::hours(1))
textsender_models::token::create_token(provided, resource, time::Duration::hours(1))
}
pub fn create_service_refresh_token(
@@ -52,7 +52,7 @@ pub fn create_service_refresh_token(
audiences: vec![String::from(AUDIENCE)],
user_id: *id,
};
textsender_models::token::create_token(key, &resource, time::Duration::hours(4))
textsender_models::token::create_token(key, resource, time::Duration::hours(4))
}
pub fn verify_token(key: &String, token: &String) -> bool {