Compare commits

..

No commits in common. "445f38c6be28f44e5ebff07b9fea88d202f75d75" and "3f93d8cabfe02a3981df3871f721b4f495cc8abd" have entirely different histories.

View File

@ -35,8 +35,7 @@ import * as lex from '../lexicon/lexicons'
import { isRecord as isFeedGenerator } from '../lexicon/types/app/bsky/feed/generator'
import { isRecord as isStarterPack } from '../lexicon/types/app/bsky/graph/starterpack'
import { isRecord as isPost } from '../lexicon/types/app/bsky/feed/post'
import { isLink, isTag } from '../lexicon/types/app/bsky/richtext/facet'
import { isMain } from '../lexicon/types/app/bsky/embed/external'
import { isTag } from '../lexicon/types/app/bsky/richtext/facet'
import { isRecord as isList } from '../lexicon/types/app/bsky/graph/list'
import { isRecord as isProfile } from '../lexicon/types/app/bsky/actor/profile'
import { hasExplicitSlur } from '../handle/explicit-slurs'
@ -121,7 +120,6 @@ export const prepareCreate = async (opts: {
const rkey = opts.rkey || nextRkey.toString()
// @TODO: validate against Lexicon record 'key' type, not just overall recordkey syntax
ensureValidRecordKey(rkey)
filterSi(record)
assertNoExplicitSlurs(rkey, record)
return {
action: WriteOpAction.Create,
@ -223,26 +221,6 @@ async function cidForSafeRecord(record: RepoRecord) {
}
}
function filterSi(record: RepoRecord) {
const filt = str => str.replace(/si=[\w-]{16}/, '');
if (isPost(record)) {
// app truncates url so si will never be in text
for (const facet of record.facets || []) {
for (const feat of facet.features) {
if (isLink(feat)) {
feat.uri = filt(feat.uri);
}
}
}
if (record.embed) {
if (isMain(record.embed)) {
record.embed.external.uri = filt(record.embed.external.uri);
}
//todo filter alt text
}
}
}
function assertNoExplicitSlurs(rkey: string, record: RepoRecord) {
let toCheck = ''
if (isProfile(record)) {