theahura / shoot-the-messenger

Script to auto-unsend all messages from a facebook messenger chat
Other
189 stars 28 forks source link

problem with deleting long discussion #99

Closed ghost closed 1 year ago

ghost commented 1 year ago

.

8SecSleeper commented 1 year ago

I plan on coming out of retirement to create another patch. Maybe this next few days. I have that issue fixed in my test version.

On Fri, Sep 8, 2023, 9:17 AM zerzededd @.***> wrote:

I have to restart deleting messages several times because after a while I get an error message. I've already tried changing the rate limit with different values and it doesn't solve the problem.

Maybe I can have the extension retry automatically when it encounters this error.

[image: image] https://user-images.githubusercontent.com/144461731/266638214-0f81b2ca-0a94-46ef-ad80-507d0b1eeea4.png

— Reply to this email directly, view it on GitHub https://github.com/theahura/shoot-the-messenger/issues/99, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2F3U7FQSE5R5WUTZRJ3ELXZMSGHANCNFSM6AAAAAA4QOTGIU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

theahura commented 1 year ago

@zerzededd can you post console logs? Not too easy to know what went wrong without more information

theahura commented 1 year ago

@8SecSleeper I can't replicate this by the way, but it seems to have popped up in a few of these bug reports. Do you know what this is?

theahura commented 1 year ago

Ok so I spent a solid chunk of today looking into this.

It looks like facebook has modified how the search behavior works again. Previously we would call element.form.dispatchEvent in order to trigger search; now there is no parent form, so this returns an undefined error.

I'm again pulling my hair trying to figure out how to simulate an enter click on the search bar :thinking:

8SecSleeper commented 1 year ago

KeyboardEvent with DispatchEvent

theahura commented 1 year ago

Doesn't work, or at least I haven't been able to get it to work. Tried the following in the dev console

x = document.querySelectorAll('[placeholder="Search"]')[0]
z = new KeyboardEvent('keydown', {
    key: "Enter",
    code: "Enter",
    bubbles: true,
    cancelable: true,
    composed: true,
    defaultPrevented: true,
    keyCode: 13,
    returnValue: false,
    view: window,
    target: x,
    srcElement: x
})
x.dispatchEvent(z)

nothing happens on the actual page

theahura commented 1 year ago

Ok I think I got it. Man I had to go deep into the guts of react for this one.

TLDR:

x.__reactFiber$frbte323rro.memoizedProps.children.props.children[0].props.children[0].props.commandConfigs[0].handler()

triggers the search event :grin:

I think from here I can reverse engineer the rest

theahura commented 1 year ago

Alright, latest push should work. Closing this out