E2EE patches
This commit is contained in:
parent
87ec7d8773
commit
2a10191926
|
@ -9,6 +9,10 @@
|
|||
*/
|
||||
|
||||
import BuiltinModule from './BuiltinModule';
|
||||
import { WebpackModules, ReactComponents, MonkeyPatch, Patcher } from 'modules';
|
||||
import { VueInjector, Reflection } from 'ui';
|
||||
import EmoteComponent from './EmoteComponent.vue';
|
||||
import aes256 from 'aes256';
|
||||
|
||||
export default new class E2EE extends BuiltinModule {
|
||||
|
||||
|
@ -16,12 +20,29 @@ export default new class E2EE extends BuiltinModule {
|
|||
return ['security', 'default', 'e2ee'];
|
||||
}
|
||||
|
||||
enabled(e) {
|
||||
async enabled(e) {
|
||||
const ctaComponent = await ReactComponents.getComponent('ChannelTextArea');
|
||||
MonkeyPatch('BD:E2EE', ctaComponent.component.prototype).after('render', this.render);
|
||||
MonkeyPatch('BD:E2EE', ctaComponent.component.prototype).before('handleSubmit', this.handleSubmit);
|
||||
}
|
||||
|
||||
render(component, args, retVal) {
|
||||
if (!(retVal.props.children instanceof Array)) retVal.props.children = [retVal.props.children];
|
||||
const inner = retVal.props.children.find(child => child.props.className && child.props.className.includes('inner'));
|
||||
|
||||
inner.props.children.splice(0, 0, VueInjector.createReactElement(EmoteComponent, {
|
||||
src: 'https://static-cdn.jtvnw.net/emoticons/v1/354/1.0',
|
||||
name: '4Head',
|
||||
hasWrapper: false
|
||||
}, true));
|
||||
}
|
||||
|
||||
handleSubmit(component, args, retVal) {
|
||||
component.props.value = aes256.encrypt('randomkey', component.props.value);
|
||||
}
|
||||
|
||||
disabled(e) {
|
||||
|
||||
for (const patch of Patcher.getPatchesByCaller('BD:E2EE')) patch.unpatch();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import { default as EmoteModule } from './EmoteModule';
|
|||
import { default as ReactDevtoolsModule } from './ReactDevtoolsModule';
|
||||
import { default as VueDevtoolsModule } from './VueDevToolsModule';
|
||||
import { default as TrackingProtection } from './TrackingProtection';
|
||||
import { default as E2EE } from './E2EE';
|
||||
|
||||
export default class {
|
||||
static initAll() {
|
||||
|
@ -9,5 +10,6 @@ export default class {
|
|||
ReactDevtoolsModule.init();
|
||||
VueDevtoolsModule.init();
|
||||
TrackingProtection.init();
|
||||
E2EE.init();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue