An open API service indexing awesome lists of open source software.

https://github.com/dhilman/gitowl-extension

GitOwl Browser Extension. Open Source Insights At a Glance.
https://github.com/dhilman/gitowl-extension

browser-extension chrome-extension github insights oss

Last synced: 6 months ago
JSON representation

GitOwl Browser Extension. Open Source Insights At a Glance.

Awesome Lists containing this project

README

          


GitOwl Browser Extension


gitowl.dev

chrome

firefox

![Screenshot](./screenshots/main.png)

GitOwl browser extension adds a sidebar to GitHub, NPM & PyPI with contextual insights.

The extension code itself is kept to a minimum, to maintain privacy and ease of review.
The insights are provided by the `gitowl.dev` iframe, which is embedded in the sidebar and doesn't have access to the content of the page.

The extension is only responsible for:
- Controlling the sidebar state
- Identifying the entity being viewed
- Instantiating the iframe
- Passing the entity name to the iframe
- Storing authentication token

## Architecture

Extension consists of the [content script](./src/content/index.tsx), the [frame](./src/frame/index.html) page and the [worker](./src/worker/index.ts).

### Content Script

- runs in the context of the page
- creates & controls the sidebar
- identifies the entity being viewed
- instantiates frame.html as an iframe
- posts messages to iframe if the entity changes

### Frame Page

The frame page contains the `gitowl.dev` iframe, it is needed to prevent issues with embedding iframe with a different origin.

- Relays messages from the content script to `gitowl.dev` (URL changes)
- Attaches authentication token to the `gitowl.dev` URL

### Worker (chromium only)

Listens for messages from `gitowl.dev` and stores the authentication token.

## Development

1. Install dependencies
```shell
$ npm install
```

2. Run the dev script
```shell
$ npm run dev
```

The extension preview will be available at `http://localhost:5173`. Alternatively, it can also be loaded as an unpacked extension (see below).

### Loading the extension (Chrome)

```shell
# Builds the extension and watches for changes
$ npm run build:watch
```

- Open the Extension Management page by navigating to `chrome://extensions`.
- Enable Developer Mode by clicking the toggle switch next to Developer mode.
- Click the `LOAD UNPACKED` button and select the `dist` directory.
- Note: there is no automatic reloading, so you will need to manually reload the extension to see changes.

## Build & Pack

The build script simply bundles the extension and zips the contents of the `dist` directory.

```shell
$ ./scripts/create-release.sh
```