Initial changes
This commit is contained in:
parent
684e5bcf38
commit
26e8177f1c
|
@ -4,6 +4,5 @@
|
||||||
"path": "/var/run/mautrix-amp/puppet.sock"
|
"path": "/var/run/mautrix-amp/puppet.sock"
|
||||||
},
|
},
|
||||||
"profile_dir": "./profiles",
|
"profile_dir": "./profiles",
|
||||||
"disable_debug": true,
|
"url": "chrome-extension://<extension-uuid>/index.html"
|
||||||
"url": "https://messages.google.com/web/"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// mautrix-amp - A very hacky Matrix-SMS bridge based on using Android Messages for Web in Puppeteer
|
// mautrix-amp - A very hacky Matrix-LINE bridge based on using LINE's Chrome Store Extension in Puppeteer
|
||||||
// Copyright (C) 2020 Tulir Asokan
|
// Copyright (C) 2020 Tulir Asokan, Andrew Ferrazzutti
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU Affero General Public License as published by
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -37,7 +37,7 @@ console.log("[Main] Reading config from", configPath)
|
||||||
const config = JSON.parse(fs.readFileSync(configPath).toString())
|
const config = JSON.parse(fs.readFileSync(configPath).toString())
|
||||||
MessagesPuppeteer.profileDir = config.profile_dir || MessagesPuppeteer.profileDir
|
MessagesPuppeteer.profileDir = config.profile_dir || MessagesPuppeteer.profileDir
|
||||||
MessagesPuppeteer.disableDebug = !!config.disable_debug
|
MessagesPuppeteer.disableDebug = !!config.disable_debug
|
||||||
MessagesPuppeteer.url = config.url || MessagesPuppeteer.url
|
MessagesPuppeteer.url = config.url
|
||||||
|
|
||||||
const api = new PuppetAPI(config.listen)
|
const api = new PuppetAPI(config.listen)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default class MessagesPuppeteer {
|
||||||
static disableDebug = false
|
static disableDebug = false
|
||||||
static noSandbox = false
|
static noSandbox = false
|
||||||
static viewport = { width: 1920, height: 1080 }
|
static viewport = { width: 1920, height: 1080 }
|
||||||
static url = "https://messages.google.com/web/"
|
static url = undefined
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -63,11 +63,18 @@ export default class MessagesPuppeteer {
|
||||||
*/
|
*/
|
||||||
async start(debug = false) {
|
async start(debug = false) {
|
||||||
this.log("Launching browser")
|
this.log("Launching browser")
|
||||||
|
|
||||||
|
const pathToExtension = require('path').join(__dirname, 'extension_files');
|
||||||
|
const extensionArgs = [
|
||||||
|
`--disable-extensions-except=${pathToExtension}`,
|
||||||
|
`--load-extension=${pathToExtension}`
|
||||||
|
];
|
||||||
|
|
||||||
this.browser = await puppeteer.launch({
|
this.browser = await puppeteer.launch({
|
||||||
executablePath: MessagesPuppeteer.executablePath,
|
executablePath: MessagesPuppeteer.executablePath,
|
||||||
userDataDir: this.profilePath,
|
userDataDir: this.profilePath,
|
||||||
args: MessagesPuppeteer.noSandbox ? ["--no-sandbox"] : undefined,
|
args: MessagesPuppeteer.noSandbox ? extensionArgs.concat("--no-sandbox") : extensionArgs,
|
||||||
headless: MessagesPuppeteer.disableDebug || !debug,
|
headless: false, // Needed to load extensions
|
||||||
defaultViewport: MessagesPuppeteer.viewport,
|
defaultViewport: MessagesPuppeteer.viewport,
|
||||||
})
|
})
|
||||||
this.log("Opening new tab")
|
this.log("Opening new tab")
|
||||||
|
|
Loading…
Reference in New Issue