This project uses a proxy to strip all ad-related requests from the Spotify desktop application. This should work for all major operating systems, but if you are using Linux, I would advise you to use this instead.
mitm.js
uses a Man-In-The-Middle proxy to decrypt SSL connections and filter out ad-related urls and domains. All spotify requests go to our locally hosted proxy, and mitm.js
is able to view the domain that each request is for, and the associated full url. With this, it's able to determine whether to allow the request through based off the rules in mitm-utils/whitelist-mitm.js
and mitm-utils/blacklist-mitm.js
. On the first run, mitm.js
generates a Root Certificate Authority (CA), which needs to be trusted by the OS.
filter-domains.js
does the same without SSL-decryption, so it does not require CA trusting, but it is not able to filter all ads since it can only filter by domains, not the exact url. Some domains, like spclient.wg.spotify.com
serve both ads and Spotify functionality, so this is a problem for filter-domains.js
. One upside is that it does not require trusting the Root CA, so it can be used on computers where you do not have the ability to trust a CA.
To build an image for the MITM proxy, simply run npm run docker-mitm
, and then create a container binding the port 8082 and the folder /usr/src/app/certs
to the host to get access to the certificates.
The port 8082 is exposed by Docker for easier setup using a reverse-proxy.
For example:
docker run -d --name=Spotify-adblock --volume=/opt/spotify-adblock/certs:/usr/src/app/certs -p 8082:8082 --restart=always spotify-adblock:latest
,where /opt/spotify-adblock/certs is the path on the host machine where you will find the certificates you need to import.