From: Dessalines Date: Wed, 13 Apr 2022 11:13:29 +0000 (-0400) Subject: Fixing generate unique changeme (#2205) X-Git-Url: http://these/git/%22%7Bauthor_url%7D/static/%24%7Bargs.thread.url%7D?a=commitdiff_plain;h=2985e88a493b8502d7338af746f6d83847570c1e;p=lemmy.git Fixing generate unique changeme (#2205) * Fixing generate unique changeme * Fixing generate unique changeme 2 * Changing link to .invalid domain. Co-authored-by: Nutomic --- diff --git a/docker/lemmy.hjson b/docker/lemmy.hjson index 779c8d2c..edf37568 100644 --- a/docker/lemmy.hjson +++ b/docker/lemmy.hjson @@ -14,7 +14,7 @@ opentelemetry_url: "http://otel:4137" # the domain name of your instance (eg "lemmy.ml") - hostname: "my_domain" + hostname: "mydomain.ml" # address where lemmy should listen for incoming requests bind: "0.0.0.0" # port where lemmy should listen for incoming requests diff --git a/migrations/2022-04-11-210137_fix_unique_changeme/down.sql b/migrations/2022-04-11-210137_fix_unique_changeme/down.sql new file mode 100644 index 00000000..28198e89 --- /dev/null +++ b/migrations/2022-04-11-210137_fix_unique_changeme/down.sql @@ -0,0 +1,6 @@ +create or replace function generate_unique_changeme() +returns text language sql +as $$ + select 'http://changeme_' || string_agg (substr('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789', ceil (random() * 62)::integer, 1), '') + from generate_series(1, 20) +$$; diff --git a/migrations/2022-04-11-210137_fix_unique_changeme/up.sql b/migrations/2022-04-11-210137_fix_unique_changeme/up.sql new file mode 100644 index 00000000..46fe55b5 --- /dev/null +++ b/migrations/2022-04-11-210137_fix_unique_changeme/up.sql @@ -0,0 +1,5 @@ +create or replace function generate_unique_changeme() +returns text language sql +as $$ + select 'http://changeme.invalid/' || substr(md5(random()::text), 0, 25); +$$; diff --git a/src/code_migrations.rs b/src/code_migrations.rs index 4c0becfe..d626c7de 100644 --- a/src/code_migrations.rs +++ b/src/code_migrations.rs @@ -53,7 +53,7 @@ fn user_updates_2020_04_02( // Update the actor_id, private_key, and public_key, last_refreshed_at let incorrect_persons = person - .filter(actor_id.like("http://changeme_%")) + .filter(actor_id.like("http://changeme%")) .filter(local.eq(true)) .load::(conn)?; @@ -91,7 +91,7 @@ fn community_updates_2020_04_02( // Update the actor_id, private_key, and public_key, last_refreshed_at let incorrect_communities = community - .filter(actor_id.like("http://changeme_%")) + .filter(actor_id.like("http://changeme%")) .filter(local.eq(true)) .load::(conn)?; @@ -143,7 +143,7 @@ fn post_updates_2020_04_03( // Update the ap_id let incorrect_posts = post - .filter(ap_id.like("http://changeme_%")) + .filter(ap_id.like("http://changeme%")) .filter(local.eq(true)) .load::(conn)?; @@ -171,7 +171,7 @@ fn comment_updates_2020_04_03( // Update the ap_id let incorrect_comments = comment - .filter(ap_id.like("http://changeme_%")) + .filter(ap_id.like("http://changeme%")) .filter(local.eq(true)) .load::(conn)?; @@ -199,7 +199,7 @@ fn private_message_updates_2020_05_05( // Update the ap_id let incorrect_pms = private_message - .filter(ap_id.like("http://changeme_%")) + .filter(ap_id.like("http://changeme%")) .filter(local.eq(true)) .load::(conn)?; @@ -252,7 +252,7 @@ fn apub_columns_2021_02_02(conn: &PgConnection) -> Result<(), LemmyError> { { use lemmy_db_schema::schema::person::dsl::*; let persons = person - .filter(inbox_url.like("http://changeme_%")) + .filter(inbox_url.like("http://changeme%")) .load::(conn)?; for p in &persons { @@ -270,7 +270,7 @@ fn apub_columns_2021_02_02(conn: &PgConnection) -> Result<(), LemmyError> { { use lemmy_db_schema::schema::community::dsl::*; let communities = community - .filter(inbox_url.like("http://changeme_%")) + .filter(inbox_url.like("http://changeme%")) .load::(conn)?; for c in &communities {