Setup Uli on Windows for Firefox - tattle-made/Uli GitHub Wiki
Overview
The source code for Uli's browser extension is contained within the browser-extension directory. You can read our learning guide to know more about the various components that make up the browser extension.
The code is primarily broken into two folders, plugin and api-server.
| Directory | Description |
|---|---|
| plugin | code for browser extension - essentially the frontend |
| api-server | a rest server for storing user preferences and archived tweets - essentially the backend |
Prerequisites :
- npm : v9.6.7^
- nodejs : v18.17.1^
- Docker: 20.10.7
Cloning the Repository and Installation
Clone the repository and navigate to the browser-extension folder.
git clone https://github.com/tattle-made/Uli.git
cd Uli/browser-extension/
Next, install all the necessary packages in the api-server and plugin folders.
cd api-server && npm install
cd ..
cd plugin && npm install
cd ..
We've completed step 1 – Uli is cloned, and all the required browser extension libraries are now installed.
Step 2 - Basic Setup
- Add Credentials for API server - Navigate to the
api-serverfolder and create a new file calleddevelopment.envwith the following content. Add this content inside thedevelopment.envfile.
NODE_ENV=development
AWS_BUCKET_NAME=XXXXXXXXXXX
SERVICE_AWS_ACCESS_KEY_ID=XXXXXXXXXX
SERVICE_AWS_SECRET_ACCESS_KEY=XXXXXXX
DB_HOST=db
DB_USERNAME=tattle
DB_PASSWORD=tattle_pw
DB_FIELD_ENCRYPTION_KEY=very-secure-key
- Change the control characters of
entrypoint.shfile.
dos2unix entrypoint.sh
- Next, navigate to the
pluginfolder and include the following code in themanifest.firefox.jsonfile. Add this entry to theconnect-srcsection within thecontent_security_policyin themanifest.firefox.jsonfile.
http://localhost:3000 ws://localhost
Your content_security_policy in the manifest.firefox.json should now look like this.
"content_security_policy": {
"extension_pages": "default-src 'none'; connect-src http://localhost:3000 ws://localhost https://ogbv-plugin.tattle.co.in/ https://uli-media.tattle.co.in/; font-src https://fonts.gstatic.com; object-src 'none'; script-src 'self'; style-src https://fonts.googleapis.com 'self' 'unsafe-inline'; img-src https://uli-media.tattle.co.in/; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; report-uri 'none';"
},
Step 3 - Starting the Development Server
- Now to begin the backend development server for coding, run the following command in the terminal within the
browser-extensionfolder.
docker-compose up
You should now see database migration in the logs.
- Next, we have to start the backend server.
docker exec -it api-server nodemon index.js
You can also manually access the api-server container within Docker Desktop. Inside the container's terminal, run the command nodemon index.js after navigating to the api-server in Docker Desktop.
- Now, to run the plugin development server, navigate to the
browser-extension/pluginfolder. You'll need to modify theplugin/package.jsonfile as described below.
- replace the command
cpwithcopy - replace the front slashes in all the file paths with double back slashes
- Now run the following command to begin local plugin development.
npm run dev:firefox
This command will create a -p and a dist folder
The dist directory should now have the following structure.
dist/
background.js
content-script.js
content-script.js.map
icon16.png
icon32.png
manifest.json
options.html
options.js
options.js.map
Load Uli on Firefox
Once you run the npm run dev:firefox, a dist folder will be created. This folder contains the unreleased extension. Load it in your browser to see the extension in action and develop it further.
To load Uli
- Go to
Setupby executingabout:debuggingin the address bar (where you enter url's and do your web searches) - Next, Click on
This Firefoxin the left-hand sidebar. - You will now see a
Temporary Extensionsdropdown. Within it, click on theLoad Temporary Add-on..button and load any single file from the dist folder. This will load the extension into the browser. - To see the extension in action, you will have to open a new tab.
Uli is all setup on Firefox.
Try the steps mentioned in this video to try Uli out