mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-26 21:01:34 +00:00
* Make webfinger case insensitive * Make webfinger case insensitive * Case insensitive domain name * Case-insensitive webfinger * formatting Co-authored-by: Kradyz <k@radiz.nl>
This commit is contained in:
parent
c883a49a40
commit
9f64872d5a
6 changed files with 10 additions and 4 deletions
|
@ -649,7 +649,7 @@ export function wrapper(form: any): string {
|
|||
|
||||
export function randomString(length: number): string {
|
||||
var result = '';
|
||||
var characters = 'abcdefghijklmnopqrstuvwxyz0123456789_';
|
||||
var characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_';
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
|
|
|
@ -8,6 +8,8 @@ homepage = "https://join-lemmy.org/"
|
|||
documentation = "https://join-lemmy.org/docs/en/index.html"
|
||||
|
||||
[lib]
|
||||
name = "lemmy_db_schema"
|
||||
path = "src/lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{
|
||||
functions::lower,
|
||||
naive_now,
|
||||
newtypes::{CommunityId, DbUrl, PersonId},
|
||||
source::community::{
|
||||
|
@ -95,7 +96,7 @@ impl Community {
|
|||
use crate::schema::community::dsl::*;
|
||||
community
|
||||
.filter(local.eq(true))
|
||||
.filter(name.eq(community_name))
|
||||
.filter(lower(name).eq(lower(community_name)))
|
||||
.first::<Self>(conn)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{
|
||||
functions::lower,
|
||||
naive_now,
|
||||
newtypes::{DbUrl, PersonId},
|
||||
schema::person::dsl::*,
|
||||
|
@ -194,7 +195,7 @@ impl Person {
|
|||
person
|
||||
.filter(deleted.eq(false))
|
||||
.filter(local.eq(true))
|
||||
.filter(name.eq(from_name))
|
||||
.filter(lower(name).eq(lower(from_name)))
|
||||
.first::<Person>(conn)
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,8 @@ pub mod functions {
|
|||
sql_function! {
|
||||
fn hot_rank(score: BigInt, time: Timestamp) -> Integer;
|
||||
}
|
||||
|
||||
sql_function!(fn lower(x: Text) -> Text);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -13,7 +13,7 @@ static SETTINGS: Lazy<RwLock<Settings>> =
|
|||
Lazy::new(|| RwLock::new(Settings::init().expect("Failed to load settings file")));
|
||||
static WEBFINGER_REGEX: Lazy<Regex> = Lazy::new(|| {
|
||||
Regex::new(&format!(
|
||||
"^acct:([a-z0-9_]{{3,}})@{}$",
|
||||
"^acct:([a-zA-Z0-9_]{{3,}})@{}$",
|
||||
Settings::get().hostname
|
||||
))
|
||||
.expect("compile webfinger regex")
|
||||
|
|
Loading…
Reference in a new issue