chore: add env variables back

This commit is contained in:
Paul Makles
2022-02-04 22:17:49 +00:00
parent e367c42dca
commit 88273021a2
4 changed files with 114 additions and 9 deletions

View File

@@ -12,6 +12,8 @@ use serde::{Deserialize, Serialize};
use ulid::Ulid;
use validator::Validate;
use crate::util::variables::MAX_GROUP_SIZE;
#[derive(Validate, Serialize, Deserialize)]
pub struct Data {
#[validate(length(min = 1, max = 32))]
@@ -32,9 +34,8 @@ pub async fn req(db: &Db, user: User, info: Json<Data>) -> Result<Json<Channel>>
let mut set: HashSet<String> = HashSet::from_iter(info.users.into_iter());
set.insert(user.id.clone());
// ! FIXME: un hard code this
if set.len() > 50 {
return Err(Error::GroupTooLarge { max: 50 });
if set.len() > *MAX_GROUP_SIZE {
return Err(Error::GroupTooLarge { max: *MAX_GROUP_SIZE });
}
for target in &set {

View File

@@ -1,15 +1,14 @@
/*use crate::util::{ratelimit::Ratelimiter, variables::{
use crate::util::{/*ratelimit::Ratelimiter,*/ variables::{
APP_URL, AUTUMN_URL, EXTERNAL_WS_URL, HCAPTCHA_SITEKEY, INVITE_ONLY, JANUARY_URL, USE_AUTUMN,
USE_EMAIL, USE_HCAPTCHA, USE_JANUARY, USE_VOSO, VAPID_PUBLIC_KEY, VOSO_URL, VOSO_WS_HOST,
}};*/
}};
use mongodb::bson::doc;
use rocket::{http::Status, serde::json::Value};
#[get("/")]
pub async fn root() -> Value {
todo!();
/*json!({
json!({
"revolt": crate::version::VERSION,
"features": {
"captcha": {
@@ -35,7 +34,7 @@ pub async fn root() -> Value {
"ws": *EXTERNAL_WS_URL,
"app": *APP_URL,
"vapid": *VAPID_PUBLIC_KEY
})*/
})
}
#[get("/ping")]