Browse Source

compatibility with nextcloud 22 and Forms API v1.1

root
neil 2 weeks ago
parent
commit
11504c00e0
  1. 4
      Cargo.toml
  2. 4
      src/forward.rs
  3. 2
      src/sniff.rs

4
Cargo.toml

@ -1,6 +1,6 @@
[package]
name = "sncf"
version = "1.4.0"
version = "1.5.0"
authors = ["Association 42l <contact@noreply.example.org>"]
edition = "2018"
@ -24,7 +24,7 @@ serde = "1.0"
serde_json = "1.0"
serde_derive = "1.0"
chrono = { version = "0.4", features = ["serde"] }
regex = "1.3"
regex = "1.5"
base64 = "0.13"
rand = "0.8"
askama = "0.10"

4
src/forward.rs

@ -79,7 +79,7 @@ pub async fn forward(
// sparing the use of a mutable body when not needed
// For now, the body only needs to be modified when the route
// is "create a new form" route
if route == "/ocs/v2.php/apps/forms/api/v1/form" {
if route == "/ocs/v2.php/apps/forms/api/v1.1/form" {
// retreive the body from the request result
let response_body = res.body().limit(PAYLOAD_LIMIT).await.map_err(|e| {
eprintln!("error_forward_resp: {}", e);
@ -100,7 +100,7 @@ pub async fn forward(
form_id
);
let update_req = forge_from(
"/ocs/v2.php/apps/forms/api/v1/form/update",
"/ocs/v2.php/apps/forms/api/v1.1/form/update",
&req,
&url,
&client,

2
src/sniff.rs

@ -7,7 +7,7 @@ use crate::debug;
// if it returns true, cancels the request
pub fn check_request(route: &str, body: &web::Bytes) -> bool {
match route {
"/ocs/v2.php/apps/forms/api/v1/form/update" => rq_form_update(body),
"/ocs/v2.php/apps/forms/api/v1.1/form/update" => rq_form_update(body),
_ => false,
}
}

Loading…
Cancel
Save