Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/botnadzor/extension/llms.txt

Use this file to discover all available pages before exploring further.

The Botnadzor Extension automatically highlights bots and suspicious accounts on VK pages using a sophisticated insertion system that modifies the DOM to provide visual indicators.

How It Works

The bot detection system operates through a modular insertion system that identifies accounts on VK pages and applies visual highlights based on affiliation data from the Botnadzor database.

Insertion Variants

The extension uses config-driven DOM modifications called “insertion variants” that are registered for different page elements:
  • Comments (=comment.ts) - Highlights bot accounts in comment sections
  • Accounts (=account.ts) - Highlights bot profiles on account pages
  • Reviews (=review.ts) - Highlights bots in review sections
  • Reply forms (=reply-form.ts) - Shows bot indicators in reply contexts
Each insertion variant:
  1. Extracts account data from the VK page markup
  2. Checks the account against the static lists service
  3. Applies visual highlights if the account is identified as a bot

Visual Highlighting System

The extension provides two types of visual indicators:

1. Affiliation Highlight

Adds a colored left border and background overlay to bot accounts:
// src/entrypoints/content/insertion-variants/shared/@markup-ui/affiliation-highlight.ts
const highlight = {
  position: 'absolute',
  inset: '0px',
  borderLeft: '3px solid',
  borderColor: 'var(--bn-inline-affiliation-border)',
  backgroundColor: 'var(--bn-inline-affiliation-color)'
};
The highlight element is dynamically positioned over the account’s DOM element with:
  • A 3px left border in the affiliation color
  • A semi-transparent background overlay
  • Automatic dark mode adaptation (50% border opacity, 20% background opacity)

2. Affiliation Badge

Displays a text badge showing the bot’s tag category:
// src/entrypoints/content/insertion-variants/shared/@markup-ui/affiliation-badge.ts
function stringifyAffiliationTags(tags: [TagListItem, ...TagListItem[]]): string {
  return `(${tags.at(-1)?.name})`;
}
The badge:
  • Shows the most specific tag name in parentheses
  • Uses italic text styling
  • Applies muted foreground color
  • Hides when no affiliation is detected

Color System

Each account affiliation includes a colorForHighlight property that determines the visual appearance. The color is applied using CSS custom properties:
element.style.setProperty(
  '--bn-inline-affiliation-color',
  accountAffiliation.colorForHighlight
);

element.style.setProperty(
  '--bn-inline-affiliation-border',
  'color-mix(in srgb, var(--bn-inline-affiliation-color) 80%, rgba(250 0 0))'
);

Static Lists Service

The bot detection relies on the StaticListsService which maintains synchronized lists of known bots from the Botnadzor database. The service provides:
  • Account affiliation checking via checkAccount(accountIdentifier)
  • Tag-based categorization of bots
  • Real-time updates of bot lists
  • Efficient lookup using account identifiers (VK IDs or nicknames)

Implementation Details

Account Data Extraction

For each page element, the insertion system extracts:
type AccountMarkupData = {
  accountAvatarUrl: string;         // Profile picture
  accountIdentifier: AccountIdentifier;  // VK ID or nickname
  accountName: string;               // Display name
};

Affiliation Check Flow

  1. Extract account identifier from page markup
  2. Query affiliationService.checkAccount() with the identifier
  3. Receive affiliation data including:
    • tags - Categorization tags
    • colorForHighlight - Visual indicator color
    • botnadzorPage - Whether account has a Botnadzor page
    • botnadzorCard - Whether account has a bot card
  4. Render highlights if affiliation exists

Automatic Cleanup

The insertion system includes automatic cleanup when:
  • Page navigation occurs
  • DOM elements are removed
  • Extension is disabled
Each insertion variant’s unmount() method ensures all added elements are removed:
unmount: () => {
  affiliationHighlightUi?.unmount();
  affiliationBadgeUi?.unmount();
  element.remove();
}

Supported VK Sites

The bot detection works across all VK-related domains:
  • vk.com and m.vk.com
  • vk.ru and m.vk.ru
  • vkvideo.ru and m.vkvideo.ru
  • web.archive.org (archived VK pages)

Performance Considerations

The insertion system is optimized for performance:
  • Lazy mounting: UI elements are only created when needed
  • Efficient rendering: Only updates DOM when data changes
  • Minimal overhead: Uses native DOM APIs for maximum speed
  • Automatic cleanup: Prevents memory leaks through proper unmounting