1
0
Fork 0
mirror of https://git.42l.fr/neil/sncf.git synced 2024-05-17 05:06:35 +02:00

Compare commits

...

8 commits
1.4.0 ... root

7 changed files with 14 additions and 10 deletions

View file

@ -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"

View file

@ -1,5 +1,8 @@
# sncf
**Warning: Breaking changes introduced on a minor Nextcloud release (>= 22.3.0) broke sncf. Please do not update until it is fixed. It seems easy to fix (use `/login` instead of `/csrftoken`) but I need time, feel free to try to fix it.**
Simple Nextcloud Forms (sncf) is a lightweight proxy written in Rust with the [Actix](https://actix.rs) framework.
It is meant to make form creation easier, through the use of the [Nextcloud Forms](https://github.com/nextcloud/forms) application, by generating administration links for forms: **users do not need to log in or register**, they just need to keep a link (in the form of `https://your-instance.com/admin/<45-byte base64 key>`) to log them in and give them access to their forms.
@ -31,8 +34,9 @@ Compatibility with sncf has been tested for the following Nextcloud and Nextclou
|--------------|------------|------------------|
| 1.0.0 | 19.0.1, 19.0.2 | 2.0.2, 2.0.3 |
| 1.0.1, 1.0.2, 1.1.0, 1.2.0 | 19.0.1, 19.0.2, 20.0.0\*, 20.0.1 | 2.0.4 |
| **No support** \*\* | above 20.0.1, below 21.x | above 2.0.4, below 2.2.2
| 1.3.0 | 21.0.0 | 2.2.2, 2.2.3, 2.2.4 |
| **Unsupported** \*\* | above 20.0.1, below 21.x | above 2.0.4, below 2.2.2
| 1.3.0, 1.4.0 | 21.0.0 | 2.2.2, 2.2.3, 2.2.4 |
| 1.5.0 | 22.2.0 | 2.3.0 |
\* Breaking changes, please check [the wiki](https://git.42l.fr/neil/sncf/wiki/Upgrade-from-a-previous-version) if you need to upgrade from a previous version.

View file

@ -7,8 +7,8 @@ use crate::database::schema::form::dsl::*;
use crate::database::structs::Form;
use crate::DbConn;
#[table_name = "form"]
#[derive(Serialize, Insertable)]
#[table_name = "form"]
pub struct InsertableForm {
pub created_at: NaiveDateTime,
pub lastvisit_at: NaiveDateTime,

View file

@ -4,8 +4,8 @@ use chrono::NaiveDateTime;
use crate::database::schema::form;
//use crate::config::CONFIG;
#[table_name = "form"]
#[derive(Serialize, Queryable, Insertable, Debug, Clone)]
#[table_name = "form"]
pub struct Form {
pub id: i32,
pub created_at: NaiveDateTime,

View file

@ -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,

View file

@ -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,
}
}

View file

@ -111,7 +111,7 @@
</div>
<div class="c-subelem">
<h3>{{ "index_panel6_title"|tr(lang) }}</h3>
<p>{{ "index_panel5_desc1"|tr(lang) }}</p>
<p>{{ "index_panel6_desc1"|tr(lang) }}</p>
</div>
</div>
</div>