fix: .well-known
This commit is contained in:
parent
9ef5feafc7
commit
d1d148456d
5 changed files with 30 additions and 4 deletions
|
@ -1 +0,0 @@
|
|||
{ "m.homeserver": { "base_url": "https://matrix.envs.net" } }
|
|
@ -1 +0,0 @@
|
|||
{ "m.server": "dendrite.neo.ixvd.net:443" }
|
|
@ -1,9 +1,12 @@
|
|||
use std::env;
|
||||
|
||||
use actix_files as fs;
|
||||
use actix_web::{App, HttpServer, middleware, web};
|
||||
use actix_web::{App, HttpServer, middleware};
|
||||
use actix_web::web::Redirect;
|
||||
use env_logger;
|
||||
|
||||
mod relay;
|
||||
mod well_known;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
|
@ -13,6 +16,7 @@ async fn main() -> std::io::Result<()> {
|
|||
App::new()
|
||||
.wrap(middleware::Logger::default())
|
||||
.configure(relay::configure)
|
||||
.configure(well_known::configure)
|
||||
.service(
|
||||
fs::Files::new("/", "./public/")
|
||||
.index_file("index.html")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use actix_web::{HttpResponse, web, get};
|
||||
use actix_web::{get, HttpResponse, web};
|
||||
use actix_web::http::StatusCode;
|
||||
|
||||
#[get("/gatus")]
|
||||
|
|
24
src/well_known.rs
Normal file
24
src/well_known.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use actix_web::{get, HttpResponse, web};
|
||||
use actix_web::http::StatusCode;
|
||||
|
||||
#[get("/matrix/server")]
|
||||
pub async fn get_matrix_server() -> HttpResponse {
|
||||
HttpResponse::build(StatusCode::OK)
|
||||
.content_type("application/json")
|
||||
.body("{ \"m.server\": \"matrix.neo.ixvd.net:443\" }")
|
||||
}
|
||||
|
||||
#[get("/matrix/client")]
|
||||
pub async fn get_matrix_client() -> HttpResponse {
|
||||
HttpResponse::build(StatusCode::OK)
|
||||
.content_type("application/json")
|
||||
.body("{ \"m.homeserver\": { \"base_url\": \"https://matrix.neo.ixvd.net:443\" } }")
|
||||
}
|
||||
|
||||
pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::scope("/.well-known")
|
||||
.service(get_matrix_server)
|
||||
.service(get_matrix_client)
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue