From a69f614129140a963eed13c0ae2f634f4910db66 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 2 Apr 2022 13:50:47 +0200 Subject: [PATCH 1/4] Bumped release version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 31140a0..55af921 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "site-backend" -version = "0.0.0" +version = "0.1.0" edition = "2021" publish = false From 799d0d47111090d8dec6880699a7648ccb355c26 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 2 Apr 2022 13:52:48 +0200 Subject: [PATCH 2/4] Hopefully fixed ci yaml --- .woodpecker.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 02781f7..e3b172d 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -12,7 +12,8 @@ pipeline: secrets: - 'docker_username' - 'docker_password' - when: tag + when: + event: tag deploy: image: 'curlimages/curl' @@ -20,4 +21,5 @@ pipeline: - 'webhook' commands: - curl -XPOST --fail -s "$WEBHOOK" - when: tag + when: + event: tag From 322f0430bf29ad17aec8770ce33a9d6005985bf1 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 2 Apr 2022 14:16:35 +0200 Subject: [PATCH 3/4] Forgot to add matrix routes >:( --- Cargo.lock | 3 ++- Cargo.toml | 1 + src/main.rs | 15 +++++++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09e1334..7cff99e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -634,12 +634,13 @@ dependencies = [ [[package]] name = "site-backend" -version = "0.0.0" +version = "0.1.0" dependencies = [ "axum", "flate2", "futures-util", "hyper", + "serde_json", "tar", "tokio", "tokio-util", diff --git a/Cargo.toml b/Cargo.toml index 55af921..64b20c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,4 @@ flate2 = "1.0.22" tokio-util = { version = "0.7.1", features = ["io"] } futures-util = "0.3.21" uuid = { version = "1.0.0-alpha.1", features = ["v4"] } +serde_json = "1.0.79" diff --git a/src/main.rs b/src/main.rs index 40e299b..1ffbaea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,13 @@ use axum::{ extract::{BodyStream, Extension}, http::StatusCode, - response::IntoResponse, - routing::{get_service, post}, + response::{IntoResponse, Json}, + routing::{get, get_service, post}, Router, }; use flate2::read::GzDecoder; use futures_util::TryStreamExt; +use serde_json::{json, Value}; use std::collections::HashSet; use std::io::ErrorKind; use std::net::SocketAddr; @@ -37,6 +38,8 @@ async fn main() { std::fs::create_dir_all(&static_dir); let app = Router::new() + .route("/.well-known/matrix/server", get(get_matrix_server)) + .route("/.well-known/matrix/client", get(get_matrix_client)) .route( "/api/deploy", post(post_deploy).layer(RequireAuthorizationLayer::bearer(&api_key)), @@ -61,6 +64,14 @@ async fn main() { .unwrap(); } +async fn get_matrix_server() -> impl IntoResponse { + Json(json!({"m.server": "matrix.rustybever.be:443"})) +} + +async fn get_matrix_client() -> impl IntoResponse { + Json(json!({"m.homeserver": {"base_url": "https://matrix.rustybever.be"}})) +} + async fn post_deploy(Extension(data_dir): Extension, res: BodyStream) -> impl IntoResponse { // This converts a stream into something that implements AsyncRead, which we can then use to // asynchronously write the file to disk From f6a3afb3156d0049cb2653e134155b4fd75d286f Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sat, 2 Apr 2022 15:41:51 +0200 Subject: [PATCH 4/4] Fixed CI constraint --- .woodpecker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index e3b172d..8311b9d 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,5 +1,5 @@ platform: linux/amd64 -branch: main +branches: main pipeline: release: