Add account connections, guild wallets and admin fixes [skip ci]
This commit is contained in:
1 parent
7076e847ea
commit
004862ea88
38 files changed
+1696
-458
No files matched your search
@@ -319,6 +319,21 @@ pub async fn put_settings(_: AdminUser, State(state): State<AppState>, Json(mut
|
||||
Some(k) => Some(k.to_string()),
|
||||
};
|
||||
s.public_url = s.public_url.map(|u| u.trim().trim_end_matches('/').to_string()).filter(|u| !u.is_empty());
|
||||
s.username_blocklist =
|
||||
s.username_blocklist.into_iter().map(|entry| entry.trim().to_ascii_lowercase()).filter(|entry| !entry.is_empty()).collect();
|
||||
if s.username_blocklist.len() > 200
|
||||
|| s.username_blocklist.iter().any(|entry| {
|
||||
let word = entry.trim_matches('*');
|
||||
word.len() < 3
|
||||
|| word.len() > 16
|
||||
|| !word.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'_')
|
||||
|| (entry.contains('*') && !(entry.starts_with('*') && entry.ends_with('*') && entry.matches('*').count() == 2))
|
||||
})
|
||||
{
|
||||
return Err(AppError::bad_request(
|
||||
"blacklist entries must be 3–16 letters, numbers or underscores; use *word* to match within names",
|
||||
));
|
||||
}
|
||||
if let Some(u) = &s.public_url {
|
||||
if !u.starts_with("http://") && !u.starts_with("https://") {
|
||||
return Err(AppError::bad_request("the public URL must start with https:// (or http://)"));
|
||||
|
||||
Reference in new issue
Block a user