Added rustfmt config & ran formatter

This commit is contained in:
Jef Roosens 2022-04-02 21:00:38 +02:00
parent 8664453ef7
commit f77be877db
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
5 changed files with 87 additions and 13 deletions

View file

@ -1,4 +1,5 @@
use crate::STATIC_DIR_NAME;
use std::{collections::HashSet, io::ErrorKind, path::Path};
use axum::{
extract::{BodyStream, Extension},
http::StatusCode,
@ -6,16 +7,16 @@ use axum::{
};
use flate2::read::GzDecoder;
use futures_util::TryStreamExt;
use std::collections::HashSet;
use std::io::ErrorKind;
use std::path::Path;
use tar::Archive;
use tokio_util::io::StreamReader;
use crate::STATIC_DIR_NAME;
pub async fn post_deploy(
Extension(data_dir): Extension<String>,
res: BodyStream,
) -> impl IntoResponse {
) -> impl IntoResponse
{
// This converts a stream into something that implements AsyncRead, which we can then use to
// asynchronously write the file to disk
let mut read =

View file

@ -1,8 +1,8 @@
use axum::routing::post;
use axum::Router;
use axum::{routing::post, Router};
mod deploy;
pub fn router() -> Router {
pub fn router() -> Router
{
Router::new().route("/deploy", post(deploy::post_deploy))
}

View file

@ -1,5 +1,6 @@
use axum::{extract::Extension, http::StatusCode, routing::get_service, Router};
use std::net::SocketAddr;
use axum::{extract::Extension, http::StatusCode, routing::get_service, Router};
use tower_http::{auth::RequireAuthorizationLayer, services::ServeDir, trace::TraceLayer};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
@ -9,7 +10,8 @@ mod matrix;
const STATIC_DIR_NAME: &str = "static";
#[tokio::main]
async fn main() {
async fn main()
{
// Enable tracing
tracing_subscriber::registry()
.with(tracing_subscriber::EnvFilter::new(

View file

@ -1,16 +1,19 @@
use axum::{response::IntoResponse, routing::get, Json, Router};
use serde_json::json;
pub fn router() -> Router {
pub fn router() -> Router
{
Router::new()
.route("/.well-known/matrix/server", get(get_matrix_server))
.route("/.well-known/matrix/client", get(get_matrix_client))
}
async fn get_matrix_server() -> impl IntoResponse {
async fn get_matrix_server() -> impl IntoResponse
{
Json(json!({"m.server": "matrix.rustybever.be:443"}))
}
async fn get_matrix_client() -> impl IntoResponse {
async fn get_matrix_client() -> impl IntoResponse
{
Json(json!({"m.homeserver": {"base_url": "https://matrix.rustybever.be"}}))
}