v0.16 migration and other fixes

This commit is contained in:
Maurus Decimus
2026-04-16 21:30:23 +02:00
parent 1e9daf1ff1
commit c9b2c7c6f3
61 changed files with 2466 additions and 7913 deletions

View File

@@ -28,7 +28,10 @@ use http_proto::{
HttpRequest, HttpResponse, HttpSessionData, ToHttpResponse,
request::{decode_path_element, fetch_body},
};
use hyper::{Method, StatusCode, header};
use hyper::{
Method, StatusCode,
header::{self, CONTENT_ENCODING},
};
use jmap::api::{ToJmapHttpResponse, ToRequestError};
use jmap_proto::error::request::RequestError;
use registry::schema::enums::Permission;
@@ -92,11 +95,19 @@ impl ManagementApi for Server {
"schema" => {
// Authenticate request
let (_in_flight, access_token) = self.authenticate_headers(req, session).await?;
let todo = "fix";
let ui_schema_path = "/Users/me/code/jmap-schema/ui_schema.json";
let ui_schema = tokio::fs::read_to_string(ui_schema_path).await.unwrap();
static SCHEMA_JSON: &[u8] =
include_bytes!("../../../../resources/schema/schema.json.gz");
const SCHEMA_HASH: &str =
include_str!("../../../../resources/schema/schema.json.sha256");
Ok(Resource::new("application/json", ui_schema.into_bytes()).into_http_response())
if path.get(1).is_some_and(|hash| hash == &SCHEMA_HASH) {
Ok(Resource::new("application/json", SCHEMA_JSON.to_vec())
.into_http_response()
.with_immutable_cache()
.with_header(CONTENT_ENCODING, "gzip"))
} else {
Ok(HttpResponse::redirect(format!("/api/schema/{SCHEMA_HASH}")))
}
}
"token" => {
let access_token = self.management_access_token(req, session).await?;