SkillAgentSearch skills...

Bridgy

📣 Connects your web site to social media. Likes, retweets, mentions, cross-posting, and more...

Install / Use

/learn @snarfed/Bridgy
About this skill

Quality Score

0/100

Category

Marketing

Supported Platforms

Universal

README

<img src="https://raw.github.com/snarfed/bridgy/main/static/bridgy_logo_with_alpha.png" alt="Bridgy" width="128" /> Bridgy Circle CI Coverage Status

Bridgy connects your web site to social media. Likes, reposts, mentions, cross-posting, and more. See the user docs for more details, or the developer docs if you want to contribute.

https://brid.gy/

Bridgy is part of the IndieWeb ecosystem. In IndieWeb terminology, Bridgy offers backfeed, POSSE, and webmention support as a service.

License: This project is placed in the public domain. You may also use it under the CC0 License.

Development

Pull requests are welcome! Feel free to ping me in #indieweb-dev with any questions.

First, fork and clone this repo. Then, install the Google Cloud SDK and run gcloud components install cloud-firestore-emulator to install the Firestore emulator. Once you have them, set up your environment by running these commands in the repo root directory:

gcloud config set project brid-gy
python3 -m venv local
source local/bin/activate
pip install -r requirements.txt
# needed to serve static files locally
ln -s local/lib/python3*/site-packages/oauth_dropins/static oauth_dropins_static

Now, you can fire up the gcloud emulator and run the tests:

gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null &
python3 -m unittest discover -s tests -t .
kill %1

If you send a pull request, please include or update a test for your new code!

To run the app locally, use flask run:

gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null &
GAE_ENV=localdev FLASK_ENV=development flask run -p 8080

Open localhost:8080 and you should see the Bridgy home page!

To test a poll or propagate task, find the relevant Would add task line in the logs, eg:

INFO:root:Would add task: projects//locations/us-central1/queues/poll {'app_engine_http_request': {'http_method': 'POST', 'relative_uri': '/_ah/queue/poll', 'app_engine_routing': {'service': 'background'}, 'body': b'source_key=agNhcHByFgsSB1R3aXR0ZXIiCXNjaG5hcmZlZAw&last_polled=1970-01-01-00-00-00', 'headers': {'Content-Type': 'application/x-www-form-urlencoded'}}, 'schedule_time': seconds: 1591176072

...pull out the relative_uri and body, and then put them together in a curl command against localhost:8080 (but don't run it yet!), eg:

curl -d 'source_key=agNhcHByFgsSB1R3aXR0ZXIiCXNjaG5hcmZlZAw&last_polled=1970-01-01-00-00-00' \
  http://localhost:8080/_ah/queue/poll

Then, restart the app with FLASK_APP=background to run the background task processing service, eg:

gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode
GAE_ENV=localdev FLASK_ENV=development flask run -p 8080

Now, run the curl command you constructed above.

If you hit an error during setup, check out the oauth-dropins Troubleshooting/FAQ section. For searchability, here are a handful of error messages that have solutions there:

bash: ./bin/easy_install: ...bad interpreter: No such file or directory

ImportError: cannot import name certs

ImportError: cannot import name tweepy

File ".../site-packages/tweepy/auth.py", line 68, in _get_request_token
  raise TweepError(e)
TweepError: must be _socket.socket, not socket

error: option --home not recognized

There's a good chance you'll need to make changes to granary or oauth-dropins at the same time as bridgy. To do that, clone their repos elsewhere, then install them in "source" mode with:

pip uninstall -y oauth-dropins
pip install -e <path-to-oauth-dropins-repo>
ln -sf <path-to-oauth-dropins-repo>/oauth_dropins/static oauth_dropins_static

pip uninstall -y granary
pip install -e <path to granary>

To deploy to App Engine, run scripts/deploy.sh.

remote_api_shell is a useful interactive Python shell that can interact with the production app's datastore, memcache, etc. To use it, create a service account and download its JSON credentials, put it somewhere safe, and put its path in your GOOGLE_APPLICATION_CREDENTIALS environment variable.

Deploying to your own App Engine project can be useful for testing, but is not recommended for production. To deploy to your own App Engine project, create a project on gcloud console and activate the Tasks API. Initialize the project on the command line using gcloud config set project <project-name> followed by gcloud app create. You will need to update TASKS_LOCATION in util.py to match your project's location. Finally, you will need to add your "background" domain (eg background.YOUR-APP-NAME.appspot.com) to OTHER_DOMAINS in util.py and set host_url in tasks.py to your base app url (eg app-dot-YOUR-APP-NAME.wn.r.appspot.com). Finally, deploy (after testing) with gcloud -q beta app deploy --no-cache --project YOUR-APP-NAME *.yaml

To work on the browser extension:

cd browser-extension
npm install
npm run test

To run just one test:

npm run test -- -t 'part of test name'

Browser extension: logs in the JavaScript console

If you're working on the browser extension, or you're sending in a bug report for it,, its JavaScript console logs are invaluable for debugging. Here's how to get them in Firefox:

  1. Open about:debugging
  2. Click This Firefox on the left
  3. Scroll down to Bridgy
  4. Click Inspect
  5. Click on the Console tab
<img src="https://user-images.githubusercontent.com/778068/119147612-9c4d2580-ba00-11eb-8d91-39487a662288.png" />

Here's how to send them in with a bug report:

  1. Right click, Export Visible Messages To, File, save the file.
  2. Email the file to bridgy @ ryanb.org. Do not post or attach it to a GitHub issue, or anywhere else public, because it contains sensitive tokens and cookies.
<img src="https://user-images.githubusercontent.com/778068/119147959-e6360b80-ba00-11eb-8e35-647850177f4c.png">

Browser extension: release

Here's how to cut a new release of the browser extension and publish it to addons.mozilla.org:

  1. ln -fs manifest.firefox.json manifest.json
  2. Load the extension in Firefox (about:debugging). Check that it works.
  3. Bump the version in browser-extension/manifest.json.
  4. Update the Changelog in the README.md section below this one.
  5. Build and sign the artifact:
    cd browser-extension/
    npm test
    ./node_modules/web-ext/bin/web-ext.js build
    
  6. Submit it to AMO.
    # get API secret from Ryan if you don't have it
    ./node_modules/web-ext/bin/web-ext.js sign --api-key user:14645521:476 --api-secret ...
    
    # If this succeeds, it will say:
    ...
    Your add-on has been submitted for review. It passed validation but could not be automatically signed because this is a listed add-on.
    FAIL
    ...
    
    It's usually auto-approved within minutes. Check the public listing here.

Here's how to publish it to the Chrome Web Store:

  1. ln -fs manifest.chrome.json manifest.json
  2. Load the extension in Chrome (chrome://extensions/, Developer mode on). Check that it works.
  3. Build and sign the artifact:
    cd browser-extension/
    npm test
    ./node_modules/web-ext/bin/web-ext.js build
    
  4. Open the console.
  5. Open the Bridgy item.
  6. Choose Package on the left.
  7. Click the Upload new package button.
  8. Upload the new version's zip file from browser-extension/web-ext-artifacts/.
  9. Update the Changelog in the Description box. Leave the rest unchanged.
  10. Click Save draft, then Submit for review.

Browser extension: Changelog

0.7.0, 2024-01-03

  • Remove Instgram. Their anti-bot defenses have led them to suspend a couple people's accounts for using this extension, so we're disabling it out of an abundance of caution. Sorry for the bad news.

0.6.1, 2022-09-18

  • Don't open silo login pages if they're not logged in. This ran at extension startup time, which was mostly harmless in manifest v2 since the background page was persistent stayed loaded, but in manifest v3 it's a service worker or non-persistent background page, which gets unloaded and then reloaded every 5m.

0.6.0, 2022-09-17

0.5, 2022-07-2

Related Skills

View on GitHub
GitHub Stars819
CategoryMarketing
Updated1d ago
Forks58

Languages

Python

Security Score

95/100

Audited on Mar 27, 2026

No findings