GithubHelp home page GithubHelp logo

nawazzeeshan / webext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from comntr/webext

0.0 1.0 0.0 32 KB

An extension for Firefox and Chrome to add comments to any URL

JavaScript 92.31% CSS 2.49% HTML 5.20%

webext's Introduction

What is this?

It's a web extension for Firefox or Chrome that allows to add comments to any URL.

More precisely, it attaches comments to SHA1 of the URL, to avoid leaking PII:

   +----------------------+
   | The current tab URL: |
   | http://example.com/  |
   +----------------------+
              |
              | 1. URL
              |
              v                            +------------------------------+
  +--------------------+                   | <iframe> with URL:           |
  | This web extension | ----------------->| https://comntr.io/#<tab-url> |
  +--------------------+                   +------------------------------+
              |                                            |
              | -> 2. GET /<sha1>/size                     |
              | <- 12 comments                             | -> 3. GET /<sha1>
              |                                            | <- JSON with comments
              v                                            | -> 4. POST /<sha1>
   +-----------------+                                     |    Hello World!
   | Database Server | <-----------------------------------+
   +-----------------+
  1. The user opens a URL and the extension gets this URL via the web extension API.
  2. The extension computes SHA1 of the URL and sends a GET /<sha1> request to the database to get the number of comments. Then this number is displayed in the extension icon's badge (just like uBlock Origin shows the number of blocked elements).
  3. The user clicks on the extension icon to see the comments. The extension sends a GET /<sha1> request and the database returns all the comments attached to that SHA1.
  4. The user adds a comment and the extension sends a POST /<sha1> with the comment text.

The database server doesn't see the original URLs and uses their SHA1 instead:

/var/lib/comntr
  /9c1...d14        # SHA1 of "http://example.com/"
    /261...776      # SHA1 of the comment file
      Hello World!
    /829...172
      Howdy

The advantage of the <iframe> approach is that the comments can be viewed in a separate tab:

The extension merely renders this page in the popup.

Involved components:

Installation

For Firefox dekstop and Firefox Android use https://addons.mozilla.org/en-US/firefox/addon/comntr/. It probably works in Firefox iOS too, but I haven't checked.

The extension works in Chrome too, but it's not published to the Chrome Web Store. Why? Publishing any extension there now requires (1) a phone number, to create a gmail account and (2) a credit card, supposedly to deter spammers. However the extension can be installed manually. First, copy the files to some folder:

mkdir -p ~/webext/comntr
cd ~/webext/comntr
git clone https://github.com/comntr/webext .

Navigate to chrome://extensions in Chrome and find the "Developer mode" toggle in the top right corner. Use "Load unpacked" to select the ~/webext/comntr folder. The extension should appear on the page and its icon should appear in the top right nav bar. It may be saying that there were some errors, but those are because Chrome didn't like the Firefox-specific field in manifest.json:

  "browser_specific_settings": {
    "gecko": {
      "id": "[email protected]"
    }
  }

This error can be ignored.

Credits

The ed25519 wasm library was taken from nazar-pc/supercom.wasm.

The web extension icon was made by Chanut from www.flaticon.com.

webext's People

Contributors

comntr avatar

Watchers

James Cloos 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.