Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

cameronaaron
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant