fix(stats): leave our own host out of the peers

Favicon lookups for local accounts can add our own host to instances.
Also skip userinfo and IPv6 literals in the backfill migration.
This commit is contained in:
Lain Soykaf 2026-10-27 20:53:56 +04:00
commit 958166589e
No known key found for this signature in database
5 changed files with 15 additions and 4 deletions

View file

@ -13,7 +13,8 @@ defmodule Pleroma.Repo.Migrations.BackfillInstancesFromUsers do
INSERT INTO instances (host, inserted_at, updated_at)
SELECT DISTINCT host, now(), now()
FROM (
SELECT substring(ap_id from '^[A-Za-z][A-Za-z0-9+.-]*://([^/:?#]+)') AS host
-- Skips userinfo; IPv6 literals give NULL and are left out.
SELECT substring(ap_id from '^[A-Za-z][A-Za-z0-9+.-]*://(?:[^/?#@]*@)?([^/:?#\\[]+)') AS host
FROM users
WHERE local = false AND ap_id IS NOT NULL
) AS hosts