Merge pull request 'Update crates' (#993) from update-crates into main

Reviewed-on: https://git.joinplu.me/Plume/Plume/pulls/993
This commit is contained in:
KitaitiMakoto 2022-01-06 21:45:53 +00:00
commit 5d5e61dfa1
15 changed files with 536 additions and 444 deletions

887
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -7,29 +7,26 @@ edition = "2018"
[dependencies] [dependencies]
activitypub = "0.1.3" activitypub = "0.1.3"
askama_escape = "0.1"
atom_syndication = "0.6" atom_syndication = "0.6"
clap = "2.33" clap = "2.33"
dotenv = "0.15.0" dotenv = "0.15.0"
gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" } gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" }
gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" } gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" } gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
guid-create = "0.1" guid-create = "0.2"
lettre_email = "0.9.2" lettre_email = "0.9.2"
num_cpus = "1.10" num_cpus = "1.10"
rocket = "0.4.6" rocket = "0.4.6"
rocket_contrib = { version = "0.4.5", features = ["json"] } rocket_contrib = { version = "0.4.5", features = ["json"] }
rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" } rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" }
rpassword = "4.0"
scheduled-thread-pool = "0.2.2" scheduled-thread-pool = "0.2.2"
serde = "1.0" serde = "1.0"
serde_json = "1.0.70" serde_json = "1.0.70"
shrinkwraprs = "0.2.1" shrinkwraprs = "0.2.1"
validator = "0.8" validator = { version = "0.14", features = ["derive"] }
validator_derive = "0.8"
webfinger = "0.4.1" webfinger = "0.4.1"
tracing = "0.1.22" tracing = "0.1.22"
tracing-subscriber = "0.2.15" tracing-subscriber = "0.3.5"
riker = "0.4.2" riker = "0.4.2"
[[bin]] [[bin]]
@ -51,7 +48,7 @@ version = "1.4.5"
[dependencies.multipart] [dependencies.multipart]
default-features = false default-features = false
features = ["server"] features = ["server"]
version = "0.16" version = "0.18"
[dependencies.plume-api] [dependencies.plume-api]
path = "plume-api" path = "plume-api"
@ -68,7 +65,7 @@ rev = "29910f2829e7e590a540da3804336577b48c7b31"
[build-dependencies] [build-dependencies]
ructe = "0.13.0" ructe = "0.13.0"
rsass = "0.9" rsass = "0.23"
[features] [features]
default = ["postgres"] default = ["postgres"]

View file

@ -120,8 +120,14 @@ fn compile_theme(path: &Path, out_dir: &Path) -> std::io::Result<()> {
// compile the .scss/.sass file // compile the .scss/.sass file
let mut out = File::create(out.join("theme.css"))?; let mut out = File::create(out.join("theme.css"))?;
out.write_all( out.write_all(
&rsass::compile_scss_file(path, rsass::OutputStyle::Compressed) &rsass::compile_scss_path(
.expect("SCSS compilation error"), path,
rsass::output::Format {
style: rsass::output::Style::Compressed,
..rsass::output::Format::default()
},
)
.expect("SCSS compilation error"),
)?; )?;
Ok(()) Ok(())

View file

@ -10,7 +10,7 @@ path = "src/main.rs"
[dependencies] [dependencies]
clap = "2.33" clap = "2.33"
dotenv = "0.14" dotenv = "0.15"
rpassword = "5.0.0" rpassword = "5.0.0"
[dependencies.diesel] [dependencies.diesel]

View file

@ -9,10 +9,9 @@ activitypub = "0.1.1"
activitystreams-derive = "0.1.1" activitystreams-derive = "0.1.1"
activitystreams-traits = "0.1.0" activitystreams-traits = "0.1.0"
array_tool = "1.0" array_tool = "1.0"
base64 = "0.10" base64 = "0.13"
heck = "0.3.0" heck = "0.4.0"
hex = "0.3" hex = "0.4"
hyper = "0.12.33"
openssl = "0.10.22" openssl = "0.10.22"
rocket = "0.4.6" rocket = "0.4.6"
reqwest = { version = "0.9", features = ["socks"] } reqwest = { version = "0.9", features = ["socks"] }
@ -24,6 +23,7 @@ syntect = "4.5.0"
tokio = "0.1.22" tokio = "0.1.22"
regex-syntax = { version = "0.6.17", default-features = false, features = ["unicode-perl"] } regex-syntax = { version = "0.6.17", default-features = false, features = ["unicode-perl"] }
tracing = "0.1.22" tracing = "0.1.22"
askama_escape = "0.10.2"
[dependencies.chrono] [dependencies.chrono]
features = ["serde"] features = ["serde"]
@ -36,3 +36,5 @@ branch = "bidi-plume"
[dev-dependencies] [dev-dependencies]
once_cell = "1.5.2" once_cell = "1.5.2"
[features]

View file

@ -1,4 +1,4 @@
use heck::CamelCase; use heck::ToUpperCamelCase;
use openssl::rand::rand_bytes; use openssl::rand::rand_bytes;
use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, LinkType, Options, Parser, Tag}; use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, LinkType, Options, Parser, Tag};
use regex_syntax::is_word_character; use regex_syntax::is_word_character;
@ -21,7 +21,7 @@ pub fn random_hex() -> String {
/// Remove non alphanumeric characters and CamelCase a string /// Remove non alphanumeric characters and CamelCase a string
pub fn make_actor_id(name: &str) -> String { pub fn make_actor_id(name: &str) -> String {
name.to_camel_case() name.to_upper_camel_case()
.chars() .chars()
.filter(|c| c.is_alphanumeric()) .filter(|c| c.is_alphanumeric())
.collect() .collect()
@ -466,6 +466,10 @@ pub fn md_to_html<'a>(
(buf, mentions.collect(), hashtags.collect()) (buf, mentions.collect(), hashtags.collect())
} }
pub fn escape(string: &str) -> askama_escape::Escaped<askama_escape::Html> {
askama_escape::escape(string, askama_escape::Html)
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View file

@ -6,13 +6,12 @@ edition = "2018"
[dependencies] [dependencies]
activitypub = "0.1.1" activitypub = "0.1.1"
ammonia = "2.1.1" ammonia = "3.1.2"
askama_escape = "0.1"
bcrypt = "0.10.1" bcrypt = "0.10.1"
guid-create = "0.1" guid-create = "0.2"
itertools = "0.8.0" itertools = "0.10.3"
lazy_static = "1.0" lazy_static = "1.0"
ldap3 = "0.7.1" ldap3 = "0.9.3"
migrations_internals= "1.4.0" migrations_internals= "1.4.0"
openssl = "0.10.22" openssl = "0.10.22"
rocket = "0.4.6" rocket = "0.4.6"
@ -26,8 +25,8 @@ tantivy = "0.13.3"
url = "2.1" url = "2.1"
walkdir = "2.2" walkdir = "2.2"
webfinger = "0.4.1" webfinger = "0.4.1"
whatlang = "0.11.1" whatlang = "0.13.0"
shrinkwraprs = "0.2.1" shrinkwraprs = "0.3.0"
diesel-derive-newtype = "0.1.2" diesel-derive-newtype = "0.1.2"
glob = "0.3.0" glob = "0.3.0"
lindera-tantivy = { version = "0.7.1", optional = true } lindera-tantivy = { version = "0.7.1", optional = true }

View file

@ -3,12 +3,11 @@ use crate::{
users::User, Connection, Error, Result, CONFIG, users::User, Connection, Error, Result, CONFIG,
}; };
use activitypub::object::Image; use activitypub::object::Image;
use askama_escape::escape;
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl}; use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
use guid_create::GUID; use guid_create::GUID;
use plume_common::{ use plume_common::{
activity_pub::{inbox::FromId, request, Id}, activity_pub::{inbox::FromId, request, Id},
utils::MediaProcessor, utils::{escape, MediaProcessor},
}; };
use std::{ use std::{
fs::{self, DirBuilder}, fs::{self, DirBuilder},

View file

@ -7,8 +7,6 @@ extern crate gettext_macros;
extern crate rocket; extern crate rocket;
#[macro_use] #[macro_use]
extern crate serde_json; extern crate serde_json;
#[macro_use]
extern crate validator_derive;
use clap::App; use clap::App;
use diesel::r2d2::ConnectionManager; use diesel::r2d2::ConnectionManager;

View file

@ -23,7 +23,7 @@ use plume_models::{
#[derive(Default, FromForm, Debug, Validate)] #[derive(Default, FromForm, Debug, Validate)]
pub struct NewCommentForm { pub struct NewCommentForm {
pub responding_to: Option<i32>, pub responding_to: Option<i32>,
#[validate(length(min = "1", message = "Your comment can't be empty"))] #[validate(length(min = 1, message = "Your comment can't be empty"))]
pub content: String, pub content: String,
pub warning: String, pub warning: String,
} }

View file

@ -20,7 +20,7 @@ use validator::{Validate, ValidationError, ValidationErrors};
#[derive(Default, FromForm, Validate)] #[derive(Default, FromForm, Validate)]
#[validate(schema( #[validate(schema(
function = "emails_match", function = "emails_match",
skip_on_field_errors = "false", skip_on_field_errors = false,
message = "Emails are not matching" message = "Emails are not matching"
))] ))]
pub struct EmailSignupForm { pub struct EmailSignupForm {
@ -41,15 +41,15 @@ fn emails_match(form: &EmailSignupForm) -> Result<(), ValidationError> {
#[derive(Default, FromForm, Validate)] #[derive(Default, FromForm, Validate)]
#[validate(schema( #[validate(schema(
function = "passwords_match", function = "passwords_match",
skip_on_field_errors = "false", skip_on_field_errors = false,
message = "Passwords are not matching" message = "Passwords are not matching"
))] ))]
pub struct NewUserForm { pub struct NewUserForm {
#[validate(length(min = "1", message = "Username should be at least 1 characters long"))] #[validate(length(min = 1, message = "Username should be at least 1 characters long"))]
pub username: String, pub username: String,
#[validate(length(min = "8", message = "Password should be at least 8 characters long"))] #[validate(length(min = 8, message = "Password should be at least 8 characters long"))]
pub password: String, pub password: String,
#[validate(length(min = "8", message = "Password should be at least 8 characters long"))] #[validate(length(min = 8, message = "Password should be at least 8 characters long"))]
pub password_confirmation: String, pub password_confirmation: String,
pub email: String, pub email: String,
pub token: String, pub token: String,

View file

@ -73,12 +73,12 @@ pub fn admin_mod(_mod: Moderator, conn: DbConn, rockets: PlumeRocket) -> Ructe {
#[derive(Clone, FromForm, Validate)] #[derive(Clone, FromForm, Validate)]
pub struct InstanceSettingsForm { pub struct InstanceSettingsForm {
#[validate(length(min = "1"))] #[validate(length(min = 1))]
pub name: String, pub name: String,
pub open_registrations: bool, pub open_registrations: bool,
pub short_description: SafeString, pub short_description: SafeString,
pub long_description: SafeString, pub long_description: SafeString,
#[validate(length(min = "1"))] #[validate(length(min = 1))]
pub default_license: String, pub default_license: String,
} }

View file

@ -37,9 +37,9 @@ pub fn new(m: Option<String>, conn: DbConn, rockets: PlumeRocket) -> Ructe {
#[derive(Default, FromForm, Validate)] #[derive(Default, FromForm, Validate)]
pub struct LoginForm { pub struct LoginForm {
#[validate(length(min = "1", message = "We need an email, or a username to identify you"))] #[validate(length(min = 1, message = "We need an email, or a username to identify you"))]
pub email_or_name: String, pub email_or_name: String,
#[validate(length(min = "1", message = "Your password can't be empty"))] #[validate(length(min = 1, message = "Your password can't be empty"))]
pub password: String, pub password: String,
} }
@ -193,7 +193,7 @@ pub fn password_reset_form(
#[derive(FromForm, Default, Validate)] #[derive(FromForm, Default, Validate)]
#[validate(schema( #[validate(schema(
function = "passwords_match", function = "passwords_match",
skip_on_field_errors = "false", skip_on_field_errors = false,
message = "Passwords are not matching" message = "Passwords are not matching"
))] ))]
pub struct NewPasswordForm { pub struct NewPasswordForm {

View file

@ -399,12 +399,12 @@ pub fn delete(
#[derive(Default, FromForm, Validate)] #[derive(Default, FromForm, Validate)]
#[validate(schema( #[validate(schema(
function = "passwords_match", function = "passwords_match",
skip_on_field_errors = "false", skip_on_field_errors = false,
message = "Passwords are not matching" message = "Passwords are not matching"
))] ))]
pub struct NewUserForm { pub struct NewUserForm {
#[validate( #[validate(
length(min = "1", message = "Username can't be empty"), length(min = 1, message = "Username can't be empty"),
custom( custom(
function = "validate_username", function = "validate_username",
message = "User name is not allowed to contain any of < > & @ ' or \"" message = "User name is not allowed to contain any of < > & @ ' or \""
@ -413,9 +413,9 @@ pub struct NewUserForm {
pub username: String, pub username: String,
#[validate(email(message = "Invalid email"))] #[validate(email(message = "Invalid email"))]
pub email: String, pub email: String,
#[validate(length(min = "8", message = "Password should be at least 8 characters long"))] #[validate(length(min = 8, message = "Password should be at least 8 characters long"))]
pub password: String, pub password: String,
#[validate(length(min = "8", message = "Password should be at least 8 characters long"))] #[validate(length(min = 8, message = "Password should be at least 8 characters long"))]
pub password_confirmation: String, pub password_confirmation: String,
} }

View file

@ -9,7 +9,7 @@ use rocket_i18n::Catalog;
use std::collections::{btree_map::BTreeMap, hash_map::DefaultHasher}; use std::collections::{btree_map::BTreeMap, hash_map::DefaultHasher};
use std::hash::Hasher; use std::hash::Hasher;
pub use askama_escape::escape; pub use plume_common::utils::escape;
pub static CACHE_NAME: &str = env!("CACHE_ID"); pub static CACHE_NAME: &str = env!("CACHE_ID");