mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-26 12:00:35 +00:00
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:
commit
5d5e61dfa1
15 changed files with 536 additions and 444 deletions
887
Cargo.lock
generated
887
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
13
Cargo.toml
13
Cargo.toml
|
@ -7,29 +7,26 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
activitypub = "0.1.3"
|
||||
askama_escape = "0.1"
|
||||
atom_syndication = "0.6"
|
||||
clap = "2.33"
|
||||
dotenv = "0.15.0"
|
||||
gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" }
|
||||
gettext-macros = { 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"
|
||||
num_cpus = "1.10"
|
||||
rocket = "0.4.6"
|
||||
rocket_contrib = { version = "0.4.5", features = ["json"] }
|
||||
rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" }
|
||||
rpassword = "4.0"
|
||||
scheduled-thread-pool = "0.2.2"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0.70"
|
||||
shrinkwraprs = "0.2.1"
|
||||
validator = "0.8"
|
||||
validator_derive = "0.8"
|
||||
validator = { version = "0.14", features = ["derive"] }
|
||||
webfinger = "0.4.1"
|
||||
tracing = "0.1.22"
|
||||
tracing-subscriber = "0.2.15"
|
||||
tracing-subscriber = "0.3.5"
|
||||
riker = "0.4.2"
|
||||
|
||||
[[bin]]
|
||||
|
@ -51,7 +48,7 @@ version = "1.4.5"
|
|||
[dependencies.multipart]
|
||||
default-features = false
|
||||
features = ["server"]
|
||||
version = "0.16"
|
||||
version = "0.18"
|
||||
|
||||
[dependencies.plume-api]
|
||||
path = "plume-api"
|
||||
|
@ -68,7 +65,7 @@ rev = "29910f2829e7e590a540da3804336577b48c7b31"
|
|||
|
||||
[build-dependencies]
|
||||
ructe = "0.13.0"
|
||||
rsass = "0.9"
|
||||
rsass = "0.23"
|
||||
|
||||
[features]
|
||||
default = ["postgres"]
|
||||
|
|
10
build.rs
10
build.rs
|
@ -120,8 +120,14 @@ fn compile_theme(path: &Path, out_dir: &Path) -> std::io::Result<()> {
|
|||
// compile the .scss/.sass file
|
||||
let mut out = File::create(out.join("theme.css"))?;
|
||||
out.write_all(
|
||||
&rsass::compile_scss_file(path, rsass::OutputStyle::Compressed)
|
||||
.expect("SCSS compilation error"),
|
||||
&rsass::compile_scss_path(
|
||||
path,
|
||||
rsass::output::Format {
|
||||
style: rsass::output::Style::Compressed,
|
||||
..rsass::output::Format::default()
|
||||
},
|
||||
)
|
||||
.expect("SCSS compilation error"),
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -10,7 +10,7 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
clap = "2.33"
|
||||
dotenv = "0.14"
|
||||
dotenv = "0.15"
|
||||
rpassword = "5.0.0"
|
||||
|
||||
[dependencies.diesel]
|
||||
|
|
|
@ -9,10 +9,9 @@ activitypub = "0.1.1"
|
|||
activitystreams-derive = "0.1.1"
|
||||
activitystreams-traits = "0.1.0"
|
||||
array_tool = "1.0"
|
||||
base64 = "0.10"
|
||||
heck = "0.3.0"
|
||||
hex = "0.3"
|
||||
hyper = "0.12.33"
|
||||
base64 = "0.13"
|
||||
heck = "0.4.0"
|
||||
hex = "0.4"
|
||||
openssl = "0.10.22"
|
||||
rocket = "0.4.6"
|
||||
reqwest = { version = "0.9", features = ["socks"] }
|
||||
|
@ -24,6 +23,7 @@ syntect = "4.5.0"
|
|||
tokio = "0.1.22"
|
||||
regex-syntax = { version = "0.6.17", default-features = false, features = ["unicode-perl"] }
|
||||
tracing = "0.1.22"
|
||||
askama_escape = "0.10.2"
|
||||
|
||||
[dependencies.chrono]
|
||||
features = ["serde"]
|
||||
|
@ -36,3 +36,5 @@ branch = "bidi-plume"
|
|||
|
||||
[dev-dependencies]
|
||||
once_cell = "1.5.2"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use heck::CamelCase;
|
||||
use heck::ToUpperCamelCase;
|
||||
use openssl::rand::rand_bytes;
|
||||
use pulldown_cmark::{html, CodeBlockKind, CowStr, Event, LinkType, Options, Parser, Tag};
|
||||
use regex_syntax::is_word_character;
|
||||
|
@ -21,7 +21,7 @@ pub fn random_hex() -> String {
|
|||
|
||||
/// Remove non alphanumeric characters and CamelCase a string
|
||||
pub fn make_actor_id(name: &str) -> String {
|
||||
name.to_camel_case()
|
||||
name.to_upper_camel_case()
|
||||
.chars()
|
||||
.filter(|c| c.is_alphanumeric())
|
||||
.collect()
|
||||
|
@ -466,6 +466,10 @@ pub fn md_to_html<'a>(
|
|||
(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)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
@ -6,13 +6,12 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
activitypub = "0.1.1"
|
||||
ammonia = "2.1.1"
|
||||
askama_escape = "0.1"
|
||||
ammonia = "3.1.2"
|
||||
bcrypt = "0.10.1"
|
||||
guid-create = "0.1"
|
||||
itertools = "0.8.0"
|
||||
guid-create = "0.2"
|
||||
itertools = "0.10.3"
|
||||
lazy_static = "1.0"
|
||||
ldap3 = "0.7.1"
|
||||
ldap3 = "0.9.3"
|
||||
migrations_internals= "1.4.0"
|
||||
openssl = "0.10.22"
|
||||
rocket = "0.4.6"
|
||||
|
@ -26,8 +25,8 @@ tantivy = "0.13.3"
|
|||
url = "2.1"
|
||||
walkdir = "2.2"
|
||||
webfinger = "0.4.1"
|
||||
whatlang = "0.11.1"
|
||||
shrinkwraprs = "0.2.1"
|
||||
whatlang = "0.13.0"
|
||||
shrinkwraprs = "0.3.0"
|
||||
diesel-derive-newtype = "0.1.2"
|
||||
glob = "0.3.0"
|
||||
lindera-tantivy = { version = "0.7.1", optional = true }
|
||||
|
|
|
@ -3,12 +3,11 @@ use crate::{
|
|||
users::User, Connection, Error, Result, CONFIG,
|
||||
};
|
||||
use activitypub::object::Image;
|
||||
use askama_escape::escape;
|
||||
use diesel::{self, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
use guid_create::GUID;
|
||||
use plume_common::{
|
||||
activity_pub::{inbox::FromId, request, Id},
|
||||
utils::MediaProcessor,
|
||||
utils::{escape, MediaProcessor},
|
||||
};
|
||||
use std::{
|
||||
fs::{self, DirBuilder},
|
||||
|
|
|
@ -7,8 +7,6 @@ extern crate gettext_macros;
|
|||
extern crate rocket;
|
||||
#[macro_use]
|
||||
extern crate serde_json;
|
||||
#[macro_use]
|
||||
extern crate validator_derive;
|
||||
|
||||
use clap::App;
|
||||
use diesel::r2d2::ConnectionManager;
|
||||
|
|
|
@ -23,7 +23,7 @@ use plume_models::{
|
|||
#[derive(Default, FromForm, Debug, Validate)]
|
||||
pub struct NewCommentForm {
|
||||
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 warning: String,
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use validator::{Validate, ValidationError, ValidationErrors};
|
|||
#[derive(Default, FromForm, Validate)]
|
||||
#[validate(schema(
|
||||
function = "emails_match",
|
||||
skip_on_field_errors = "false",
|
||||
skip_on_field_errors = false,
|
||||
message = "Emails are not matching"
|
||||
))]
|
||||
pub struct EmailSignupForm {
|
||||
|
@ -41,15 +41,15 @@ fn emails_match(form: &EmailSignupForm) -> Result<(), ValidationError> {
|
|||
#[derive(Default, FromForm, Validate)]
|
||||
#[validate(schema(
|
||||
function = "passwords_match",
|
||||
skip_on_field_errors = "false",
|
||||
skip_on_field_errors = false,
|
||||
message = "Passwords are not matching"
|
||||
))]
|
||||
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,
|
||||
#[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,
|
||||
#[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 email: String,
|
||||
pub token: String,
|
||||
|
|
|
@ -73,12 +73,12 @@ pub fn admin_mod(_mod: Moderator, conn: DbConn, rockets: PlumeRocket) -> Ructe {
|
|||
|
||||
#[derive(Clone, FromForm, Validate)]
|
||||
pub struct InstanceSettingsForm {
|
||||
#[validate(length(min = "1"))]
|
||||
#[validate(length(min = 1))]
|
||||
pub name: String,
|
||||
pub open_registrations: bool,
|
||||
pub short_description: SafeString,
|
||||
pub long_description: SafeString,
|
||||
#[validate(length(min = "1"))]
|
||||
#[validate(length(min = 1))]
|
||||
pub default_license: String,
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ pub fn new(m: Option<String>, conn: DbConn, rockets: PlumeRocket) -> Ructe {
|
|||
|
||||
#[derive(Default, FromForm, Validate)]
|
||||
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,
|
||||
#[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,
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ pub fn password_reset_form(
|
|||
#[derive(FromForm, Default, Validate)]
|
||||
#[validate(schema(
|
||||
function = "passwords_match",
|
||||
skip_on_field_errors = "false",
|
||||
skip_on_field_errors = false,
|
||||
message = "Passwords are not matching"
|
||||
))]
|
||||
pub struct NewPasswordForm {
|
||||
|
|
|
@ -399,12 +399,12 @@ pub fn delete(
|
|||
#[derive(Default, FromForm, Validate)]
|
||||
#[validate(schema(
|
||||
function = "passwords_match",
|
||||
skip_on_field_errors = "false",
|
||||
skip_on_field_errors = false,
|
||||
message = "Passwords are not matching"
|
||||
))]
|
||||
pub struct NewUserForm {
|
||||
#[validate(
|
||||
length(min = "1", message = "Username can't be empty"),
|
||||
length(min = 1, message = "Username can't be empty"),
|
||||
custom(
|
||||
function = "validate_username",
|
||||
message = "User name is not allowed to contain any of < > & @ ' or \""
|
||||
|
@ -413,9 +413,9 @@ pub struct NewUserForm {
|
|||
pub username: String,
|
||||
#[validate(email(message = "Invalid email"))]
|
||||
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,
|
||||
#[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,
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use rocket_i18n::Catalog;
|
|||
use std::collections::{btree_map::BTreeMap, hash_map::DefaultHasher};
|
||||
use std::hash::Hasher;
|
||||
|
||||
pub use askama_escape::escape;
|
||||
pub use plume_common::utils::escape;
|
||||
|
||||
pub static CACHE_NAME: &str = env!("CACHE_ID");
|
||||
|
||||
|
|
Loading…
Reference in a new issue