diff --git a/.circleci/config.yml b/.circleci/config.yml index fde3a5e..a8de0d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,7 +22,7 @@ jobs: echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - sudo apt-get update - sudo apt-get install -y apt-transport-https ca-certificates gnupg google-cloud-sdk google-cloud-sdk-datastore-emulator default-jre + sudo apt-get install -y apt-transport-https ca-certificates gnupg google-cloud-sdk google-cloud-cli-firestore-emulator default-jre - run: name: Python dependencies @@ -40,7 +40,7 @@ jobs: - run: name: Build and test command: | - CLOUDSDK_CORE_PROJECT=bridgy-federated gcloud beta emulators datastore start --no-store-on-disk --use-firestore-in-datastore-mode --host-port=localhost:8089 < /dev/null >& /dev/null & + CLOUDSDK_CORE_PROJECT=brid-gy gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /tmp/firestore-emulator.log & sleep 5s python -m coverage run --source=. --omit=appengine_config.py,logs.py,tests/\* -m unittest discover -v python -m coverage html -d /tmp/coverage_html diff --git a/README.md b/README.md index 45941be..451e06b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ Development --- Development reference docs are at [bridgy-fed.readthedocs.io](https://bridgy-fed.readthedocs.io/). Pull requests are welcome! Feel free to [ping me in #indieweb-dev](https://indieweb.org/discuss) with any questions. -First, fork and clone this repo. Then, install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run `gcloud components install beta cloud-datastore-emulator` to install the [datastore emulator](https://cloud.google.com/datastore/docs/tools/datastore-emulator). Once you have them, set up your environment by running these commands in the repo root directory: +First, fork and clone this repo. Then, install the [Google Cloud SDK](https://cloud.google.com/sdk/) and run `gcloud components install cloud-firestore-emulator` to install the [Firestore emulator](https://cloud.google.com/firestore/docs/emulator). Once you have them, set up your environment by running these commands in the repo root directory: + ```sh gcloud config set project bridgy-federated @@ -24,7 +25,7 @@ pip install -r requirements.txt Now, run the tests to check that everything is set up ok: ```shell -gcloud beta emulators datastore start --use-firestore-in-datastore-mode --no-store-on-disk --host-port=localhost:8089 --quiet < /dev/null >& /dev/null & +gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null & python3 -m unittest discover ``` diff --git a/docs/index.rst b/docs/index.rst index 80cc370..cc22fbd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,25 +1,27 @@ Bridgy Fed developer documentation ---------------------------------- -Bridgy Fed connects your web site to -`Mastodon `__ and the -`fediverse `__ via -`ActivityPub `__, -`webmentions `__, and -`microformats2 `__. Your -site gets its own fediverse profile, posts and avatar and header and -all. Bridgy Fed translates likes, reposts, mentions, follows, and more -back and forth. `See the user docs `__ and -`developer docs `__ for more -details. +Bridgy Fed connects different decentralized social network protocols. It +currently supports the +`fediverse `__ (eg +`Mastodon `__) via +`ActivityPub `__, and the +`IndieWeb `__ via +`webmentions `__ and +`microformats2 `__. +`Bluesky/AT +Protocol `__ and +`Nostr `__ are planned +for 2024. Bridgy Fed translates profiles, likes, reposts, mentions, +follows, and more from any supported network to any other. `See the user +docs `__ and `developer +docs `__ for more details. https://fed.brid.gy/ -Also see the -`original `__ -`design `__ blog posts. - -License: This project is placed in the public domain. +License: This project is placed in the public domain. You may also use +it under the `CC0 +License `__. Development ----------- @@ -31,11 +33,11 @@ requests are welcome! Feel free to `ping me in First, fork and clone this repo. Then, install the `Google Cloud SDK `__ and run -``gcloud components install beta cloud-datastore-emulator`` to install -the `datastore -emulator `__. -Once you have them, set up your environment by running these commands in -the repo root directory: +``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: .. code:: sh @@ -48,7 +50,7 @@ Now, run the tests to check that everything is set up ok: .. code:: shell - gcloud beta emulators datastore start --use-firestore-in-datastore-mode --no-store-on-disk --host-port=localhost:8089 --quiet < /dev/null >& /dev/null & + gcloud emulators firestore start --host-port=:8089 --database-mode=datastore-mode < /dev/null >& /dev/null & python3 -m unittest discover Finally, run this in the repo root directory to start the web app @@ -112,8 +114,9 @@ How to add a new protocol 5. TODO: add a new usage section to the docs for the new protocol. 6. TODO: does the new protocol need any new UI or signup functionality? Unusual, but not impossible. Add that if necessary. -7. Add the new protocol’s logo to ``static/``, use it in - `templates/user.html `__. +7. Protocol logos may be emoji or image files. If this one is a file, + add it ``static/``. Then add the emoji or file ```` tag in the + ``Protocol`` subclass’s ``LOGO_HTML`` constant. Stats ----- diff --git a/models.py b/models.py index a6f8095..23d0099 100644 --- a/models.py +++ b/models.py @@ -1180,7 +1180,7 @@ class Follower(ndb.Model): query = Follower.query( Follower.status == 'active', filter_prop == user.key, - ).order(-Follower.updated) + ) followers, before, after = fetch_page(query, Follower, by=Follower.updated) users = ndb.get_multi(f.from_ if collection == 'followers' else f.to diff --git a/tests/test_activitypub.py b/tests/test_activitypub.py index 84c0b15..435ec98 100644 --- a/tests/test_activitypub.py +++ b/tests/test_activitypub.py @@ -1649,7 +1649,7 @@ class ActivityPubTest(TestCase): def test_following_collection_page(self, *_): self.store_following() after = datetime(1900, 1, 1).isoformat() - prev = Follower.query(Follower.to == ActivityPub(id='http://baz').key, + prev = Follower.query(Follower.to == ActivityPub(id='http://bar').key, Follower.from_ == self.user.key, ).get().updated.isoformat()