Code Monkey home page Code Monkey logo

cookie-plugin's Introduction

This is the code source for Misakey Cookie Webextension.

Launch

This project uses react-scripts-webextension

Dev mode:
  • TARGET_BROWSER=firefox yarn start.
  • Available value for TARGET_BROWSER: ['chrome', 'firefox']
  • Default value: 'firefox'
  • output folder in build/dev
Production mode:
  • TARGET_BROWSER=firefox make build
  • Available value for TARGET_BROWSER: ['chrome', 'firefox']
  • Default value: 'firefox'
  • output folder in build/prod
Production zips:
Build zips
  • make build-zip
  • use VERSION=<myversion> make build-zip to get zip output with version in the name
  • output directly in build
Source code zip
  • make zip-plugin-source-code --> generate a zip of the source_code for reviewers
  • output folder in build/source_code.zip

Tests on browser

Chrome
  • Go to Menu -> More tools -> Extensions
  • Enable Developer mode
  • Upload the generated folder (chrome or firefox) with Load unpackaged extension
  • The extension should be loaded
Firefox
  • Go to about:debugging in the url
  • Upload the generated folder (chrome or firefox) with Load temporary module
  • The extension should be loaded
  • Enable debugging of extensions

Addon:

Background script (/src/addon/background)

The main purpose of this script is to block unwanted requests before they are launched in the client browser. It is based on the @cliqz/adblocker library.

Add new blocking rules

See engine README.md in ./engine

Test new rules

To test the new rules inside the plugin before pushing on the repo:

  • Serve the files with serverMockup.js:
    • yarn start-server-mockup
  • Replace RESOURCE_URL in src/addon/background/config.js by 'http://localhost:3005'
  • Test the plugin on your browser as explained in Test on browser

To see how to add or remove rules in engine.bytes and mainPurpose.json file, see README.md in folder engine.

Content script (/src/addon/content)

The main purpose of this script is to hide cookies banners and other annoying content on the current page of the browser. It is also based on the @cliqz/adblocker library.

Popup (/src/addon/popup)

This folder stands for what is displayed in the extension popup in the browser.

Manifest

The file manifest.json indicates to the browser where to find each resources to execute. It also handle permissions of the web extension and other configuration keys. It has to be at the root of the final folder (build).

We generate the manifest file from a template according to target browser (script in /manifest)

Lint and test

# Lint
yarn lint 

Git hook

A pre-commit hook is available to automatically run the linter before any commit (this way we can avoid "lint" commits)

To install it go to the devtools/git folder and run ./pre-commit-install.sh

License

The code is published under GPLv3. More info in the LICENSE file.

cookie-plugin's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.