diff --git a/chat/preview/CharacterPreview.vue b/chat/preview/CharacterPreview.vue index 02b5fc3..a310852 100644 --- a/chat/preview/CharacterPreview.vue +++ b/chat/preview/CharacterPreview.vue @@ -133,7 +133,7 @@ export default class CharacterPreview extends Vue { } this.statusMessage = this.onlineCharacter.statusText; - this.statusClasses = getStatusClasses(this.onlineCharacter, undefined, true, true, false); + this.statusClasses = getStatusClasses(this.onlineCharacter, undefined, true, false, false); } diff --git a/electron/main.ts b/electron/main.ts index 0abb0d4..27f3714 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -236,11 +236,13 @@ function createWindow(): Electron.BrowserWindow | undefined { blocker.enableBlockingInSession(electron.session.defaultSession); - // Temp fix -- manually override adblocker's preload script 1) to point to CJS; 2) to use absolute path - const originPath = require.resolve('@cliqz/adblocker-electron-preload'); - const preloadScript = path.resolve(path.dirname(originPath), 'preload.cjs.js'); + // Temp fix -- manually override adblocker's preload script + // to point to CJS that has been copied over with config in webpack.config.js + const preloadScript = './preview/assets/adblocker/preload.cjs.js'; // require.resolve('@cliqz/adblocker-electron-preload'); - log.debug('adblock.preload.path', { finalPath: preloadScript, originPath }); + // const originPath = require.resolve('@cliqz/adblocker-electron-preload'); + // const preloadScript = path.resolve(path.dirname(originPath), 'preload.cjs.js'); + log.debug('adblock.preload.path', { finalPath: preloadScript /*, originPath */ }); electron.session.defaultSession.setPreloads( _.concat( @@ -252,28 +254,28 @@ function createWindow(): Electron.BrowserWindow | undefined { ) ); - log.debug('adblock.preloaders', { loaders: electron.session.defaultSession.getPreloads() }) + log.debug('adblock.preloaders', { loaders: electron.session.defaultSession.getPreloads() }); blocker.on('request-blocked', (request: Request) => { log.debug('adblock.request.blocked', { url: request.url }); }); - + blocker.on('request-redirected', (request: Request) => { log.debug('adblock.request.redirected', { url: request.url }); }); - + blocker.on('request-whitelisted', (request: Request) => { log.debug('adblock.request.whitelisted', { url: request.url }); }); - + blocker.on('csp-injected', (request: Request) => { log.debug('adblock.inject.csp', { url: request.url }); }); - + blocker.on('script-injected', (script: string, url: string) => { log.debug('adblock.inject.script', { length: script.length, url }); }); - + blocker.on('style-injected', (style: string, url: string) => { log.debug('adblock.inject.style', { length: style.length, url }); }); diff --git a/electron/webpack.config.js b/electron/webpack.config.js index dcacc19..b575036 100644 --- a/electron/webpack.config.js +++ b/electron/webpack.config.js @@ -121,6 +121,11 @@ const mainConfig = { from: path.resolve(__dirname, '..', 'chat', 'preview', 'assets', '**', '*').replace(/\\/g, '/'), to: path.join('preview', 'assets'), context: path.resolve(__dirname, '..', 'chat', 'preview', 'assets') + }, + { + from: path.resolve(__dirname, '..', 'node_modules', '@cliqz', 'adblocker-electron-preload', 'dist', 'preload.cjs.js').replace(/\\/g, '/'), + to: path.join('preview', 'assets', 'adblocker'), + context: path.resolve(__dirname, '..', 'node_modules', '@cliqz', 'adblocker-electron-preload', 'dist') } ] }