chore: remove quark dependency from delta 🎉
closes #283 fix: allow setting port and use_tls from config closes #143
@@ -1,8 +0,0 @@
|
||||
use revolt_rocket_okapi::revolt_okapi::openapi3::OpenApi;
|
||||
use rocket::Route;
|
||||
|
||||
mod stats;
|
||||
|
||||
pub fn routes() -> (Vec<Route>, OpenApi) {
|
||||
openapi_get_routes_spec![stats::stats]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
use revolt_quark::models::stats::Stats;
|
||||
use revolt_quark::{Db, Result};
|
||||
|
||||
use rocket::serde::json::Json;
|
||||
|
||||
/// # Query Stats
|
||||
///
|
||||
/// Fetch various technical statistics.
|
||||
#[openapi(tag = "Admin")]
|
||||
#[get("/stats")]
|
||||
pub async fn stats(db: &Db) -> Result<Json<Stats>> {
|
||||
Ok(Json(db.generate_stats().await?))
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
use iso8601_timestamp::Timestamp;
|
||||
use revolt_config::config;
|
||||
use revolt_database::{
|
||||
tasks,
|
||||
util::{permissions::DatabasePermissionQuery, reference::Reference},
|
||||
Database, Message, PartialMessage, User,
|
||||
};
|
||||
@@ -88,7 +89,7 @@ pub async fn edit(
|
||||
// Queue up a task for processing embeds if the we have sufficient permissions
|
||||
if permissions.has_channel_permission(ChannelPermission::SendEmbeds) {
|
||||
if let Some(content) = edit.content {
|
||||
revolt_quark::tasks::process_embeds::queue(
|
||||
tasks::process_embeds::queue(
|
||||
message.channel.to_string(),
|
||||
message.id.to_string(),
|
||||
content,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
use revolt_quark::variables::delta::IS_STAGING;
|
||||
use revolt_config::{config, Settings};
|
||||
use revolt_rocket_okapi::{revolt_okapi::openapi3::OpenApi, settings::OpenApiSettings};
|
||||
pub use rocket::http::Status;
|
||||
pub use rocket::response::Redirect;
|
||||
use rocket::{Build, Rocket};
|
||||
|
||||
mod admin;
|
||||
mod bots;
|
||||
mod channels;
|
||||
mod customisation;
|
||||
@@ -18,15 +17,14 @@ mod sync;
|
||||
mod users;
|
||||
mod webhooks;
|
||||
|
||||
pub fn mount(mut rocket: Rocket<Build>) -> Rocket<Build> {
|
||||
pub fn mount(config: Settings, mut rocket: Rocket<Build>) -> Rocket<Build> {
|
||||
let settings = OpenApiSettings::default();
|
||||
|
||||
if *IS_STAGING {
|
||||
if config.features.webhooks_enabled {
|
||||
mount_endpoints_and_merged_docs! {
|
||||
rocket, "/".to_owned(), settings,
|
||||
"/" => (vec![], custom_openapi_spec()),
|
||||
"" => openapi_get_routes_spec![root::root],
|
||||
"/admin" => admin::routes(),
|
||||
"/users" => users::routes(),
|
||||
"/bots" => bots::routes(),
|
||||
"/channels" => channels::routes(),
|
||||
@@ -47,7 +45,6 @@ pub fn mount(mut rocket: Rocket<Build>) -> Rocket<Build> {
|
||||
rocket, "/".to_owned(), settings,
|
||||
"/" => (vec![], custom_openapi_spec()),
|
||||
"" => openapi_get_routes_spec![root::root],
|
||||
"/admin" => admin::routes(),
|
||||
"/users" => users::routes(),
|
||||
"/bots" => bots::routes(),
|
||||
"/channels" => channels::routes(),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use authifier::models::Session;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::Regex;
|
||||
use revolt_database::{Database, User};
|
||||
use revolt_models::v0;
|
||||
use revolt_quark::authifier::models::Session;
|
||||
use revolt_result::{create_error, Result};
|
||||
|
||||
use rocket::{serde::json::Json, State};
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
use revolt_quark::variables::delta::{
|
||||
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 revolt_quark::Result;
|
||||
|
||||
use revolt_config::config;
|
||||
use revolt_result::Result;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -91,32 +87,34 @@ pub struct RevoltConfig {
|
||||
#[openapi(tag = "Core")]
|
||||
#[get("/")]
|
||||
pub async fn root() -> Result<Json<RevoltConfig>> {
|
||||
let config = config().await;
|
||||
|
||||
Ok(Json(RevoltConfig {
|
||||
revolt: env!("CARGO_PKG_VERSION").to_string(),
|
||||
features: RevoltFeatures {
|
||||
captcha: CaptchaFeature {
|
||||
enabled: *USE_HCAPTCHA,
|
||||
key: HCAPTCHA_SITEKEY.to_string(),
|
||||
enabled: !config.api.security.captcha.hcaptcha_key.is_empty(),
|
||||
key: config.api.security.captcha.hcaptcha_sitekey,
|
||||
},
|
||||
email: *USE_EMAIL,
|
||||
invite_only: *INVITE_ONLY,
|
||||
email: !config.api.smtp.host.is_empty(),
|
||||
invite_only: config.api.registration.invite_only,
|
||||
autumn: Feature {
|
||||
enabled: *USE_AUTUMN,
|
||||
url: AUTUMN_URL.to_string(),
|
||||
enabled: !config.hosts.autumn.is_empty(),
|
||||
url: config.hosts.autumn,
|
||||
},
|
||||
january: Feature {
|
||||
enabled: *USE_JANUARY,
|
||||
url: JANUARY_URL.to_string(),
|
||||
enabled: !config.hosts.january.is_empty(),
|
||||
url: config.hosts.january,
|
||||
},
|
||||
voso: VoiceFeature {
|
||||
enabled: *USE_VOSO,
|
||||
url: VOSO_URL.to_string(),
|
||||
ws: VOSO_WS_HOST.to_string(),
|
||||
enabled: !config.hosts.voso_legacy.is_empty(),
|
||||
url: config.hosts.voso_legacy,
|
||||
ws: config.hosts.voso_legacy_ws,
|
||||
},
|
||||
},
|
||||
ws: EXTERNAL_WS_URL.to_string(),
|
||||
app: APP_URL.to_string(),
|
||||
vapid: VAPID_PUBLIC_KEY.to_string(),
|
||||
ws: config.hosts.events,
|
||||
app: config.hosts.app,
|
||||
vapid: config.api.vapid.public_key,
|
||||
build: BuildInformation {
|
||||
commit_sha: option_env!("VERGEN_GIT_SHA")
|
||||
.unwrap_or_else(|| "<failed to generate>")
|
||||
|
||||
BIN
crates/delta/src/routes/users/avatars/1.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
crates/delta/src/routes/users/avatars/2.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
crates/delta/src/routes/users/avatars/3.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
crates/delta/src/routes/users/avatars/4.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
crates/delta/src/routes/users/avatars/5.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
crates/delta/src/routes/users/avatars/6.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
crates/delta/src/routes/users/avatars/7.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
@@ -59,6 +59,14 @@ impl revolt_rocket_okapi::response::OpenApiResponderInner for CachedFile {
|
||||
pub async fn default_avatar(target: String) -> CachedFile {
|
||||
CachedFile((
|
||||
ContentType::PNG,
|
||||
revolt_quark::util::pfp::avatar(target.chars().last().unwrap()),
|
||||
match target.chars().last().unwrap() {
|
||||
'0' | '1' | '2' | '3' | 'S' | 'Z' => include_bytes!("avatars/2.png").to_vec(),
|
||||
'4' | '5' | '6' | '7' | 'T' => include_bytes!("avatars/3.png").to_vec(),
|
||||
'8' | '9' | 'A' | 'B' => include_bytes!("avatars/4.png").to_vec(),
|
||||
'C' | 'D' | 'E' | 'F' | 'V' => include_bytes!("avatars/5.png").to_vec(),
|
||||
'G' | 'H' | 'J' | 'K' | 'W' => include_bytes!("avatars/6.png").to_vec(),
|
||||
'M' | 'N' | 'P' | 'Q' | 'X' => include_bytes!("avatars/7.png").to_vec(),
|
||||
_ => include_bytes!("avatars/1.png").to_vec(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
||||