How govza/haramblock works
Haram Block is a cross-browser extension that applies per-site policies to detect and mask inappropriate images, GIFs, and video. The main path is webpage media discovery in the content script, policy-based processing and inference requests over background RPC, then prediction-driven overlays. Users configure site policy, strictness, and masking through the popup or options page; host settings and predictions are persisted in browser storage. The graph includes the documented video path and ONNX inference layer. Some subsystem links are based on documented capabilities and tree structure; unsampled implementation details are left unwired.
Main entry points: backgroundRpc.ts Background RPC · MediaPipeline.ts Media pipeline · inferenceOrchestrationService.ts Inference orchestration · ImageProcessor.ts Image processing
Components 18
Page processing
- Content bootstrap
entrypoints/content/index.ts - Media pipeline
entrypoints/content/core/MediaPipeline.ts - DOM media discovery
entrypoints/content/core/DomObserver.ts - Image processing
entrypoints/content/core/ImageProcessor.ts - Video processing
entrypoints/content/core/VideoProcessor.ts - Video frame sampling
entrypoints/content/video/sampling/sample.ts - Prediction overlays
entrypoints/content/presentation/imageMaskOverlay.ts
Background inference
- Background RPC
utils/messaging/services/backgroundRpc.ts - Inference orchestration
entrypoints/background/services/inferenceOrchestrationService.ts - ONNX inference
utils/inference/runtimes/onnx/prediction.ts - Model management
entrypoints/background/services/modelService.ts
Policy and settings
- Popup controls
entrypoints/popup/App.tsx - Options controls
entrypoints/options/App.tsx - Host settings service
entrypoints/background/services/hostSettingsService.ts
Persistence
- Host settings repository
utils/db/hostSettingsRepository.ts - Prediction repositories
utils/db/imagePredictionRepository.ts - IndexedDB and session storage
utils/db/db.ts
Other components
- Visited webpage
Connections 20
- Visited webpage → DOM media discovery: provides DOM
- Content bootstrap → Media pipeline: starts
- Media pipeline → DOM media discovery: observes media
- Media pipeline → Image processing: routes images
- Media pipeline → Video processing: routes video
- Image processing → Background RPC: requests inference
- Video processing → Video frame sampling: samples frames
- Video frame sampling → Background RPC: sends frames
- Background RPC → Inference orchestration: dispatches requests
- Inference orchestration → ONNX inference: runs inference
- Inference orchestration → Prediction repositories: reads and writes predictions
- Inference orchestration → Background RPC: returns predictions
- Media pipeline → Prediction overlays: applies verdicts
- Popup controls → Background RPC: reads and updates settings
- Options controls → Background RPC: reads and updates settings
- Background RPC → Host settings service: dispatches settings
- Host settings service → Host settings repository: reads and writes
- Host settings repository → IndexedDB and session storage: persists settings
- Prediction repositories → IndexedDB and session storage: persists predictions
- Model management → ONNX inference: configures model