Added file upload and TOS in french
Some checks are pending
Rust-build / build (push) Waiting to run

This commit is contained in:
Justine 2024-07-31 13:52:49 +02:00
parent d68ffcebd7
commit 821e53b2c0
13 changed files with 646 additions and 51 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/target /target
/Files/posts.json /Files/posts.json
/Files/Stored_files/*

362
Cargo.lock generated
View File

@ -8,7 +8,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
"bytes", "bytes",
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -19,6 +19,29 @@ dependencies = [
"tracing", "tracing",
] ]
[[package]]
name = "actix-files"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0773d59061dedb49a8aed04c67291b9d8cf2fe0b60130a381aab53c6dd86e9be"
dependencies = [
"actix-http",
"actix-service",
"actix-utils",
"actix-web",
"bitflags 2.6.0",
"bytes",
"derive_more",
"futures-core",
"http-range",
"log",
"mime",
"mime_guess",
"percent-encoding",
"pin-project-lite",
"v_htmlescape",
]
[[package]] [[package]]
name = "actix-http" name = "actix-http"
version = "3.3.1" version = "3.3.1"
@ -31,7 +54,7 @@ dependencies = [
"actix-utils", "actix-utils",
"ahash 0.8.3", "ahash 0.8.3",
"base64 0.21.2", "base64 0.21.2",
"bitflags", "bitflags 1.3.2",
"brotli", "brotli",
"bytes", "bytes",
"bytestring", "bytestring",
@ -68,6 +91,44 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "actix-multipart"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5118a26dee7e34e894f7e85aa0ee5080ae4c18bf03c0e30d49a80e418f00a53"
dependencies = [
"actix-multipart-derive",
"actix-utils",
"actix-web",
"derive_more",
"futures-core",
"futures-util",
"httparse",
"local-waker",
"log",
"memchr",
"mime",
"rand",
"serde",
"serde_json",
"serde_plain",
"tempfile",
"tokio",
]
[[package]]
name = "actix-multipart-derive"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e11eb847f49a700678ea2fa73daeb3208061afa2b9d1a8527c03390f4c4a1c6b"
dependencies = [
"darling",
"parse-size",
"proc-macro2",
"quote",
"syn 2.0.23",
]
[[package]] [[package]]
name = "actix-router" name = "actix-router"
version = "0.5.1" version = "0.5.1"
@ -167,7 +228,7 @@ dependencies = [
"serde_urlencoded", "serde_urlencoded",
"smallvec", "smallvec",
"socket2", "socket2",
"time 0.3.22", "time 0.3.36",
"url", "url",
] ]
@ -281,12 +342,24 @@ version = "0.21.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
[[package]]
name = "base64"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]] [[package]]
name = "block-buffer" name = "block-buffer"
version = "0.9.0" version = "0.9.0"
@ -422,7 +495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb"
dependencies = [ dependencies = [
"percent-encoding", "percent-encoding",
"time 0.3.22", "time 0.3.36",
"version_check", "version_check",
] ]
@ -469,12 +542,56 @@ dependencies = [
"typenum", "typenum",
] ]
[[package]]
name = "darling"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
dependencies = [
"darling_core",
"darling_macro",
]
[[package]]
name = "darling_core"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 2.0.23",
]
[[package]]
name = "darling_macro"
version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
"darling_core",
"quote",
"syn 2.0.23",
]
[[package]] [[package]]
name = "debug-helper" name = "debug-helper"
version = "0.3.13" version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e"
[[package]]
name = "deranged"
version = "0.3.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
dependencies = [
"powerfmt",
]
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.17" version = "0.99.17"
@ -533,6 +650,22 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1"
[[package]]
name = "errno"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"libc",
"windows-sys 0.52.0",
]
[[package]]
name = "fastrand"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.26" version = "1.0.26"
@ -657,6 +790,12 @@ dependencies = [
"itoa", "itoa",
] ]
[[package]]
name = "http-range"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.8.0" version = "1.8.0"
@ -669,6 +808,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
[[package]]
name = "humansize"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7"
dependencies = [
"libm",
]
[[package]] [[package]]
name = "iana-time-zone" name = "iana-time-zone"
version = "0.1.57" version = "0.1.57"
@ -692,6 +840,12 @@ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "ident_case"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]] [[package]]
name = "idna" name = "idna"
version = "0.3.0" version = "0.3.0"
@ -754,9 +908,21 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.141" version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "libm"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]]
name = "linux-raw-sys"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]] [[package]]
name = "local-channel" name = "local-channel"
@ -835,6 +1001,16 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.7.1" version = "0.7.1"
@ -856,6 +1032,12 @@ dependencies = [
"windows-sys 0.45.0", "windows-sys 0.45.0",
] ]
[[package]]
name = "num-conv"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
[[package]] [[package]]
name = "num-traits" name = "num-traits"
version = "0.2.15" version = "0.2.15"
@ -910,6 +1092,12 @@ dependencies = [
"windows-targets 0.48.0", "windows-targets 0.48.0",
] ]
[[package]]
name = "parse-size"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "944553dd59c802559559161f9816429058b869003836120e262e8caec061b7ae"
[[package]] [[package]]
name = "paste" name = "paste"
version = "1.0.12" version = "1.0.12"
@ -940,6 +1128,12 @@ version = "0.3.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964"
[[package]]
name = "powerfmt"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.17" version = "0.2.17"
@ -1000,7 +1194,7 @@ version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [ dependencies = [
"bitflags", "bitflags 1.3.2",
] ]
[[package]] [[package]]
@ -1029,6 +1223,19 @@ dependencies = [
"semver", "semver",
] ]
[[package]]
name = "rustix"
version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
"bitflags 2.6.0",
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.13" version = "1.0.13"
@ -1049,9 +1256,9 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.164" version = "1.0.185"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31"
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
@ -1075,6 +1282,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_plain"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "serde_spanned" name = "serde_spanned"
version = "0.6.3" version = "0.6.3"
@ -1156,10 +1372,14 @@ dependencies = [
[[package]] [[package]]
name = "sqpad" name = "sqpad"
version = "1.0.0" version = "1.1.0"
dependencies = [ dependencies = [
"actix-files",
"actix-multipart",
"actix-web", "actix-web",
"base64 0.22.1",
"chrono", "chrono",
"humansize",
"magic-crypt", "magic-crypt",
"rand", "rand",
"serde", "serde",
@ -1168,6 +1388,12 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "strsim"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.109" version = "1.0.109"
@ -1190,6 +1416,18 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "tempfile"
version = "3.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1"
dependencies = [
"cfg-if",
"fastrand",
"rustix",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "tiger" name = "tiger"
version = "0.1.0" version = "0.1.0"
@ -1214,11 +1452,14 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.22" version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [ dependencies = [
"deranged",
"itoa", "itoa",
"num-conv",
"powerfmt",
"serde", "serde",
"time-core", "time-core",
"time-macros", "time-macros",
@ -1226,16 +1467,17 @@ dependencies = [
[[package]] [[package]]
name = "time-core" name = "time-core"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.9" version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [ dependencies = [
"num-conv",
"time-core", "time-core",
] ]
@ -1346,6 +1588,15 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "unicase"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89"
dependencies = [
"version_check",
]
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.13" version = "0.3.13"
@ -1378,6 +1629,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "v_htmlescape"
version = "0.15.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e8257fbc510f0a46eb602c10215901938b5c2a7d5e70fc11483b1d3c9b5b18c"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"
@ -1499,6 +1756,15 @@ dependencies = [
"windows-targets 0.48.0", "windows-targets 0.48.0",
] ]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.6",
]
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.42.2" version = "0.42.2"
@ -1529,6 +1795,22 @@ dependencies = [
"windows_x86_64_msvc 0.48.0", "windows_x86_64_msvc 0.48.0",
] ]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_gnullvm"
version = "0.42.2" version = "0.42.2"
@ -1541,6 +1823,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.42.2" version = "0.42.2"
@ -1553,6 +1841,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.42.2" version = "0.42.2"
@ -1565,6 +1859,18 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.42.2" version = "0.42.2"
@ -1577,6 +1883,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.42.2" version = "0.42.2"
@ -1589,6 +1901,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]] [[package]]
name = "windows_x86_64_gnullvm" name = "windows_x86_64_gnullvm"
version = "0.42.2" version = "0.42.2"
@ -1601,6 +1919,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.42.2" version = "0.42.2"
@ -1613,6 +1937,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.4.7" version = "0.4.7"

View File

@ -1,13 +1,17 @@
[package] [package]
name = "sqpad" name = "sqpad"
version = "1.0.0" version = "1.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
actix-files = "0.6.6"
actix-multipart = "0.7.2"
actix-web = "4.3.1" actix-web = "4.3.1"
base64 = "0.22.1"
chrono = "0.4.26" chrono = "0.4.26"
humansize = "2.1.3"
#clap = "4.2.4" #clap = "4.2.4"
magic-crypt = "3.1.12" magic-crypt = "3.1.12"
#message-io = "0.15.1" #message-io = "0.15.1"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,11 +9,14 @@
body { body {
background-color: #2e2e2e; background-color: #2e2e2e;
color: white; color: white;
font-family: Arial, sans-serif;
text-align: center; text-align: center;
padding-top: 50px; padding-top: 50px;
font-family: Fira Mono;
} }
@import url(https://fonts.bunny.net/css?family=fira-mono:400);
h1 { h1 {
color: pink; color: pink;
} }
@ -27,14 +30,14 @@
max-width: 90%; max-width: 90%;
margin: 0 auto; margin: 0 auto;
padding: 20px; padding: 20px;
border: 2px solid pink; /*border: 2px solid pink;
border-radius: 10px; border-radius: 10px;*/
align: center; align: center;
} }
label { label {
display: block; display: block;
margin-top: 10px; margin-top: 5px;
} }
input[type="text"] { input[type="text"] {
@ -45,6 +48,8 @@
color: white; color: white;
margin: auto; margin: auto;
display: block; display: block;
height: 40px;
font-size: x-large;
} }
textarea { textarea {
@ -56,6 +61,7 @@
align: center; align: center;
margin: auto; margin: auto;
display: block; display: block;
font-size: x-large;
} }
@ -123,21 +129,30 @@
</head> </head>
<body> <body>
<h1>SqPad</h1> <h1>SqPad</h1>
<div id="form-container"> <div id="form-container">
<form action="/" method="post" enctype="application/x-www-form-urlencoded"> <form action="/" method="post" enctype="application/x-www-form-urlencoded">
<label for="name"></label>
<input type="text" id="name" name="name" placeholder="Title Here." required>
<label for="name">Name</label> <label for="content"></label>
<input type="text" id="name" name="name" required>
<label for="content">Content</label>
<textarea type="input" id="content" name="content" rows="30" cols="55" placeholder="Put your content here. It will be encrypted via DES-256 and stored." required></textarea> <textarea type="input" id="content" name="content" rows="30" cols="55" placeholder="Put your content here. It will be encrypted via DES-256 and stored." required></textarea>
<input type="submit" value="Send">
<input type="submit" value="submit"> </form>
<form action="/file" method="post" enctype="multipart/form-data">
<br>
<label for="fileupload">Or upload a file, max. size 100MB:</label>
<input id="fileupload" name="file" type="file" required>
<br>
<input type="submit" value="Upload">
</form> </form>
</div> </div>
<hr> <hr>
<a href="https://gitea.squi.fr/Rust/SqPad">SqPad</a> by Squi <a href="https://gitea.squi.fr/Rust/SqPad">SqPad</a> by Squi
<hr> <hr>
<a href="tos"> Conditions d'utilisation </a>
<p> Need to report something hosted on this website ? Send an email to <a href="mailto:admin@squi.fr">admin@squi.fr</a> including the link to the content.</p>
<p> Vous avez trouvé quelque chose de problématique hebergé sur ce site ? Ecrivez à <a href="mailto:admin@squi.fr">admin@squi.fr</a> en incluant le lien du contenu.</p>

View File

@ -1,3 +1,4 @@
{"name":"qzdqzd","crypt":"EFOUHjEiFhRorSgOQAgOgA==","date":"03/07/2023@18:45:45","id":11295522918797061807} {"name":"Coucou","crypt":"v2GQruagmH/4mH23jHsQsQ==","date":"30/07/2024@17:37:42","id":13756540686218610888}
{"name":"qzdqzdq","crypt":"Wap895rKiiX6QKQcoW/HeA==","date":"07/07/2023@13:54:54","id":11359763750215510915} {"name":"ccc","crypt":"CPxmHNEzGTjTzLnPD4cT1g==","date":"31/07/2024@12:32:43","id":2023961136064904175}
{"name":"Salut","crypt":"HgTgatuvDrFDzSzB1NBD8g==","date":"07/07/2023@13:58:53","id":7122794868924569050} {"name":"azdazd","crypt":"VHkcgcJYiWMPL6iAsR7VaA==","date":"31/07/2024@13:02:16","id":12968686421810818419}
{"name":"d","crypt":"gUvEqnyQ0471LO9c0zluZQ==","date":"31/07/2024@13:23:06","id":6034734435954264973}

54
Files/tos.html Normal file
View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Conditions Générales d'Utilisation</title>
</head>
<body>
<h1>Conditions Générales d'Utilisation</h1>
<p><strong>Dernière mise à jour : 31 juillet 2024</strong></p>
<p>Bienvenue sur SqPad (le "Site"). En accédant à notre Site ou en l'utilisant, vous acceptez de vous conformer aux présentes Conditions Générales d'Utilisation ("CGU"). Veuillez lire attentivement ces conditions.</p>
<h2>1. Acceptation des Conditions</h2>
<p>En utilisant le Site, vous acceptez ces CGU et toute modification future. Si vous n'acceptez pas ces termes, n'utilisez pas le Site.</p>
<h2>2. Description du Service</h2>
<p>SqPad fournit une plateforme permettant aux utilisateurs de télécharger et de stocker des contenus chiffrés (le "Service"). Les clés de chiffrement sont gérées exclusivement par les utilisateurs, et SqPad n'a pas accès au contenu des fichiers chiffrés.</p>
<h2>3. Responsabilités de l'Utilisateur</h2>
<ul>
<li><strong>Conformité aux Lois</strong> : Vous acceptez d'utiliser le Service en conformité avec toutes les lois et réglementations locales, nationales et internationales applicables.</li>
<li><strong>Contenu Interdit</strong> : Il est strictement interdit de télécharger tout contenu illégal, nuisible, diffamatoire, contrefaisant ou autrement répréhensible. Cela inclut, mais ne se limite pas à, du matériel relatif à l'abus sexuel d'enfants (CSAM), au terrorisme et à la violation des droits d'auteur.</li>
<li><strong>Sécurité du Compte</strong> : Vous êtes responsable de maintenir la confidentialité de votre compte et de vos clés de chiffrement. Vous acceptez de nous informer immédiatement de toute utilisation non autorisée de votre compte.</li>
</ul>
<h2>4. Procédure de Notification et de Retrait</h2>
<p>Si vous pensez que du contenu hébergé sur notre Site est illégal ou enfreint ces CGU, veuillez nous en informer immédiatement par un mail à admin@squi.fr en précisant le nom du site et l'infraction constatée. Nous examinerons toutes les notifications et prendrons les mesures appropriées, y compris le retrait ou la désactivation de l'accès au contenu si nécessaire.</p>
<h2>5. Limitation de Responsabilité</h2>
<ul>
<li><strong>Absence de Responsabilité pour le Contenu des Utilisateurs</strong> : SqPad n'a pas la capacité de déchiffrer et de surveiller le contenu téléchargé par les utilisateurs. Par conséquent, nous ne sommes pas responsables du contenu téléchargé par les utilisateurs.</li>
<li><strong>Réponse aux Demandes Légales</strong> : Nous nous conformerons aux demandes légales et aux ordonnances judiciaires dans la mesure requise par la loi, y compris la coopération avec les autorités judiciaires dans les enquêtes sur les activités illégales.</li>
</ul>
<h2>6. Vie Privée et Protection des Données</h2>
<ul>
<li><strong>Données des Utilisateurs</strong> : Nous collectons et traitons les données personnelles conformément à notre Politique de Confidentialité, qui est incorporée par référence dans ces CGU.</li>
<li><strong>Chiffrement</strong> : Tout le contenu téléchargé est chiffré par les utilisateurs, et SqPad n'a pas accès aux clés de chiffrement ni au contenu des fichiers.</li>
</ul>
<h2>7. Résiliation</h2>
<p>Nous nous réservons le droit de suspendre ou de résilier votre accès au Site et au Service à notre seule discrétion, sans préavis, si vous violez ces CGU ou si nous sommes tenus de le faire par la loi.</p>
<h2>8. Modifications des Conditions</h2>
<p>Nous pouvons modifier ces CGU à tout moment. Nous vous informerons des changements importants en publiant les nouvelles CGU sur le Site ou par d'autres moyens. Votre utilisation continue du Service après de telles modifications constitue votre acceptation des nouvelles CGU.</p>
<h2>9. Droit Applicable</h2>
<p>Ces CGU sont régies par et interprétées conformément aux lois de la France. Tout litige découlant de ces CGU sera soumis à la juridiction exclusive des tribunaux français.</p>
<h2>10. Coordonnées</h2>
<p>Pour toute question concernant ces CGU ou le Service, veuillez nous contacter à :</p>
<p>admin@squi.fr</p>
</body>
</html>

View File

@ -1,9 +1,13 @@
# SqPad # SqPad
A encrypted pastebin. Gives a webui where you can post text with a title, which can then be shared via a link. The server stores the text encrypted thanks to MagicCrypt using AES-256. A encrypted pastebin. Gives a webui where you can post text with a title, which can then be shared via a link. The server stores the text encrypted thanks to MagicCrypt using AES-256.
New : you can also send files.
## Install ## Install
Juste compile and launch it in the same folder as "Files". Juste compile and launch it in the same folder as "Files".
This is only for development, though.
## Docker ## Docker
Start by ![installing docker](https://docs.docker.com/engine/install/) if need be, then: Start by ![installing docker](https://docs.docker.com/engine/install/) if need be, then:
``` ```
@ -20,21 +24,4 @@ The link can be used via a browser normally; it can also be used with curl or wg
For now, notes are kept forever until some admin manually removes them. For now, notes are kept forever until some admin manually removes them.
## Warnings ## Warnings
The size of a post is limited to 1MB. This value can be changed in the source code, see the end of the main function, at the bottom of src/main.rs : The size of a post or upload is limited to 100MB. This value can be changed in the source code, see the end of the main function, at the bottom of src/main.rs.
```rust
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(move || {
App::new()
//Limit is configured here
.app_data(web::FormConfig::default().limit(1024 * 1000))
.service(get_index)
.service(post_index)
.service(show_post)
})
.bind(("0.0.0.0", 8080))?
.run()
.await
}
```

186
src/fileupload.rs Normal file
View File

@ -0,0 +1,186 @@
pub mod fileupload {
pub use actix_multipart::form::{tempfile::TempFile, MultipartForm};
pub use actix_web::{get, post, web, App, HttpResponse, HttpServer, HttpRequest, Responder};
pub use std::fs;
pub use std::io::{Read, Write};
pub use serde_derive::{Serialize, Deserialize};
pub use base64::prelude::*;
pub use actix_files::NamedFile;
pub use rand::Rng;
pub use chrono::Local;
pub use magic_crypt::{new_magic_crypt, MagicCryptTrait};
pub use std::fs::OpenOptions;
pub use humansize::{format_size, DECIMAL};
pub use actix_web::Error;
pub use actix_multipart::MultipartError;
#[derive(Debug, MultipartForm)]
pub struct UploadForm {
#[multipart(limit = "100MB")]
file: TempFile,
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct EncryptedFile {
name: String,
crypt: String,
date: String,
id: u64,
}
fn b64_to_file(b64: &String, destfile: &str) -> Result<(), Box<dyn std::error::Error>> {
let decoded_data = BASE64_STANDARD.decode(b64)?;
fs::write(destfile, &decoded_data)?;
Ok(())
}
fn encrypt(content: &String, password: &String) -> String {
let mc = new_magic_crypt!(password, 256);
let encrypted = mc.encrypt_str_to_base64(&content);
return String::from(encrypted);
}
fn random_password() -> String {
const CHARSET: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz\
0123456789";
let mut rng = rand::thread_rng();
let password: String = (0..64)
.map(|_| {
let idx = rng.gen_range(0..CHARSET.len());
CHARSET[idx] as char
})
.collect();
return password;
}
fn store_encrypted_file(b64: &String, name: &String, password: &String, id: &u64) -> Result<(), Box<dyn std::error::Error>> {
let mut file = OpenOptions::new()
.write(true)
.append(true)
.create(true)
.open(format!("./Files/Stored_files/{}.json", id))
.unwrap();
let crypt = encrypt(b64, password);
let now = Local::now();
let now = now.format("%d/%m/%Y@%H:%M:%S");
let my_encrypted_file = EncryptedFile { name: name.clone(), crypt: crypt, date: format!("{}", now), id: id.clone() };
let json = serde_json::to_string(&my_encrypted_file).unwrap();
writeln!(file, "{}", &json)?;
Ok(())
}
fn get_decrypted_file(id: &u64, password: &String) -> Result<String, Box<dyn std::error::Error>> {
let json_content = fs::read_to_string(format!("./Files/Stored_files/{}.json", id))?;
let encr_file: EncryptedFile = serde_json::from_str(json_content.as_str())?;
let decr_file = decrypt(encr_file.crypt.clone(), password.clone().as_str())?;
let path = format!("/tmp/{}", encr_file.name);
b64_to_file(&decr_file, &path)?;
Ok(path)
}
fn decrypt(encrypted: String, pass: &str) -> Result<String, String> {
let mc = new_magic_crypt!(pass, 256);
let result = mc.decrypt_base64_to_string(&encrypted);
match result {
Ok(v) => {
return Ok(v);
},
Err(_) => {
return Err("Could not decrypt".to_string());
},
}
}
#[post("/file")]
pub async fn post_file(MultipartForm(form): MultipartForm<UploadForm>, req: HttpRequest) -> impl Responder {
//File is :
//UploadForm { file: TempFile { file: NamedTempFile("/tmp/.tmp8yLb6N"), content_type: Some("image/jpeg"), file_name: Some("157.jpg"), size: 1437187 } }
//The file is written to /tmp, which means trying to persist it in current dir fails.
//But we can read it directly instead.
//Persisting == writing the temporary file to a definitive file.
//let destpath = String::from("/tmp/destfile.jpg");
//let stored_file = form.file.file.persist(destpath).unwrap();
//Reading the file in base64.
let mut src_file = form.file.file.reopen().unwrap();
let mut buffer = Vec::new();
src_file.read_to_end(&mut buffer).unwrap();
let base64_content = BASE64_STANDARD.encode(&buffer);
//Writing it back on disk.
//let destpath = String::from("./coucou.jpg");
//b64_to_file(&base64_content, &destpath).unwrap();
//Storing it encrypted.
let password = random_password();
let mut rng = rand::thread_rng();
let id: u64 = rng.gen::<u64>();
let hostname = req.headers().get("Host").unwrap().to_str().unwrap();
let filename = String::from(form.file.file_name.unwrap_or("NAMENOTFOUND".to_string()));
match store_encrypted_file(&base64_content, &filename, &password, &id){
Ok(_) => (),
Err(e) => return HttpResponse::Ok().body(format!("File could not be saved, got {}", e)),
};
//try to get html header and footer files.
let header = fs::read_to_string("./Files/header.html").unwrap_or("".to_string());
let footer = fs::read_to_string("./Files/footer.html").unwrap_or("".to_string());
let hsize = format_size(form.file.size, DECIMAL);
//We have to send smthing back to the user.
let link = format!("http://{}/getfile/{}/{}", hostname, id, password);
let answer = format!(
"{}Uploaded {} with size: {}\n\
<br><br><a href=\"{}\">Here</a>\n\
<br><br>You can download it with in a terminal with<br>\
<pre>curl -JLO {}</pre>{}",
header,
filename,
hsize,
link,
link,
footer,
);
return HttpResponse::Ok().body(answer);
}
//Serve the file back to the user
#[get("/getfile/{id}/{password}")]
pub async fn get_file(path: web::Path<(u64, String)>) -> impl Responder {
let (id,password) = path.into_inner();
let path = get_decrypted_file(&id, &password).unwrap();
let sendback = NamedFile::open(path.clone());
match fs::remove_file(path.clone()) {
Ok(_) => (),
Err(e) => eprintln!("File {} could not be deleted, got {}", path, e),
};
sendback
}
#[get("/")]
pub async fn get_index() -> impl Responder {
let page = fs::read_to_string("./Files/index.html").unwrap();
return HttpResponse::Ok().body(page);
}
pub fn handle_multipart_error(err: MultipartError, _req: &HttpRequest) -> Error {
eprintln!("Multipart error {}", err);
return Error::from(err);
}
}

View File

@ -1,6 +1,5 @@
use magic_crypt::{new_magic_crypt, MagicCryptTrait}; use magic_crypt::{new_magic_crypt, MagicCryptTrait};
use std::fs; use std::fs;
use serde::{Serialize, Deserialize};
use serde_derive::{Serialize, Deserialize}; use serde_derive::{Serialize, Deserialize};
use actix_web::{get, post, web, App, HttpResponse, HttpServer, HttpRequest, Responder}; use actix_web::{get, post, web, App, HttpResponse, HttpServer, HttpRequest, Responder};
use actix_web::http::header::HeaderValue; use actix_web::http::header::HeaderValue;
@ -8,6 +7,10 @@ use std::fs::OpenOptions;
use std::io::prelude::*; use std::io::prelude::*;
use chrono::Local; use chrono::Local;
use rand::Rng; use rand::Rng;
use actix_multipart::form::MultipartFormConfig;
pub mod fileupload;
use crate::fileupload::fileupload::*;
#[derive(Deserialize)] #[derive(Deserialize)]
struct Post { struct Post {
@ -156,15 +159,29 @@ async fn get_index() -> impl Responder {
return HttpResponse::Ok().body(page); return HttpResponse::Ok().body(page);
} }
#[get("/tos")]
async fn get_tos() -> impl Responder {
let page = fs::read_to_string("./Files/tos.html").unwrap();
return HttpResponse::Ok().body(page);
}
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
HttpServer::new(move || { HttpServer::new(move || {
App::new() App::new()
.app_data(web::FormConfig::default().limit(1024 * 1000)) .app_data(
MultipartFormConfig::default()
.total_limit(100 * 1024 * 1024 )//Maximum form size 100MB
.memory_limit(10 * 1024 * 1024)//10 MB
.error_handler(handle_multipart_error)
)
.service(get_index) .service(get_index)
.service(post_index) .service(post_index)
.service(show_post) .service(show_post)
.service(post_file)
.service(get_file)
.service(get_tos)
}) })
.bind(("0.0.0.0", 8080))? .bind(("0.0.0.0", 8080))?
.run() .run()