* Moving rtc calls to build under rtc feature flag
- Marking additional goal met on roadmap The current build model succesfully builds rtc enabled/disabled builds
This commit is contained in:
parent
4e737d4292
commit
e5e0875037
@ -10,7 +10,6 @@ use db::{ self, Channel};
|
||||
|
||||
use crate::http::set_json_body;
|
||||
use crate::qs_param;
|
||||
use crate::rtc;
|
||||
|
||||
|
||||
pub async fn list_channels(pool: &Pool, response: &mut Response<Body>, params: HashMap<String, String>) {
|
||||
@ -56,7 +55,9 @@ pub async fn create_channel(pool: &Pool, response: &mut Response<Body>, params:
|
||||
match Channel::add(pool, name, description, kind).await {
|
||||
Ok(resp) => {
|
||||
match resp {
|
||||
#[cfg(feature = "rtc")]
|
||||
Row(channel) => {
|
||||
use crate::rtc;
|
||||
set_json_body(response, json!({"channel": channel}));
|
||||
rtc::create_channel(channel).await;
|
||||
StatusCode::OK
|
||||
@ -114,7 +115,9 @@ pub async fn delete_channel(pool: &Pool, response: &mut Response<Body>, params:
|
||||
|
||||
if let Some(id) = channel_id {
|
||||
match Channel::delete(pool, id).await {
|
||||
#[cfg(feature = "rtc")]
|
||||
Ok(Success) => {
|
||||
use crate::rtc;
|
||||
rtc::delete_channel(id).await;
|
||||
},
|
||||
Ok(_) => {/* can't actually happen */}
|
||||
|
@ -36,6 +36,7 @@ mod members;
|
||||
mod perms;
|
||||
mod messages;
|
||||
mod admin;
|
||||
#[cfg(feature="rtc")]
|
||||
mod rtc;
|
||||
|
||||
mod http;
|
||||
|
@ -9,7 +9,6 @@ use db::Response::*;
|
||||
|
||||
use crate::http::set_json_body;
|
||||
use crate::qs_param;
|
||||
use crate::rtc;
|
||||
|
||||
|
||||
pub async fn get_online_members(p: &Pool, response: &mut Response<Body>) {
|
||||
@ -70,10 +69,14 @@ pub async fn post_self_nickname(p: &Pool, response: &mut Response<Body>, params:
|
||||
|
||||
let uid = qs_param!(params, "id", u64).unwrap();
|
||||
match Member::update_nick(p, uid, nick.as_ref()).await {
|
||||
#[cfg(feature = "rtc")]
|
||||
Ok(_) => {
|
||||
use crate::rtc;
|
||||
rtc::update_nickname(uid, nick.as_str()).await;
|
||||
StatusCode::OK
|
||||
},
|
||||
#[cfg(not(feature = "rtc"))]
|
||||
Ok(_) => StatusCode::OK,
|
||||
Err(e) => {
|
||||
eprintln!("{}", e);
|
||||
StatusCode::INTERNAL_SERVER_ERROR
|
||||
|
@ -98,6 +98,7 @@ pub async fn send_message(pool: &Pool, response: &mut Response<Body>, body: Body
|
||||
else {
|
||||
// Safe unwrap with ctype - its container type is checked prior
|
||||
match db::Message::send(pool, &content, ctype.unwrap(), channel_id.unwrap(), uid).await {
|
||||
#[cfg(feature = "rtc")]
|
||||
Ok(Row(msg)) => {
|
||||
use crate::rtc;
|
||||
rtc::new_message(pool, msg).await;
|
||||
|
@ -44,7 +44,7 @@ I'd like to be able to support people that make good software and give them a pl
|
||||
* RTC Permissions: Unprivileged users shouldn't receive messaegs if they don't have the required permissions
|
||||
|
||||
|
||||
* Optional RTC: Optionally compile RTC communications(Easy)
|
||||
* ~~Optional RTC: Optionally compile RTC communications(Easy)~~
|
||||
|
||||
* Optional decentralization: Optionally compile decentralization comms to users. All of this can be done at the API level(Probably easy).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user