From 84f683c264455decb61191b087a0a60a425f65a9 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 15 Oct 2024 15:04:12 +0100 Subject: [PATCH 1/4] Fix duplicate protocol in export api --- thoth-export-server/src/lib.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/thoth-export-server/src/lib.rs b/thoth-export-server/src/lib.rs index 7ac5ca87..187770ea 100644 --- a/thoth-export-server/src/lib.rs +++ b/thoth-export-server/src/lib.rs @@ -4,7 +4,7 @@ use std::time::Duration; use actix_cors::Cors; use actix_web::{middleware::Logger, web::Data, App, HttpServer}; use paperclip::actix::{web, web::HttpResponse, OpenApiExt}; -use paperclip::v2::models::{Contact, DefaultApiRaw, Info, License, Tag}; +use paperclip::v2::models::{Contact, DefaultApiRaw, Info, License, OperationProtocol, Tag}; use thoth_client::ThothClient; mod bibtex; @@ -56,8 +56,20 @@ pub async fn start_server( log::info!("Setting Thoth GraphQL endpoint to {}", gql_endpoint); HttpServer::new(move || { + // extract hostname and protocol from public URL + let (protocol, host) = public_url + .strip_prefix("https://") + .map(|stripped| (OperationProtocol::Https, stripped)) + .or_else(|| { + public_url + .strip_prefix("http://") + .map(|stripped| (OperationProtocol::Http, stripped)) + }) + .unwrap_or((OperationProtocol::Http, public_url.as_str())); + let spec = DefaultApiRaw { - host: Some(public_url.clone()), + host: Some(host.to_string()), + schemes: [protocol].into_iter().collect(), tags: vec![ Tag { name: "Formats".to_string(), From 9bb0dd06f5e88e7acbddd093e356a1fc976ba023 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 15 Oct 2024 15:05:57 +0100 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb93c631..eecc30b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + - [636](https://github.com/thoth-pub/thoth/issues/636) - OpenAPI documentation was displaying the public URL of the export API with an extra protocol ## [[0.12.11]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.11) - 2024-10-14 ### Changed From 3d9da663341b15f210f0f5818195f59cc8c18273 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 15 Oct 2024 15:42:37 +0100 Subject: [PATCH 3/4] Bump v0.12.12 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 12 ++++++------ thoth-api-server/Cargo.toml | 6 +++--- thoth-api/Cargo.toml | 4 ++-- thoth-app-server/Cargo.toml | 2 +- thoth-app/Cargo.toml | 6 +++--- thoth-client/Cargo.toml | 8 ++++---- thoth-errors/Cargo.toml | 2 +- thoth-export-server/Cargo.toml | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1df3e68d..5f9a49eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3182,7 +3182,7 @@ dependencies = [ [[package]] name = "thoth" -version = "0.12.11" +version = "0.12.12" dependencies = [ "cargo-husky", "clap", @@ -3197,7 +3197,7 @@ dependencies = [ [[package]] name = "thoth-api" -version = "0.12.11" +version = "0.12.12" dependencies = [ "actix-web", "argon2rs", @@ -3226,7 +3226,7 @@ dependencies = [ [[package]] name = "thoth-api-server" -version = "0.12.11" +version = "0.12.12" dependencies = [ "actix-cors", "actix-identity", @@ -3242,7 +3242,7 @@ dependencies = [ [[package]] name = "thoth-app" -version = "0.12.11" +version = "0.12.12" dependencies = [ "anyhow", "chrono", @@ -3271,7 +3271,7 @@ dependencies = [ [[package]] name = "thoth-app-server" -version = "0.12.11" +version = "0.12.12" dependencies = [ "actix-cors", "actix-web", @@ -3281,7 +3281,7 @@ dependencies = [ [[package]] name = "thoth-client" -version = "0.12.11" +version = "0.12.12" dependencies = [ "chrono", "graphql_client", @@ -3297,7 +3297,7 @@ dependencies = [ [[package]] name = "thoth-errors" -version = "0.12.11" +version = "0.12.12" dependencies = [ "actix-web", "csv", @@ -3318,7 +3318,7 @@ dependencies = [ [[package]] name = "thoth-export-server" -version = "0.12.11" +version = "0.12.12" dependencies = [ "actix-cors", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 6de3d6de..48b471a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" } members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"] [dependencies] -thoth-api = { version = "=0.12.11", path = "thoth-api", features = ["backend"] } -thoth-api-server = { version = "=0.12.11", path = "thoth-api-server" } -thoth-app-server = { version = "=0.12.11", path = "thoth-app-server" } -thoth-errors = { version = "=0.12.11", path = "thoth-errors" } -thoth-export-server = { version = "=0.12.11", path = "thoth-export-server" } +thoth-api = { version = "=0.12.12", path = "thoth-api", features = ["backend"] } +thoth-api-server = { version = "=0.12.12", path = "thoth-api-server" } +thoth-app-server = { version = "=0.12.12", path = "thoth-app-server" } +thoth-errors = { version = "=0.12.12", path = "thoth-errors" } +thoth-export-server = { version = "=0.12.12", path = "thoth-export-server" } clap = { version = "4.5.16", features = ["cargo", "env"] } dialoguer = { version = "0.11.0", features = ["password"] } dotenv = "0.15.0" diff --git a/thoth-api-server/Cargo.toml b/thoth-api-server/Cargo.toml index dcd3d64a..f96c6a33 100644 --- a/thoth-api-server/Cargo.toml +++ b/thoth-api-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api-server" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth" readme = "README.md" [dependencies] -thoth-api = { version = "=0.12.11", path = "../thoth-api", features = ["backend"] } -thoth-errors = { version = "=0.12.11", path = "../thoth-errors" } +thoth-api = { version = "=0.12.12", path = "../thoth-api", features = ["backend"] } +thoth-errors = { version = "=0.12.12", path = "../thoth-errors" } actix-web = "4.9" actix-cors = "0.7.0" actix-identity = "0.7.1" diff --git a/thoth-api/Cargo.toml b/thoth-api/Cargo.toml index 96733f33..3352ddc6 100644 --- a/thoth-api/Cargo.toml +++ b/thoth-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" } backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web", "jsonwebtoken"] [dependencies] -thoth-errors = { version = "=0.12.11", path = "../thoth-errors" } +thoth-errors = { version = "=0.12.12", path = "../thoth-errors" } actix-web = { version = "4.8", optional = true } argon2rs = "0.2.5" isbn2 = "0.4.0" diff --git a/thoth-app-server/Cargo.toml b/thoth-app-server/Cargo.toml index 224fdcc6..6d7b0590 100644 --- a/thoth-app-server/Cargo.toml +++ b/thoth-app-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app-server" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" diff --git a/thoth-app/Cargo.toml b/thoth-app/Cargo.toml index 47b99159..fd3ea8e1 100644 --- a/thoth-app/Cargo.toml +++ b/thoth-app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -36,8 +36,8 @@ uuid = { version = "1.10.0", features = ["serde", "v4"] } # `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm # https://docs.rs/getrandom/latest/getrandom/#webassembly-support getrandom = { version = "0.2", features = ["js"] } -thoth-api = { version = "=0.12.11", path = "../thoth-api" } -thoth-errors = { version = "=0.12.11", path = "../thoth-errors" } +thoth-api = { version = "=0.12.12", path = "../thoth-api" } +thoth-errors = { version = "=0.12.12", path = "../thoth-errors" } [build-dependencies] dotenv = "0.15.0" diff --git a/thoth-client/Cargo.toml b/thoth-client/Cargo.toml index 0c98e95b..b31374b0 100644 --- a/thoth-client/Cargo.toml +++ b/thoth-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-client" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -10,8 +10,8 @@ readme = "README.md" build = "build.rs" [dependencies] -thoth-api = {version = "=0.12.11", path = "../thoth-api" } -thoth-errors = {version = "=0.12.11", path = "../thoth-errors" } +thoth-api = {version = "=0.12.12", path = "../thoth-api" } +thoth-errors = {version = "=0.12.12", path = "../thoth-errors" } graphql_client = "0.14.0" chrono = { version = "0.4.38", features = ["serde"] } reqwest = { version = "0.12", features = ["json"] } @@ -22,4 +22,4 @@ serde_json = "1.0" uuid = { version = "1.10.0", features = ["serde"] } [build-dependencies] -thoth-api = { version = "=0.12.11", path = "../thoth-api", features = ["backend"] } +thoth-api = { version = "=0.12.12", path = "../thoth-api", features = ["backend"] } diff --git a/thoth-errors/Cargo.toml b/thoth-errors/Cargo.toml index 5393a603..b22d4607 100644 --- a/thoth-errors/Cargo.toml +++ b/thoth-errors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-errors" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index e18facf3..157a089c 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-export-server" -version = "0.12.11" +version = "0.12.12" authors = ["Javier Arias ", "Ross Higman "] edition = "2021" license = "Apache-2.0" @@ -10,9 +10,9 @@ readme = "README.md" build = "build.rs" [dependencies] -thoth-api = { version = "=0.12.11", path = "../thoth-api" } -thoth-errors = { version = "=0.12.11", path = "../thoth-errors" } -thoth-client = { version = "=0.12.11", path = "../thoth-client" } +thoth-api = { version = "=0.12.12", path = "../thoth-api" } +thoth-errors = { version = "=0.12.12", path = "../thoth-errors" } +thoth-client = { version = "=0.12.12", path = "../thoth-client" } actix-web = "4.9" actix-cors = "0.7.0" cc_license = "0.1.0" From 4ab90f654fa747c5c15dc83d9d16314218eae41c Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 15 Oct 2024 15:42:59 +0100 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eecc30b0..2c11a793 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [[0.12.12]](https://github.com/thoth-pub/thoth/releases/tag/v0.12.12) - 2024-10-15 ### Fixed - [636](https://github.com/thoth-pub/thoth/issues/636) - OpenAPI documentation was displaying the public URL of the export API with an extra protocol