From d72d03f7d96370c0d07614b122efbf9e92c66d36 Mon Sep 17 00:00:00 2001 From: iostream Date: Mon, 17 Aug 2020 09:34:06 +0700 Subject: [PATCH] block ads from facebook --- README.md | 2 +- src/hosts.cpp | 14 +++++++------- src/stdafx.h | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 02a9184..a793fc9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

A multi-purpose adblocker and skip bypass for the Windows Spotify Desktop Application.

Please support Spotify by purchasing premium

- Last updated: 18 July 2020
+ Last updated: 17 August 2020
Last tested version: 1.1.39.612.g1e7e78a4

diff --git a/src/hosts.cpp b/src/hosts.cpp index 91df927..1df3bb2 100644 --- a/src/hosts.cpp +++ b/src/hosts.cpp @@ -7,19 +7,19 @@ std::wofstream logging; _getaddrinfo getaddrinfo_orig; +const std::array blockList = { "google", "doubleclick", "qualaroo.com" , "fbsbx.com" }; + // check if ads hostname bool is_blockhost (const char* nodename) { + std::string nnodename (nodename); if (0 == nnodename.compare ("wpad")) return g_skip_wpad ? true : false; - - if (std::string::npos != nnodename.find ("google")) - return true; - if (std::string::npos != nnodename.find ("doubleclick")) - return true; - if (std::string::npos != nnodename.find ("qualaroo.com")) - return true; + for (auto i : blockList) { + if (std::string::npos != nnodename.find (i)) + return true; + } return false; } diff --git a/src/stdafx.h b/src/stdafx.h index 7b35cae..da3d579 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -16,6 +16,7 @@ #include #include +#include #include #include