Add cfg_attr gate to server_server endpoints

next
Devin Ragotzy 2020-07-26 09:39:57 -04:00 committed by timokoesters
parent 42e0102a2a
commit e6a1b0b66f
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
1 changed files with 4 additions and 4 deletions

View File

@ -130,14 +130,14 @@ pub async fn send_request<T: Endpoint>(
} }
} }
#[get("/.well-known/matrix/server")] #[cfg_attr(feature = "conduit_bin",get("/.well-known/matrix/server"))]
pub fn well_known_server() -> Json<String> { pub fn well_known_server() -> Json<String> {
rocket::response::content::Json( rocket::response::content::Json(
json!({ "m.server": "matrixtesting.koesters.xyz:14004"}).to_string(), json!({ "m.server": "matrixtesting.koesters.xyz:14004"}).to_string(),
) )
} }
#[get("/_matrix/federation/v1/version")] #[cfg_attr(feature = "conduit_bin",get("/_matrix/federation/v1/version"))]
pub fn get_server_version() -> MatrixResult<get_server_version::Response, Error> { pub fn get_server_version() -> MatrixResult<get_server_version::Response, Error> {
MatrixResult(Ok(get_server_version::Response { MatrixResult(Ok(get_server_version::Response {
server: Some(get_server_version::Server { server: Some(get_server_version::Server {
@ -147,7 +147,7 @@ pub fn get_server_version() -> MatrixResult<get_server_version::Response, Error>
})) }))
} }
#[get("/_matrix/key/v2/server")] #[cfg_attr(feature = "conduit_bin",get("/_matrix/key/v2/server"))]
pub fn get_server_keys(db: State<'_, Database>) -> Json<String> { pub fn get_server_keys(db: State<'_, Database>) -> Json<String> {
let mut verify_keys = BTreeMap::new(); let mut verify_keys = BTreeMap::new();
verify_keys.insert( verify_keys.insert(
@ -177,7 +177,7 @@ pub fn get_server_keys(db: State<'_, Database>) -> Json<String> {
Json(response.to_string()) Json(response.to_string())
} }
#[get("/_matrix/key/v2/server/<_key_id>")] #[cfg_attr(feature = "conduit_bin",get("/_matrix/key/v2/server/<_key_id>"))]
pub fn get_server_keys_deprecated(db: State<'_, Database>, _key_id: String) -> Json<String> { pub fn get_server_keys_deprecated(db: State<'_, Database>, _key_id: String) -> Json<String> {
get_server_keys(db) get_server_keys(db)
} }