Botnadzor usesDocumentation 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.
@webext-core/proxy-service to enable seamless communication between the background service worker, content scripts, and popup. This architecture allows all extension contexts to access background services as if they were local objects.
Overview
Browser extensions run in multiple isolated contexts:- Background — Service worker that manages state and business logic
- Content Scripts — Scripts injected into web pages (VK.com)
- Popup — Extension UI shown when clicking the extension icon
@webext-core/proxy-service provides a transparent RPC (Remote Procedure Call) layer.
How It Works
The proxy service library uses browser extension messaging APIs to forward method calls from content scripts and popup to the background service worker.In Background Context
Services are registered insrc/entrypoints/background.ts:
src/entrypoints/background.ts
In Content Script / Popup
Services are accessed usinggetService() from @webext-core/proxy-service:
Type-Safe Service Keys
Service keys are defined insrc/shared/proxy-service-keys.ts with full TypeScript type safety:
src/shared/proxy-service-keys.ts
ProxyServiceKey<T> type ensures that:
- Method calls are type-checked
- Return types are inferred correctly
- Only public methods are accessible
Registered Services
All 13 services are registered insrc/entrypoints/background.ts:
src/entrypoints/background.ts
Service Descriptions
AffiliationService
AffiliationService
Checks if accounts are affiliated with bot/spam lists.Key Methods:
checkAccount(accountIdentifier)— Check account affiliationpollAffiliation()— Poll for affiliation changes
AuthService
AuthService
Manages user authentication with access codes.Key Methods:
getAuthStatus()— Get current auth statussetAccessCode(code)— Set access codecheckAuth()— Validate access codefetchFromDynamicApiWithAccessCode()— Make authenticated API calls
CollectingService
CollectingService
Collects comment data for bot detection analysis.Key Methods:
collectCommentIfNeeded()— Register comment for collectionpersistRegisteredCommentsIfNeeded()— Save collected data
DxConfigService
DxConfigService
Developer experience configuration for debugging.Key Methods:
get()— Get DX configpatch()— Update DX config
ExtensionVersionService
ExtensionVersionService
Tracks extension version and update notifications.Key Methods:
pollVersionInfo()— Get version information
FrontendService
FrontendService
Manages the frontend base URL for the Botnadzor web app.Key Methods:
getBaseUrl()— Get frontend base URL
InspectorService
InspectorService
Provides comment inspection tools for detailed analysis.Key Methods:
trigger()— Trigger inspector for a commentpollState()— Poll inspector state
NotificationService
NotificationService
Browser notification management.Key Methods:
show()— Show browser notification
PopupService
PopupService
Popup state management.Key Methods:
pollState()— Poll popup statesetState()— Update popup state
RegDateService
RegDateService
Fetches VK account registration dates.Key Methods:
fetchRegDate(accountIdentifier)— Fetch registration date
RootConfigService
RootConfigService
Remote configuration management.Key Methods:
get()— Get root configurationpoll()— Poll for config changes
StaticListsService
StaticListsService
Manages static lists (bots, insertions, etc.) with local/remote combining.Key Methods:
getItems(listId)— Get all items from a listfindItem(listId, index, value)— Find specific itemgetListSummary(listId)— Get list statisticsaddLocalItem(listId, item)— Add local itemremoveLocalItem(listId, index, value)— Remove itemupdateIfNeeded()— Update lists from remote
UserConfigService
UserConfigService
User preferences and configuration.Key Methods:
get()— Get user configpatch()— Update user config
Service Architecture
Services follow consistent patterns:Constructor Dependencies
Services declare dependencies in their constructor:src/entrypoints/background/@services/auth-service.ts
Pollable State
Services use thePollable pattern for reactive state:
Async Initialization
Services that need async setup start background tasks in the constructor:Disposal
Services implementSymbol.dispose for cleanup:
Usage Examples
In Content Scripts
src/entrypoints/content/insertion-management.ts
In Popup
src/entrypoints/popup/app/tabs/=access.tsx
In Insertion Variants
src/entrypoints/content/insertion-variants/=account.ts
Limitations
Non-Serializable Values
You cannot pass non-serializable values across contexts:Method Return Types
All service methods must returnPromise<T> where T is JSON-serializable:
Performance Considerations
Call Overhead
Each service call involves:- Serialization of arguments
- Browser messaging API call
- Deserialization in background context
- Method execution
- Serialization of result
- Response messaging
- Deserialization of result
Batch Operations
When possible, batch multiple operations:Next Steps
Static Lists
Deep dive into the StaticListsService implementation
Entrypoints
Learn about the three extension entrypoints