Skip to content
Snippets Groups Projects
Commit 6716a2d3 authored by insert's avatar insert
Browse files

Join with newlines for embed generation.

Server January URL endpoint on server configuration.
parent 6cc92b87
Branches
Tags
No related merge requests found
...@@ -107,9 +107,8 @@ impl Embed { ...@@ -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 < >
......
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 { ...@@ -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();
......
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 { ...@@ -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,
......
...@@ -49,6 +49,7 @@ lazy_static! { ...@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment