add tracking protection

This commit is contained in:
Jiiks 2018-08-09 13:04:19 +03:00
parent 4f98eaf85b
commit 572c57d3a7
4 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,34 @@
/**
* BetterDiscord Tracking Protection Module
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
* All rights reserved.
* https://betterdiscord.net
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import BuiltinModule from './BuiltinModule';
import { Patcher, MonkeyPatch, WebpackModules } from 'modules';
export default new class E2EE extends BuiltinModule {
get settingPath() {
return ['security', 'default', 'tracking-protection'];
}
track(e) {
// console.log('Blocked Tracking');
}
enabled(e) {
if (Patcher.getPatchesByCaller('BD:TrackingProtection').length) return;
MonkeyPatch('BD:TrackingProtection', WebpackModules.getModuleByProps(['track'])).instead('track', this.track);
}
disabled(e) {
for (const patch of Patcher.getPatchesByCaller('BD:TrackingProtection')) patch.unpatch();
}
}

View File

@ -1,3 +1,4 @@
export { default as EmoteModule } from './EmoteModule';
export { default as ReactDevtoolsModule } from './ReactDevtoolsModule';
export { default as VueDevtoolsModule } from './VueDevToolsModule';
export { default as TrackingProtection } from './TrackingProtection';

View File

@ -149,6 +149,13 @@
{
"id": "default",
"settings": [
{
"id": "tracking-protection",
"type": "bool",
"text": "Tracking Protection",
"hint": "Completely disabled any Discord tracking",
"value": false
},
{
"id": "e2ee",
"type": "bool",

View File

@ -12,7 +12,7 @@ import { DOM, BdUI, BdMenu, Modals, Reflection, Toasts } from 'ui';
import BdCss from './styles/index.scss';
import { Events, CssEditor, Globals, Settings, Database, Updater, ModuleManager, PluginManager, ThemeManager, ExtModuleManager, Vendor, WebpackModules, Patcher, MonkeyPatch, ReactComponents, ReactHelpers, ReactAutoPatcher, DiscordApi, BdWebApi, Connectivity } from 'modules';
import { ClientLogger as Logger, ClientIPC, Utils } from 'common';
import { EmoteModule, ReactDevtoolsModule, VueDevtoolsModule } from 'builtin';
import { EmoteModule, ReactDevtoolsModule, VueDevtoolsModule, TrackingProtection } from 'builtin';
import electron from 'electron';
import path from 'path';
@ -75,6 +75,7 @@ class BetterDiscord {
try {
ReactDevtoolsModule.init();
VueDevtoolsModule.init();
TrackingProtection.init();
await Database.init();
await Settings.loadSettings();
await ModuleManager.initModules();