mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Merge branch 'index-u-tags' into 'main'
feat: index 'u' tags See merge request soapbox-pub/ditto!644
This commit is contained in:
commit
1acb8bd56d
1 changed files with 5 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import { logi } from '@soapbox/logi';
|
|||
import { JsonValue } from '@std/json';
|
||||
import { Kysely } from 'kysely';
|
||||
import { nip27 } from 'nostr-tools';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { DittoTables } from '@/db/DittoTables.ts';
|
||||
import { dbEventsCounter } from '@/metrics.ts';
|
||||
|
|
@ -61,6 +62,10 @@ class EventsDB extends NPostgres {
|
|||
'r': ({ event, count }) => (event.kind === 1985 ? count < 20 : count < 3),
|
||||
't': ({ event, count, value }) =>
|
||||
(value === value.toLowerCase()) && (event.kind === 1985 ? count < 20 : count < 5) && value.length < 50,
|
||||
'u': ({ count, value }) => {
|
||||
const { success } = z.string().url().safeParse(value); // maybe find a better library specific for validating web urls
|
||||
return count < 15 && success;
|
||||
},
|
||||
};
|
||||
|
||||
static indexExtensions(event: NostrEvent): Record<string, string> {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue