Commit Graph

79 Commits

Author SHA1 Message Date
Andrew Ferrazzutti 77d63837bc Update copyright 2022-03-28 15:00:36 -04:00
Andrew Ferrazzutti e4702d9d3e When kicked out of LINE, post last known LINE dialog message 2021-10-14 23:56:33 -04:00
Andrew Ferrazzutti 1932bca139 Log to puppeteer from content script 2021-10-14 23:55:38 -04:00
Andrew Ferrazzutti 2d9805afe5 Disable mouse jiggle heartbeat messages 2021-10-14 20:50:13 -04:00
Andrew Ferrazzutti e4de88fccc Allow disabling chat cycling 2021-10-14 20:49:46 -04:00
Andrew Ferrazzutti bba3f87635 Add missing await
When will I stop forgetting this?...
2021-07-30 02:43:28 -04:00
Andrew Ferrazzutti bc0ee93276 Fix broken login cancellation 2021-07-26 01:40:47 -04:00
Andrew Ferrazzutti d4ab8b90d2 Fix non-interpolated log message 2021-07-24 13:32:44 -04:00
Andrew Ferrazzutti 7ffa83252f Try to prevent duplicate cycle/jiggle timers 2021-07-23 02:32:48 -04:00
Andrew Ferrazzutti 3868c19b71 Tighten up puppet DM invites 2021-07-22 03:20:58 -04:00
Andrew Ferrazzutti f39781cdcc Sync non-recent groups by joining them 2021-07-21 21:28:12 -04:00
Andrew Ferrazzutti 57c448e0c3 Contact syncing and invites
* Add ability to sync all LINE contacts, which is relevant because the
  list of recent chats excludes users you haven't spoken to lately.
* Add bot command to list all contacts.
* Allow inviting a puppet to a DM to create a portal for that LINE user,
  instead of having to wait for that user to message you first.
2021-07-19 04:10:10 -04:00
Andrew Ferrazzutti 81553df1c4 Try to fix some errors caused by bad ordering 2021-07-14 03:17:07 -04:00
Andrew Ferrazzutti 570eedf904 Auto-derive the installed LINE extension's UUID 2021-07-08 02:25:30 -04:00
Andrew Ferrazzutti f4bd0ca1c9 Use longer timeout for outgoing messages 2021-07-07 01:25:56 -04:00
Andrew Ferrazzutti 69028c6edd Fix problems with outgoing messages
1. Don't set the "own message" promise to null on resolve, as other
   places may still be awaiting on it afterwards
2. Retry pressing "Enter" to send a message if it doesn't work on the
   first try, which can happen for some reason
2021-07-02 14:04:53 -04:00
Andrew Ferrazzutti e1b822bd52 Jiggle mouse with xdotool to keep LINE alive
Even if Chrome is the only window in an X session, and even if the
window is focused, the LINE extension stops getting new messages unless
the mouse has moved recently. To work around that, use xdotool to move
the mouse every so often.
2021-07-02 14:04:53 -04:00
Andrew Ferrazzutti 8c2c0126c9 Sync, store, and poll for incoming read receipts 2021-07-02 14:04:52 -04:00
Andrew Ferrazzutti 2fec597cba Tweak window size
Helps when running in Xvnc
2021-06-18 00:09:20 -04:00
Andrew Ferrazzutti 2c026939c3 Minor formatting fixes 2021-06-17 23:59:25 -04:00
Andrew Ferrazzutti f05a91e95d Better checks for chat messages to appear
- Re-click on a chat item if one click didn't work for some reason
- Wait long for a single message to appear, but stop early when found
- After single message found, wait less for more changes
2021-06-17 23:55:19 -04:00
Andrew Ferrazzutti 40a48d12a2 Don't view groups/rooms when possible, via MSC2409
Use the sidebar to sync non-DM messages, just like what's done for DM
messages.

However, since sidebar messages don't say who sent a message, this
requires scanning read receipts with MSC2409: when a non-DM sidebar
message is seen, the bridge bot sends that message. Only when that
placeholder is viewed in Matrix does Puppeteer actually view the non-DM
chat to find who really sent the message. Then the bridgebot redacts its
message, and the message gets re-sent by the puppet of the LINE user who
really sent it.
2021-06-17 23:32:45 -04:00
Andrew Ferrazzutti 1ae30bcf1b Use read receipts to know when to sync media
Instead of having to view a LINE chat when a media message is sent, send
a placeholder message that gets replaced with the actual media when it's
viewed in Matrix.
2021-06-17 00:42:06 -04:00
Andrew Ferrazzutti a3e7caac27 Merge branch 'master' into better-receipts-msc2409 2021-06-16 22:14:26 -04:00
Andrew Ferrazzutti ee5ccf9b2f Attempt to wait for chat messages to appear
When opening a chat (like during a sync or in response to a new message
notification), the message list loads lazily, so not waiting for all
items to load can cause messages to be missed.

However, there doesn't seem to be any indicator for when a message list
has been fully loaded...

As a best effort attempt, simply wait until no new updates to the
message list have been seen for a while.
2021-06-16 02:27:27 -04:00
Andrew Ferrazzutti 555b19c289 Always use LINE puppet for own messages
...that are sent from another client.

Also look up the profile data for the user's LINE account on sync,
including at startup, so that there's always a puppet available.
2021-06-15 02:55:55 -04:00
Andrew Ferrazzutti 0d154c826e Fix outbound message sending
The message text input field in LINE chats doesn't play nice with
Puppeteer's "type" function for live-typing text...

It's a div instead of a text input, and uses innerText instead of value.
Setting its innerText directly seems to work best, so just use that.
2021-06-14 01:54:24 -04:00
Andrew Ferrazzutti 33ca6223c5 Use MSC2409 to send outgoing read receipts
When a message is viewed in Matrix, make Puppeteer view its LINE chat
2021-06-11 02:53:30 -04:00
Andrew Ferrazzutti 85dc7a842e Don't view LINE DMs whenever possible
Use the sidebar to sync DM messages instead of visiting the DM itself,
so as to not make LINE (and your contact) think you really read the DM.

This cannot be done for non-text messages (which are not previwable in
the sidebar) and non-DM chats (whose sidebar messages don't say who sent
a message).
2021-06-10 02:54:12 -04:00
Andrew Ferrazzutti 0d849cf2bb JSON stringify objects before logging them
Because Eclipse/Wild Web Developer messes them up
2021-06-10 02:52:25 -04:00
Andrew Ferrazzutti e37a7c41bf Minor formatting changes 2021-06-10 02:52:13 -04:00
Andrew Ferrazzutti c5eea7b50b Fix crash when logging in after a forced logout
Also tidy up bridge notices during the login flow
2021-06-08 00:24:00 -04:00
Andrew Ferrazzutti 14de373787 Startup fixes 2021-06-06 18:24:42 -04:00
Andrew Ferrazzutti 54507f8aaf Catch getting logged out
Happens when logging into Line on Chrome somewhere else
2021-06-06 18:24:34 -04:00
Andrew Ferrazzutti 34ea2021ec Attempt to respect bridge.initial_conversation_sync
But probably doing it wrong
2021-06-06 18:21:32 -04:00
Andrew Ferrazzutti 6d646e082b Inbound sync & sticker improvements
- Handle "decrypting" state of messages
- Handle lazy loading of emoji
- Better handle lazy loading of images/stickers
- Improve reliability of message sending, especially when sending
  several messages quickly
- Use m.sticker events for inbound stickers instead of m.image, and add
  a config to optionally use m.image if desired
- Use proper sizing for emoji, and add config to scale them since they
  are somewhat small
- Deduplicate stickers as best as possible (works until they get a
  different blob URL)
- Add config to disable bridging stickers/emoji
- Send m.notice for inbound messages of unknown type
2021-06-06 18:15:38 -04:00
Andrew Ferrazzutti 6583815301 Dismiss error dialog for getting disconnected
If the connection to LINE is lost, when it comes back, and error dialog
appears. Detect that dialog and click it automatically.

The same detection works for any error dialog.
2021-06-05 23:51:12 -04:00
Andrew Ferrazzutti 4305d8f994 Fix tracking "Read by" counts in group chats 2021-04-30 02:56:15 -04:00
Andrew Ferrazzutti e13f59a8f3 Rework message syncing and sending 2021-04-27 02:59:16 -04:00
Andrew Ferrazzutti 7f937d34e2 WIP read receipt improvements 2021-04-23 03:38:13 -04:00
Andrew Ferrazzutti c8d1d38d21 Incoming read receipts for MRU chats
TODO: poll other chats for read receipts
2021-04-22 02:40:50 -04:00
Andrew Ferrazzutti d30402a98f More robust message syncing and room cleaning 2021-04-22 02:39:52 -04:00
Andrew Ferrazzutti 935bc6bdb8 Maybe fix message sorting 2021-04-06 01:57:15 -04:00
Andrew Ferrazzutti 5aa3cf8b81 Add missing paren 2021-04-05 03:56:01 -04:00
Andrew Ferrazzutti fa6d3b5279 Just-in-case sort of synced messages 2021-04-03 03:11:05 -04:00
Andrew Ferrazzutti 9d6c7efa70 Confirm this works with extension version 2.4.3
Just update SETUP.md to mention the version, and remove the TODO for
adding phone number login, which LINE Chrome will disable soon.
2021-03-31 01:55:11 -04:00
Andrew Ferrazzutti afcc206a93 Wait for outbound images to be sent
Also prevent possible race condition in waiting for inbound images, and
generally tighten up file sending/receiving.
2021-03-29 01:25:05 -04:00
Andrew Ferrazzutti 00e7226efe Outbound images, no echo 2021-03-28 03:16:07 -04:00
Andrew Ferrazzutti 36ba98fda1 Outbound images (bad echo) 2021-03-27 03:37:41 -04:00
Andrew Ferrazzutti 04c09cea1f Actually print message on incorrect email/password 2021-03-26 02:48:11 -04:00