# abba23/spotify-adblock architecture

> Architecture diagram of the GitHub repository abba23/spotify-adblock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abba23/spotify-adblock
- Repository: https://github.com/abba23/spotify-adblock

## Overview

spotify-adblock is a Linux preload library that intercepts Spotify’s CEF URL-request function, extracts each request URL, blocks matches against a configured denylist, and forwards other requests to CEF. Configuration is loaded from the user or system config directory; decisions are logged. The runtime path is clear from the excerpts, though no independent Spotify or CEF implementation is present in the repository.

Main entry points: [`src/lib.rs`](https://github.com/abba23/spotify-adblock/blob/main/src/lib.rs) (CEF request hook), [`src/config.rs`](https://github.com/abba23/spotify-adblock/blob/main/src/config.rs) (Config discovery and parsing), [`src/hook.rs`](https://github.com/abba23/spotify-adblock/blob/main/src/hook.rs) (Symbol resolution), [`src/cef.rs`](https://github.com/abba23/spotify-adblock/blob/main/src/cef.rs) (CEF request ABI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interception["Request interception"]
  node_hook_entry["CEF request hook<br/>[lib.rs]"]
  node_cef_abi["CEF request ABI<br/>[cef.rs]"]
  node_request_policy["Denylist filtering<br/>[lib.rs]"]
end

subgraph group_policy["Policy and configuration"]
  node_config_loader["Config discovery and parsing<br/>[config.rs]"]
end

subgraph group_runtime["Runtime support"]
  node_hook_macro["Symbol resolution<br/>[hook.rs]"]
  node_decision_logs["Decision logging<br/>[log.rs]"]
end

node_spotify(("Spotify process"))
node_cef_runtime["Original CEF handler"]
node_config_file["Config file"]

node_spotify -->|"calls hooked API"| node_hook_entry
node_hook_entry -->|"reads request URL"| node_cef_abi
node_hook_entry -->|"checks URL"| node_request_policy
node_request_policy -->|"uses denylist"| node_config_loader
node_config_loader -->|"finds and reads"| node_config_file
node_hook_entry -->|"forwards allowed request"| node_cef_runtime
node_hook_entry -->|"declares wrapper"| node_hook_macro
node_hook_macro -->|"resolves next symbol"| node_cef_runtime
node_hook_entry -->|"logs decisions"| node_decision_logs

click node_hook_entry "https://github.com/abba23/spotify-adblock/blob/main/src/lib.rs"
click node_cef_abi "https://github.com/abba23/spotify-adblock/blob/main/src/cef.rs"
click node_request_policy "https://github.com/abba23/spotify-adblock/blob/main/src/lib.rs"
click node_config_loader "https://github.com/abba23/spotify-adblock/blob/main/src/config.rs"
click node_hook_macro "https://github.com/abba23/spotify-adblock/blob/main/src/hook.rs"
click node_decision_logs "https://github.com/abba23/spotify-adblock/blob/main/src/log.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_hook_entry,node_cef_abi,node_request_policy toneBlue
class node_config_loader toneAmber
class node_hook_macro,node_decision_logs,node_cef_runtime toneMint
class node_spotify,node_config_file toneIndigo
```

## Components

### Request interception

- [CEF request hook](https://github.com/abba23/spotify-adblock/blob/main/src/lib.rs): `src/lib.rs`
- [CEF request ABI](https://github.com/abba23/spotify-adblock/blob/main/src/cef.rs): `src/cef.rs`
- [Denylist filtering](https://github.com/abba23/spotify-adblock/blob/main/src/lib.rs): `src/lib.rs`

### Policy and configuration

- [Config discovery and parsing](https://github.com/abba23/spotify-adblock/blob/main/src/config.rs): `src/config.rs`

### Runtime support

- [Symbol resolution](https://github.com/abba23/spotify-adblock/blob/main/src/hook.rs): `src/hook.rs`
- [Decision logging](https://github.com/abba23/spotify-adblock/blob/main/src/log.rs): `src/log.rs`

### Other components

- **Spotify process**
- **Original CEF handler**
- **Config file**

## Connections

- Spotify process → CEF request hook: calls hooked API (evidence: `README.md`)
- CEF request hook → CEF request ABI: reads request URL (evidence: `src/lib.rs`)
- CEF request hook → Denylist filtering: checks URL (evidence: `src/lib.rs`)
- Denylist filtering → Config discovery and parsing: uses denylist (evidence: `src/lib.rs`)
- Config discovery and parsing → Config file: finds and reads (evidence: `src/config.rs`)
- CEF request hook → Original CEF handler: forwards allowed request (evidence: `src/lib.rs`)
- CEF request hook → Symbol resolution: declares wrapper (evidence: `src/lib.rs`)
- Symbol resolution → Original CEF handler: resolves next symbol (evidence: `src/hook.rs`)
- CEF request hook → Decision logging: logs decisions (evidence: `src/lib.rs`)
