Skip to content

Commit ce87772

Browse files
committed
initial commit
0 parents  commit ce87772

File tree

17 files changed

+3449
-0
lines changed

17 files changed

+3449
-0
lines changed

PeaceSpotify.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.7.34009.444
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PeaceSpotify", "PeaceSpotify\PeaceSpotify.vcxproj", "{7148D620-E409-427F-9B27-C107F8FBDBCC}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Debug|x64.ActiveCfg = Debug|x64
17+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Debug|x64.Build.0 = Debug|x64
18+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Debug|x86.ActiveCfg = Debug|Win32
19+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Debug|x86.Build.0 = Debug|Win32
20+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Release|x64.ActiveCfg = Release|x64
21+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Release|x64.Build.0 = Release|x64
22+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Release|x86.ActiveCfg = Release|Win32
23+
{7148D620-E409-427F-9B27-C107F8FBDBCC}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {4E0E76DA-240D-43FC-BA5E-02DA23D6C2A2}
30+
EndGlobalSection
31+
EndGlobal

PeaceSpotify/PeaceSpotify.vcxproj

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>17.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{7148d620-e409-427f-9b27-c107f8fbdbcc}</ProjectGuid>
25+
<RootNamespace>PeaceSpotify</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
</PropertyGroup>
28+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
30+
<ConfigurationType>DynamicLibrary</ConfigurationType>
31+
<UseDebugLibraries>true</UseDebugLibraries>
32+
<PlatformToolset>v143</PlatformToolset>
33+
<CharacterSet>Unicode</CharacterSet>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
36+
<ConfigurationType>DynamicLibrary</ConfigurationType>
37+
<UseDebugLibraries>false</UseDebugLibraries>
38+
<PlatformToolset>v143</PlatformToolset>
39+
<WholeProgramOptimization>true</WholeProgramOptimization>
40+
<CharacterSet>Unicode</CharacterSet>
41+
</PropertyGroup>
42+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
43+
<ConfigurationType>DynamicLibrary</ConfigurationType>
44+
<UseDebugLibraries>true</UseDebugLibraries>
45+
<PlatformToolset>v143</PlatformToolset>
46+
<CharacterSet>Unicode</CharacterSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
49+
<ConfigurationType>DynamicLibrary</ConfigurationType>
50+
<UseDebugLibraries>false</UseDebugLibraries>
51+
<PlatformToolset>v143</PlatformToolset>
52+
<WholeProgramOptimization>true</WholeProgramOptimization>
53+
<CharacterSet>Unicode</CharacterSet>
54+
</PropertyGroup>
55+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
56+
<ImportGroup Label="ExtensionSettings">
57+
</ImportGroup>
58+
<ImportGroup Label="Shared">
59+
</ImportGroup>
60+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
61+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
62+
</ImportGroup>
63+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
67+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
68+
</ImportGroup>
69+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
70+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
71+
</ImportGroup>
72+
<PropertyGroup Label="UserMacros" />
73+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
74+
<TargetName>libcef</TargetName>
75+
</PropertyGroup>
76+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
77+
<TargetName>libcef</TargetName>
78+
</PropertyGroup>
79+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
80+
<ClCompile>
81+
<WarningLevel>Level3</WarningLevel>
82+
<SDLCheck>true</SDLCheck>
83+
<PreprocessorDefinitions>WIN32;_DEBUG;PEACESPOTIFY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
84+
<ConformanceMode>true</ConformanceMode>
85+
<PrecompiledHeader>Use</PrecompiledHeader>
86+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
87+
</ClCompile>
88+
<Link>
89+
<SubSystem>Windows</SubSystem>
90+
<GenerateDebugInformation>true</GenerateDebugInformation>
91+
<EnableUAC>false</EnableUAC>
92+
<ModuleDefinitionFile>peace.def</ModuleDefinitionFile>
93+
</Link>
94+
</ItemDefinitionGroup>
95+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
96+
<ClCompile>
97+
<WarningLevel>Level3</WarningLevel>
98+
<FunctionLevelLinking>true</FunctionLevelLinking>
99+
<IntrinsicFunctions>true</IntrinsicFunctions>
100+
<SDLCheck>true</SDLCheck>
101+
<PreprocessorDefinitions>WIN32;NDEBUG;PEACESPOTIFY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
102+
<ConformanceMode>true</ConformanceMode>
103+
<PrecompiledHeader>Use</PrecompiledHeader>
104+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
105+
<LanguageStandard>stdcpplatest</LanguageStandard>
106+
</ClCompile>
107+
<Link>
108+
<SubSystem>Windows</SubSystem>
109+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
110+
<OptimizeReferences>true</OptimizeReferences>
111+
<GenerateDebugInformation>true</GenerateDebugInformation>
112+
<EnableUAC>false</EnableUAC>
113+
<ModuleDefinitionFile>peace.def</ModuleDefinitionFile>
114+
</Link>
115+
</ItemDefinitionGroup>
116+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
117+
<ClCompile>
118+
<WarningLevel>Level3</WarningLevel>
119+
<SDLCheck>true</SDLCheck>
120+
<PreprocessorDefinitions>_DEBUG;PEACESPOTIFY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
121+
<ConformanceMode>true</ConformanceMode>
122+
<PrecompiledHeader>Use</PrecompiledHeader>
123+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
124+
<LanguageStandard>stdcpp20</LanguageStandard>
125+
</ClCompile>
126+
<Link>
127+
<SubSystem>Windows</SubSystem>
128+
<GenerateDebugInformation>true</GenerateDebugInformation>
129+
<EnableUAC>false</EnableUAC>
130+
<ModuleDefinitionFile>peace.def</ModuleDefinitionFile>
131+
</Link>
132+
</ItemDefinitionGroup>
133+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
134+
<ClCompile>
135+
<WarningLevel>Level3</WarningLevel>
136+
<FunctionLevelLinking>true</FunctionLevelLinking>
137+
<IntrinsicFunctions>true</IntrinsicFunctions>
138+
<SDLCheck>true</SDLCheck>
139+
<PreprocessorDefinitions>NDEBUG;PEACESPOTIFY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
140+
<ConformanceMode>true</ConformanceMode>
141+
<PrecompiledHeader>Use</PrecompiledHeader>
142+
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
143+
<LanguageStandard>stdcpp20</LanguageStandard>
144+
</ClCompile>
145+
<Link>
146+
<SubSystem>Windows</SubSystem>
147+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
148+
<OptimizeReferences>true</OptimizeReferences>
149+
<GenerateDebugInformation>true</GenerateDebugInformation>
150+
<EnableUAC>false</EnableUAC>
151+
<ModuleDefinitionFile>peace.def</ModuleDefinitionFile>
152+
</Link>
153+
</ItemDefinitionGroup>
154+
<ItemGroup>
155+
<ClInclude Include="framework.h" />
156+
<ClInclude Include="pch.h" />
157+
<ClInclude Include="peace.h" />
158+
<ClInclude Include="redir.h" />
159+
<ClInclude Include="stubs.h" />
160+
</ItemGroup>
161+
<ItemGroup>
162+
<ClCompile Include="dllmain.cpp" />
163+
<ClCompile Include="pch.cpp">
164+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
165+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
166+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
167+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
168+
</ClCompile>
169+
<ClCompile Include="peace.cpp" />
170+
</ItemGroup>
171+
<ItemGroup>
172+
<None Include="peace.def" />
173+
</ItemGroup>
174+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
175+
<ImportGroup Label="ExtensionTargets">
176+
</ImportGroup>
177+
</Project>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Source Files">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Header Files">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Resource Files">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClInclude Include="framework.h">
19+
<Filter>Header Files</Filter>
20+
</ClInclude>
21+
<ClInclude Include="pch.h">
22+
<Filter>Header Files</Filter>
23+
</ClInclude>
24+
<ClInclude Include="stubs.h">
25+
<Filter>Header Files</Filter>
26+
</ClInclude>
27+
<ClInclude Include="peace.h">
28+
<Filter>Header Files</Filter>
29+
</ClInclude>
30+
<ClInclude Include="redir.h">
31+
<Filter>Header Files</Filter>
32+
</ClInclude>
33+
</ItemGroup>
34+
<ItemGroup>
35+
<ClCompile Include="dllmain.cpp">
36+
<Filter>Source Files</Filter>
37+
</ClCompile>
38+
<ClCompile Include="pch.cpp">
39+
<Filter>Source Files</Filter>
40+
</ClCompile>
41+
<ClCompile Include="peace.cpp">
42+
<Filter>Source Files</Filter>
43+
</ClCompile>
44+
</ItemGroup>
45+
<ItemGroup>
46+
<None Include="peace.def">
47+
<Filter>Source Files</Filter>
48+
</None>
49+
</ItemGroup>
50+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

PeaceSpotify/dllmain.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include "pch.h"
2+
#include "peace.h"
3+
4+
BOOL APIENTRY DllMain(HMODULE hModule,
5+
DWORD ul_reason_for_call,
6+
LPVOID lpReserved
7+
)
8+
{
9+
switch (ul_reason_for_call)
10+
{
11+
case DLL_PROCESS_ATTACH:
12+
{
13+
if(!Init(LoadLibraryW(L"libcef_orig.dll"))) return FALSE;
14+
break;
15+
}
16+
case DLL_THREAD_ATTACH:
17+
case DLL_THREAD_DETACH:
18+
case DLL_PROCESS_DETACH:
19+
break;
20+
}
21+
return TRUE;
22+
}

PeaceSpotify/framework.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
4+
// Windows Header Files
5+
#include <windows.h>

PeaceSpotify/pch.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// pch.cpp: source file corresponding to the pre-compiled header
2+
3+
#include "pch.h"
4+
5+
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.

PeaceSpotify/pch.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// pch.h: This is a precompiled header file.
2+
// Files listed below are compiled only once, improving build performance for future builds.
3+
// This also affects IntelliSense performance, including code completion and many code browsing features.
4+
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
5+
// Do not add files here that you will be updating frequently as this negates the performance advantage.
6+
7+
#ifndef PCH_H
8+
#define PCH_H
9+
10+
// add headers that you want to pre-compile here
11+
#include "framework.h"
12+
13+
#endif //PCH_H

PeaceSpotify/peace.cpp

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#include "pch.h"
2+
#include "peace.h"
3+
#include <vector>
4+
#include <string>
5+
#include <stdexcept>
6+
7+
template<typename T>
8+
void InitAddress(T& fncAddr, HMODULE hModule, LPCSTR fncName)
9+
{
10+
fncAddr = (T)GetProcAddress(hModule, fncName);
11+
if (fncAddr == NULL)
12+
{
13+
throw std::runtime_error("Invalid Address");
14+
}
15+
}
16+
17+
PCEF_URLREQUEST_CREATE_T original_cef_url_request_create = NULL;
18+
PCEF_STRING_USERFREE_UTF16_FREE_T original_cef_string_user_free_utf_free = NULL;
19+
20+
static std::vector<std::wstring> black_list = {
21+
L"https://spclient.wg.spotify.com/ads/", // ads
22+
L"https://spclient.wg.spotify.com/ad-logic/", // ads
23+
L"https://spclient.wg.spotify.com/gabo-receiver-service/", // tracking
24+
};
25+
26+
bool IsBlackListed(const std::wstring url) {
27+
for (std::wstring blacklisted : black_list)
28+
if (!url.compare(0, blacklisted.length(), blacklisted)) return TRUE;
29+
return FALSE;
30+
}
31+
32+
33+
bool Init(HMODULE hModule) {
34+
if (!hModule)
35+
return FALSE;
36+
InitAddress(original_cef_url_request_create, hModule, "cef_urlrequest_create");
37+
InitAddress(original_cef_string_user_free_utf_free, hModule, "cef_string_userfree_utf16_free");
38+
return TRUE;
39+
}
40+
41+
cef_urlrequest_t*
42+
_cef_urlrequest_create(
43+
cef_request_t* request,
44+
cef_urlrequest_client_t* client,
45+
cef_request_context_t* request_context)
46+
{
47+
cef_string_userfree_t url_utf16 = request->get_url(request);
48+
std::wstring url = std::wstring(url_utf16->length, ' ');
49+
for (unsigned int i = 0; i < url_utf16->length; i++) url[i] = *(url_utf16->str + i);
50+
original_cef_string_user_free_utf_free(url_utf16);
51+
52+
if (IsBlackListed(url)) {
53+
54+
return NULL;
55+
}
56+
57+
return original_cef_url_request_create(request, client, request_context);
58+
}

PeaceSpotify/peace.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
LIBRARY
2+
EXPORTS
3+
cef_urlrequest_create=_cef_urlrequest_create @184

0 commit comments

Comments
 (0)