Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move furry detection to separate file #223

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions web/admin/lib/furry-detector.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs";

type ProfileViewMinimal = Pick<ProfileViewDetailed, "displayName"> &
Pick<ProfileViewDetailed, "description">;

export function isProbablyFurry(profile?: ProfileViewMinimal): boolean {
if (!profile) {
return false;
}

// ∆ (increment operator) and Δ (delta)
// Θ (uppercase theta) and θ (lowercase theta)
const therian = /(Θ|θ)(∆|Δ)/;

if (profile?.displayName?.match(therian)) {
return true;
}

if (!profile.description) {
return false;
}

const terms = [
"furry",
"furries",
therian,
"therian",
/\bpup\b/,
/\bfur\b/,
"anthro",
"canine",
/bu?n+u*y/, // too good to not use
"kemono",
"furaffinity",
"derg",
/scal(y|ie)/,
/gay (fur|dog|cat|wolf)/,
/(f|m)urr?suit/,
"otherkin",
"protogen",
"fluffy",
];

const description = profile.description.toLowerCase();

for (const term of terms) {
if (
typeof term === "object"
? description.match(term)
: description.includes(term)
) {
return true;
}
}

return false;
}
47 changes: 3 additions & 44 deletions web/admin/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { getProfile } from "~/lib/cached-bsky";
import { isProbablyFurry } from "~/lib/furry-detector";
import { Actor, ActorStatus } from "../../proto/bff/v1/types_pb";
import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs";

Expand All @@ -18,50 +19,8 @@ const queues = computed(() => ({
All: actors.value,
"Probably furry": actors.value.filter((actor) => {
const profile = didToProfile(actor.did);
if (!profile?.description) return false;

// ∆ (increment operator) and Δ (delta)
// Θ (uppercase theta) and θ (lowercase theta)
const therian = /(Θ|θ)(∆|Δ)/;

if (profile.displayName?.match(therian)) {
return true;
}

const terms = [
"furry",
"furries",
therian,
"therian",
/\bpup\b/,
/\bfur\b/,
"anthro",
"canine",
/bu?n+u*y/, // too good to not use
"kemono",
"furaffinity",
"derg",
/scal(y|ie)/,
/gay (fur|dog|cat|wolf)/,
/(f|m)urr?suit/,
"otherkin",
"protogen",
"fluffy",
];

const description = profile.description.toLowerCase();

for (const term of terms) {
if (
typeof term === "object"
? description.match(term)
: description.includes(term)
) {
return true;
}
}

return false;

return isProbablyFurry(profile);
}),
"Empty profiles": actors.value.filter((actor) => {
const profile = didToProfile(actor.did);
Expand Down