Join with newlines for embed generation.

Server January URL endpoint on server configuration.
This commit is contained in:
Paul
2021-05-14 22:39:16 +01:00
parent 6cc92b877e
commit 6716a2d32b
4 changed files with 14 additions and 6 deletions

View File

@@ -107,9 +107,8 @@ impl Embed {
v v
}) })
// This will also remove newlines, but .collect::<Vec<&str>>()
// that isn't important here. .join("\n");
.collect::<String>();
// ! FIXME: allow multiple links // ! FIXME: allow multiple links
// ! FIXME: prevent generation if link is surrounded with < > // ! FIXME: prevent generation if link is surrounded with < >

View File

@@ -1,4 +1,4 @@
use crate::util::variables::VAPID_PRIVATE_KEY; use crate::util::variables::{VAPID_PRIVATE_KEY, USE_JANUARY};
use crate::{ use crate::{
database::*, database::*,
notifications::{events::ClientboundNotification, websocket::is_online}, notifications::{events::ClientboundNotification, websocket::is_online},
@@ -231,6 +231,10 @@ impl Message {
} }
pub fn process_embed(&self) { pub fn process_embed(&self) {
if !*USE_JANUARY {
return;
}
if let Content::Text(text) = &self.content { if let Content::Text(text) = &self.content {
let id = self.id.clone(); let id = self.id.clone();
let content = text.clone(); let content = text.clone();

View File

@@ -1,6 +1,6 @@
use crate::util::variables::{ use crate::util::variables::{
APP_URL, AUTUMN_URL, DISABLE_REGISTRATION, EXTERNAL_WS_URL, HCAPTCHA_SITEKEY, INVITE_ONLY, APP_URL, JANUARY_URL, AUTUMN_URL, DISABLE_REGISTRATION, EXTERNAL_WS_URL, HCAPTCHA_SITEKEY, INVITE_ONLY,
USE_AUTUMN, USE_EMAIL, USE_HCAPTCHA, USE_VOSO, VAPID_PUBLIC_KEY, VOSO_URL, VOSO_WS_HOST, USE_AUTUMN, USE_JANUARY, USE_EMAIL, USE_HCAPTCHA, USE_VOSO, VAPID_PUBLIC_KEY, VOSO_URL, VOSO_WS_HOST,
}; };
use mongodb::bson::doc; use mongodb::bson::doc;
@@ -22,6 +22,10 @@ pub async fn root() -> JsonValue {
"enabled": *USE_AUTUMN, "enabled": *USE_AUTUMN,
"url": *AUTUMN_URL "url": *AUTUMN_URL
}, },
"january": {
"enabled": *USE_JANUARY,
"url": *JANUARY_URL
},
"voso": { "voso": {
"enabled": *USE_VOSO, "enabled": *USE_VOSO,
"url": *VOSO_URL, "url": *VOSO_URL,

View File

@@ -49,6 +49,7 @@ lazy_static! {
pub static ref USE_HCAPTCHA: bool = env::var("REVOLT_HCAPTCHA_KEY").is_ok(); pub static ref USE_HCAPTCHA: bool = env::var("REVOLT_HCAPTCHA_KEY").is_ok();
pub static ref USE_PROMETHEUS: bool = env::var("REVOLT_ENABLE_PROMETHEUS").map_or(false, |v| v == "1"); pub static ref USE_PROMETHEUS: bool = env::var("REVOLT_ENABLE_PROMETHEUS").map_or(false, |v| v == "1");
pub static ref USE_AUTUMN: bool = env::var("AUTUMN_PUBLIC_URL").is_ok(); pub static ref USE_AUTUMN: bool = env::var("AUTUMN_PUBLIC_URL").is_ok();
pub static ref USE_JANUARY: bool = env::var("JANUARY_PUBLIC_URL").is_ok();
pub static ref USE_VOSO: bool = env::var("VOSO_PUBLIC_URL").is_ok() && env::var("VOSO_MANAGE_TOKEN").is_ok(); pub static ref USE_VOSO: bool = env::var("VOSO_PUBLIC_URL").is_ok() && env::var("VOSO_MANAGE_TOKEN").is_ok();
// SMTP Settings // SMTP Settings