Skip to content

Web browser extension for instant Lightning donations on social platforms, even if recepient has no lightning wallet.

License

Notifications You must be signed in to change notification settings

Donate4Fun/donate4fun

Repository files navigation

Telegram Chat Twitter Follow Website codecov

Chrome Web Store Firefox Add-on

Latest Chrome Extension Latest Firefox Add-on

Visitors

Donate4.Fun

This is repository for Donate4.Fun webservice and browser extension. Directory structure:

  • /donate4fun/ - backend (API)
  • /tests/ - tests for backend
  • /frontend/ - website and shared libraries
  • /extensions/ - browser extensions
  • /charts/ - Helm charts for webservice and dependencies (LND, PostgreSQL, Tor)
  • /docker/ - Docker-compose config and Dockerfiles for local development

Development

Website

For developing you need a Docker and docker-compose (see /docker dir). It's recommended to use some virtual env manager, for example direnv.

  • Create config.yaml
  • launch Docker containers (cd docker; docker-compose up -d)
  • launch api python -m donate4fun
  • launch frontend (cd frontend; pnpm run dev)

Tests

Run tests with pytest from repository root.

Trubleshooting

If tests are failing with error FAILURE_REASON_INSUFFICIENT_BALANCE try restarting lnd-bob: docker-compose restart lnd-bob Sometimes channel could not start after starting all services.

If you are getting an error 'database "donate4fun-test" already exists' then connect to local postgresql and drop this database psql -U postgres -c 'drop database "donate4fun-test"'

Browser extension

You need to install both frontend and extension dependencies to build.

(cd frontend && pnpm i)
cd extensions/src
pnpm i
pnpm run dev

Then open browser and install unpacked extension from extensions/chrome or extensions/firefox.

To build release versions run npm run package-clean.

Deploy

For deploying publicly you need a Kubernetes cluster and Helm (see /charts dir).

Build and deploy dependencies

./deploy.sh tor
./deploy.sh lnd
./deploy.sh rtl

Build and deploy the service

./deploy-donate4fun.sh

Extension build and publish

Build

To build release version of extension

cd extensions/src
pnpm install
pnpm build

Chrome Web Store

To make a new release and publish extension to Chrome Web Store NB: always build with pnpm build before publishing

cd extensions/src
npx semantic-release --no-ci

The following environment variables are needed

  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_REFRESH_TOKEN Read this guide on how to obtain them.

Firefox Add On

To publish add-on to addons.mozilla.org

(cd extensions/src && pnpm package-clean)
./scripts/publish-amo.py

The following environment variables are needed

  • AMO_JWT_ISSUER
  • AMO_JWT_SECRET Read this doc on how to obtain them.