Skip to content

Commit

Permalink
lmptm.ignoreDisableSync, --disable-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
lanly-dev committed Feb 9, 2020
1 parent 7e917d3 commit fbd192f
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

All notable changes to the "LetMePlayTheMusic" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
Check [Keep a Changelog](http://keepachangelog.com) for recommendations on how to structure this file.

## [1.3.0] - February 2020
### Added
- Add [ignoreDisableSync](https://github.com/puppeteer/puppeteer/blob/0b1777e73cb1e83ece9e09b7b51d11b798def06f/lib/Launcher.js#L277) setting [#3](https://github.com/lanly-dev/VSCode-LMPTM/issues/3#issuecomment-572180371), [#5](https://github.com/lanly-dev/VSCode-LMPTM/issues/5)
- Use [Adblocker](https://github.com/cliqz-oss/adblocker/tree/master/packages/adblocker-puppeteer) - New version breaks webpack build
- Ignore [disable extension flag from puppeteer](https://github.com/puppeteer/puppeteer/blob/0b1777e73cb1e83ece9e09b7b51d11b798def06f/lib/Launcher.js#L270)
- 11 files, 141.77KB, 1.42.0

## [1.2.0] - December 2019
### Added
Expand All @@ -14,7 +21,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
## [1.1.0] - October 2019
### Added
- Use [Adblocker](https://github.com/cliqz-oss/adblocker/tree/master/packages/adblocker-puppeteer)
- Improve extension package size with [Webpack](https://webpack.js.org/) from 4.98MB (v1.0.0) to 226.1KB (v1.1.0)
- Improve extension package size with [Webpack](https://webpack.js.org) from 4.98MB (v1.0.0) to 226.1KB (v1.1.0)
- 11 files, 226.28KB, 1.39.0

## [1.0.0] - August 2019
Expand Down
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,25 @@ Required Chromium-based browser

## Extension Settings

* `lmptm.browserPath`: Specifies custom browser executable file path.
* `lmptm.incognitoMode`: Specifies whether to launch browser in incognito/private mode.
* `lmptm.userData`: Specifies if the extension could store browser's user data, if enabled, user data directory setting is required.
* `lmptm.userDataDirectory`: Specifies [user data directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md), this will be ignored if **User Data** setting disabled.
* `lmptm.browserPath`: Specify custom browser executable file path.
* `lmptm.ignoreDisableSync`: Ignore --disable-sync, this option is specifically for [Brave](https://brave.com) browser.
* `lmptm.incognitoMode`: Specify whether to launch browser in incognito/private mode.
* `lmptm.userData`: Specify if the extension could store browser's user data, if enabled, user data directory setting is required.
* `lmptm.userDataDirectory`: Specify [user data directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md), this will be ignored if **User Data** setting disabled.

## Known Issues

Errors may pop up (mostly happen in console) or functioning incorrectly if navigating too fast
- Errors may pop up (mostly happen in console) or functioning incorrectly if navigating too fast
- Does not work with Opera browser

## Release Notes

### 1.3.0
- Remove adblocker
- Enable adding extensions for browser
- Add ignoreDisableSync setting option in order to able to launch [Brave](https://brave.com) browser
- Switch tslint to eslint

### 1.2.0
- Able to launch other Chromium-based browsers
- Able to launch browser in Incognito/Private mode
Expand Down
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"displayName": "Let Me Play The Music",
"description": "Control playback from the popular music sites",
"homepage": "https://github.com/lanly-dev/VSCode-LMPTM",
"version": "1.2.0",
"version": "1.3.0",
"publisher": "lanly-dev",
"engines": {
"vscode": "^1.41.0"
"vscode": "^1.42.0"
},
"extensionKind": [
"ui"
Expand Down Expand Up @@ -39,21 +39,26 @@
"lmptm.browserPath": {
"type": "string",
"default": null,
"markdownDescription": "Specifies custom browser executable file path."
"markdownDescription": "Specify custom browser executable file path."
},
"lmptm.ignoreDisableSync": {
"type": "boolean",
"default": false,
"markdownDescription": "Ignore `-disable-sync`, this option is specifically for [Brave](https://brave.com) browser."
},
"lmptm.incognitoMode": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to launch browser in incognito/private mode."
"markdownDescription": "Specify whether to launch browser in incognito/private mode."
},
"lmptm.userData": {
"type": "boolean",
"default": false,
"markdownDescription": "Specifies if the extension could store browser's user data, if enabled, user data directory setting is required"
"markdownDescription": "Specify if the extension could store browser's user data, if enabled, user data directory setting is required"
},
"lmptm.userDataDirectory": {
"type": "string",
"markdownDescription": "Specifies [user data directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md), this will be ignored if **User Data** setting disabled."
"markdownDescription": "Specify [user data directory](https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md), this will be ignored if **User Data** setting disabled."
}
}
}
Expand Down Expand Up @@ -88,9 +93,7 @@
"webpack-cli": "^3.3.10"
},
"dependencies": {
"@cliqz/adblocker-puppeteer": "^1.5.0",
"karma-chrome-launcher": "^3.1.0",
"node-fetch": "^2.6.0",
"puppeteer-core": "^2.1.1",
"terser": "^4.6.3"
},
Expand Down
7 changes: 3 additions & 4 deletions src/browser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { PuppeteerBlocker } from '@cliqz/adblocker-puppeteer'
import fetch from 'node-fetch'
import * as fs from 'fs'
import * as path from 'path'
import * as puppeteer from 'puppeteer-core'
Expand Down Expand Up @@ -31,11 +29,13 @@ export class Browser {
public static launch(buttons: Buttons, context: vscode.ExtensionContext) {
if (!Browser.activeBrowser && !Browser.launched) {
const args = ['--window-size=500,500']
const iArgs = ['--disable-extensions'] // enable extension
if (vscode.workspace.getConfiguration().get('lmptm.userData')) {
const uddir = vscode.workspace.getConfiguration().get('lmptm.userDataDirectory')
if (uddir) args.push(`--user-data-dir=${vscode.workspace.getConfiguration().get('lmptm.userDataDirectory')}`)
else return vscode.window.showInformationMessage('Please specify the user data directory or disable user data setting!')
}
if (vscode.workspace.getConfiguration().get('lmptm.ignoreDisableSync')) iArgs.push('--disable-sync')

let cPath = vscode.workspace.getConfiguration().get('lmptm.browserPath')
if (!cPath) cPath = WhichChrome.getPaths().Chrome || WhichChrome.getPaths().Chromium
Expand All @@ -48,7 +48,7 @@ export class Browser {
headless: false,
defaultViewport: null,
args: args,
ignoreDefaultArgs: ['--mute-audio', '--hide-scrollbars']
ignoreDefaultArgs: iArgs
}).then(async (browser: puppeteer.Browser) => {
buttons.setStatusButtonText('Running $(browser)')
Browser.cssPath = path.join(context.extensionPath, 'dist', 'scripts', 'style.css')
Expand Down Expand Up @@ -366,7 +366,6 @@ export class Browser {
await this.setupPageWatcher(page)

page.on('load', async () => {
PuppeteerBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker: PuppeteerBlocker) => blocker.enableBlockingInPage(page))
if (this.musicBrandCheck(page.url()) === 'spotify') await this.checkSpotifyCSP(page)
this.injectHtml(page)
this.addScripts(page)
Expand Down

0 comments on commit fbd192f

Please sign in to comment.