Browse Source

Merge branch 'next' into 'next'

Add TURN Readme

See merge request famedly/conduit!233
merge-requests/233/merge
Torsten Flammiger 4 years ago
parent
commit
21060b689b
  1. 9
      APPSERVICES.md
  2. 36
      TURN.md
  3. 4
      src/database/admin.rs
  4. 10
      src/database/appservice.rs
  5. 9
      src/database/rooms.rs

9
APPSERVICES.md

@ -40,6 +40,15 @@ appservice can send requests to the homeserver. You don't need to restart @@ -40,6 +40,15 @@ appservice can send requests to the homeserver. You don't need to restart
Conduit, but if it doesn't work, restarting while the appservice is running
could help.
### Remove an appservice
To remove an appservice go to your admin room and execute
```@conduit:your.server.name: unregister_appservice <name>```
where `<name>` is of course one of the output of `list_appservices`.
## Appservice-specific instructions
### Tested appservices

36
TURN.md

@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
# Setting up TURN/STURN
## General instructions
* This was tested against Conduit(Next), Coturn (Archlinux) and Element (Android)
* Build your own Conduit from source. It's dead simple to build.
* Use the NEXT branch as only this branch provides the necessary functionality.
* This documentation assumes you have a [Coturn server](https://github.com/coturn/coturn) up and runnig. See [here](https://github.com/matrix-org/synapse/blob/develop/docs/turn-howto.md) how to get it working with the reference implementation. It's almost the same with Conduit.
## Add a few setting to your existing conduit.toml
```
# Coturn settings to inform the clients where to find a coturn server
# to enable Audio/Video calls
# domain.tdl should match the REALM setting of coturn
# Adjust this as needed, If you have only one transport write it this way:
# turn_uris = ["turn:domain.tld?transport=tcp"]
turn_uris = ["turn:domain.tdl?transport=udp", "turn:domain.tld?transport=tcp"]
# the value of static-auth-secret of your turnserver
turn_secret = ""
# the default
turn_ttl = 86400 # 1 Day
# If you have your TURN server configured to use a username and password
# you can provide these information too. In this case comment out
# turn_secret above!
#turn_username = ""
#turn_password = ""
```
## Apply setting
Restart Conduit and enjoy audio and/or video call functionality from within Element.

4
src/database/admin.rs

@ -12,6 +12,7 @@ use tracing::warn; @@ -12,6 +12,7 @@ use tracing::warn;
pub enum AdminCommand {
RegisterAppservice(serde_yaml::Value),
UnregisterAppservice(String),
ListAppservices,
SendMessage(RoomMessageEventContent),
}
@ -96,6 +97,9 @@ impl Admin { @@ -96,6 +97,9 @@ impl Admin {
AdminCommand::RegisterAppservice(yaml) => {
guard.appservice.register_appservice(yaml).unwrap(); // TODO handle error
}
AdminCommand::UnregisterAppservice(service_name) => {
guard.appservice.unregister_appservice(&service_name).unwrap(); // TODO: see above
}
AdminCommand::ListAppservices => {
if let Ok(appservices) = guard.appservice.iter_ids().map(|ids| ids.collect::<Vec<_>>()) {
let count = appservices.len();

10
src/database/appservice.rs

@ -27,6 +27,16 @@ impl Appservice { @@ -27,6 +27,16 @@ impl Appservice {
Ok(())
}
/**
* Remove an appservice registration
*
* service_name is the name you send to register the service
*/
pub fn unregister_appservice(&self, service_name: &str) -> Result<()> {
self.id_appserviceregistrations.remove(service_name.as_bytes())?;
Ok(())
}
pub fn get_registration(&self, id: &str) -> Result<Option<serde_yaml::Value>> {
self.cached_registrations
.read()

9
src/database/rooms.rs

@ -1528,6 +1528,15 @@ impl Rooms { @@ -1528,6 +1528,15 @@ impl Rooms {
));
}
}
"unregister_appservice" => {
if args.len() == 1 {
db.admin.send(AdminCommand::UnregisterAppservice(args[0].to_owned()));
} else {
db.admin.send(AdminCommand::SendMessage(
RoomMessageEventContent::text_plain("Invalid appservice identifier. Need a valid identifier string"),
));
}
}
"list_appservices" => {
db.admin.send(AdminCommand::ListAppservices);
}

Loading…
Cancel
Save