polyphony-chat / symfonia

A Polyphony chat server, compatible with Spacebar and the Discord API.
Mozilla Public License 2.0
25 stars 3 forks source link

Complete `/ping` endpoint #62

Closed bitfl0wer closed 1 month ago

bitfl0wer commented 1 month ago

The ping endpoint needs to be completed to show the correct values from the instances' configuration. This is how the endpoint currently looks:

use std::env;

use chorus::types::{PingInstance, PingReturn};
use poem::{handler, web::Json, IntoResponse, Route};
use serde::Serialize;

pub fn setup_routes() -> Route {
    Route::new().at("/ping", ping)
}

#[handler]
pub async fn ping() -> poem::Result<impl IntoResponse> {
    let ping_response = PingReturn {
        // TODO: Fill this with configuration values
        ping: "pong!".to_string(),
        instance: PingInstance {
            id: Some(1.into()),
            name: "todo".to_string(),
            description: None,
            image: None,
            correspondence_email: None,
            correspondence_user_id: None,
            front_page: None,
            tos_page: None,
        },
    };
    Ok(Json(ping_response))
}
Quat3rnion commented 1 month ago

Data filled in with d17e1ceb5f02690b51401ebafbbe877066da5b85