From 3f44ee37fe3c6e469cd996ce1b06025a7fdcde99 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Mon, 2 Sep 2024 12:01:57 +0200 Subject: [PATCH] v0.1.13 --- CHANGELOG.md | 9 ++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- src/pages/config/mod.rs | 7 ++++-- src/pages/config/schema/sieve.rs | 39 ++++++++++++++++++++++++++++---- 5 files changed, 50 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13c148f..20b39ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.1.13] - 2024-09-02 + +## Added +- Untrusted Sieve script management. + +### Changed + +### Fixed + ## [0.1.12] - 2024-08-29 ## Added diff --git a/Cargo.lock b/Cargo.lock index 04a9b57..e89f93f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2356,7 +2356,7 @@ dependencies = [ [[package]] name = "webadmin" -version = "0.1.12" +version = "0.1.13" dependencies = [ "ahash", "base64", diff --git a/Cargo.toml b/Cargo.toml index 1ae19d3..e867441 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ homepage = "https://stalw.art" keywords = ["web", "admin", "email", "mail", "server"] categories = ["email"] license = "AGPL-3.0-only OR LicenseRef-SEL" -version = "0.1.12" +version = "0.1.13" edition = "2021" resolver = "2" diff --git a/src/pages/config/mod.rs b/src/pages/config/mod.rs index abbba72..9dc50ef 100644 --- a/src/pages/config/mod.rs +++ b/src/pages/config/mod.rs @@ -539,8 +539,11 @@ impl LayoutBuilder { .create("Limits") .route("/sieve-limits/edit") .insert() - .create("Scripts") - .route("/script") + .create("System Scripts") + .route("/trusted-script") + .insert() + .create("User Scripts") + .route("/untrusted-script") .insert() .insert() .create("Management") diff --git a/src/pages/config/schema/sieve.rs b/src/pages/config/schema/sieve.rs index 74e586b..561d47e 100644 --- a/src/pages/config/schema/sieve.rs +++ b/src/pages/config/schema/sieve.rs @@ -312,8 +312,8 @@ impl Builder { ]) .build() .build() - // Scripts - .new_schema("script") + // Trusted Scripts + .new_schema("trusted-script") .prefix("sieve.trusted.scripts") .suffix("contents") .names("script", "scripts") @@ -329,17 +329,46 @@ impl Builder { .build() .new_field("contents") .label("Contents") - .help("Contents of the Sieve script") + .help("Contents of the trusted Sieve script") .typ(Type::Text) .input_check([], [Validator::Required]) .build() .new_form_section() - .title("Sieve Script") + .title("Trusted Sieve Script") .fields(["_id", "name", "contents"]) .build() - .list_title("Sieve scripts") + .list_title("System Sieve scripts") .list_subtitle("Manage Sieve scripts executed by the trusted interpreter") .list_fields(["_id", "name"]) .build() + // Untrusted Scripts + .new_schema("untrusted-script") + .prefix("sieve.untrusted.scripts") + .suffix("contents") + .names("script", "scripts") + .new_id_field() + .label("Script Id") + .help("Unique identifier for the script") + .build() + .new_field("name") + .label("Description") + .help("Brief description of the Sieve script") + .typ(Type::Input) + .input_check([Transformer::Trim], [Validator::Required]) + .build() + .new_field("contents") + .label("Contents") + .help("Contents of the Sieve script") + .typ(Type::Text) + .input_check([], [Validator::Required]) + .build() + .new_form_section() + .title("Untrusted Sieve Script") + .fields(["_id", "name", "contents"]) + .build() + .list_title("User Sieve scripts") + .list_subtitle("Manage untrusted Sieve scripts that can be imported by users") + .list_fields(["_id", "name"]) + .build() } }