-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert to headless puppeteer #5
base: main
Are you sure you want to change the base?
Conversation
@cameronaaron Should this PR work? I am trying to run it with a customized dockerfile chaoticbear#2, that should run puppeteer and puppeteer installed globally, but getting an error: |
I have it installed and running, thanks for this branch! However, I'm seeing the same issue as #4 -- I can receive messages just fine, and if I send messages from the web interface it shows up in my matrix chat windows, but anytime I try to send from matrix, I get error 429. Any thoughts? |
oh I forgot I started this i'm surprised it even works that much :/ I will look at this tomorrow and finish it up |
For what it's worth, I see that I've made two slight changes, presumably because it didn't work otherwise? I don't exactly remember what happened, or whether it's specific to this branch vs main, but this is the current state of my repo:
I've never used go, so I don't know if this is actually necessary to get the docker to build, or if this is just me somehow being silly. |
Summary:
This pull request replaces Electron with Puppeteer for headless browser automation in the Matrix-Google Voice bridge. The key motivation for this change is to reduce resource usage and simplify deployment, especially in containerized environments.
Key Changes:
Browser Initialization:
Replaced Electron-based initialization with Puppeteer.
Puppeteer now handles launching a headless browser to interact with Google Voice.
Script Injection:
Script loading previously done via webContents in Electron is now handled with page.addScriptTag() in Puppeteer.
Request Interception:
Network request interception logic has been moved to Puppeteer’s page.on('request', ...) to block unnecessary requests and allow only essential ones.
JavaScript Execution:
Replaced Electron’s webContents.executeJavaScript() with Puppeteer’s page.evaluate() to execute custom scripts within the browser context.
Inter-Process Communication (IPC):
Retained the same IPC mechanism (stdin and stdout) for communication between the Go application and the headless browser, ensuring backward compatibility.
File Renaming:
Benefits:
Reduced Overhead: Puppeteer is lighter than Electron, leading to lower resource usage.
Easier Containerization: Puppeteer integrates better with containers, eliminating the need for Electron’s GUI components.
More Streamlined Dependencies: Fewer dependencies are required compared to Electron.
Testing:
Successfully tested all major functionalities, including:
Browser initialization
Script injection
Request interception
JavaScript execution
IPC communication